
## Summary This pull request introduces several new keymaps specifically for VSCode when using LazyVim. These changes aim to enhance the integration between VSCode and LazyVim by adding keymaps for, tab navigation, and syncing nvim undo/redo actions with vscode undo/redo. ## Changes - Synced undo/redo lists with VSCode using `VSCodeNotify`: (check https://github.com/vscode-neovim/vscode-neovim/issues/1139 for more details) - `u` for undo - `<C-r>` for redo - Enabled navigation of VSCode tabs similar to LazyVim buffers: - `<S-h>` to go to the previous editor - `<S-l>` to go to the next editor ## Additional Notes These changes are intended to improve the user experience for those who use LazyVim within VSCode by providing more intuitive and consistent keybindings. Please test these keymaps to ensure they work as expected in your VSCode setup. Co-authored-by: Deniz Gökçin <deniz.gokcin@treatwell.com>
70 lines
1.9 KiB
Lua
70 lines
1.9 KiB
Lua
if not vim.g.vscode then
|
|
return {}
|
|
end
|
|
|
|
local enabled = {
|
|
"LazyVim",
|
|
"dial.nvim",
|
|
"flit.nvim",
|
|
"lazy.nvim",
|
|
"leap.nvim",
|
|
"mini.ai",
|
|
"mini.comment",
|
|
"mini.move",
|
|
"mini.pairs",
|
|
"mini.surround",
|
|
"nvim-treesitter",
|
|
"nvim-treesitter-textobjects",
|
|
"nvim-ts-context-commentstring",
|
|
"snacks.nvim",
|
|
"ts-comments.nvim",
|
|
"vim-repeat",
|
|
"yanky.nvim",
|
|
}
|
|
|
|
local Config = require("lazy.core.config")
|
|
Config.options.checker.enabled = false
|
|
Config.options.change_detection.enabled = false
|
|
Config.options.defaults.cond = function(plugin)
|
|
return vim.tbl_contains(enabled, plugin.name) or plugin.vscode
|
|
end
|
|
|
|
-- Add some vscode specific keymaps
|
|
vim.api.nvim_create_autocmd("User", {
|
|
pattern = "LazyVimKeymapsDefaults",
|
|
callback = function()
|
|
-- VSCode-specific keymaps for search and navigation
|
|
vim.keymap.set("n", "<leader><space>", "<cmd>Find<cr>")
|
|
vim.keymap.set("n", "<leader>/", [[<cmd>lua require('vscode').action('workbench.action.findInFiles')<cr>]])
|
|
vim.keymap.set("n", "<leader>ss", [[<cmd>lua require('vscode').action('workbench.action.gotoSymbol')<cr>]])
|
|
|
|
-- Keep undo/redo lists in sync with VsCode
|
|
vim.keymap.set("n", "u", "<Cmd>call VSCodeNotify('undo')<CR>")
|
|
vim.keymap.set("n", "<C-r>", "<Cmd>call VSCodeNotify('redo')<CR>")
|
|
|
|
-- Navigate VSCode tabs like lazyvim buffers
|
|
vim.keymap.set("n", "<S-h>", "<Cmd>call VSCodeNotify('workbench.action.previousEditor')<CR>")
|
|
vim.keymap.set("n", "<S-l>", "<Cmd>call VSCodeNotify('workbench.action.nextEditor')<CR>")
|
|
end,
|
|
})
|
|
|
|
function LazyVim.terminal()
|
|
require("vscode").action("workbench.action.terminal.toggleTerminal")
|
|
end
|
|
|
|
return {
|
|
{
|
|
"LazyVim/LazyVim",
|
|
config = function(_, opts)
|
|
opts = opts or {}
|
|
-- disable the colorscheme
|
|
opts.colorscheme = function() end
|
|
require("lazyvim").setup(opts)
|
|
end,
|
|
},
|
|
{
|
|
"nvim-treesitter/nvim-treesitter",
|
|
opts = { highlight = { enable = false } },
|
|
},
|
|
}
|