fix: Moving the LSP configs out of the Mason file, using the new vim.lsp.config way of configuring LSPs, adding the 'after' config directory for LSP specific configs that override/extend those in the 'lsp' dir and fit with the new configuration way of NVIM 0.11+, moving shortcuts to lspconfig instead of Mason, removing the rename custom function in telescope and using the LSP based function.

This commit is contained in:
Finch 2025-12-31 16:45:29 -06:00
parent 2d605cd9cd
commit 11c68f3743
11 changed files with 123 additions and 179 deletions

View File

@ -10,6 +10,7 @@ declare -A configs=(
["fb-custom.zsh-theme"]="$HOME/.oh-my-zsh/custom/themes"
["nvim/init.lua"]="$HOME/.config/nvim/init.lua"
["nvim/lua"]="$HOME/.config/nvim/"
["nvim/after"]="$HOME/.config/nvim/"
["nvim/snippets"]="$HOME/.config/nvim/"
["tmux.conf"]="$HOME/.tmux.conf"
["wezterm.lua"]="$HOME/.config/wezterm/wezterm.lua"

View File

View File

@ -0,0 +1,5 @@
return {
flags = {
debounce_text_changes = 100,
}
}

11
nvim/after/lsp/lua_ls.lua Normal file
View File

@ -0,0 +1,11 @@
return {
settings = {
Lua = {
diagnostics = {
globals = {
'vim'
}
}
}
}
}

View File

@ -0,0 +1,3 @@
return {
filetypes = { 'md', 'markdown', 'telekasten' }
}

21
nvim/after/lsp/pylsp.lua Normal file
View File

@ -0,0 +1,21 @@
return {
settings = {
pylsp = {
plugins = {
pycodestyle = {
enabled = false,
ignore = {
'E501'
},
maxLineLength = 120,
},
pylint = {
enabled = true,
args = {
'--disable=line-too-long'
},
}
}
}
}
}

View File

@ -0,0 +1,21 @@
return {
settings = {
['rust_analyzer'] = {
check = {
command = 'clippy',
extraArgs = {
'--',
'-D clippy::all',
'-W clippy::pedantic',
'-W clippy::restriction'
},
},
diagnostics = {
enable = true,
experimental = {
enable = true,
}
}
}
}
}

View File

@ -14,6 +14,7 @@ end
vim.opt.rtp:prepend(lazypath)
require('lazy').setup({
require('plugins.lspconfig'), -- LSP configuration
require('plugins.mason'), -- LSP and DAP manager
require('plugins.gruvbox'), -- Colorscheme
require('plugins.comment'), -- Simple language specific commenting shortcuts

View File

@ -1,4 +1,47 @@
return {
'neovim/nvim-lspconfig',
lazy = false,
-- lazy = false,
config = function ()
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
-- All functions and keymaps contained here are universal to LSPs
local on_attach = function(client, bufnr)
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Keyboard Mappings
local bufopts = { noremap = true, silent = true, buffer = bufnr }
vim.keymap.set('n', '<C-[>', vim.diagnostic.goto_prev, bufopts)
vim.keymap.set('n', '<C-]>', vim.diagnostic.goto_next, bufopts)
-- vim.keymap.set('n', 'gl', vim.diagnostic.open_float, bufopts)
vim.keymap.set('n', 'ga', vim.lsp.buf.code_action, bufopts)
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
vim.keymap.set('n', 'gs', vim.lsp.buf.signature_help, bufopts)
vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, bufopts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
vim.keymap.set('n', '<leader><leader>f', function() vim.lsp.buf.format { async = true } end, bufopts)
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, bufopts)
end
-- Kick the logging to debug level
-- vim.lsp.set_log_level("debug")
vim.diagnostic.config ({
virtual_text = {
source = 'always',
},
severity_sort = true,
float = {
source = 'always'
}
})
vim.lsp.config('*', {
capabilities = capabilities,
on_attach = on_attach,
})
end
}

View File

@ -3,149 +3,28 @@ return {
config = function()
require('mason').setup()
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
-- All functions and keymaps contained here are universal to LSPs
local on_attach = function(client, bufnr)
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Keyboard Mappings
local bufopts = { noremap = true, silent = true, buffer = bufnr }
vim.keymap.set('n', '<C-[>', vim.diagnostic.goto_prev, bufopts)
vim.keymap.set('n', '<C-]>', vim.diagnostic.goto_next, bufopts)
-- vim.keymap.set('n', 'gl', vim.diagnostic.open_float, bufopts)
vim.keymap.set('n', 'ga', vim.lsp.buf.code_action, bufopts)
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
vim.keymap.set('n', 'gs', vim.lsp.buf.signature_help, bufopts)
vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, bufopts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
vim.keymap.set('n', '<leader><leader>f', function() vim.lsp.buf.format { async = true } end, bufopts)
end
require('mason-lspconfig').setup {
automatic_enable = true,
automatic_installation = true,
ensure_installed = {
'ansiblels',
'arduino_language_server',
'bashls',
-- Currently having issues with including some of the LSPs, even though they match the names in Mason
'ansiblels', -- Ansible
'arduino_language_server', -- Arduino specific C
'bashls', -- Bash
-- 'cfn-lint', -- Cloudformation for AWS
'clangd', -- C/C++
-- 'gdscript', -- Godot script
-- 'hadolint', -- Dockerfile linting
'intelephense', -- PHP
'lua_ls',
'lua_ls', -- Lua
'marksman', -- markdown
'pylsp',
'rust_analyzer',
-- 'ts_ls', -- Typscript
'yamlls',
'pylsp', -- Python
'rust_analyzer', -- Rust
'ts_ls', -- Typscript
'yamlls', -- YAML
}
}
vim.diagnostic.config ({
virtual_text = {
source = "always",
},
severity_sort = true,
float = {
source = "always"
},
})
-- Kick the logging to debug level
-- vim.lsp.set_log_level("debug")
vim.lsp.config('gdscript', {
capabilities = capabilities,
on_attach = on_attach,
flags = {
debounce_text_changes = 100,
}
})
vim.lsp.config('lua_ls', {
capabilities = capabilities,
on_attach = on_attach,
settings = {
Lua = {
diagnostics = {
globals = {
'vim'
}
}
}
}
})
vim.lsp.config('pylsp', {
capabilities = capabilities,
on_attach = on_attach,
settings = {
pylsp = {
plugins = {
pycodestyle = {
enabled = false,
ignore = {
'E501' -- Ignore line length pep8 warnings
},
maxLineLength = 120,
},
pylint = {
enabled = true,
args = {
'--disable=line-too-long'
},
}
}
}
}
})
vim.lsp.config("rust_analyzer", {
capabilities = capabilities,
on_attach = on_attach,
settings = {
['rust_analyzer'] = {
check = {
command = 'clippy',
extraArgs = {
'--',
'-D clippy::all',
'-W clippy::pedantic',
'-W clippy::restriction'
},
},
diagnostics = {
enable = true,
experimental = {
enable = true,
}
}
}
}
})
vim.lsp.config("clangd", {
capabilities = capabilities,
on_attach = on_attach,
})
vim.lsp.config("marksman", {
capabilities = capabilities,
on_attach = on_attach,
filetypes = { 'md', 'markdown', 'telekasten' }
})
vim.lsp.config("*", {
capabilities = capabilities,
on_attach = on_attach,
})
end,
dependencies = {
'neovim/nvim-lspconfig',
'mason-org/mason-lspconfig.nvim',
},
lazy = false,

View File

@ -6,29 +6,6 @@ return {
local action_state = require('telescope.actions.state')
local fb_actions = telescope.extensions.file_browser.actions
local custom_actions = {}
function custom_actions.grep_multi_select(prompt_bufnr)
local function get_table_size(t)
local count = 0
for _ in pairs(t) do
count = count + 1
end
return count
end
local picker = action_state.get_current_picker(prompt_bufnr)
local num_selections = get_table_size(picker:get_multi_selection())
if num_selections > 1 then
actions.send_selected_to_qflist(prompt_bufnr)
actions.open_qflist()
print(action_state.get_current_picker(prompt_bufnr))
else
actions.file_edit(prompt_bufnr)
end
end
opts.defaults = {
file_ignore_patterns = {
'.png$',
@ -39,10 +16,12 @@ return {
'.webp$',
'.uproject$',
'-workspace$',
'.git/',
'.node_modules/',
'node_modules',
},
layout_config = { prompt_position = 'top' },
layout_strategy = 'horizontal',
layout_config = { prompt_position = 'bottom' },
layout_strategy = 'vertical',
mappings = {
i = {
['<ESC>'] = actions.close,
@ -57,20 +36,12 @@ return {
opts.pickers = {
diagnostics = {
theme = 'ivy',
-- theme = 'ivy',
initial_mode = 'normal',
layout_config = {
preview_cutoff = 9999,
},
},
grep_string = {
initial_mode = 'normal',
mappings = {
['n'] = {
['<cr>'] = custom_actions.grep_multi_select,
},
},
},
}
opts.extensions = {
@ -101,12 +72,6 @@ return {
require('telescope.builtin').find_files({
no_ignore = false,
hidden = true,
file_ignore_patterns = {
'.git/',
'.node_modules/',
'.webp',
'.png',
},
})
end,
},
@ -158,12 +123,6 @@ return {
require('telescope.builtin').lsp_dynamic_workspace_symbols()
end
},
{
'<leader>rn',
function()
require('telescope.builtin').grep_string({ search = vim.fn.expand('<cword>') })
end
},
{
';e',
function()