This commit is contained in:
Benjamin Kyd
2023-03-04 11:13:16 +00:00
parent ba5392a13b
commit 951676bfb1
3 changed files with 22 additions and 159 deletions

View File

@@ -1,66 +0,0 @@
require("lspsaga").setup({})
local keymap = vim.keymap.set
-- LSP finder - Find the symbol's definition
-- If there is no definition, it will instead be hidden
-- When you use an action in finder like "open vsplit",
-- you can use <C-t> to jump back
keymap("n", "gh", "<cmd>Lspsaga lsp_finder<CR>")
-- Code action
keymap({"n","v"}, "<leader>ca", "<cmd>Lspsaga code_action<CR>")
-- Rename all occurrences of the hovered word for the entire file
keymap("n", "gr", "<cmd>Lspsaga rename<CR>")
-- Rename all occurrences of the hovered word for the selected files
keymap("n", "gr", "<cmd>Lspsaga rename ++project<CR>")
-- Peek definition
-- You can edit the file containing the definition in the floating window
-- It also supports open/vsplit/etc operations, do refer to "definition_action_keys"
-- It also supports tagstack
-- Use <C-t> to jump back
keymap("n", "gp", "<cmd>Lspsaga peek_definition<CR>")
-- Go to definition
keymap("n", "gd", "<cmd>Lspsaga goto_definition<CR>")
-- Diagnostic jump
-- You can use <C-o> to jump back to your previous location
keymap("n", "[e", "<cmd>Lspsaga diagnostic_jump_prev<CR>")
keymap("n", "]e", "<cmd>Lspsaga diagnostic_jump_next<CR>")
-- Diagnostic jump with filters such as only jumping to an error
keymap("n", "[E", function()
require("lspsaga.diagnostic"):goto_prev({ severity = vim.diagnostic.severity.ERROR })
end)
keymap("n", "]E", function()
require("lspsaga.diagnostic"):goto_next({ severity = vim.diagnostic.severity.ERROR })
end)
-- Toggle outline
keymap("n","<leader>o", "<cmd>Lspsaga outline<CR>")
-- Hover Doc
-- If there is no hover doc,
-- there will be a notification stating that
-- there is no information available.
-- To disable it just use ":Lspsaga hover_doc ++quiet"
-- Pressing the key twice will enter the hover window
keymap("n", "K", "<cmd>Lspsaga hover_doc<CR>")
-- If you want to keep the hover window in the top right hand corner,
-- you can pass the ++keep argument
-- Note that if you use hover with ++keep, pressing this key again will
-- close the hover window. If you want to jump to the hover window
-- you should use the wincmd command "<C-w>w"
keymap("n", "K", "<cmd>Lspsaga hover_doc ++keep<CR>")
-- Call hierarchy
keymap("n", "<Leader>ci", "<cmd>Lspsaga incoming_calls<CR>")
keymap("n", "<Leader>co", "<cmd>Lspsaga outgoing_calls<CR>")
-- Floating terminal
keymap({"n", "t"}, "<A-d>", "<cmd>Lspsaga term_toggle<CR>")

View File

@@ -1,28 +1,30 @@
-- TODO( fix
local cmp = require'cmp'
cmp.setup({
snippet = {
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
vim.fn["vsnip#anonymous"](args.body)
end,
},
mapping = {
['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
['<C-y>'] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
['<C-e>'] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
},
mapping = {
["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-n>"] = cmp.mapping.select_next_item(),
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.close(),
["<CR>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = true,
}),
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
},
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'vsnip' }, -- For vsnip users.
}, {
{ name = 'buffer' },
})
["<Tab>"] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "s" }),
["<S-Tab>"] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "s" }),
},
sources = {
{ name = "nvim_lsp" },
{ name = "vsnip" },
{ name = "path" },
},
})
-- Set configuration for specific filetype.
@@ -50,9 +52,3 @@ cmp.setup.cmdline(':', {
})
})
-- Setup lspconfig.
-- local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
-- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
-- require('lspconfig')['<YOUR_LSP_SERVER>'].setup {
--capabilities = capabilities
-- }

View File

@@ -1,67 +0,0 @@
-- local opts = {silent = true, noremap = true}
-- vim.api.nvim_set_keymap('n', '<C-n>', '<Cmd>NvimTreeToggle<CR>', opts)
-- vim.api.nvim_set_keymap('n', '<leader>r', '<Cmd>NvimTreeRefresh<CR>', opts)
-- -- find the currently open file in tree
-- vim.api.nvim_set_keymap('n', '<leader>n', '<Cmd>NvimTreeFindFile<CR>', opts)
-- local tree_cb = require'nvim-tree.config'.nvim_tree_callback
-- local list = {
-- { key = "<C-t>", cb = tree_cb("tabnew") },
-- { key = "<CR>", cb = tree_cb("edit") },
-- { key = "o", cb = tree_cb("edit") },
-- { key = "<2-LeftMouse>", cb = tree_cb("edit") },
-- { key = "<2-RightMouse>", cb = tree_cb("cd") },
-- { key = "<Tab>", cb = tree_cb("preview") },
-- { key = "R", cb = tree_cb("refresh") },
-- { key = "a", cb = tree_cb("create") },
-- { key = "d", cb = tree_cb("remove") },
-- { key = "r", cb = tree_cb("rename") },
-- { key = "x", cb = tree_cb("cut") },
-- { key = "y", cb = tree_cb("copy") },
-- { key = "p", cb = tree_cb("paste") },
-- { key = "<", cb = tree_cb("dir_up") },
-- { key = "q", cb = tree_cb("close") }
-- }
-- require'nvim-tree'.setup {
-- disable_netrw = true,
-- hijack_netrw = true,
-- open_on_setup = false,
-- ignore_ft_on_setup = {},
-- open_on_tab = false,
-- hijack_cursor = false,
-- update_cwd = false,
-- diagnostics = {
-- enable = false,
-- icons = {
-- hint = "",
-- info = "",
-- warning = "",
-- error = "",
-- }
-- },
-- update_focused_file = {
-- enable = false,
-- update_cwd = false,
-- ignore_list = {}
-- },
-- system_open = {
-- cmd = nil,
-- args = {}
-- },
-- filters = {
-- dotfiles = false,
-- custom = {}
-- },
-- view = {
-- width = 30,
-- height = 30,
-- hide_root_folder = false,
-- side = 'left',
-- mappings = {
-- custom_only = false,
-- list = list,
-- }
-- }
-- }