performance update for git branch status in vimrc
This commit is contained in:
parent
d0bc21397d
commit
236964d8a0
51
vim/.vimrc
51
vim/.vimrc
|
@ -1,22 +1,29 @@
|
|||
set runtimepath^=~/.vim/bundle/ctrlp.vim
|
||||
set runtimepath^=~/.vim/bundle/nerdtree
|
||||
"set runtimepath^=~/.vim/bundle/ctrlp.vim
|
||||
""set runtimepath^=~/.vim/bundle/nerdtree
|
||||
set nocompatible
|
||||
set relativenumber
|
||||
syntax on
|
||||
filetype plugin on
|
||||
set tabstop=4 shiftwidth=4 expandtab
|
||||
set number
|
||||
set hlsearch
|
||||
"set relativenumber
|
||||
|
||||
""folding
|
||||
set foldenable foldlevelstart=20 foldmethod=indent
|
||||
|
||||
" finding files
|
||||
set path+=**
|
||||
set wildmenu
|
||||
|
||||
" tags
|
||||
command! MakeTags !ctags -R .
|
||||
set path+=**
|
||||
set wildmenu
|
||||
|
||||
" " tags
|
||||
command! MakeTags !ctags -R .
|
||||
"
|
||||
" linter
|
||||
autocmd FileType python setlocal makeprg=pylint\ --output-format=parseable
|
||||
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 makeprg=yamllint\ --f\
|
||||
parsable\ %
|
||||
autocmd FileType json autocmd BufWritePre <buffer> %!python -m json.tool
|
||||
2>/dev/null
|
||||
autocmd BufWritePost *.py silent make! <afile> | silent redraw!
|
||||
autocmd QuickFixCmdPost [^l]* cwindow
|
||||
|
||||
|
@ -33,19 +40,25 @@ set cursorline
|
|||
hi CursorLine cterm=NONE ctermbg=darkgrey ctermfg=white
|
||||
|
||||
" statusline
|
||||
function! GitBranch()
|
||||
return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
|
||||
let g:gitparsedbranchname = ' '
|
||||
function! UpdateGitBranch()
|
||||
let l:branchname = system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
|
||||
let g:branchstatus = strlen(l:branchname) > 0?' '.l:branchname.' ':''
|
||||
endfunction
|
||||
|
||||
function! StatuslineGit()
|
||||
let l:branchname = GitBranch()
|
||||
return strlen(l:branchname) > 0?' '.l:branchname.' ':''
|
||||
endfunction
|
||||
augroup UPDATE_GITBRANCH
|
||||
" clear old commands
|
||||
autocmd!
|
||||
" update git branch
|
||||
autocmd BufWritePre * :call UpdateGitBranch()
|
||||
autocmd BufReadPost * :call UpdateGitBranch()
|
||||
autocmd BufEnter * :call UpdateGitBranch()
|
||||
augroup END
|
||||
|
||||
set laststatus=2
|
||||
set statusline=
|
||||
set statusline+=%#PmenuSel#
|
||||
set statusline+=%{StatuslineGit()}
|
||||
set statusline+=%{g:branchstatus}
|
||||
set statusline+=%#BufTabLineCurrent#
|
||||
set statusline+=\ %M
|
||||
set statusline+=\ %r
|
||||
|
@ -60,12 +73,14 @@ set statusline+=\ %p%%
|
|||
set statusline+=\ [%n]
|
||||
|
||||
|
||||
"map <C-n> :NERDTreeToggle<CR>
|
||||
" Tree of files
|
||||
map <C-n> :Lex <bar> vertical resize 30 <CR>
|
||||
|
||||
let g:vimspector_enable_mappings = 'HUMAN'
|
||||
packadd! vimspector
|
||||
"let g:vimspector_enable_mappings = 'HUMAN'
|
||||
"packadd! vimspector
|
||||
|
||||
"packadd! gruvbox
|
||||
colorscheme gruvbox
|
||||
set bg=dark
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue