Created
January 8, 2018 04:15
-
-
Save kxzk/b97197faaca99ea4a4fe1d3a798c1c0e to your computer and use it in GitHub Desktop.
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
" Dictionary: take mode() input -> longer notation of current mode | |
" mode() is defined by Vim | |
let g:currentmode={ 'n' : 'Normal ', 'no' : 'N·Operator Pending ', 'v' : 'Visual ', 'V' : 'V·Line ', '^V' : 'V·Block ', 's' : 'Select ', 'S': 'S·Line ', '^S' : 'S·Block ', 'i' : 'Insert ', 'R' : 'Replace ', 'Rv' : 'V·Replace ', 'c' : 'Command ', 'cv' : 'Vim Ex ', 'ce' : 'Ex ', 'r' : 'Prompt ', 'rm' : 'More ', 'r?' : 'Confirm ', '!' : 'Shell ', 't' : 'Terminal '} | |
" Function: return current mode | |
" abort -> function will abort soon as error detected | |
function! ModeCurrent() abort | |
let l:modecurrent = mode() | |
" use get() -> fails safely, since ^V doesn't seem to register | |
" 3rd arg is used when return of mode() == 0, which is case with ^V | |
" thus, ^V fails -> returns 0 -> replaced with 'V Block' | |
let l:modelist = toupper(get(g:currentmode, l:modecurrent, 'V·Block ')) | |
let l:current_status_mode = l:modelist | |
return l:current_status_mode | |
endfunction | |
set statusline= | |
set statusline+=\ %{ModeCurrent()} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment