]> git.madduck.net Git - etc/vim.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

LSP config
authormartin f. krafft <madduck@madduck.net>
Thu, 10 Apr 2025 11:03:26 +0000 (13:03 +0200)
committermartin f. krafft <madduck@madduck.net>
Thu, 10 Apr 2025 11:03:49 +0000 (13:03 +0200)
.vim/ftplugin/python.vim
.vimrc

index e8634578f2c87bf461af0383310f99480d4122fc..ff848f9b636df9becdf3f5480304e887e0387bba 100644 (file)
@@ -11,3 +11,48 @@ setlocal formatoptions+=bl
 
 imap <Leader>t import ipdb; ipdb.set_trace()  # noqa:E402,E702 # fmt: skip
 imap <Leader>m if __name__ == "__main__":<CR>import sys<CR>sys.exit()<ESC>i
 
 imap <Leader>t import ipdb; ipdb.set_trace()  # noqa:E402,E702 # fmt: skip
 imap <Leader>m if __name__ == "__main__":<CR>import sys<CR>sys.exit()<ESC>i
+
+if executable('ruffxx')
+    au User lsp_setup call lsp#register_server({
+        \ 'name': 'ruff',
+        \ 'cmd': {server_info->['ruff', 'server']},
+        \ 'allowlist': ['python'],
+        \ 'workspace_config': {},
+        \ })
+endif
+
+if executable('pylsp')
+    au User lsp_setup call lsp#register_server({
+        \ 'name': 'pylsp',
+        \ 'cmd': {server_info->['pylsp']},
+        \ 'allowlist': ['python'],
+        \ 'workspace_config': {},
+        \ })
+endif
+
+let b:ale_linters = ["mypy", "vim-lsp", "ruff"]
+let b:ale_fixers = [
+      \ "add_blank_lines_for_python_control_statements",
+      \ "ruff",
+      \ "ruff_format"
+      \]
+
+let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
+
+imap <silent> <F7> :ALELint<CR>
+nmap <silent> <F7> :ALELint<CR>
+imap <silent> <F8> :ALEFix<CR>
+nmap <silent> <F8> :ALEFix<CR>
+
+nmap <silent> <C-k> <Plug>(ale_previous_wrap)
+nmap <silent> <C-j> <Plug>(ale_next_wrap)
+
+inoremap <expr> <Tab>   pumvisible() ? "\<C-n>" : "\<Tab>"
+inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
+inoremap <expr> <cr>    pumvisible() ? asyncomplete#close_popup() : "\<cr>"
+
+let g:asyncomplete_auto_popup = 1
+
+imap <c-@> <Plug>(asyncomplete_force_refresh)
+
+setlocal scl=no
diff --git a/.vimrc b/.vimrc
index cc3aad5138e509abed19c0e039ac4e336290d386..81d9463366bd45e97c8be6b9e7546f6e79b578e0 100644 (file)
--- a/.vimrc
+++ b/.vimrc
@@ -209,7 +209,7 @@ set nowrap
 " sidescrolloff
 " minimal number of columns to keep left and right of the cursor
 "       set siso=0
 " sidescrolloff
 " minimal number of columns to keep left and right of the cursor
 "       set siso=0
-set siso=0
+set siso=1
 
 " display
 " include "lastline" to show the last line even if it doesn't fit
 
 " display
 " include "lastline" to show the last line even if it doesn't fit
@@ -685,6 +685,7 @@ let &flp='^\v\s*(((#|\a|\d{,4}|[ivx]{,4})[]:.)}/])+|[-\*.·→+])\s+'
 " completeopt
 " whether to use a popup menu for Insert mode completion
 "       set cot=menu,preview
 " completeopt
 " whether to use a popup menu for Insert mode completion
 "       set cot=menu,preview
+set cot=menu,noinsert,popup,preview,fuzzy
 
 " pumheight
 " maximum height of the popup menu
 
 " pumheight
 " maximum height of the popup menu
@@ -1527,6 +1528,15 @@ iab <Leader>→ ➬
 
 iab :thumbsup: 👍️
 
 
 iab :thumbsup: 👍️
 
+let g:ale_completion_enabled = 0
+let g:ale_fixers = { '*': [ "remove_trailing_lines", "trim_whitespace" ] }
+let g:ale_sign_error = '>>'
+let g:ale_sign_warning = '--'
+let g:ale_set_loclist = 1
+let g:ale_open_list = 1
+let g:ale_virtualtext_cursor = 'current'
+let g:ale_floating_window_border = repeat([''], 8)
+
 try
   execute pathogen#infect()
 catch
 try
   execute pathogen#infect()
 catch