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
-- 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
map('v', '<', '<gv', { noremap = true })
map('v', '>', '>gv', { noremap = true })

View File

@ -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({

View File

@ -21,7 +21,7 @@ cmp.setup({
end,
},
mapping = {
["<Tab>"] = cmp.mapping(function(fallback)
["<Tab>"] = 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" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
["<S-Tab>"] = 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" }),
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<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
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<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
-- ... 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 ...
})