vim-python-format Install You need first install yapf pip3 install yapf Add this plugin to vim by vundle Add next lines to your .vimrc: autocmd FileType python nnoremap <buffer> <c-k> :call PythonFormat()<cr> autocmd BufWrite *.py call PythonFormat()