From 951676bfb1d2f2dea11cdbd87ded91b3f78d16ff Mon Sep 17 00:00:00 2001 From: Benjamin Kyd Date: Sat, 4 Mar 2023 11:13:16 +0000 Subject: [PATCH] ok epic --- .../nvim/lua/plugin-config/lspsaga.lua | 66 ------------------ .../nvim/lua/plugin-config/nvim-cmp.lua | 48 ++++++------- .../nvim/lua/plugin-config/nvim-tree.lua | 67 ------------------- 3 files changed, 22 insertions(+), 159 deletions(-) delete mode 100644 common/.config/nvim/lua/plugin-config/lspsaga.lua delete mode 100644 common/.config/nvim/lua/plugin-config/nvim-tree.lua diff --git a/common/.config/nvim/lua/plugin-config/lspsaga.lua b/common/.config/nvim/lua/plugin-config/lspsaga.lua deleted file mode 100644 index b59ee58..0000000 --- a/common/.config/nvim/lua/plugin-config/lspsaga.lua +++ /dev/null @@ -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 to jump back -keymap("n", "gh", "Lspsaga lsp_finder") - --- Code action -keymap({"n","v"}, "ca", "Lspsaga code_action") - --- Rename all occurrences of the hovered word for the entire file -keymap("n", "gr", "Lspsaga rename") - --- Rename all occurrences of the hovered word for the selected files -keymap("n", "gr", "Lspsaga rename ++project") - --- 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 to jump back -keymap("n", "gp", "Lspsaga peek_definition") - --- Go to definition -keymap("n", "gd", "Lspsaga goto_definition") - --- Diagnostic jump --- You can use to jump back to your previous location -keymap("n", "[e", "Lspsaga diagnostic_jump_prev") -keymap("n", "]e", "Lspsaga diagnostic_jump_next") - --- 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","o", "Lspsaga outline") - --- 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", "Lspsaga hover_doc") - --- 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 "w" -keymap("n", "K", "Lspsaga hover_doc ++keep") - --- Call hierarchy -keymap("n", "ci", "Lspsaga incoming_calls") -keymap("n", "co", "Lspsaga outgoing_calls") - --- Floating terminal -keymap({"n", "t"}, "", "Lspsaga term_toggle") diff --git a/common/.config/nvim/lua/plugin-config/nvim-cmp.lua b/common/.config/nvim/lua/plugin-config/nvim-cmp.lua index a53f140..cb71674 100644 --- a/common/.config/nvim/lua/plugin-config/nvim-cmp.lua +++ b/common/.config/nvim/lua/plugin-config/nvim-cmp.lua @@ -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 = { - [''] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }), - [''] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }), - [''] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), - [''] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `` mapping. - [''] = cmp.mapping({ - i = cmp.mapping.abort(), - c = cmp.mapping.close(), + }, + mapping = { + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.close(), + [""] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = true, }), - [''] = 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' }, - }) + [""] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "s" }), + [""] = 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 with each lsp server you've enabled. --- require('lspconfig')[''].setup { ---capabilities = capabilities --- } diff --git a/common/.config/nvim/lua/plugin-config/nvim-tree.lua b/common/.config/nvim/lua/plugin-config/nvim-tree.lua deleted file mode 100644 index e2d6dc6..0000000 --- a/common/.config/nvim/lua/plugin-config/nvim-tree.lua +++ /dev/null @@ -1,67 +0,0 @@ --- local opts = {silent = true, noremap = true} --- vim.api.nvim_set_keymap('n', '', 'NvimTreeToggle', opts) --- vim.api.nvim_set_keymap('n', 'r', 'NvimTreeRefresh', opts) --- -- find the currently open file in tree --- vim.api.nvim_set_keymap('n', 'n', 'NvimTreeFindFile', opts) - --- local tree_cb = require'nvim-tree.config'.nvim_tree_callback --- local list = { --- { key = "", cb = tree_cb("tabnew") }, --- { key = "", 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 = "", 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, --- } --- } --- }