Compare commits
4 Commits
6372e8f63c
...
4c8f6cbc8b
Author | SHA1 | Date | |
---|---|---|---|
4c8f6cbc8b | |||
e5e2453efb | |||
e11b4d54a2 | |||
a4377b22ac |
@ -1,40 +1,32 @@
|
||||
return {
|
||||
'neovim/nvim-lspconfig',
|
||||
|
||||
dependencies = {
|
||||
-- Language server management plugins
|
||||
'williamboman/mason.nvim',
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
|
||||
-- Completion plugins
|
||||
'hrsh7th/cmp-nvim-lsp', -- Source for built-in language server client
|
||||
'hrsh7th/cmp-buffer', -- Source for buffer words
|
||||
'hrsh7th/cmp-path', -- Source for filesystem paths
|
||||
'kbenzie/cmp-git', -- Source for Git/GitHub/GitLab
|
||||
'hrsh7th/nvim-cmp', -- Completion engine combines and use the above
|
||||
-- Completion sources plugins
|
||||
'hrsh7th/cmp-nvim-lsp', -- Source for built-in language server client
|
||||
'saadparwaiz1/cmp_luasnip', -- Source for LuaSnip snippets
|
||||
'hrsh7th/cmp-buffer', -- Source for buffer words
|
||||
'hrsh7th/cmp-path', -- Source for filesystem paths
|
||||
'kbenzie/cmp-git', -- Source for Git/GitHub/GitLab
|
||||
'hrsh7th/nvim-cmp', -- Completion engine combines and uses the above
|
||||
|
||||
-- TODO: https://github.com/b0o/SchemaStore.nvim
|
||||
-- TODO: https://github.com/jmbuhr/otter.nvim
|
||||
-- Lua vim module support in lua language server
|
||||
'folke/neodev.nvim',
|
||||
-- Expose clangd extensions
|
||||
'p00f/clangd_extensions.nvim',
|
||||
|
||||
-- LSP UI plugins
|
||||
'aznhe21/actions-preview.nvim',
|
||||
'j-hui/fidget.nvim',
|
||||
'folke/trouble.nvim',
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
'ray-x/lsp_signature.nvim',
|
||||
|
||||
-- Lua vim module support in lua language server
|
||||
'folke/neodev.nvim',
|
||||
|
||||
-- Snippet pluggins
|
||||
{ 'L3MON4D3/LuaSnip', build = 'make install_jsregexp' },
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
|
||||
-- Expose clangd extensions
|
||||
'p00f/clangd_extensions.nvim',
|
||||
|
||||
-- TODO: https://github.com/b0o/SchemaStore.nvim
|
||||
-- TODO: https://github.com/jmbuhr/otter.nvim
|
||||
-- TODO: https://github.com/nvimtools/none-ls.nvim
|
||||
|
||||
-- TODO: https://github.com/mfussenegger/nvim-dap
|
||||
-- TODO: https://github.com/rcarriga/nvim-dap-ui
|
||||
},
|
||||
@ -132,35 +124,6 @@ return {
|
||||
})
|
||||
require("cmp_git").setup({})
|
||||
|
||||
-- Customise LSP UI
|
||||
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
|
||||
vim.lsp.handlers.hover, {
|
||||
border = 'rounded',
|
||||
title = 'Hover',
|
||||
}
|
||||
)
|
||||
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(
|
||||
vim.lsp.handlers.signature_help, {
|
||||
border = 'rounded',
|
||||
title = 'Signature Help',
|
||||
}
|
||||
)
|
||||
|
||||
-- Customise diagnostics UI
|
||||
vim.diagnostic.config({
|
||||
float = {
|
||||
border = 'rounded', -- Enable rounded border on floats
|
||||
},
|
||||
virtual_text = false, -- Disable trailing virtual text
|
||||
})
|
||||
|
||||
-- Diagnostics mappings
|
||||
-- TODO: trouble.nvim mappings instead? https://youtu.be/MuUrCcvE-Yw?t=631
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { remap = false })
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { remap = false })
|
||||
vim.keymap.set('n', '<leader>sd', vim.diagnostic.open_float, { remap = false })
|
||||
vim.keymap.set('n', '<leader>sq', vim.diagnostic.setqflist, { remap = false })
|
||||
|
||||
-- Mappings created when LSP is attached to a buffer
|
||||
local augroup = vim.api.nvim_create_augroup('lsp', { clear = true })
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
@ -196,31 +159,8 @@ return {
|
||||
end
|
||||
})
|
||||
|
||||
-- Snippet mappings
|
||||
local luasnip = require('luasnip')
|
||||
luasnip.setup({})
|
||||
vim.keymap.set({ 'i', 's' }, '<C-j>', function()
|
||||
if luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
end
|
||||
end, { silent = true })
|
||||
vim.keymap.set({ 'i', 's' }, '<C-K>', function()
|
||||
if luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
end
|
||||
end, { silent = true })
|
||||
|
||||
-- Load snippets
|
||||
local opts = { paths = vim.fn.stdpath('config') .. '/snippets' }
|
||||
require('luasnip.loaders.from_snipmate').lazy_load(opts)
|
||||
require('luasnip.loaders.from_lua').lazy_load(opts)
|
||||
|
||||
-- LSP UI plugins
|
||||
require('fidget').setup({})
|
||||
require('trouble').setup({})
|
||||
vim.keymap.set('n', '<leader>tr', function()
|
||||
require('trouble').toggle()
|
||||
end, { remap = false })
|
||||
require('lsp_signature').setup({
|
||||
floating_window = true,
|
||||
hint_enable = false,
|
||||
|
20
lua/plugins/diagnostics.lua
Normal file
20
lua/plugins/diagnostics.lua
Normal file
@ -0,0 +1,20 @@
|
||||
return {
|
||||
{
|
||||
'folke/trouble.nvim',
|
||||
dependencies = {
|
||||
'nvim-tree/nvim-web-devicons'
|
||||
},
|
||||
config = function()
|
||||
require('trouble').setup({})
|
||||
|
||||
vim.keymap.set('n', '<leader>tr', function()
|
||||
require('trouble').toggle()
|
||||
end, { remap = false })
|
||||
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { remap = false })
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { remap = false })
|
||||
vim.keymap.set('n', '<leader>sd', vim.diagnostic.open_float, { remap = false })
|
||||
vim.keymap.set('n', '<leader>sq', vim.diagnostic.setqflist, { remap = false })
|
||||
end
|
||||
},
|
||||
}
|
26
lua/plugins/snippets.lua
Normal file
26
lua/plugins/snippets.lua
Normal file
@ -0,0 +1,26 @@
|
||||
return {
|
||||
'L3MON4D3/LuaSnip',
|
||||
name = 'LuaSnip',
|
||||
build = 'make install_jsregexp',
|
||||
config = function()
|
||||
local luasnip = require('luasnip')
|
||||
luasnip.setup({})
|
||||
|
||||
-- Load snippets
|
||||
local opts = { paths = vim.fn.stdpath('config') .. '/snippets' }
|
||||
require('luasnip.loaders.from_snipmate').lazy_load(opts)
|
||||
require('luasnip.loaders.from_lua').lazy_load(opts)
|
||||
|
||||
-- Snippet keybindings
|
||||
vim.keymap.set({ 'i', 's' }, '<C-j>', function()
|
||||
if luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
end
|
||||
end, { silent = true })
|
||||
vim.keymap.set({ 'i', 's' }, '<C-K>', function()
|
||||
if luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
end
|
||||
end, { silent = true })
|
||||
end
|
||||
}
|
21
lua/ui.lua
Normal file
21
lua/ui.lua
Normal file
@ -0,0 +1,21 @@
|
||||
-- Customise LSP UI
|
||||
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
|
||||
vim.lsp.handlers.hover, {
|
||||
border = 'rounded',
|
||||
title = 'Hover',
|
||||
}
|
||||
)
|
||||
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(
|
||||
vim.lsp.handlers.signature_help, {
|
||||
border = 'rounded',
|
||||
title = 'Signature Help',
|
||||
}
|
||||
)
|
||||
|
||||
-- Customise diagnostic UI
|
||||
vim.diagnostic.config({
|
||||
float = {
|
||||
border = 'rounded',
|
||||
},
|
||||
virtual_text = false,
|
||||
})
|
Loading…
x
Reference in New Issue
Block a user