diff --git a/vimrc b/vimrc index 2c23fd0..611b122 100644 --- a/vimrc +++ b/vimrc @@ -72,8 +72,15 @@ nnoremap gc " save all and quit nnoremap q :waZQ + +function! RunBlackIfInPythonFile() + if &filetype ==# 'python' + :call Black() + endif +endfunction + " save -nnoremap :w +nnoremap :call RunBlackIfInPythonFile():w " save and close buffer nnoremap w :w:bw nnoremap :bp @@ -82,7 +89,7 @@ nnoremap :bn nnoremap :noh nnoremap p :PlugInstall -nnoremap f call Black() +nnoremap b :call RunBlackIfInPythonFile() " show number of lines in buffer nnoremap l :echo line("$") @@ -90,6 +97,14 @@ nnoremap l :echo line("$") " quickly source vimrc with + s nnoremap s :source ~/.vimrc +" move selection +nnoremap :m .+1== +nnoremap :m .-2== +inoremap :m .+1==gi +inoremap :m .-2==gi +vnoremap :m '>+1gv=gv +vnoremap :m '<-2gv=gv + let g:python3_host_prog = $HOME . '/.local/venv/nvim/bin/python' let g:black#settings = { \ 'fast': 1,