mirror of
https://github.com/davegallant/nix-config
synced 2025-08-07 13:22:28 +00:00
Add custom statusline in vim
This commit is contained in:
6
flake.lock
generated
6
flake.lock
generated
@@ -7,11 +7,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1612396114,
|
"lastModified": 1612561117,
|
||||||
"narHash": "sha256-W9B49pT2/Zzjd5GsGmjxCHcWdmBDTUVKdLrocGxA/Sc=",
|
"narHash": "sha256-UEB+5KCINGyaAfkgqWeUhUwyBxTrlTLO+FjbYCG4exk=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "3f2f7f8efa57cb820d947b07a5a513764a45b462",
|
"rev": "d4202875831a2d1b9dd3002d89b8c794af9e5a43",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@@ -7,7 +7,6 @@
|
|||||||
set hlsearch
|
set hlsearch
|
||||||
set ignorecase
|
set ignorecase
|
||||||
set incsearch
|
set incsearch
|
||||||
set laststatus=2
|
|
||||||
set mouse=a
|
set mouse=a
|
||||||
set nocompatible
|
set nocompatible
|
||||||
set noswapfile
|
set noswapfile
|
||||||
@@ -21,6 +20,31 @@
|
|||||||
set tabstop=2
|
set tabstop=2
|
||||||
set wildmenu
|
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
|
" Remember line number
|
||||||
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
|
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user