Skip to content

Commit 0f50be1

Browse files
author
Daniel Gusenburger
committed
using ruff for python file formatting
1 parent 610fc67 commit 0f50be1

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed

lua/lsp.lua

+24-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ local nvim_lsp = require("lspconfig")
33
-- Use an on_attach function to only map the following keys
44
-- after the language server attaches to the current buffer
55
local on_attach = function(client, bufnr)
6+
if client.name == "ruff_lsp" then
7+
-- Disable hover in favor of pyright
8+
client.server_capabilities.hoverProvider = false
9+
end
610
local opts = {noremap = true, silent = true}
711
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
812

@@ -14,7 +18,7 @@ end
1418
-- Use a loop to conveniently call 'setup' on multiple servers and
1519
-- map buffer local keybindings when the language server attaches'cssls'
1620
local servers = {
17-
"pyright",
21+
"ruff_lsp",
1822
"rust_analyzer",
1923
"bashls",
2024
"vimls",
@@ -25,6 +29,25 @@ local servers = {
2529
"cssls"
2630
}
2731

32+
nvim_lsp.pyright.setup {
33+
on_attach = on_attach,
34+
flags = {
35+
debounce_text_changes = 150
36+
},
37+
settings = {
38+
pyright = {
39+
-- Using Ruff's import organizer
40+
disableOrganizeImports = true
41+
},
42+
python = {
43+
analysis = {
44+
-- Ignore all files for analysis to exclusively use Ruff for linting
45+
ignore = {"*"}
46+
}
47+
}
48+
}
49+
}
50+
2851
for _, lsp in ipairs(servers) do
2952
nvim_lsp[lsp].setup {
3053
on_attach = on_attach,

lua/plugins/formatter.lua

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ return {
1818
-- Configuration for psf/black
1919
function()
2020
return {
21-
exe = "yapf", -- this should be available on your $PATH
22-
stdin = true
21+
exe = "ruff format", -- this should be available on your $PATH
2322
}
2423
end
2524
},

snippets/tex.snippets

+9
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,12 @@ snippet beg
123123
\begin{$1}
124124
$2
125125
\end{$1}
126+
127+
snippet mbf
128+
\mathbf{$1}
129+
130+
snippet ita
131+
\textit{$1}
132+
133+
snippet tbf
134+
\textbf{$1}

0 commit comments

Comments
 (0)