Add vscode fixes and general improvements

This commit is contained in:
Ryan 2023-10-13 20:04:56 +08:00
parent 8c02d4ea84
commit 573ea78839
Signed by: juan
GPG Key ID: 807ECD28A698D245
3 changed files with 31 additions and 24 deletions

View File

@ -1,5 +1,12 @@
local map = vim.api.nvim_set_keymap local map = vim.api.nvim_set_keymap
-- vscode
if vim.g.vscode then
-- undo/REDO via vscode
map("n","u","<Cmd>call VSCodeNotify('undo')<CR>")
map("n","<C-r>","<Cmd>call VSCodeNotify('redo')<CR>")
end
-- generic mappings -- generic mappings
map('v', '<', '<gv', { noremap = true }) map('v', '<', '<gv', { noremap = true })
map('v', '>', '>gv', { noremap = true }) map('v', '>', '>gv', { noremap = true })

View File

@ -68,7 +68,7 @@ return require("packer").startup(function(use)
-- local -- local
{ "hrsh7th/cmp-cmdline", after = "nvim-cmp" }, { "hrsh7th/cmp-cmdline", after = "nvim-cmp" },
{ "hrsh7th/cmp-buffer", 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", "petertriho/cmp-git",
after = "nvim-cmp", after = "nvim-cmp",
@ -148,18 +148,18 @@ return require("packer").startup(function(use)
require("hop").setup({ keys = "etovxqpdygfblzhckisuran" }) require("hop").setup({ keys = "etovxqpdygfblzhckisuran" })
end, end,
}) })
use({ -- use({
"c0r73x/neotags.lua", -- "c0r73x/neotags.lua",
event = "BufEnter", -- event = "BufEnter",
config = function() -- config = function()
require("neotags").setup({ -- require("neotags").setup({
ctags = { -- enable = string.find(vim.fn.getcwd(), "/home/"),
directory = vim.env.HOME .. '/.cache/nvim/neotags/' -- default directory where to store tags -- ctags = {
-- directory = vim.env.HOME .. '/.cache/nvim/neotags' -- default directory where to store tags
} -- },
}) -- })
end -- end
}) -- })
-- eye-candy -- eye-candy
use({ use({

View File

@ -21,7 +21,7 @@ cmp.setup({
end, end,
}, },
mapping = { mapping = {
["<Tab>"] = cmp.mapping(function(fallback) ["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_next_item() cmp.select_next_item()
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
@ -34,7 +34,7 @@ cmp.setup({
fallback() fallback()
end end
end, { "i", "s" }), end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback) ["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_prev_item() cmp.select_prev_item()
elseif luasnip.jumpable(-1) then elseif luasnip.jumpable(-1) then
@ -43,21 +43,21 @@ cmp.setup({
fallback() fallback()
end end
end, { "i", "s" }), end, { "i", "s" }),
['<C-b>'] = cmp.mapping.scroll_docs(-4), ['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4), ['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(), ['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(), ['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items ['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items
-- ... Your other mappings ... -- ... Your other mappings ...
}, },
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = "luasnip" }, -- For luasnip users.
{ name = "ctags" },
{ name = "nvim_lsp" }, { name = "nvim_lsp" },
{ name = "treesitter" }, { name = "treesitter" },
{ name = "buffer" }, { name = "async_path" },
{ name = "luasnip" }, -- For luasnip users.
{ name = "path" },
{ name = "git" }, { name = "git" },
{ name = "ctags" }, { name = "buffer" },
}) })
-- ... Your other configuration ... -- ... Your other configuration ...
}) })