diff --git a/.vim/python.vimrc.vim b/.vim/python.vimrc.vim index 981e672..801abc6 100644 --- a/.vim/python.vimrc.vim +++ b/.vim/python.vimrc.vim @@ -1,7 +1,7 @@ " vim-python augroup vimrc-python autocmd! - autocmd FileType python setlocal expandtab shiftwidth=4 tabstop=8 colorcolumn=79 + autocmd FileType python setlocal noexpandtab shiftwidth=4 tabstop=4 colorcolumn=79 \ formatoptions+=croq softtabstop=4 \ cinwords=if,elif,else,for,while,try,except,finally,def,class,with augroup END @@ -19,7 +19,7 @@ let g:jedi#smart_auto_mappings = 0 " ale :call extend(g:ale_linters, { - \'python': ['ruff', 'flake8'], }) + \'python': ['ruff', 'flake8', 'pylsp'], }) ":call extend(g:ale_fixers, { " \'python': ['ruff_format'], }) diff --git a/.vim/vimrc b/.vim/vimrc index 7abe427..900b14c 100644 --- a/.vim/vimrc +++ b/.vim/vimrc @@ -343,7 +343,7 @@ let g:ale_linters = { \ 'hare': ['hare', 'vim-lsp'], \ 'lua': ['vim-lsp'], \ 'nix': ['nil', 'rnix_lsp', 'alejandra', 'deadnix', 'statix', 'nixpkgs-fmt', 'vim-lsp'], - \ 'python': ['ruff', 'vim-lsp', 'pylint', 'yapf', 'isort'], + \ 'python': ['ruff', 'vim-lsp', 'pylint', 'pylsp', 'yapf', 'isort'], \ 'rust': ['analyzer', 'cargo', 'rls', 'vim-lsp'], \ 'sh': ['shellcheck', 'shfmt', 'shell', 'vim-lsp'], \ 'bash': ['shellcheck', 'shfmt', 'shell', 'vim-lsp'], @@ -1180,14 +1180,14 @@ if executable('dhall-lsp-server') \ }) augroup END endif -if executable('pyls') +if executable('pylsp') " pip install python-language-server " or python-lsp-black from the AUR augroup lsp_py autocmd! autocmd User lsp_setup call lsp#register_server({ \ 'name': 'pyls', - \ 'cmd': {server_info->[&shell, &shellcmdflag, 'pyls']}, + \ 'cmd': {server_info->[&shell, &shellcmdflag, 'pylsp']}, \ 'allowlist': ['python'], \ }) " \ 'cmd': {server_info->['pyls']}, @@ -1229,7 +1229,7 @@ function! s:on_lsp_buffer_enabled() abort let g:lsp_format_sync_timeout = 700 augroup lsp_format_sync autocmd! - autocmd! BufWritePre *.rs,*.go call execute('LspDocumentFormatSync') + autocmd! BufWritePre *.rs,*.go,*.python call execute('LspDocumentFormatSync') augroup END " refer to doc to add more commands