Compare commits
No commits in common. "f3d3f4daebaf3bc4ea43650fb432a379da9a3fc1" and "c0ebf30b377be6d9c9486324f06ca4ef4fc400b2" have entirely different histories.
f3d3f4daeb
...
c0ebf30b37
2
programs
2
programs
@ -133,7 +133,7 @@ inkscape
|
|||||||
typescript
|
typescript
|
||||||
typescript-language-server
|
typescript-language-server
|
||||||
pyright
|
pyright
|
||||||
ruff
|
python-black
|
||||||
bash-language-server
|
bash-language-server
|
||||||
vscode-css-languageserver
|
vscode-css-languageserver
|
||||||
rust-analyzer
|
rust-analyzer
|
||||||
|
@ -11,8 +11,7 @@ au TermOpen * setlocal nonumber norelativenumber
|
|||||||
tnoremap <silent> <esc> <c-\><c-n><c-\><c-n>
|
tnoremap <silent> <esc> <c-\><c-n><c-\><c-n>
|
||||||
|
|
||||||
" sign column on top of the line number (gutter for things like breakpoints, warnings)
|
" 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
|
" enable line numbers
|
||||||
set number relativenumber
|
set number relativenumber
|
||||||
|
@ -12,22 +12,20 @@ local keymap = confutil.keymap
|
|||||||
-- to turn this off for a session (permanently), run
|
-- to turn this off for a session (permanently), run
|
||||||
-- :autocmd! AutoFormat
|
-- :autocmd! AutoFormat
|
||||||
-- https://superuser.com/a/1415274
|
-- https://superuser.com/a/1415274
|
||||||
|
vim.api.nvim_create_augroup("AutoFormat", {})
|
||||||
|
|
||||||
-- vim.api.nvim_create_augroup("AutoFormat", {})
|
vim.api.nvim_create_autocmd(
|
||||||
--
|
"BufWritePost",
|
||||||
-- vim.api.nvim_create_autocmd(
|
{
|
||||||
-- "BufWritePost",
|
pattern = "*.py",
|
||||||
-- {
|
group = "AutoFormat",
|
||||||
-- pattern = "*.py",
|
callback = function()
|
||||||
-- group = "AutoFormat",
|
vim.cmd("silent !black --quiet %")
|
||||||
-- callback = function()
|
vim.cmd("edit")
|
||||||
-- vim.cmd("silent !black --quiet %")
|
vim.cmd("norm zz")
|
||||||
-- vim.cmd("edit")
|
end,
|
||||||
-- vim.cmd("norm zz")
|
}
|
||||||
-- end,
|
)
|
||||||
-- }
|
|
||||||
-- )
|
|
||||||
|
|
||||||
|
|
||||||
------
|
------
|
||||||
-- git gutter
|
-- git gutter
|
||||||
@ -115,20 +113,12 @@ keymap("gR", "<cmd>TroubleToggle lsp_references<cr>")
|
|||||||
-- language server (LSP)
|
-- language server (LSP)
|
||||||
------
|
------
|
||||||
vim.cmd.packadd("nvim-lspconfig")
|
vim.cmd.packadd("nvim-lspconfig")
|
||||||
local nvim_lsp = require('lspconfig')
|
|
||||||
|
|
||||||
local on_attach = function(client, bufnr)
|
local on_attach = function(client, bufnr)
|
||||||
local function buf_set_option(name, value) vim.api.nvim_set_option_value(name, value, { buf = bufnr }) end
|
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
|
|
||||||
|
|
||||||
-- Enable completion triggered by <c-x><c-o>
|
-- Enable completion triggered by <c-x><c-o>
|
||||||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
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.declaration, opts)
|
||||||
keymap('gd', vim.lsp.buf.definition, opts)
|
keymap('gd', vim.lsp.buf.definition, opts)
|
||||||
keymap('gK', vim.lsp.buf.hover, 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)
|
keymap('<localleader>f', vim.lsp.buf.format, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- find ruff config file path
|
|
||||||
local ruff_config = vim.fs.root(0, { ".git", "pyproject.toml" }) or ""
|
|
||||||
|
|
||||||
-- table declares LSPs to be set up
|
-- table declares LSPs to be set up
|
||||||
-- as well as settings per server (overrides defaults)
|
-- as well as settings per server (overrides defaults)
|
||||||
local servers = {
|
local servers = {
|
||||||
pyright = {
|
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 },
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
-- pylsp = {
|
-- pylsp = {
|
||||||
-- settings = {
|
-- settings = {
|
||||||
-- plugins = {
|
-- plugins = {
|
||||||
@ -220,6 +184,7 @@ local servers = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
local nvim_lsp = require('lspconfig')
|
||||||
for lsp, sv_settings in pairs(servers) do
|
for lsp, sv_settings in pairs(servers) do
|
||||||
-- defaults
|
-- defaults
|
||||||
local settings = {
|
local settings = {
|
||||||
|
Loading…
Reference in New Issue
Block a user