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:
parent
2d605cd9cd
commit
11c68f3743
@ -10,6 +10,7 @@ declare -A configs=(
|
|||||||
["fb-custom.zsh-theme"]="$HOME/.oh-my-zsh/custom/themes"
|
["fb-custom.zsh-theme"]="$HOME/.oh-my-zsh/custom/themes"
|
||||||
["nvim/init.lua"]="$HOME/.config/nvim/init.lua"
|
["nvim/init.lua"]="$HOME/.config/nvim/init.lua"
|
||||||
["nvim/lua"]="$HOME/.config/nvim/"
|
["nvim/lua"]="$HOME/.config/nvim/"
|
||||||
|
["nvim/after"]="$HOME/.config/nvim/"
|
||||||
["nvim/snippets"]="$HOME/.config/nvim/"
|
["nvim/snippets"]="$HOME/.config/nvim/"
|
||||||
["tmux.conf"]="$HOME/.tmux.conf"
|
["tmux.conf"]="$HOME/.tmux.conf"
|
||||||
["wezterm.lua"]="$HOME/.config/wezterm/wezterm.lua"
|
["wezterm.lua"]="$HOME/.config/wezterm/wezterm.lua"
|
||||||
|
|||||||
0
nvim/after/lsp/cfn-lint.lua
Normal file
0
nvim/after/lsp/cfn-lint.lua
Normal file
5
nvim/after/lsp/gdscript.lua
Normal file
5
nvim/after/lsp/gdscript.lua
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
return {
|
||||||
|
flags = {
|
||||||
|
debounce_text_changes = 100,
|
||||||
|
}
|
||||||
|
}
|
||||||
11
nvim/after/lsp/lua_ls.lua
Normal file
11
nvim/after/lsp/lua_ls.lua
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
return {
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
diagnostics = {
|
||||||
|
globals = {
|
||||||
|
'vim'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
3
nvim/after/lsp/marksman.lua
Normal file
3
nvim/after/lsp/marksman.lua
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
return {
|
||||||
|
filetypes = { 'md', 'markdown', 'telekasten' }
|
||||||
|
}
|
||||||
21
nvim/after/lsp/pylsp.lua
Normal file
21
nvim/after/lsp/pylsp.lua
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
return {
|
||||||
|
settings = {
|
||||||
|
pylsp = {
|
||||||
|
plugins = {
|
||||||
|
pycodestyle = {
|
||||||
|
enabled = false,
|
||||||
|
ignore = {
|
||||||
|
'E501'
|
||||||
|
},
|
||||||
|
maxLineLength = 120,
|
||||||
|
},
|
||||||
|
pylint = {
|
||||||
|
enabled = true,
|
||||||
|
args = {
|
||||||
|
'--disable=line-too-long'
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
21
nvim/after/lsp/rust_analyzer.lua
Normal file
21
nvim/after/lsp/rust_analyzer.lua
Normal 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,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -14,6 +14,7 @@ end
|
|||||||
vim.opt.rtp:prepend(lazypath)
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
require('lazy').setup({
|
require('lazy').setup({
|
||||||
|
require('plugins.lspconfig'), -- LSP configuration
|
||||||
require('plugins.mason'), -- LSP and DAP manager
|
require('plugins.mason'), -- LSP and DAP manager
|
||||||
require('plugins.gruvbox'), -- Colorscheme
|
require('plugins.gruvbox'), -- Colorscheme
|
||||||
require('plugins.comment'), -- Simple language specific commenting shortcuts
|
require('plugins.comment'), -- Simple language specific commenting shortcuts
|
||||||
|
|||||||
@ -1,4 +1,47 @@
|
|||||||
return {
|
return {
|
||||||
'neovim/nvim-lspconfig',
|
'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
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,149 +3,28 @@ return {
|
|||||||
config = function()
|
config = function()
|
||||||
require('mason').setup()
|
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 {
|
require('mason-lspconfig').setup {
|
||||||
automatic_enable = true,
|
automatic_enable = true,
|
||||||
automatic_installation = true,
|
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
'ansiblels',
|
-- Currently having issues with including some of the LSPs, even though they match the names in Mason
|
||||||
'arduino_language_server',
|
'ansiblels', -- Ansible
|
||||||
'bashls',
|
'arduino_language_server', -- Arduino specific C
|
||||||
|
'bashls', -- Bash
|
||||||
|
-- 'cfn-lint', -- Cloudformation for AWS
|
||||||
'clangd', -- C/C++
|
'clangd', -- C/C++
|
||||||
|
-- 'gdscript', -- Godot script
|
||||||
-- 'hadolint', -- Dockerfile linting
|
-- 'hadolint', -- Dockerfile linting
|
||||||
'intelephense', -- PHP
|
'intelephense', -- PHP
|
||||||
'lua_ls',
|
'lua_ls', -- Lua
|
||||||
'marksman', -- markdown
|
'marksman', -- markdown
|
||||||
'pylsp',
|
'pylsp', -- Python
|
||||||
'rust_analyzer',
|
'rust_analyzer', -- Rust
|
||||||
-- 'ts_ls', -- Typscript
|
'ts_ls', -- Typscript
|
||||||
'yamlls',
|
'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,
|
end,
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'neovim/nvim-lspconfig',
|
|
||||||
'mason-org/mason-lspconfig.nvim',
|
'mason-org/mason-lspconfig.nvim',
|
||||||
},
|
},
|
||||||
lazy = false,
|
lazy = false,
|
||||||
|
|||||||
@ -6,29 +6,6 @@ return {
|
|||||||
local action_state = require('telescope.actions.state')
|
local action_state = require('telescope.actions.state')
|
||||||
local fb_actions = telescope.extensions.file_browser.actions
|
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 = {
|
opts.defaults = {
|
||||||
file_ignore_patterns = {
|
file_ignore_patterns = {
|
||||||
'.png$',
|
'.png$',
|
||||||
@ -39,10 +16,12 @@ return {
|
|||||||
'.webp$',
|
'.webp$',
|
||||||
'.uproject$',
|
'.uproject$',
|
||||||
'-workspace$',
|
'-workspace$',
|
||||||
|
'.git/',
|
||||||
|
'.node_modules/',
|
||||||
'node_modules',
|
'node_modules',
|
||||||
},
|
},
|
||||||
layout_config = { prompt_position = 'top' },
|
layout_config = { prompt_position = 'bottom' },
|
||||||
layout_strategy = 'horizontal',
|
layout_strategy = 'vertical',
|
||||||
mappings = {
|
mappings = {
|
||||||
i = {
|
i = {
|
||||||
['<ESC>'] = actions.close,
|
['<ESC>'] = actions.close,
|
||||||
@ -57,20 +36,12 @@ return {
|
|||||||
|
|
||||||
opts.pickers = {
|
opts.pickers = {
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
theme = 'ivy',
|
-- theme = 'ivy',
|
||||||
initial_mode = 'normal',
|
initial_mode = 'normal',
|
||||||
layout_config = {
|
layout_config = {
|
||||||
preview_cutoff = 9999,
|
preview_cutoff = 9999,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
grep_string = {
|
|
||||||
initial_mode = 'normal',
|
|
||||||
mappings = {
|
|
||||||
['n'] = {
|
|
||||||
['<cr>'] = custom_actions.grep_multi_select,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
opts.extensions = {
|
opts.extensions = {
|
||||||
@ -101,12 +72,6 @@ return {
|
|||||||
require('telescope.builtin').find_files({
|
require('telescope.builtin').find_files({
|
||||||
no_ignore = false,
|
no_ignore = false,
|
||||||
hidden = true,
|
hidden = true,
|
||||||
file_ignore_patterns = {
|
|
||||||
'.git/',
|
|
||||||
'.node_modules/',
|
|
||||||
'.webp',
|
|
||||||
'.png',
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
@ -158,12 +123,6 @@ return {
|
|||||||
require('telescope.builtin').lsp_dynamic_workspace_symbols()
|
require('telescope.builtin').lsp_dynamic_workspace_symbols()
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
{
|
|
||||||
'<leader>rn',
|
|
||||||
function()
|
|
||||||
require('telescope.builtin').grep_string({ search = vim.fn.expand('<cword>') })
|
|
||||||
end
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
';e',
|
';e',
|
||||||
function()
|
function()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user