Skip to content

Instantly share code, notes, and snippets.

@mertcanekren
Created May 10, 2020 15:25
Show Gist options
  • Save mertcanekren/0df82a6709d01c49d3db8fa4c6f9d9a2 to your computer and use it in GitHub Desktop.
Save mertcanekren/0df82a6709d01c49d3db8fa4c6f9d9a2 to your computer and use it in GitHub Desktop.
.vimrc
set number
nmap <silent> <A-Up> :wincmd k<CR>
nmap <silent> <A-Down> :wincmd j<CR>
nmap <silent> <A-Left> :wincmd h<CR>
nmap <silent> <A-Right> :wincmd l<CR>
set showcmd
syntax enable
set tabstop=4
set softtabstop=4
set expandtab
set wildmenu
set lazyredraw
set showmatch
set laststatus=2
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()}
set statusline+=%2*[%n%H%M%R%W]%*\ " flags and buf no
set statusline+=%-40f\ " path
set statusline+=%<\ " cut at start
set statusline+=%=%1*%y%*%*\ " file type
set statusline+=\%{(&fenc!=''?&fenc:&enc)}
set statusline+=%10((%l,%c)%)\ " line and column
set statusline+=%P
hi User1 ctermbg=red ctermfg=black guibg=red guifg=yellow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment