feat(vscode): better vscode support
This commit is contained in:
@ -161,6 +161,8 @@ function M.load(name)
|
|||||||
-- HACK: LazyVim may have overwritten options of the Lazy ui, so reset this here
|
-- HACK: LazyVim may have overwritten options of the Lazy ui, so reset this here
|
||||||
vim.cmd([[do VimResized]])
|
vim.cmd([[do VimResized]])
|
||||||
end
|
end
|
||||||
|
local pattern = "LazyVim" .. name:sub(1, 1):upper() .. name:sub(2)
|
||||||
|
vim.api.nvim_exec_autocmds("User", { pattern = pattern, modeline = false })
|
||||||
end
|
end
|
||||||
|
|
||||||
M.did_init = false
|
M.did_init = false
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
-- This file is automatically loaded by lazyvim.config.init
|
-- This file is automatically loaded by lazyvim.config.init
|
||||||
|
vim.notify("load")
|
||||||
|
|
||||||
local Util = require("lazyvim.util")
|
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 })
|
map("n", "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
||||||
|
|
||||||
-- Move to window using the <ctrl> hjkl keys
|
-- Move to window using the <ctrl> hjkl keys
|
||||||
map("n", "<C-h>", "<C-w>h", { desc = "Go to left window" })
|
map("n", "<C-h>", "<C-w>h", { desc = "Go to left window", remap = true })
|
||||||
map("n", "<C-j>", "<C-w>j", { desc = "Go to lower window" })
|
map("n", "<C-j>", "<C-w>j", { desc = "Go to lower window", remap = true })
|
||||||
map("n", "<C-k>", "<C-w>k", { desc = "Go to upper window" })
|
map("n", "<C-k>", "<C-w>k", { desc = "Go to upper window", remap = true })
|
||||||
map("n", "<C-l>", "<C-w>l", { desc = "Go to right window" })
|
map("n", "<C-l>", "<C-w>l", { desc = "Go to right window", remap = true })
|
||||||
|
|
||||||
-- Resize window using <ctrl> arrow keys
|
-- Resize window using <ctrl> arrow keys
|
||||||
map("n", "<C-Up>", "<cmd>resize +2<cr>", { desc = "Increase window height" })
|
map("n", "<C-Up>", "<cmd>resize +2<cr>", { desc = "Increase window height" })
|
||||||
@ -129,12 +130,12 @@ map("n", "<leader>fT", function() Util.float_term() end, { desc = "Terminal (cwd
|
|||||||
map("t", "<esc><esc>", "<c-\\><c-n>", { desc = "Enter Normal Mode" })
|
map("t", "<esc><esc>", "<c-\\><c-n>", { desc = "Enter Normal Mode" })
|
||||||
|
|
||||||
-- windows
|
-- windows
|
||||||
map("n", "<leader>ww", "<C-W>p", { desc = "Other window" })
|
map("n", "<leader>ww", "<C-W>p", { desc = "Other window", remap = true })
|
||||||
map("n", "<leader>wd", "<C-W>c", { desc = "Delete window" })
|
map("n", "<leader>wd", "<C-W>c", { desc = "Delete window", remap = true })
|
||||||
map("n", "<leader>w-", "<C-W>s", { desc = "Split window below" })
|
map("n", "<leader>w-", "<C-W>s", { desc = "Split window below", remap = true })
|
||||||
map("n", "<leader>w|", "<C-W>v", { desc = "Split window right" })
|
map("n", "<leader>w|", "<C-W>v", { desc = "Split window right", remap = true })
|
||||||
map("n", "<leader>-", "<C-W>s", { desc = "Split window below" })
|
map("n", "<leader>-", "<C-W>s", { desc = "Split window below", remap = true })
|
||||||
map("n", "<leader>|", "<C-W>v", { desc = "Split window right" })
|
map("n", "<leader>|", "<C-W>v", { desc = "Split window right", remap = true })
|
||||||
|
|
||||||
-- tabs
|
-- tabs
|
||||||
map("n", "<leader><tab>l", "<cmd>tablast<cr>", { desc = "Last Tab" })
|
map("n", "<leader><tab>l", "<cmd>tablast<cr>", { desc = "Last Tab" })
|
||||||
|
@ -14,6 +14,7 @@ local enabled = {
|
|||||||
"nvim-treesitter-textobjects",
|
"nvim-treesitter-textobjects",
|
||||||
"nvim-ts-context-commentstring",
|
"nvim-ts-context-commentstring",
|
||||||
"vim-repeat",
|
"vim-repeat",
|
||||||
|
"LazyVim",
|
||||||
}
|
}
|
||||||
|
|
||||||
local Config = require("lazy.core.config")
|
local Config = require("lazy.core.config")
|
||||||
@ -21,42 +22,44 @@ local Plugin = require("lazy.core.plugin")
|
|||||||
Config.options.checker.enabled = false
|
Config.options.checker.enabled = false
|
||||||
Config.options.change_detection.enabled = false
|
Config.options.change_detection.enabled = false
|
||||||
|
|
||||||
local update_state = Plugin.update_state
|
-- HACK: disable all plugins except the ones we want
|
||||||
---@diagnostic disable-next-line: duplicate-set-field
|
local fix_disabled = Plugin.Spec.fix_disabled
|
||||||
Plugin.update_state = function()
|
function Plugin.Spec.fix_disabled(self)
|
||||||
-- Config.spec.disabled = {}
|
for _, plugin in pairs(self.plugins) do
|
||||||
for name, plugin in pairs(Config.plugins) do
|
|
||||||
if not (vim.tbl_contains(enabled, plugin.name) or plugin.vscode) then
|
if not (vim.tbl_contains(enabled, plugin.name) or plugin.vscode) then
|
||||||
Config.plugins[name] = nil
|
plugin.enabled = false
|
||||||
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)
|
|
||||||
end
|
end
|
||||||
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()
|
update_state()
|
||||||
Config.to_clean = {}
|
Config.to_clean = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
local map = vim.keymap.set
|
-- Add some vscode specific keymaps
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
map("n", "<leader><space>", "<cmd>Find<cr>")
|
pattern = "LazyVimKeymaps",
|
||||||
map("n", "<leader>/", [[<cmd>call VSCodeNotify('workbench.action.findInFiles')<cr>]])
|
callback = function()
|
||||||
map("n", "<leader>ss", [[<cmd>call VSCodeNotify('workbench.action.gotoSymbol')<cr>]])
|
vim.keymap.set("n", "<leader><space>", "<cmd>Find<cr>")
|
||||||
|
vim.keymap.set("n", "<leader>/", [[<cmd>call VSCodeNotify('workbench.action.findInFiles')<cr>]])
|
||||||
map("n", "<C-h>", "<C-w>h", { desc = "Go to left window", remap = true })
|
vim.keymap.set("n", "<leader>ss", [[<cmd>call VSCodeNotify('workbench.action.gotoSymbol')<cr>]])
|
||||||
map("n", "<C-j>", "<C-w>j", { desc = "Go to lower window", remap = true })
|
end,
|
||||||
map("n", "<C-k>", "<C-w>k", { desc = "Go to upper window", remap = true })
|
})
|
||||||
map("n", "<C-l>", "<C-w>l", { desc = "Go to right window", remap = true })
|
|
||||||
|
|
||||||
map("n", "<leader>wd", "<C-W>c", { desc = "Delete window", remap = true })
|
|
||||||
map("n", "<leader>-", "<C-W>s", { desc = "Split window below", remap = true })
|
|
||||||
map("n", "<leader>|", "<C-W>v", { desc = "Split window right", remap = true })
|
|
||||||
|
|
||||||
return {
|
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",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
opts = { highlight = { enable = false } },
|
opts = { highlight = { enable = false } },
|
||||||
|
Reference in New Issue
Block a user