D1488.vim-mode-in-status.bash (1482B)
1 #!/bin/bash 2 3 function 0neGal/set-up-status-line { 4 5 # Hide the normal mode name 6 bleopt keymap_vi_mode_show= 7 8 function ble/prompt/backslash:0neGal/currentmode { 9 bleopt keymap_vi_mode_update_prompt=1 10 11 local mode; ble/keymap:vi/script/get-mode 12 case $mode in 13 (*n) ble/prompt/print $'\e[1m-- NORMAL --\e[m' ;; 14 (*v) ble/prompt/print $'\e[1m-- VISUAL --\e[m' ;; 15 (*V) ble/prompt/print $'\e[1m-- V-LINE --\e[m' ;; 16 (*) ble/prompt/print $'\e[1m-- V-BLOQ --\e[m' ;; 17 (*s) ble/prompt/print $'\e[1m-- SELECT --\e[m' ;; 18 (*S) ble/prompt/print $'\e[1m-- S-LINE --\e[m' ;; 19 (*) ble/prompt/print $'\e[1m-- S-BLOQ --\e[m' ;; 20 (i) ble/prompt/print $'\e[1m-- INSERT --\e[m' ;; 21 (R) ble/prompt/print $'\e[1m-- RPLACE --\e[m' ;; 22 () ble/prompt/print $'\e[1m-- VPLACE --\e[m' ;; 23 (*) ble/prompt/print $'\e[1m-- ?????? --\e[m' ;; 24 esac 25 26 # Change the default color of status line 27 case $mode in 28 (*n) ble-face prompt_status_line=bg=gray,fg=white ;; 29 (*[vVsS]) ble-face prompt_status_line=bg=teal,fg=white ;; 30 (*[iR]) ble-face prompt_status_line=bg=navy,fg=white ;; 31 (*) ble-face prompt_status_line=bg=240,fg=231 ;; 32 esac 33 } 34 35 # In this example, we put the mode string, date and time, and the 36 # current working directory in the status line. 37 bleopt prompt_status_line='\q{0neGal/currentmode}\r\e[96m\w\e[m\r\D{%F %H:%M}' 38 } 39 blehook/eval-after-load keymap_vi 0neGal/set-up-status-line