aboutsummaryrefslogtreecommitdiff
path: root/vim/after/ftplugin/python.vim
blob: 41b1d886e4062ce88bb3fab7de8a7e0c0ddb880c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
" Python
let g:lsp_settings = {}
let g:lsp_settings['pylsp-all'] =
    \ {
    \   'workspace_config': {'pylsp-all': {
    \     'configurationSources': ['flake8'],
    \     'plugins': {
    \	    'pyflakes' : {'enabled': v:false},
    \	    'flake8': {'enabled': v:true},
    \	    'mypy-ls': {'enabled': v:true, 'live_mode': v:false},
    \	    'pylint': {'enabled': v:true},
    \	    'pydocstyle': {'enabled': v:true},
    \	    'pyls_isort': {'enabled': v:true},
    \	    'autopep8': {'enabled': v:false},
    \	    'yapf': {'enabled': v:false},
    \	    'black': {'enabled': v:true},
    \     }
    \   }}
    \ }

" 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.