aboutsummaryrefslogtreecommitdiff
path: root/.vim/after
diff options
context:
space:
mode:
authorOxbian <got.dacs@slmail.me>2023-07-25 00:02:49 +0200
committerOxbian <got.dacs@slmail.me>2023-07-25 00:02:49 +0200
commit32de71752457551f96433f9aff5fba81950d8245 (patch)
treee1a8c5b85dd7e2548baaaa526d8186abd6c55b10 /.vim/after
parent15aa4257ee97af243573c43644b35cf6ddbc0b25 (diff)
downloadvimrc-32de71752457551f96433f9aff5fba81950d8245.tar.gz
vimrc-32de71752457551f96433f9aff5fba81950d8245.zip
Setting up formatting for python
Diffstat (limited to '.vim/after')
-rw-r--r--.vim/after/ftplugin/python.vim12
1 files changed, 11 insertions, 1 deletions
diff --git a/.vim/after/ftplugin/python.vim b/.vim/after/ftplugin/python.vim
index bd158fa..41b1d88 100644
--- a/.vim/after/ftplugin/python.vim
+++ b/.vim/after/ftplugin/python.vim
@@ -1,5 +1,4 @@
" Python
-
let g:lsp_settings = {}
let g:lsp_settings['pylsp-all'] =
\ {
@@ -18,3 +17,14 @@ let g:lsp_settings['pylsp-all'] =
\ }
\ }}
\ }
+
+" Define a custom function that executes :LspDocumentFormat and :!isort
+if !exists('*FormatPythonFile')
+ function! FormatPythonFile()
+ silent execute '!black %'
+ silent execute '!isort %'
+ endfunction
+endif
+" Remap the custom function to <leader>ldf
+nnoremap <leader>ldf :call FormatPythonFile()<CR>
+
ArKa projects. All rights to me, and your next child right arm.