mirror of
https://github.com/iofq/nvim.nix.git
synced 2026-01-23 08:55:16 -06:00
use qflist for lsp
This commit is contained in:
parent
24b44e172f
commit
58c0637b78
9 changed files with 31 additions and 72 deletions
|
|
@ -21,6 +21,7 @@ return {
|
|||
compositeLiteralTypes = true,
|
||||
constantValues = true,
|
||||
functionTypeParameters = true,
|
||||
ignoredError = true,
|
||||
rangeVariableTypes = true,
|
||||
parameterNames = true,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@ return {
|
|||
end,
|
||||
settings = {
|
||||
Lua = {
|
||||
codeLens = {
|
||||
enable = true,
|
||||
},
|
||||
hint = {
|
||||
enable = true,
|
||||
arrayIndex = 'Enable',
|
||||
|
|
|
|||
|
|
@ -1,9 +1,3 @@
|
|||
-- create undopath
|
||||
vim.api.nvim_create_autocmd('VimEnter', {
|
||||
command = 'silent !mkdir -p ' .. vim.fn.stdpath('data') .. 'undo',
|
||||
group = vim.api.nvim_create_augroup('Init', {}),
|
||||
})
|
||||
|
||||
-- open :h in buffers
|
||||
vim.api.nvim_create_autocmd('BufWinEnter', {
|
||||
pattern = '*',
|
||||
|
|
@ -31,6 +25,7 @@ vim.api.nvim_create_autocmd({ 'FileType' }, {
|
|||
vim.cmd('copen')
|
||||
-- move cursor to stay at same index (or up one if at EOF)
|
||||
vim.api.nvim_win_set_cursor(vim.fn.win_getid(), { ln < #qf and ln or math.max(ln - 1, 1), 0 })
|
||||
require('quicker').refresh()
|
||||
end, { buffer = true })
|
||||
end,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
-- Switch tab length on the fly
|
||||
vim.keymap.set('n', '\\t', function()
|
||||
vim.o.tabstop = vim.o.tabstop == 8 and 2 or 2 * vim.o.tabstop
|
||||
vim.notify('tabstop: ' .. vim.o.tabstop)
|
||||
end, { silent = true, desc = 'toggle tabstop' })
|
||||
vim.keymap.set({ 'v', 'i' }, 'wq', '<esc>l', { noremap = true, silent = true })
|
||||
vim.keymap.set('v', '<', '<gv')
|
||||
|
|
|
|||
|
|
@ -1,34 +0,0 @@
|
|||
M = {}
|
||||
M.diagnostics = function(filter)
|
||||
Snacks.picker.diagnostics {
|
||||
filter = filter,
|
||||
focus = 'list',
|
||||
format = function(item, picker)
|
||||
P = require('snacks.picker.format')
|
||||
local ret = {} ---@type snacks.picker.Highlight[]
|
||||
vim.list_extend(ret, P.filename(item, picker))
|
||||
|
||||
local diag = item.item ---@type vim.Diagnostic
|
||||
if item.severity then
|
||||
vim.list_extend(ret, P.severity(item, picker))
|
||||
end
|
||||
|
||||
local message = diag.message
|
||||
ret[#ret + 1] = { message }
|
||||
Snacks.picker.highlight.markdown(ret)
|
||||
ret[#ret + 1] = { ' ' }
|
||||
|
||||
if diag.source then
|
||||
ret[#ret + 1] = { diag.source, 'SnacksPickerDiagnosticSource' }
|
||||
ret[#ret + 1] = { ' ' }
|
||||
end
|
||||
|
||||
if diag.code then
|
||||
ret[#ret + 1] = { ('(%s)'):format(diag.code), 'SnacksPickerDiagnosticCode' }
|
||||
ret[#ret + 1] = { ' ' }
|
||||
end
|
||||
return ret
|
||||
end,
|
||||
}
|
||||
end
|
||||
return M
|
||||
|
|
@ -17,23 +17,9 @@ return {
|
|||
if not client then
|
||||
return
|
||||
end
|
||||
vim.keymap.set('n', 'grg', '<cmd>Trouble lsp toggle<CR>', { buffer = ev.buf, desc = 'Trouble LSP' })
|
||||
|
||||
vim.keymap.set('n', 'gO', function()
|
||||
Snacks.picker.lsp_symbols { focus = 'list' }
|
||||
end, { buffer = ev.buf, desc = 'LSP symbols' })
|
||||
vim.keymap.set('n', '<C-]>', function()
|
||||
Snacks.picker.lsp_definitions { focus = 'list' }
|
||||
end, { buffer = ev.buf, desc = 'LSP definition' })
|
||||
vim.keymap.set('n', 'grt', function()
|
||||
Snacks.picker.lsp_type_definitions { focus = 'list' }
|
||||
end, { buffer = ev.buf, desc = 'LSP type definition' })
|
||||
vim.keymap.set('n', 'grr', function()
|
||||
Snacks.picker.lsp_references { focus = 'list' }
|
||||
end, { buffer = ev.buf, desc = 'LSP refrences' })
|
||||
vim.keymap.set('n', 'gri', function()
|
||||
Snacks.picker.lsp_implementations { focus = 'list' }
|
||||
end, { buffer = ev.buf, desc = 'LSP implementations' })
|
||||
|
||||
vim.keymap.set('n', 'grh', function()
|
||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
|
||||
|
|
@ -41,10 +27,10 @@ return {
|
|||
vim.keymap.set('n', 'grl', vim.lsp.codelens.run, { buffer = ev.buf, desc = 'vim.lsp.codelens.run()' })
|
||||
|
||||
vim.keymap.set('n', 'gre', function()
|
||||
require('plugins.lib.snacks').diagnostics { buf = true }
|
||||
vim.diagnostic.setloclist()
|
||||
end, { buffer = ev.buf, desc = 'LSP buffer diagnostics' })
|
||||
vim.keymap.set('n', 'grE', function()
|
||||
require('plugins.lib.snacks').diagnostics { cwd = false }
|
||||
vim.diagnostic.setqflist()
|
||||
end, { buffer = ev.buf, desc = 'LSP diagnostics' })
|
||||
|
||||
vim.keymap.set('n', 'grc', function()
|
||||
|
|
@ -55,7 +41,7 @@ return {
|
|||
end, { buffer = ev.buf, desc = 'LSP outgoing_calls' })
|
||||
|
||||
-- Auto-refresh code lenses
|
||||
if client.server_capabilities.codeLensProvider then
|
||||
if client:supports_method('textDocument/codeLens') or client.server_capabilities.codeLensProvider then
|
||||
vim.api.nvim_create_autocmd({ 'InsertLeave', 'TextChanged' }, {
|
||||
group = vim.api.nvim_create_augroup(string.format('lsp-%s-%s', ev.buf, client.id), {}),
|
||||
callback = function()
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ return {
|
|||
custom_textobjects = {
|
||||
i = extra_ai.indent(),
|
||||
g = extra_ai.buffer(),
|
||||
l = extra_ai.line(),
|
||||
e = extra_ai.line(),
|
||||
u = ai.gen_spec.function_call(),
|
||||
a = ai.gen_spec.treesitter { a = '@parameter.outer', i = '@parameter.inner' },
|
||||
k = ai.gen_spec.treesitter { a = '@assignment.lhs', i = '@assignment.lhs' },
|
||||
|
|
|
|||
|
|
@ -121,6 +121,20 @@ return {
|
|||
end,
|
||||
desc = 'Refresh qflist',
|
||||
},
|
||||
{
|
||||
'<leader>q>',
|
||||
function()
|
||||
require('quicker').expand { before = 2, after = 2, add_to_existing = true }
|
||||
end,
|
||||
desc = 'Expand quickfix context',
|
||||
},
|
||||
{
|
||||
'<leader>q<',
|
||||
function()
|
||||
require('quicker').collapse()
|
||||
end,
|
||||
desc = 'Collapse quickfix context',
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,20 +79,6 @@ return {
|
|||
mode = { 'n', 't' },
|
||||
desc = 'terminal open',
|
||||
},
|
||||
{
|
||||
']r',
|
||||
function()
|
||||
Snacks.words.jump(1, true)
|
||||
end,
|
||||
desc = 'next reference',
|
||||
},
|
||||
{
|
||||
'[r',
|
||||
function()
|
||||
Snacks.words.jump(-1, true)
|
||||
end,
|
||||
desc = 'next reference',
|
||||
},
|
||||
{
|
||||
'<leader><leader>',
|
||||
function()
|
||||
|
|
@ -179,6 +165,13 @@ return {
|
|||
end,
|
||||
desc = 'pick treesitter nodes',
|
||||
},
|
||||
{
|
||||
'<leader>fq',
|
||||
function()
|
||||
Snacks.picker.qflist()
|
||||
end,
|
||||
desc = 'pick quickfix list',
|
||||
},
|
||||
{
|
||||
'<leader>jf',
|
||||
function()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue