From 573ea7883999199bfaf4c3ead3bd6360e0a9f895 Mon Sep 17 00:00:00 2001 From: Ryan Date: Fri, 13 Oct 2023 20:04:56 +0800 Subject: [PATCH] Add vscode fixes and general improvements --- lua/mappings.lua | 7 +++++++ lua/plugins.lua | 26 +++++++++++++------------- lua/plugins/cmp.lua | 22 +++++++++++----------- 3 files changed, 31 insertions(+), 24 deletions(-) diff --git a/lua/mappings.lua b/lua/mappings.lua index 376481a..b792781 100644 --- a/lua/mappings.lua +++ b/lua/mappings.lua @@ -1,5 +1,12 @@ local map = vim.api.nvim_set_keymap +-- vscode +if vim.g.vscode then + -- undo/REDO via vscode + map("n","u","call VSCodeNotify('undo')") + map("n","","call VSCodeNotify('redo')") +end + -- generic mappings map('v', '<', '', '>gv', { noremap = true }) diff --git a/lua/plugins.lua b/lua/plugins.lua index 47cb71f..dc3765d 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -68,7 +68,7 @@ return require("packer").startup(function(use) -- local { "hrsh7th/cmp-cmdline", after = "nvim-cmp" }, { "hrsh7th/cmp-buffer", after = "nvim-cmp" }, - { "hrsh7th/cmp-path", after = "nvim-cmp" }, + { "FelipeLema/cmp-async-path", after = "nvim-cmp" }, { "petertriho/cmp-git", after = "nvim-cmp", @@ -148,18 +148,18 @@ return require("packer").startup(function(use) require("hop").setup({ keys = "etovxqpdygfblzhckisuran" }) end, }) - use({ - "c0r73x/neotags.lua", - event = "BufEnter", - config = function() - require("neotags").setup({ - ctags = { - directory = vim.env.HOME .. '/.cache/nvim/neotags/' -- default directory where to store tags - - } - }) - end - }) + -- use({ + -- "c0r73x/neotags.lua", + -- event = "BufEnter", + -- config = function() + -- require("neotags").setup({ + -- enable = string.find(vim.fn.getcwd(), "/home/"), + -- ctags = { + -- directory = vim.env.HOME .. '/.cache/nvim/neotags' -- default directory where to store tags + -- }, + -- }) + -- end + -- }) -- eye-candy use({ diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua index 9c883f6..19da9f5 100644 --- a/lua/plugins/cmp.lua +++ b/lua/plugins/cmp.lua @@ -21,7 +21,7 @@ cmp.setup({ end, }, mapping = { - [""] = cmp.mapping(function(fallback) + [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() @@ -34,7 +34,7 @@ cmp.setup({ fallback() end end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) + [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_prev_item() elseif luasnip.jumpable(-1) then @@ -43,21 +43,21 @@ cmp.setup({ fallback() end end, { "i", "s" }), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items -- ... Your other mappings ... }, sources = cmp.config.sources({ + { name = "luasnip" }, -- For luasnip users. + { name = "ctags" }, { name = "nvim_lsp" }, { name = "treesitter" }, - { name = "buffer" }, - { name = "luasnip" }, -- For luasnip users. - { name = "path" }, + { name = "async_path" }, { name = "git" }, - { name = "ctags" }, + { name = "buffer" }, }) -- ... Your other configuration ... })