From c12835ab8683c68116503a1aab614e0d6ff68528 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 22 May 2023 20:40:41 +0200 Subject: [PATCH] feat(vscode): added vscode extra with minimal functionality. Will only do something when vim.g.vscode is set --- lua/lazyvim/plugins/extras/vscode.lua | 56 +++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/vscode.lua diff --git a/lua/lazyvim/plugins/extras/vscode.lua b/lua/lazyvim/plugins/extras/vscode.lua new file mode 100644 index 00000000..069b3528 --- /dev/null +++ b/lua/lazyvim/plugins/extras/vscode.lua @@ -0,0 +1,56 @@ +if not vim.g.vscode then + return {} +end + +local enabled = { + "flit.nvim", + "lazy.nvim", + "leap.nvim", + "mini.ai", + "mini.comment", + "mini.pairs", + "mini.surround", + "nvim-treesitter", + "nvim-treesitter-textobjects", + "vim-repeat", +} + +local Config = require("lazy.core.config") +local Plugin = require("lazy.core.plugin") +Config.options.checker.enabled = false +Config.options.change_detection.enabled = false + +local update_state = Plugin.update_state +---@diagnostic disable-next-line: duplicate-set-field +Plugin.update_state = function() + -- Config.spec.disabled = {} + for name, plugin in pairs(Config.plugins) do + if not vim.list_contains(enabled, plugin.name) then + Config.plugins[name] = nil + end + end + update_state() + Config.to_clean = {} +end + +local map = vim.keymap.set + +map("n", "", "Find") +map("n", "/", [[call VSCodeNotify('workbench.action.findInFiles')]]) +map("n", "ss", [[call VSCodeNotify('workbench.action.gotoSymbol')]]) + +map("n", "", "h", { desc = "Go to left window", remap = true }) +map("n", "", "j", { desc = "Go to lower window", remap = true }) +map("n", "", "k", { desc = "Go to upper window", remap = true }) +map("n", "", "l", { desc = "Go to right window", remap = true }) + +map("n", "wd", "c", { desc = "Delete window", remap = true }) +map("n", "-", "s", { desc = "Split window below", remap = true }) +map("n", "|", "v", { desc = "Split window right", remap = true }) + +return { + { + "nvim-treesitter/nvim-treesitter", + opts = { highlight = { enable = false } }, + }, +}