diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 960effb7..5c5e70dd 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -161,6 +161,8 @@ function M.load(name) -- HACK: LazyVim may have overwritten options of the Lazy ui, so reset this here vim.cmd([[do VimResized]]) end + local pattern = "LazyVim" .. name:sub(1, 1):upper() .. name:sub(2) + vim.api.nvim_exec_autocmds("User", { pattern = pattern, modeline = false }) end M.did_init = false diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index 4083da13..609b3009 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -1,4 +1,5 @@ -- This file is automatically loaded by lazyvim.config.init +vim.notify("load") local Util = require("lazyvim.util") @@ -18,10 +19,10 @@ map("n", "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) map("n", "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) -- Move to window using the hjkl keys -map("n", "", "h", { desc = "Go to left window" }) -map("n", "", "j", { desc = "Go to lower window" }) -map("n", "", "k", { desc = "Go to upper window" }) -map("n", "", "l", { desc = "Go to right window" }) +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 }) -- Resize window using arrow keys map("n", "", "resize +2", { desc = "Increase window height" }) @@ -129,12 +130,12 @@ map("n", "fT", function() Util.float_term() end, { desc = "Terminal (cwd map("t", "", "", { desc = "Enter Normal Mode" }) -- windows -map("n", "ww", "p", { desc = "Other window" }) -map("n", "wd", "c", { desc = "Delete window" }) -map("n", "w-", "s", { desc = "Split window below" }) -map("n", "w|", "v", { desc = "Split window right" }) -map("n", "-", "s", { desc = "Split window below" }) -map("n", "|", "v", { desc = "Split window right" }) +map("n", "ww", "p", { desc = "Other window", remap = true }) +map("n", "wd", "c", { desc = "Delete window", remap = true }) +map("n", "w-", "s", { desc = "Split window below", remap = true }) +map("n", "w|", "v", { desc = "Split window right", remap = true }) +map("n", "-", "s", { desc = "Split window below", remap = true }) +map("n", "|", "v", { desc = "Split window right", remap = true }) -- tabs map("n", "l", "tablast", { desc = "Last Tab" }) diff --git a/lua/lazyvim/plugins/extras/vscode.lua b/lua/lazyvim/plugins/extras/vscode.lua index e8e8c4c8..c8adc036 100644 --- a/lua/lazyvim/plugins/extras/vscode.lua +++ b/lua/lazyvim/plugins/extras/vscode.lua @@ -14,6 +14,7 @@ local enabled = { "nvim-treesitter-textobjects", "nvim-ts-context-commentstring", "vim-repeat", + "LazyVim", } local Config = require("lazy.core.config") @@ -21,42 +22,44 @@ 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 +-- HACK: disable all plugins except the ones we want +local fix_disabled = Plugin.Spec.fix_disabled +function Plugin.Spec.fix_disabled(self) + for _, plugin in pairs(self.plugins) do if not (vim.tbl_contains(enabled, plugin.name) or plugin.vscode) then - Config.plugins[name] = nil - end - end - for _, plugin in pairs(Config.plugins) do - if plugin.dependencies then - plugin.dependencies = vim.tbl_filter(function(dep) - return Config.plugins[dep] - end, plugin.dependencies) + plugin.enabled = false end end + fix_disabled(self) +end + +-- HACK: don't clean plugins in vscode +local update_state = Plugin.update_state +function Plugin.update_state() 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 }) +-- Add some vscode specific keymaps +vim.api.nvim_create_autocmd("User", { + pattern = "LazyVimKeymaps", + callback = function() + vim.keymap.set("n", "", "Find") + vim.keymap.set("n", "/", [[call VSCodeNotify('workbench.action.findInFiles')]]) + vim.keymap.set("n", "ss", [[call VSCodeNotify('workbench.action.gotoSymbol')]]) + 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 } },