LSP update on base
This commit is contained in:
@@ -24,3 +24,8 @@ map("v", "<leader>r", "\"hy:%s/<C-r>h//g<left><left>")
|
||||
|
||||
-- Buffer manager
|
||||
map("n", "<leader>b", ":lua require(\"buffer_manager.ui\").toggle_quick_menu()<CR>")
|
||||
|
||||
-- LSP
|
||||
map("n", "<leader>lf", "<cmd>lua vim.lsp.buf.format { async = true }<CR>")
|
||||
map("n", "<leader>la", "<cmd>lua vim.lsp.buf.code_action()<CR>")
|
||||
map("n", "<leader>lr", "<cmd>lua vim.lsp.buf.rename()<CR>")
|
||||
|
||||
33
lua/plugins/cmp.lua
Normal file
33
lua/plugins/cmp.lua
Normal file
@@ -0,0 +1,33 @@
|
||||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"L3MON4D3/LuaSnip",
|
||||
"saadparwaiz1/cmp_luasnip"
|
||||
},
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" }
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-u>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(4),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
["<Tab>"] = cmp.mapping.select_next_item(),
|
||||
["<S-Tab>"] = cmp.mapping.select_prev_item()
|
||||
})
|
||||
}
|
||||
end
|
||||
}
|
||||
24
lua/plugins/lsp.lua
Normal file
24
lua/plugins/lsp.lua
Normal file
@@ -0,0 +1,24 @@
|
||||
return {
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
dependencies = {
|
||||
"williamboman/mason.nvim",
|
||||
"neovim/nvim-lspconfig",
|
||||
"hrsh7th/cmp-nvim-lsp"
|
||||
},
|
||||
config = function()
|
||||
local lspconfig = require("lspconfig")
|
||||
local lsp_capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
local defaultSetup = function(server)
|
||||
lspconfig[server].setup {
|
||||
capabilities = lsp_capabilities
|
||||
}
|
||||
end
|
||||
|
||||
require("mason").setup()
|
||||
require("mason-lspconfig").setup {
|
||||
ensure_installed = {},
|
||||
handlers = { defaultSetup }
|
||||
}
|
||||
end
|
||||
}
|
||||
@@ -9,7 +9,6 @@ return {
|
||||
local builtin = require("telescope.builtin")
|
||||
|
||||
telescope.setup()
|
||||
|
||||
telescope.load_extension("fzf")
|
||||
|
||||
vim.keymap.set("n", "<leader>ff", builtin.fd, {})
|
||||
@@ -18,7 +17,7 @@ return {
|
||||
vim.keymap.set("n", "<C-f>", builtin.current_buffer_fuzzy_find, {})
|
||||
|
||||
-- Visual word highlight
|
||||
local default_opts = {noremap = true, silent = true}
|
||||
local default_opts = { noremap = true, silent = true }
|
||||
vim.api.nvim_set_keymap("v", "<C-f>", "y<ESC>:Telescope current_buffer_fuzzy_find default_text=<c-r>0<CR>", {})
|
||||
vim.api.nvim_set_keymap("v", "<leader>fw", "y<ESC>:Telescope live_grep default_text=<c-r>0<CR>", {})
|
||||
vim.api.nvim_set_keymap("v", "<leader>ff", "y<ESC>:Telescope fd default_text=<c-r>0<CR>", {})
|
||||
|
||||
Reference in New Issue
Block a user