From 4895bdfa238b56007c34d25ba941e07406d7ac85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Wo=C5=BAniak?= Date: Sun, 1 Dec 2024 23:30:07 +0100 Subject: [PATCH] Changed pyright&black to ruff in nvim --- .config/nvim/init.vim | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 7eab425..f2bd7d5 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -207,7 +207,7 @@ local handlers = { -- Use a loop to conveniently call 'setup' on multiple servers and -- map buffer local keybindings when the language server attaches -local servers = { 'pyright', 'clangd', 'bashls', 'yamlls', 'ansiblels', 'gopls', 'solargraph', 'terraformls', 'tflint', 'marksman', 'rust_analyzer' } +local servers = { 'clangd', 'bashls', 'yamlls', 'ansiblels', 'gopls', 'solargraph', 'terraformls', 'tflint', 'marksman', 'rust_analyzer' } for _, lsp in pairs(servers) do require('lspconfig')[lsp].setup { on_attach = on_attach, @@ -219,6 +219,7 @@ for _, lsp in pairs(servers) do } end + -- Handlers when you are in the insert mode you see the errors vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, @@ -267,6 +268,9 @@ require'lspconfig'.gopls.setup { }, } +-- Setup Python (ruff) +require('lspconfig').ruff.setup({}) + -- luasnip setup local luasnip = require 'luasnip' @@ -357,12 +361,13 @@ let g:neoformat_try_formatprg = 1 let g:neoformat_basic_format_trim = 1 let g:neoformat_only_msg_on_error = 1 " autocmd BufWritePre * silent! undojoin | Neoformat -let g:neoformat_python_black = { - \ 'exe': 'black', - \ 'stdin': 1, - \ 'args': ['--line-length', '80', '-q', '-'], - \ } -let g:neoformat_enabled_python = ['black'] + +let g:neoformat_python_ruff = { + \ 'exe': 'ruff', + \ 'stdin': 1, + \ 'args': ['format', '--line-length=80', '-q', '-'], + \ } +let g:neoformat_enabled_python = ['ruff'] " Terraform let g:terraform_fmt_on_save=1 @@ -609,7 +614,7 @@ let g:shfmt_opt="-ci" " Python autocmd BufRead,BufNewFile *.py set textwidth=0 autocmd BufRead,BufNewFile *.py set fo-=t -autocmd BufWritePre *.py silent! undojoin | Neoformat black +autocmd BufWritePre *.py silent! undojoin | Neoformat ruff " Newsboat autocmd BufRead,BufNewFile urls set textwidth=0