From 49b3e061e0b6745e6e5cb5629940788f2a1c4f99 Mon Sep 17 00:00:00 2001 From: Jakub Fojt Date: Fri, 7 Feb 2020 13:09:57 +0100 Subject: [PATCH] Add statusline Configure autowrap and ignore whitespace for markdown. Install flake8 plugin. --- .vimrc | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.vimrc b/.vimrc index 2204839..ea58e72 100755 --- a/.vimrc +++ b/.vimrc @@ -25,6 +25,7 @@ if filereadable(expand(vundle_dir) . "/README.md") Plugin 'easymotion/vim-easymotion' Plugin 'cpiger/NeoDebug' Plugin 'ivan-krukov/vim-snakemake' + Plugin 'nvie/vim-flake8' call vundle#end() " required else @@ -57,6 +58,9 @@ set scrolloff=5 " Don't let cursor be within 5 lines from top or bottom " Warn for trailing whitespace. Search with wrap (w) do not move cursor (n) function! WhitespaceWarn() + if &ft =~ 'markdown' + return + endif echohl WarningMsg echo 'Found whitespace.' echohl None @@ -71,6 +75,7 @@ function! StripTrailingWhitespace() call winrestview(l:save) echo "Stripped trailing whitespace" endfunction +au BufRead,BufNewFile *.md setlocal textwidth=80 autocmd BufWritePost * if search('\s\+$', 'wn') | call WhitespaceWarn() | endif command TrailWhitespace call StripTrailingWhitespace() @@ -97,6 +102,22 @@ command! -bang Q quit " fugitive.vim looks for tags in .git " set tags +=~/tags " Recursively move upwards in tree, searching in subfolders for tags file +" Status line +set laststatus=2 +set statusline= +set statusline+=%#StatusLineTerm# +set statusline+=%{FugitiveStatusline()} +set statusline+=%#MoreMsg# +set statusline+=\ %f +set statusline+=%m\ " +set statusline+=%= +set statusline+=%#WildMenu# +set statusline+=%y +set statusline+=\ %p%% +set statusline+=\ %l:%c" +set statusline+=%#MoreMsg# +set statusline+=\ " + if exists(":NERDTree") " Open NERDTree if no file specified autocmd StdinReadPre * let s:std_in=1 @@ -169,8 +190,8 @@ nmap v :e $MYVIMRC nmap /g /[<=>]\{7,}.*$ " Git-Gutter status, commit, grep, blame nmap gs :Gstatus +nmap gS :!git add % nmap gc :Gcommit -nmap gS :Gstatus :Gcommit nmap gg :Ggrep nmap gb :Gblame