Migrate to new lsp config style, replace clear-action with fastaction, etc
This commit is contained in:
parent
7495a66472
commit
6cf9979241
1 changed files with 83 additions and 95 deletions
170
init.lua
170
init.lua
|
|
@ -24,6 +24,7 @@ end
|
||||||
|
|
||||||
opt.guicursor:append('a:blinkon1500-blinkoff1500-blinkwait1200') -- Blink cursor once every 1.5 seconds
|
opt.guicursor:append('a:blinkon1500-blinkoff1500-blinkwait1200') -- Blink cursor once every 1.5 seconds
|
||||||
o.mouse = 'a' -- Enable mouse input
|
o.mouse = 'a' -- Enable mouse input
|
||||||
|
o.mousemoveevent = true -- Allow plugins to detect mouse movement
|
||||||
o.termguicolors = true -- Enable 24bit terminal colors
|
o.termguicolors = true -- Enable 24bit terminal colors
|
||||||
|
|
||||||
-- Other interface settings
|
-- Other interface settings
|
||||||
|
|
@ -243,12 +244,22 @@ vim.diagnostic.config {
|
||||||
underline = {
|
underline = {
|
||||||
-- Only underline warnings and up
|
-- Only underline warnings and up
|
||||||
severity = { min = vim.diagnostic.severity.WARN }
|
severity = { min = vim.diagnostic.severity.WARN }
|
||||||
}
|
},
|
||||||
|
virtual_text = {
|
||||||
|
severity = { min = vim.diagnostic.severity.WARN },
|
||||||
|
},
|
||||||
|
virtual_lines = {
|
||||||
|
current_line = true,
|
||||||
|
},
|
||||||
|
signs = {
|
||||||
|
text = {
|
||||||
|
[vim.diagnostic.severity.ERROR] = '',
|
||||||
|
[vim.diagnostic.severity.WARN] = '',
|
||||||
|
[vim.diagnostic.severity.INFO] = '',
|
||||||
|
[vim.diagnostic.severity.HINT] = '',
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
fn.sign_define('DiagnosticSignInfo', { text = '', texthl = 'DiagnosticSignInfo' })
|
|
||||||
fn.sign_define('DiagnosticSignHint', { text = '', texthl = 'DiagnosticSignHint' })
|
|
||||||
fn.sign_define('DiagnosticSignWarn', { text = '', texthl = 'DiagnosticSignWarn' })
|
|
||||||
fn.sign_define('DiagnosticSignError', { text = '', texthl = 'DiagnosticSignError' })
|
|
||||||
|
|
||||||
au('LspAttach', { callback = function(event)
|
au('LspAttach', { callback = function(event)
|
||||||
require'which-key'.register({
|
require'which-key'.register({
|
||||||
|
|
@ -375,7 +386,7 @@ require('lazy').setup({
|
||||||
vim.g['test#strategy'] = 'neovim'
|
vim.g['test#strategy'] = 'neovim'
|
||||||
end},
|
end},
|
||||||
{'julian/vim-textobj-variable-segment', dependencies = {'kana/vim-textobj-user'}},
|
{'julian/vim-textobj-variable-segment', dependencies = {'kana/vim-textobj-user'}},
|
||||||
{'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', opts = {
|
{'nvim-treesitter/nvim-treesitter', dependencies = {'OXY2DEV/markview.nvim'}, build = ':TSUpdate', opts = {
|
||||||
-- Configure the nvim-ts-autotag plugin
|
-- Configure the nvim-ts-autotag plugin
|
||||||
autotag = {
|
autotag = {
|
||||||
enable = true,
|
enable = true,
|
||||||
|
|
@ -409,45 +420,39 @@ require('lazy').setup({
|
||||||
lspconfig.util.default_config.capabilities = capabilities
|
lspconfig.util.default_config.capabilities = capabilities
|
||||||
|
|
||||||
-- Set up language servers
|
-- Set up language servers
|
||||||
lspconfig.ansiblels.setup {}
|
vim.lsp.config('lua_ls', {
|
||||||
lspconfig.bashls.setup {}
|
|
||||||
lspconfig.clangd.setup {}
|
|
||||||
lspconfig.cssls.setup {}
|
|
||||||
lspconfig.eslint.setup {
|
|
||||||
settings = {
|
|
||||||
rulesCustomizations = {
|
|
||||||
{ rule = '*no-shadow*', severity = 'off' },
|
|
||||||
{ rule = '*no-unused-vars', severity = 'off' }
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
lspconfig.html.setup {}
|
|
||||||
lspconfig.jsonls.setup {}
|
|
||||||
lspconfig.lemminx.setup {}
|
|
||||||
lspconfig.lua_ls.setup {
|
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
runtime = {
|
runtime = {
|
||||||
version = 'LuaJIT',
|
version = 'LuaJIT',
|
||||||
},
|
path = {
|
||||||
diagnostics = {
|
'lua/?.lua',
|
||||||
globals = {'vim'},
|
'lua/?/init.lua',
|
||||||
},
|
},
|
||||||
workspace = {
|
workspace = {
|
||||||
library = vim.api.nvim_get_runtime_file('', true),
|
|
||||||
checkThirdParty = false,
|
checkThirdParty = false,
|
||||||
|
library = {
|
||||||
|
vim.env.VIMRUNTIME
|
||||||
},
|
},
|
||||||
telemetry = {
|
|
||||||
enable = false,
|
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
lspconfig.nil_ls.setup {}
|
})
|
||||||
--lspconfig.basedpyright.setup {}
|
vim.lsp.enable({
|
||||||
lspconfig.pyright.setup {}
|
'ansiblels',
|
||||||
lspconfig.vimls.setup {}
|
'ast_grep',
|
||||||
lspconfig.yamlls.setup {}
|
'bashls',
|
||||||
|
'clangd',
|
||||||
|
'cssls',
|
||||||
|
'html',
|
||||||
|
'jsonls',
|
||||||
|
'lemminx',
|
||||||
|
'lua_ls',
|
||||||
|
'ty',
|
||||||
|
'vimls',
|
||||||
|
'yamlls',
|
||||||
|
})
|
||||||
end},
|
end},
|
||||||
{'Saghen/blink.cmp', dependencies = {'altermo/ultimate-autopair.nvim', 'rcarriga/cmp-dap'}, lazy = false, build = 'cargo build --release', opts_extend = {'sources.default'}, opts = {
|
{'Saghen/blink.cmp', dependencies = {'altermo/ultimate-autopair.nvim', 'rcarriga/cmp-dap'}, lazy = false, build = 'cargo build --release', opts_extend = {'sources.default'}, opts = {
|
||||||
keymap = {
|
keymap = {
|
||||||
|
|
@ -655,7 +660,9 @@ require('lazy').setup({
|
||||||
else
|
else
|
||||||
return {}
|
return {}
|
||||||
end
|
end
|
||||||
end)()
|
end)(),
|
||||||
|
expose_as_code_action = 'all',
|
||||||
|
jsx_close_tag = { enable = true },
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
{'dmmulroy/ts-error-translator.nvim', opts = {}},
|
{'dmmulroy/ts-error-translator.nvim', opts = {}},
|
||||||
|
|
@ -707,6 +714,8 @@ require('lazy').setup({
|
||||||
hover = {
|
hover = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
},
|
},
|
||||||
|
tab_size = 24,
|
||||||
|
max_name_length = 24,
|
||||||
},
|
},
|
||||||
}, keys = {
|
}, keys = {
|
||||||
{'<A-,>', '<Cmd>BufferLineCyclePrev<CR>', { desc = 'Next buffer' }},
|
{'<A-,>', '<Cmd>BufferLineCyclePrev<CR>', { desc = 'Next buffer' }},
|
||||||
|
|
@ -726,32 +735,15 @@ require('lazy').setup({
|
||||||
{'<Leader>bh', '<Cmd>BufferLineMovePrev<CR>', { desc = 'Move buffer left' }},
|
{'<Leader>bh', '<Cmd>BufferLineMovePrev<CR>', { desc = 'Move buffer left' }},
|
||||||
{'<Leader>bl', '<Cmd>BufferLineMoveNext<CR>', { desc = 'Move buffer right' }},
|
{'<Leader>bl', '<Cmd>BufferLineMoveNext<CR>', { desc = 'Move buffer right' }},
|
||||||
}},
|
}},
|
||||||
{'luckasRanarison/clear-action.nvim', config = function()
|
{'Chaitanyabsprip/fastaction.nvim', opts = {
|
||||||
require'clear-action'.setup {
|
dismiss_keys = {'q', '<Esc>', '<C-c>'},
|
||||||
signs = {
|
keys = 'fjdkslarueiwovmcxpzbnty',
|
||||||
enable = true,
|
register_ui_select = false,
|
||||||
-- Only show one symbol instead of several per category
|
}, config = function(_, opts)
|
||||||
combine = true,
|
local fastaction = require'fastaction'
|
||||||
-- Don't show the number of actions,
|
fastaction.setup(opts)
|
||||||
show_count = false,
|
vim.keymap.set('n', 'ga', fastaction.code_action)
|
||||||
-- Which icons to use for code action sings
|
vim.keymap.set('n', '<Leader>la', fastaction.code_action)
|
||||||
icons = {
|
|
||||||
combined = '🛈',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
popup = { enable = true },
|
|
||||||
}
|
|
||||||
au('LspAttach', { callback = function(event)
|
|
||||||
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
|
||||||
local code_action
|
|
||||||
if client and client.name ~= 'jdtls' then
|
|
||||||
code_action = require'clear-action'.code_action
|
|
||||||
else
|
|
||||||
code_action = vim.lsp.buf.code_action
|
|
||||||
end
|
|
||||||
vim.keymap.set('n', 'ga', code_action, { buffer = event.buf, desc = 'Code action' })
|
|
||||||
vim.keymap.set('n', '<Leader>la', vim.lsp.buf.code_action, { buffer = event.buf, desc = 'Code action' })
|
|
||||||
end })
|
|
||||||
end},
|
end},
|
||||||
{'MattesGroeger/vim-bookmarks', config = function()
|
{'MattesGroeger/vim-bookmarks', config = function()
|
||||||
vim.g.bookmark_no_default_key_mappings = 1
|
vim.g.bookmark_no_default_key_mappings = 1
|
||||||
|
|
@ -785,9 +777,8 @@ require('lazy').setup({
|
||||||
host = 'localhost',
|
host = 'localhost',
|
||||||
port = '${port}',
|
port = '${port}',
|
||||||
executable = {
|
executable = {
|
||||||
command = 'node',
|
command = 'js-debug-adapter',
|
||||||
args = {
|
args = {
|
||||||
mason_path('js-debug-adapter') .. '/js-debug/src/dapDebugServer.js',
|
|
||||||
'${port}'
|
'${port}'
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -845,10 +836,17 @@ require('lazy').setup({
|
||||||
{
|
{
|
||||||
type = 'pwa-node',
|
type = 'pwa-node',
|
||||||
request = 'attach',
|
request = 'attach',
|
||||||
name = 'Attach',
|
name = 'Attach to process',
|
||||||
processId = require'dap.utils'.pick_process,
|
processId = require'dap.utils'.pick_process,
|
||||||
cwd = '${workspaceFolder}',
|
cwd = '${workspaceFolder}',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
type = 'pwa-node',
|
||||||
|
request = 'attach',
|
||||||
|
name = 'Attach to port',
|
||||||
|
address = 'localhost',
|
||||||
|
port = 9229,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
type = 'pwa-node',
|
type = 'pwa-node',
|
||||||
request = 'launch',
|
request = 'launch',
|
||||||
|
|
@ -890,6 +888,9 @@ require('lazy').setup({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end},
|
end},
|
||||||
|
{'mfussenegger/nvim-dap-python', dependencies = {'mfussenegger/nvim-dap'}, config = function()
|
||||||
|
require'dap-python'.setup('uv')
|
||||||
|
end},
|
||||||
{'rcarriga/nvim-dap-ui', dependencies = {
|
{'rcarriga/nvim-dap-ui', dependencies = {
|
||||||
'mfussenegger/nvim-dap',
|
'mfussenegger/nvim-dap',
|
||||||
'nvim-neotest/nvim-nio'
|
'nvim-neotest/nvim-nio'
|
||||||
|
|
@ -900,9 +901,7 @@ require('lazy').setup({
|
||||||
dap.listeners.after.event_initialized.dapui_config = function()
|
dap.listeners.after.event_initialized.dapui_config = function()
|
||||||
dapui.open {}
|
dapui.open {}
|
||||||
end
|
end
|
||||||
require'which-key'.register {
|
vim.keymap.set('n', '<Leader>dd', dapui.toggle, { desc = 'Toggle' })
|
||||||
['<Leader>dd'] = {dapui.toggle, 'Toggle'}
|
|
||||||
}
|
|
||||||
end},
|
end},
|
||||||
{'theHamsta/nvim-dap-virtual-text', dependencies = {'mfussenegger/nvim-dap'}, opts = {
|
{'theHamsta/nvim-dap-virtual-text', dependencies = {'mfussenegger/nvim-dap'}, opts = {
|
||||||
-- Clear virtual text when the debugger does a continue
|
-- Clear virtual text when the debugger does a continue
|
||||||
|
|
@ -1053,32 +1052,22 @@ require('lazy').setup({
|
||||||
{'junegunn/goyo.vim', config = function()
|
{'junegunn/goyo.vim', config = function()
|
||||||
vim.g.goyo_height = '95%'
|
vim.g.goyo_height = '95%'
|
||||||
end},
|
end},
|
||||||
{url = 'https://git.sr.ht/~whynothugo/lsp_lines.nvim', config = function()
|
{'williamboman/mason.nvim', version = "^2.1.0", opts = {}},
|
||||||
require'lsp_lines'.setup()
|
{'williamboman/mason-lspconfig.nvim', version = "^2.1.0", dependencies = {'williamboman/mason.nvim', 'neovim/nvim-lspconfig'}, opts = {
|
||||||
vim.diagnostic.config {
|
automatic_enable = false,
|
||||||
virtual_text = {
|
|
||||||
severity = { min = vim.diagnostic.severity.WARN },
|
|
||||||
},
|
|
||||||
virtual_lines = {
|
|
||||||
only_current_line = true,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end},
|
|
||||||
{'williamboman/mason.nvim', opts = {}},
|
|
||||||
{'williamboman/mason-lspconfig.nvim', dependencies = {'williamboman/mason.nvim'}, opts = {
|
|
||||||
automatic_installation = true
|
|
||||||
}},
|
}},
|
||||||
{'NeogitOrg/neogit', lazy = false, opts = {
|
{'NeogitOrg/neogit', lazy = false, opts = {
|
||||||
disable_context_highlighting = true,
|
disable_context_highlighting = true,
|
||||||
integrations = {
|
integrations = {
|
||||||
diffview = true,
|
diffview = true,
|
||||||
|
telescope = true,
|
||||||
},
|
},
|
||||||
signs = {
|
signs = {
|
||||||
item = {"", ""},
|
item = {"", ""},
|
||||||
section = {"", ""},
|
section = {"", ""},
|
||||||
},
|
},
|
||||||
}, keys = {
|
}, keys = {
|
||||||
{'<Leader><C-g>', '<Cmd>Neogit<CR>', { desc = 'Neogit' }}
|
{'<Leader>g', '<Cmd>Neogit<CR>', { desc = 'Neogit' }}
|
||||||
}},
|
}},
|
||||||
{'rcarriga/nvim-notify', dependencies = {'nvim-telescope/telescope.nvim'}, opts = {
|
{'rcarriga/nvim-notify', dependencies = {'nvim-telescope/telescope.nvim'}, opts = {
|
||||||
stages = 'fade',
|
stages = 'fade',
|
||||||
|
|
@ -1316,9 +1305,8 @@ require('lazy').setup({
|
||||||
pattern = 'NvimTree*',
|
pattern = 'NvimTree*',
|
||||||
callback = function()
|
callback = function()
|
||||||
local api = require('nvim-tree.api')
|
local api = require('nvim-tree.api')
|
||||||
local view = require('nvim-tree.view')
|
|
||||||
|
|
||||||
if not view.is_visible() then
|
if not api.tree.is_visible() then
|
||||||
api.tree.open()
|
api.tree.open()
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
@ -1339,11 +1327,11 @@ require('lazy').setup({
|
||||||
}},
|
}},
|
||||||
{'folke/which-key.nvim', opts = {}, config = function (plugin, opts)
|
{'folke/which-key.nvim', opts = {}, config = function (plugin, opts)
|
||||||
require'which-key'.setup(opts)
|
require'which-key'.setup(opts)
|
||||||
require'which-key'.register {
|
require'which-key'.add {
|
||||||
['<Leader>q'] = { name = 'Quickfix' },
|
{'<Leader>q', group = 'Quickfix' },
|
||||||
['<Leader>l'] = { name = 'LSP' },
|
{'<Leader>l', group = 'LSP' },
|
||||||
['<Leader>b'] = { name = 'Buffer' },
|
{'<Leader>b', group = 'Buffer' },
|
||||||
['<Leader>e'] = { name = 'Diagnostic' },
|
{'<Leader>e', group = 'Diagnostic' },
|
||||||
}
|
}
|
||||||
end},
|
end},
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue