Add statusline

Configure autowrap and ignore whitespace for markdown. Install flake8
plugin.
This commit is contained in:
2020-02-07 13:09:57 +01:00
parent 94129da2ed
commit 49b3e061e0

23
.vimrc
View File

@@ -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<bang>
" 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 <Leader>v :e $MYVIMRC <CR>
nmap <Leader>/g /[<=>]\{7,}.*$<CR>
" Git-Gutter status, commit, grep, blame
nmap <Leader>gs :Gstatus<CR>
nmap <Leader>gS :!git add %<CR>
nmap <Leader>gc :Gcommit<CR>
nmap <Leader>gS :Gstatus<CR> :Gcommit<CR>
nmap <Leader>gg :Ggrep<space>
nmap <Leader>gb :Gblame<CR>