enhance lsp experience
This commit is contained in:
parent
690da16686
commit
a56478039e
7 changed files with 64 additions and 11 deletions
|
@ -10,6 +10,8 @@ require('statusline')
|
||||||
require('snippets')
|
require('snippets')
|
||||||
require('autocompletion')
|
require('autocompletion')
|
||||||
require('treesitterconfig')
|
require('treesitterconfig')
|
||||||
|
require('troubleconfig')
|
||||||
|
require('null-ls-config')
|
||||||
require('filemanager')
|
require('filemanager')
|
||||||
require('notes')
|
require('notes')
|
||||||
require('zenmode')
|
require('zenmode')
|
||||||
|
|
|
@ -53,13 +53,14 @@ local on_attach = function(client, bufnr)
|
||||||
|
|
||||||
local opts = { noremap = true, silent = true }
|
local opts = { noremap = true, silent = true }
|
||||||
buf_set_keymap("n", "gd", "<cmd>Telescope lsp_definitions<CR>", opts)
|
buf_set_keymap("n", "gd", "<cmd>Telescope lsp_definitions<CR>", opts)
|
||||||
buf_set_keymap("n", "gh", "<cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
|
||||||
buf_set_keymap("n", "gD", "<cmd>Telescope lsp_implementations<CR>", opts)
|
buf_set_keymap("n", "gD", "<cmd>Telescope lsp_implementations<CR>", opts)
|
||||||
buf_set_keymap("n", "gs", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
-- buf_set_keymap("n", "gr", "<cmd>Telescope lsp_references<CR>", opts)
|
||||||
buf_set_keymap("n", "gR", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
vim.keymap.set("n", "gf",vim.lsp.buf.formatting)
|
||||||
buf_set_keymap("n", "gH", "<cmd>Telescope lsp_code_actions<CR>", opts)
|
vim.keymap.set("n", "gh", vim.lsp.buf.hover)
|
||||||
buf_set_keymap("n", "gr", "<cmd>Telescope lsp_references<CR>", opts)
|
vim.keymap.set("n", "ge", vim.diagnostic.open_float)
|
||||||
buf_set_keymap("n", "ge", "<cmd>lua vim.diagnostic.open_float()<CR>", opts)
|
vim.keymap.set("n", "gs", vim.lsp.buf.signature_help)
|
||||||
|
vim.keymap.set("n", "gR", vim.lsp.buf.rename)
|
||||||
|
vim.keymap.set("n", "gH", vim.lsp.buf.code_action)
|
||||||
end
|
end
|
||||||
|
|
||||||
local lsp_installer = require 'nvim-lsp-installer'
|
local lsp_installer = require 'nvim-lsp-installer'
|
||||||
|
@ -71,3 +72,10 @@ lsp_installer.on_server_ready(function(server)
|
||||||
server:setup(opts)
|
server:setup(opts)
|
||||||
vim.cmd [[ do User LspAttachBuffers ]]
|
vim.cmd [[ do User LspAttachBuffers ]]
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
require "lsp_signature".setup {
|
||||||
|
handler_opts = {
|
||||||
|
border = "rounded"
|
||||||
|
},
|
||||||
|
toggle_key = "<M-r>",
|
||||||
|
}
|
||||||
|
|
|
@ -24,9 +24,6 @@ vim.keymap.set('n', '<leader>f', '<cmd>Telescope find_files<CR>')
|
||||||
vim.keymap.set('n', '<leader>l', '<cmd>Telescope live_grep<CR>')
|
vim.keymap.set('n', '<leader>l', '<cmd>Telescope live_grep<CR>')
|
||||||
vim.keymap.set('n', '<silent> gy', '<cmd>Telescope treesitter<CR>')
|
vim.keymap.set('n', '<silent> gy', '<cmd>Telescope treesitter<CR>')
|
||||||
|
|
||||||
-- neo formatter
|
|
||||||
vim.keymap.set('n', '<leader>p', ':Neoformat<CR>')
|
|
||||||
|
|
||||||
-- spelling
|
-- spelling
|
||||||
vim.keymap.set('n', '<silent> <leader>se', ':set spell spelllang=en<CR>')
|
vim.keymap.set('n', '<silent> <leader>se', ':set spell spelllang=en<CR>')
|
||||||
vim.keymap.set('n', '<silent> <leader>sd', ':set spell spelllang=de<CR>')
|
vim.keymap.set('n', '<silent> <leader>sd', ':set spell spelllang=de<CR>')
|
||||||
|
|
12
nvim/lua/null-ls-config.lua
Normal file
12
nvim/lua/null-ls-config.lua
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
require("null-ls").setup({
|
||||||
|
sources = {
|
||||||
|
-- FORMATTING
|
||||||
|
require("null-ls").builtins.formatting.stylua,
|
||||||
|
require("null-ls").builtins.formatting.eslint,
|
||||||
|
require("null-ls").builtins.formatting.prettierd,
|
||||||
|
-- DIAGNOSTICS
|
||||||
|
require("null-ls").builtins.diagnostics.eslint,
|
||||||
|
-- COMPLETIONS
|
||||||
|
require("null-ls").builtins.completion.spell,
|
||||||
|
},
|
||||||
|
})
|
|
@ -41,4 +41,10 @@ require('colorizer').setup()
|
||||||
|
|
||||||
|
|
||||||
-- nvim surround
|
-- nvim surround
|
||||||
require("nvim-surround").setup()
|
require("nvim-surround").setup({
|
||||||
|
surrounds = {
|
||||||
|
["*"] = {
|
||||||
|
add = { "*", "*" },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
|
@ -70,17 +70,22 @@ Plug 'nvim-lualine/lualine.nvim'
|
||||||
Plug 'neovim/nvim-lspconfig'
|
Plug 'neovim/nvim-lspconfig'
|
||||||
Plug 'williamboman/nvim-lsp-installer'
|
Plug 'williamboman/nvim-lsp-installer'
|
||||||
|
|
||||||
|
Plug 'jose-elias-alvarez/null-ls.nvim'
|
||||||
|
|
||||||
Plug 'hrsh7th/cmp-nvim-lsp'
|
Plug 'hrsh7th/cmp-nvim-lsp'
|
||||||
Plug 'hrsh7th/cmp-buffer'
|
Plug 'hrsh7th/cmp-buffer'
|
||||||
Plug 'hrsh7th/cmp-path'
|
Plug 'hrsh7th/cmp-path'
|
||||||
Plug 'hrsh7th/cmp-cmdline'
|
Plug 'hrsh7th/cmp-cmdline'
|
||||||
Plug 'hrsh7th/nvim-cmp'
|
Plug 'hrsh7th/nvim-cmp'
|
||||||
|
|
||||||
|
Plug 'folke/trouble.nvim'
|
||||||
|
Plug 'ray-x/lsp_signature.nvim'
|
||||||
|
|
||||||
Plug 'L3MON4D3/LuaSnip'
|
Plug 'L3MON4D3/LuaSnip'
|
||||||
Plug 'saadparwaiz1/cmp_luasnip'
|
Plug 'saadparwaiz1/cmp_luasnip'
|
||||||
|
|
||||||
-- Autoformatter
|
-- Autoformatter
|
||||||
Plug 'sbdchd/neoformat'
|
-- Plug 'sbdchd/neoformat'
|
||||||
|
|
||||||
-- treesitter
|
-- treesitter
|
||||||
Plug('nvim-treesitter/nvim-treesitter', {['do'] = ':TSUpdate'})
|
Plug('nvim-treesitter/nvim-treesitter', {['do'] = ':TSUpdate'})
|
||||||
|
|
23
nvim/lua/troubleconfig.lua
Normal file
23
nvim/lua/troubleconfig.lua
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
require("trouble").setup {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>xx", "<cmd>TroubleToggle<cr>",
|
||||||
|
{silent = true, noremap = true}
|
||||||
|
)
|
||||||
|
vim.keymap.set("n", "<leader>xw", "<cmd>TroubleToggle workspace_diagnostics<cr>",
|
||||||
|
{silent = true, noremap = true}
|
||||||
|
)
|
||||||
|
vim.keymap.set("n", "<leader>xd", "<cmd>TroubleToggle document_diagnostics<cr>",
|
||||||
|
{silent = true, noremap = true}
|
||||||
|
)
|
||||||
|
vim.keymap.set("n", "<leader>xl", "<cmd>TroubleToggle loclist<cr>",
|
||||||
|
{silent = true, noremap = true}
|
||||||
|
)
|
||||||
|
vim.keymap.set("n", "<leader>xq", "<cmd>TroubleToggle quickfix<cr>",
|
||||||
|
{silent = true, noremap = true}
|
||||||
|
)
|
||||||
|
vim.keymap.set("n", "gr", "<cmd>TroubleToggle lsp_references<cr>",
|
||||||
|
{silent = true, noremap = true}
|
||||||
|
)
|
Loading…
Add table
Reference in a new issue