Compare commits

..

No commits in common. "f3d3f4daebaf3bc4ea43650fb432a379da9a3fc1" and "c0ebf30b377be6d9c9486324f06ca4ef4fc400b2" have entirely different histories.

3 changed files with 19 additions and 55 deletions

View File

@ -133,7 +133,7 @@ inkscape
typescript
typescript-language-server
pyright
ruff
python-black
bash-language-server
vscode-css-languageserver
rust-analyzer

View File

@ -11,8 +11,7 @@ au TermOpen * setlocal nonumber norelativenumber
tnoremap <silent> <esc> <c-\><c-n><c-\><c-n>
" sign column on top of the line number (gutter for things like breakpoints, warnings)
" this can be an issue because it blocks line numbers
" set scl=number
set scl=number
" enable line numbers
set number relativenumber

View File

@ -12,22 +12,20 @@ local keymap = confutil.keymap
-- to turn this off for a session (permanently), run
-- :autocmd! AutoFormat
-- https://superuser.com/a/1415274
vim.api.nvim_create_augroup("AutoFormat", {})
-- vim.api.nvim_create_augroup("AutoFormat", {})
--
-- vim.api.nvim_create_autocmd(
-- "BufWritePost",
-- {
-- pattern = "*.py",
-- group = "AutoFormat",
-- callback = function()
-- vim.cmd("silent !black --quiet %")
-- vim.cmd("edit")
-- vim.cmd("norm zz")
-- end,
-- }
-- )
vim.api.nvim_create_autocmd(
"BufWritePost",
{
pattern = "*.py",
group = "AutoFormat",
callback = function()
vim.cmd("silent !black --quiet %")
vim.cmd("edit")
vim.cmd("norm zz")
end,
}
)
------
-- git gutter
@ -115,20 +113,12 @@ keymap("gR", "<cmd>TroubleToggle lsp_references<cr>")
-- language server (LSP)
------
vim.cmd.packadd("nvim-lspconfig")
local nvim_lsp = require('lspconfig')
local on_attach = function(client, bufnr)
local function buf_set_option(name, value) vim.api.nvim_set_option_value(name, value, { buf = bufnr }) end
if client.name == "ruff" then
-- defer hover to pyright
client.server_capabilities.hoverProvider = false
end
local function buf_set_option(name, value) vim.api.nvim_set_option_value(name, value, { buf=bufnr }) end
-- Enable completion triggered by <c-x><c-o>
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
local opts = { noremap = true, silent = true, buffer = bufnr }
local opts = { noremap = true, silent = true, buffer=bufnr }
keymap('gD', vim.lsp.buf.declaration, opts)
keymap('gd', vim.lsp.buf.definition, opts)
keymap('gK', vim.lsp.buf.hover, opts)
@ -145,36 +135,10 @@ local on_attach = function(client, bufnr)
keymap('<localleader>f', vim.lsp.buf.format, opts)
end
-- find ruff config file path
local ruff_config = vim.fs.root(0, { ".git", "pyproject.toml" }) or ""
-- table declares LSPs to be set up
-- as well as settings per server (overrides defaults)
local servers = {
pyright = {
settings = {
pyright = {
-- defer to ruff
disableOrganizeImports = true,
},
python = {
analysis = {
-- defer to ruff
ignore = { '*' },
},
}
}
},
ruff = {
settings = {
format = {
args = { "--config=" .. ruff_config },
},
lint = {
args = { "--config=" .. ruff_config },
},
}
},
pyright = {},
-- pylsp = {
-- settings = {
-- plugins = {
@ -220,6 +184,7 @@ local servers = {
},
},
}
local nvim_lsp = require('lspconfig')
for lsp, sv_settings in pairs(servers) do
-- defaults
local settings = {