prompt-vim-mode.bash (521B)
1 # ble/contrib/prompt-vim-mode.bash (C) 2020-2021, akinomyoga 2 3 # \q{contrib/vim-mode} (Prompt escape sequence) 4 # 5 # Example: 6 # 7 # ble-import contrib/prompt-vim-mode 8 # PS1='[\u@\h \W]\q{contrib/vim-mode}\$ ' 9 # bleopt keymap_vi_mode_show:= 10 # 11 12 function ble/prompt/backslash:contrib/vim-mode { 13 local mode; ble/keymap:vi/script/get-mode 14 case $mode in 15 ([iR]*) ble/prompt/print '(ins)' ;; 16 (*n) ble/prompt/print '(cmd)' ;; 17 (*x) ble/prompt/print '(vis)' ;; 18 (*s) ble/prompt/print '(sel)' ;; 19 esac 20 }