diff --git a/vimrc b/vimrc index ba86828..0ce12b8 100644 --- a/vimrc +++ b/vimrc @@ -32,8 +32,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 @@ -42,7 +49,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("$") @@ -50,6 +57,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,