Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
keymap/vi: add "ble/keymap:vi/script/get-mode" for user-defined mode …
…strings
- Loading branch information
1 parent
b424fa5
commit f25a6e8
Showing
9 changed files
with
188 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# bashrc | ||
|
||
set -o vi | ||
bind 'set show-mode-in-prompt on' | ||
bind $'set vi-cmd-mode-string \eD\eM\e7\e[9999B\r\e[K\e[1m~\e[m\e8' | ||
bind $'set vi-ins-mode-string \eD\eM\e7\e[9999B\r\e[K\e[1m-- INSERT --\e[m\e8' | ||
PS0=$'\e7\eD\eM\e[9999B\e[2K\e8' | ||
|
||
bind '"\C-l": clear-screen' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# -*- mode: sh; mode: sh-bash -*- | ||
|
||
set -o vi | ||
bind '"\C-l": clear-screen' | ||
|
||
# bind 'set show-mode-in-prompt on' | ||
# bind $'set vi-cmd-mode-string \1\eD\eM\e7\e[9999B\r\e[K\e[1m~\e[m\e8\2' | ||
# bind $'set vi-ins-mode-string \1\eD\eM\e7\e[9999B\r\e[K\e[1m-- INSERT --\e[m\e8\2' | ||
# PS0=$'\1\e7\e[9999B\e[2K\e8\2' | ||
|
||
CMD='\e[1m~\e[m' | ||
INSERT='\e[1m-- INSERT --\e[m' | ||
bind 'set show-mode-in-prompt on' | ||
bind $"set vi-cmd-mode-string \1\eD\eM\e7\e[9999B\r\e[K\e[1m$CMD\e[m\e8\2" | ||
bind $"set vi-ins-mode-string \1\eD\eM\e7\e[9999B\r\e[K\e[1m$INSERT\e[m\e8\2" | ||
PS0=$'\1\e7\e[9999B\e[2K\e8\2' | ||
#PS4=$'\1\e7\eD\eM\e[9999B\e[2K\e8\2' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
|
||
function 0neGal/set-up-status-line { | ||
|
||
# Hide the normal mode name | ||
bleopt keymap_vi_mode_show= | ||
|
||
function ble/prompt/backslash:0neGal/currentmode { | ||
bleopt keymap_vi_mode_update_prompt=1 | ||
|
||
local mode; ble/keymap:vi/script/get-mode | ||
case $mode in | ||
(*n) ble/prompt/print $'\e[1m-- NORMAL --\e[m' ;; | ||
(*v) ble/prompt/print $'\e[1m-- VISUAL --\e[m' ;; | ||
(*V) ble/prompt/print $'\e[1m-- V-LINE --\e[m' ;; | ||
(*) ble/prompt/print $'\e[1m-- V-BLOQ --\e[m' ;; | ||
(*s) ble/prompt/print $'\e[1m-- SELECT --\e[m' ;; | ||
(*S) ble/prompt/print $'\e[1m-- S-LINE --\e[m' ;; | ||
(*) ble/prompt/print $'\e[1m-- S-BLOQ --\e[m' ;; | ||
(i) ble/prompt/print $'\e[1m-- INSERT --\e[m' ;; | ||
(R) ble/prompt/print $'\e[1m-- RPLACE --\e[m' ;; | ||
() ble/prompt/print $'\e[1m-- VPLACE --\e[m' ;; | ||
(*) ble/prompt/print $'\e[1m-- ?????? --\e[m' ;; | ||
esac | ||
|
||
# Change the default color of status line | ||
case $mode in | ||
(*n) ble-color-setface prompt_status_line bg=gray,fg=white ;; | ||
(*[vVsS]) ble-color-setface prompt_status_line bg=teal,fg=white ;; | ||
(*[iR]) ble-color-setface prompt_status_line bg=navy,fg=white ;; | ||
(*) ble-color-setface prompt_status_line bg=240,fg=231 ;; | ||
esac | ||
} | ||
|
||
bleopt prompt_status_line='\q{0neGal/currentmode}' | ||
|
||
} | ||
blehook/eval-after-load keymap_vi 0neGal/set-up-status-line |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
" Tests for statusline mode-strings | ||
|
||
"set noshowmode " This hides the normal mode line | ||
set laststatus=2 " Enables the statusline | ||
|
||
" Names for each mode (used for the statusbar) | ||
let g:currentmode={ | ||
\ 'n' : '-- NORMAL --', | ||
\ 'v' : '-- VISUAL --', | ||
\ 'V' : '-- V-LINE --', | ||
\ '' : '-- V-BLOQ --', | ||
\ 'i' : '-- INSERT --', | ||
\ 'ic' : '-- INSERT --', | ||
\ 'ix' : '-- INSERT --', | ||
\ 'R' : '-- RPLACE --', | ||
\ 'Rv' : '-- VPLACE --', | ||
\ 'c' : '-- PROMPT --', | ||
\ '!' : '-- !SHELL --', | ||
\ 't' : '-- TSHELL --', | ||
\ 'r' : '-- PROMPT --', | ||
\ 'r?' : '-- ACCEPT --', | ||
\} | ||
|
||
" Sets the statusline | ||
set statusline=%{mode()} | ||
"%{g:currentmode[mode()]} | ||
|
||
" And unless you wanna go insane when going between modes I recommend this | ||
set ttimeoutlen=0 " Which eliminates the annoying delay when switching modes (This is only for normal Vim) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters