Add undotree plugin and update lsp config
This commit is contained in:
parent
80a87c9a57
commit
73283b58b4
@ -10,23 +10,38 @@ lsp.nvim_workspace()
|
||||
|
||||
local cmp = require("cmp")
|
||||
local cmp_select = { behavior = cmp.SelectBehavior.Select }
|
||||
|
||||
lsp.setup_nvim_cmp({
|
||||
mapping = lsp.defaults.cmp_mappings({
|
||||
local cmp_mapping = lsp.defaults.cmp_mappings({
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(cmp_select),
|
||||
["<C-n>"] = cmp.mapping.select_next_item(cmp_select),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
})
|
||||
})
|
||||
|
||||
lsp.on_attach(function(client, buffnr)
|
||||
lsp.default_keymaps({ buffer = buffnr })
|
||||
lsp.setup_nvim_cmp({ mapping = cmp_mapping })
|
||||
|
||||
-- Gimme pretty icons
|
||||
lsp.set_sign_icons({
|
||||
error = '✘',
|
||||
warn = '▲',
|
||||
hint = '⚑',
|
||||
info = '»'
|
||||
})
|
||||
|
||||
lsp.on_attach(function(_, buffnr)
|
||||
local opts = { buffer = buffnr, remap = false }
|
||||
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
|
||||
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set("n", "<Leader>re", vim.lsp.buf.rename, opts)
|
||||
vim.keymap.set({"n", "i"}, "<C-h>", vim.lsp.buf.signature_help, opts)
|
||||
|
||||
vim.keymap.set("n", "<Leader>fmt", function()
|
||||
vim.lsp.buf.format({ async = false, timeout_ms = 5000 })
|
||||
end)
|
||||
end)
|
||||
|
||||
|
||||
-- NOTE: Format on save does not support async formatting
|
||||
lsp.format_on_save({
|
||||
servers = {
|
||||
@ -34,5 +49,4 @@ lsp.format_on_save({
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
lsp.setup()
|
||||
|
3
after/plugin/undotree.lua
Normal file
3
after/plugin/undotree.lua
Normal file
@ -0,0 +1,3 @@
|
||||
local undotree = require("undotree")
|
||||
|
||||
vim.keymap.set("n", "<Leader>u", undotree.toggle, { noremap = true, silent = true })
|
@ -23,3 +23,12 @@ vim.keymap.set({"n", "v", "i"}, "<C-s>", "<cmd>w<CR>")
|
||||
vim.keymap.set({"n", "v"}, "<F1>", "<NOP>")
|
||||
vim.keymap.set("n", "s", "<NOP>")
|
||||
|
||||
|
||||
-- Some nice remaps (thanks Prime)
|
||||
|
||||
-- Move selected lines up or down
|
||||
vim.keymap.set("v", "J", ":move '>+1<CR>gv=gv")
|
||||
vim.keymap.set("v", "K", ":move '<-2<CR>gv=gv")
|
||||
|
||||
-- Join lines without moving the cursor
|
||||
vim.keymap.set("n", "J", "mzJ`z")
|
||||
|
@ -17,12 +17,15 @@ return require("packer").startup(function(use)
|
||||
"VonHeikemen/lsp-zero.nvim",
|
||||
branch = "v2.x",
|
||||
requires = {
|
||||
{"neovim/nvim-lspconfig"},
|
||||
{"hrsh7th/nvim-cmp"},
|
||||
{"hrsh7th/cmp-nvim-lsp"},
|
||||
{"hrsh7th/cmp-path"},
|
||||
{"williamboman/mason.nvim"},
|
||||
{"williamboman/mason-lspconfig.nvim"},
|
||||
{ "neovim/nvim-lspconfig" },
|
||||
{ "hrsh7th/nvim-cmp" },
|
||||
{ "hrsh7th/cmp-nvim-lsp" },
|
||||
{ "hrsh7th/cmp-path" },
|
||||
{ "saadparwaiz1/cmp_luasnip" },
|
||||
{ "L3MON4D3/LuaSnip" },
|
||||
{ "rafamadriz/friendly-snippets" },
|
||||
{ "williamboman/mason.nvim" },
|
||||
{ "williamboman/mason-lspconfig.nvim" },
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,7 +37,7 @@ return require("packer").startup(function(use)
|
||||
use {
|
||||
"CantoroMC/ayu-nvim",
|
||||
config = function()
|
||||
vim.cmd("colorscheme ayu")
|
||||
vim.cmd.colorscheme("ayu")
|
||||
end
|
||||
}
|
||||
|
||||
@ -59,8 +62,19 @@ return require("packer").startup(function(use)
|
||||
|
||||
use {
|
||||
"windwp/nvim-autopairs",
|
||||
requires = {
|
||||
{ "hrsh7th/nvim-cmp" },
|
||||
},
|
||||
config = function()
|
||||
require("nvim-autopairs").setup()
|
||||
local ap = require("nvim-autopairs")
|
||||
local ap_cmp = require("nvim-autopairs.completion.cmp")
|
||||
local cmp = require("cmp")
|
||||
|
||||
cmp.event:on("confirm_done", ap_cmp.on_confirm_done())
|
||||
|
||||
ap.setup {
|
||||
check_ts = true
|
||||
}
|
||||
end
|
||||
}
|
||||
|
||||
@ -71,8 +85,8 @@ return require("packer").startup(function(use)
|
||||
"nvim-telescope/telescope.nvim",
|
||||
tag = "0.1.1",
|
||||
requires = {
|
||||
{"nvim-lua/plenary.nvim"},
|
||||
{"nvim-treesitter/nvim-treesitter"},
|
||||
{ "nvim-lua/plenary.nvim" },
|
||||
{ "nvim-treesitter/nvim-treesitter" },
|
||||
},
|
||||
config = function()
|
||||
require("telescope").load_extension("harpoon")
|
||||
@ -82,8 +96,17 @@ return require("packer").startup(function(use)
|
||||
use {
|
||||
"ThePrimeagen/harpoon",
|
||||
requires = {
|
||||
{"nvim-lua/plenary.nvim"},
|
||||
{ "nvim-lua/plenary.nvim" },
|
||||
}
|
||||
}
|
||||
|
||||
use {
|
||||
"jiaoshijie/undotree",
|
||||
requires = {
|
||||
"nvim-lua/plenary.nvim"
|
||||
},
|
||||
config = function()
|
||||
require("undotree").setup()
|
||||
end
|
||||
}
|
||||
end)
|
||||
|
Loading…
Reference in New Issue
Block a user