mirror of
https://github.com/davegallant/nix-config
synced 2025-08-06 11:23:40 +00:00
Add custom statusline in vim
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
set hlsearch
|
||||
set ignorecase
|
||||
set incsearch
|
||||
set laststatus=2
|
||||
set mouse=a
|
||||
set nocompatible
|
||||
set noswapfile
|
||||
@@ -21,6 +20,31 @@
|
||||
set tabstop=2
|
||||
set wildmenu
|
||||
|
||||
|
||||
" Custom statusline
|
||||
function! GitBranch()
|
||||
return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
|
||||
endfunction
|
||||
|
||||
function! StatuslineGit()
|
||||
let l:branchname = GitBranch()
|
||||
return strlen(l:branchname) > 0?' '.l:branchname.' ':''
|
||||
endfunction
|
||||
|
||||
set statusline=
|
||||
set statusline+=%#PmenuSel#
|
||||
set statusline+=%{StatuslineGit()}
|
||||
set statusline+=%#LineNr#
|
||||
set statusline+=\ %f
|
||||
set statusline+=%m
|
||||
set statusline+=%=
|
||||
set statusline+=%#CursorColumn#
|
||||
set statusline+=\ %y
|
||||
set statusline+=\ %{&fileencoding?&fileencoding:&encoding}
|
||||
set statusline+=\[%{&fileformat}\]
|
||||
set statusline+=\ %p%%
|
||||
set statusline+=\ %l:%c
|
||||
|
||||
" Remember line number
|
||||
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
|
||||
|
||||
|
Reference in New Issue
Block a user