[!NOTE]
This is a post for a restricted environment.
And I hope that you will never encounter those situations.
Download python-lsp-serverpython 3.8 (= =) in 2025 Fine 1
2
3
4
5
6
pip download --python-version 3.8 --platform \
manylinux2014_aarch64 \
--only-binary= :all: \
--no-deps
-d ./python-lsp-server \
python-lsp-server
Download vim-lsp1
git clone depth = 1 https://github.com/prabirshrestha/vim-lsp.git
From pdf to tgzDo not use clip board, b64 strings can be corrupted Why pdf? Well, ... 1
2
pdftotext file.pdf | base64 -d > tmp.tgz
tar -xvzf tmp.tgz
or if base64 does not work properly even with -i
flag 1
2
3
4
5
#! /bin/python3
import base64
with open ( "tmp.txt" , "r" ) as f :
with open ( "tmp.tgz" , "wb" ) as out_f :
out_f . write ( base64 . b64decode ( b64_str ))
Install python-lsp-server1
pip install --no-index --find-links ./python-lsp-server *.whl
Do not forget to add path to python-lsp-server to PATH python-lsp-server configedit ~/.config/pylsp/config.toml
1
2
3
4
5
6
7
8
9
10
11
12
[ plugins ]
pyflakes . enabled = true
pycodestyle . enabled = true
mccabe . enabled = true
rope . enabled = true
mypy . enabled = true
isort . enabled = true
flake8 . enabled = true
[ plugins . pycodestyle ]
maxLineLength = 120 # optional, still enforce 120 chars if needed
]
vim-lsp configput vim-lsp at ~/.config/nvim/pack/plugins/start/
add in ~/.config/nvim/init.vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
if executable ( 'pylsp' )
augroup lsp_python
autocmd !
autocmd User lsp_setup call lsp #register_server ( {
\ 'name' : 'pylsp' ,
\ 'cmd' : {server_info -> ['pylsp' ]},
\ 'whitelist' : ['python' ],
\ })
autocmd FileType python call lsp #enable ()
augroup END
endif
" Some Key binds
augroup lsp_python_maps
autocmd !
" Only map gd after vim-lsp is ready for Python buffers
autocmd FileType python nnoremap < buffer > gd :LspDefinition < CR >
autocmd FileType python nnoremap < buffer > gr :LspReferences < CR >
autocmd FileType python nnoremap < buffer > < leader > rn :LspRename < CR >
autocmd FileType python nnoremap < buffer > < leader > ca :LspCodeAction < CR >
autocmd FileType python nnoremap < buffer > < leader > cf :LspDocumentFormat < CR >
autocmd FileType python nnoremap < buffer > = :LspDocumentRangeFormat < CR >
augroup END