nvim: lsp
This commit is contained in:
parent
34214c5f7e
commit
e6b3ac25dd
4 changed files with 58 additions and 14 deletions
|
@ -234,6 +234,7 @@ function M.config()
|
|||
vim.api.nvim_set_hl(0, 'CmpItemAbbrMatch', { link = 'GruvboxAquaBold' })
|
||||
vim.api.nvim_set_hl(0, 'CmpItemAbbrMatchFuzzy', { link = 'GruvboxAquaBold' })
|
||||
|
||||
|
||||
local tbg = vim.api.nvim_get_hl_by_name('GruvboxBg0', false)
|
||||
local bg = vim.api.nvim_get_hl_by_name('GruvboxBg0', true)
|
||||
local tfg = vim.api.nvim_get_hl_by_name('GruvboxGray', false)
|
||||
|
@ -245,6 +246,14 @@ function M.config()
|
|||
ctermbg = tbg.foreground,
|
||||
underdotted = true
|
||||
})
|
||||
|
||||
|
||||
vim.api.nvim_set_hl(0, 'LspCodeLens', {
|
||||
fg = fg.foreground,
|
||||
ctermfg = tfg.foreground,
|
||||
italic = true
|
||||
})
|
||||
|
||||
end
|
||||
})
|
||||
|
||||
|
|
|
@ -5,10 +5,11 @@ local M = {
|
|||
'b0o/schemastore.nvim',
|
||||
'SmiteshP/nvim-navic',
|
||||
{ 'j-hui/fidget.nvim', config = true },
|
||||
{ 'ray-x/lsp_signature.nvim' },
|
||||
},
|
||||
keys = {
|
||||
{'<Space>li', '<Cmd>LspInfo<CR>', desc = 'Lsp info' },
|
||||
{'<Space>ll', '<Cmd>LspLog<CR>', desc = 'Lsp log' },
|
||||
keys = {
|
||||
{ '<Space>li', '<Cmd>LspInfo<CR>', desc = 'Lsp info' },
|
||||
{ '<Space>ll', '<Cmd>LspLog<CR>', desc = 'Lsp log' },
|
||||
},
|
||||
lazy = false
|
||||
}
|
||||
|
@ -68,13 +69,24 @@ function M.config()
|
|||
vim.keymap.set('i', '<C-k>', vim.lsp.buf.signature_help, mkOpts('LSP signature help'))
|
||||
end
|
||||
|
||||
if client.server_capabilities.codeLensProvider then
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ 'BufEnter', 'CursorHold', 'InsertLeave' }, {
|
||||
callback = vim.lsp.codelens.refresh,
|
||||
buffer = bufnr,
|
||||
})
|
||||
vim.keymap.set('n', '<space>cl', vim.lsp.codelens.run, mkOpts('LSP Run code lens'))
|
||||
end
|
||||
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, mkOpts('LSP type definition'))
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, mkOpts('LSP rename'))
|
||||
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, mkOpts('LSP Code action'))
|
||||
vim.keymap.set('v', '<space>ca', vim.lsp.buf.code_action, mkOpts('LSP Code action'))
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, mkOpts('LSP references'))
|
||||
-- vim.keymap.set('n', 'gr', vim.lsp.buf.references, mkOpts('LSP references'))
|
||||
vim.keymap.set('n', 'gr', '<Cmd>Trouble lsp_references<CR>', mkOpts('LSP references'))
|
||||
|
||||
vim.keymap.set('n', '<space>F', function() vim.lsp.buf.format({ async = true, filter = formatting_filter, }) end, opts)
|
||||
vim.keymap.set('n', '<space>F', function() vim.lsp.buf.format({ async = true, filter = formatting_filter, }) end,
|
||||
opts)
|
||||
if (formatting_filter(client)) then
|
||||
vim.api.nvim_buf_set_option(bufnr, 'formatexpr', 'v:lua.vim.lsp.formatexpr(#{timeout_ms:250})')
|
||||
end
|
||||
|
@ -151,10 +163,10 @@ function M.config()
|
|||
local u = require('lspconfig.util')
|
||||
return u.search_ancestors(startpath, function(path)
|
||||
return not string.find(path, '/vendor/') and (
|
||||
u.path.exists(u.path.join(path, 'composer.json'))
|
||||
or u.path.exists(u.path.join(path, 'sharedLibs'))
|
||||
or u.path.exists(u.path.join(path, '.git'))
|
||||
)
|
||||
u.path.exists(u.path.join(path, 'composer.json'))
|
||||
or u.path.exists(u.path.join(path, 'sharedLibs'))
|
||||
or u.path.exists(u.path.join(path, '.git'))
|
||||
)
|
||||
end)
|
||||
end
|
||||
}
|
||||
|
|
8
dot_config/nvim/lua/configs/packages/lsp_signature.lua
Normal file
8
dot_config/nvim/lua/configs/packages/lsp_signature.lua
Normal file
|
@ -0,0 +1,8 @@
|
|||
return {
|
||||
'ray-x/lsp_signature.nvim',
|
||||
lazy = true,
|
||||
config = {
|
||||
hint_prefix = '',
|
||||
floating_window = false,
|
||||
}
|
||||
}
|
|
@ -9,21 +9,32 @@ local M = {
|
|||
build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build'
|
||||
}
|
||||
},
|
||||
cmd = { 'Telescope' },
|
||||
keys = {
|
||||
{'<Space>b', [[<Cmd>Telescope buffers<CR>]], desc = 'Buffers'},
|
||||
{'<Space>ff', [[<Cmd>Telescope fd<CR>]], desc = 'Search file'},
|
||||
{'<Space>T', [[<Cmd>Telescope<CR>]], desc = 'Telescope'},
|
||||
{ '<Space>b', [[<Cmd>Telescope buffers<CR>]], desc = 'Buffers' },
|
||||
{ '<Space>ff', [[<Cmd>Telescope fd<CR>]], desc = 'Search file' },
|
||||
{ '<Space>T', [[<Cmd>Telescope<CR>]], desc = 'Telescope' },
|
||||
}
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local telescope = require('telescope')
|
||||
local actions = require('telescope.actions')
|
||||
local layout_actions = require('telescope.actions.layout')
|
||||
|
||||
telescope.setup {
|
||||
defaults = {
|
||||
preview = {
|
||||
hide_on_startup = true
|
||||
},
|
||||
mappings = {
|
||||
i = {
|
||||
['<M-i>'] = layout_actions.toggle_preview,
|
||||
},
|
||||
n = {
|
||||
['<M-i>'] = layout_actions.toggle_preview,
|
||||
}
|
||||
}
|
||||
},
|
||||
pickers = {
|
||||
buffers = {
|
||||
|
@ -32,8 +43,12 @@ function M.config()
|
|||
sort_mru = true,
|
||||
-- theme = "dropdown",
|
||||
mappings = {
|
||||
i = { ['<c-d>'] = 'delete_buffer', },
|
||||
n = { ['<c-d>'] = 'delete_buffer', }
|
||||
i = {
|
||||
['<C-d>'] = actions.delete_buffer,
|
||||
},
|
||||
n = {
|
||||
['<C-d>'] = actions.delete_buffer,
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue