♻️ refactor(nvim): vscode extra now calls neovim-vscode module
This commit is contained in:
parent
c40125f996
commit
1fb2926488
1 changed files with 28 additions and 10 deletions
|
@ -2,7 +2,9 @@ if not vim.g.vscode then
|
||||||
return {}
|
return {}
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.o.spell = false
|
local Config = require("lazy.core.config")
|
||||||
|
local Plugin = require("lazy.core.plugin")
|
||||||
|
local vscode = require("vscode-neovim")
|
||||||
|
|
||||||
-- Add any additional plugins in vscode, you can set vscode=true on a plugin spec.
|
-- Add any additional plugins in vscode, you can set vscode=true on a plugin spec.
|
||||||
local enabled = {
|
local enabled = {
|
||||||
|
@ -14,19 +16,31 @@ local enabled = {
|
||||||
"mini.surround",
|
"mini.surround",
|
||||||
"nvim-treesitter",
|
"nvim-treesitter",
|
||||||
"nvim-treesitter-textobjects",
|
"nvim-treesitter-textobjects",
|
||||||
|
"nvim-various-textobjs",
|
||||||
"nvim-ts-context-commentstring",
|
"nvim-ts-context-commentstring",
|
||||||
"vim-repeat",
|
"vim-repeat",
|
||||||
|
"yanky.nvim",
|
||||||
|
"highlight-undo.nvim",
|
||||||
|
"multicursors.nvim",
|
||||||
"LazyVim",
|
"LazyVim",
|
||||||
}
|
}
|
||||||
|
|
||||||
local Config = require("lazy.core.config")
|
|
||||||
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
|
||||||
Config.options.defaults.cond = function(plugin)
|
Config.options.defaults.cond = function(plugin)
|
||||||
return vim.tbl_contains(enabled, plugin.name) or plugin.vscode
|
return vim.tbl_contains(enabled, plugin.name) or plugin.vscode
|
||||||
end
|
end
|
||||||
|
|
||||||
|
vim.o.spell = false
|
||||||
|
vim.notify = vscode.notify
|
||||||
|
vim.g.clipboard = vim.g.vscode_clipboard
|
||||||
|
|
||||||
|
local function vscode_action(cmd)
|
||||||
|
return function()
|
||||||
|
vscode.action(cmd)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Add some vscode specific keymaps
|
-- Add some vscode specific keymaps
|
||||||
vim.api.nvim_create_autocmd("User", {
|
vim.api.nvim_create_autocmd("User", {
|
||||||
pattern = "LazyVimKeymaps",
|
pattern = "LazyVimKeymaps",
|
||||||
|
@ -34,17 +48,17 @@ vim.api.nvim_create_autocmd("User", {
|
||||||
-- find file
|
-- find file
|
||||||
vim.keymap.set("n", "<leader><space>", "<cmd>Find<cr>")
|
vim.keymap.set("n", "<leader><space>", "<cmd>Find<cr>")
|
||||||
-- find in files
|
-- find in files
|
||||||
vim.keymap.set("n", "<leader>/", [[<cmd>call VSCodeNotify('workbench.action.findInFiles')<cr>]])
|
vim.keymap.set("n", "<leader>/", vscode_action("workbench.action.findInFiles"))
|
||||||
-- open symbol
|
-- open symbol
|
||||||
vim.keymap.set("n", "<leader>ss", [[<cmd>call VSCodeNotify('workbench.action.gotoSymbol')<cr>]])
|
vim.keymap.set("n", "<leader>ss", vscode_action("workbench.action.gotoSymbol"))
|
||||||
-- view problems
|
-- view problems
|
||||||
vim.keymap.set("n", "<leader>xx", [[<cmd>call VSCodeNotify('workbench.actions.view.problems')<cr>]])
|
vim.keymap.set("n", "<leader>xx", vscode_action("workbench.actions.view.problems"))
|
||||||
-- open file explorer in left sidebar
|
-- open file explorer in left sidebar
|
||||||
vim.keymap.set("n", "<leader>e", [[<cmd>call VSCodeNotify('workbench.view.explorer')<cr>]])
|
vim.keymap.set("n", "<leader>e", vscode_action("workbench.view.explorer"))
|
||||||
-- Code Action
|
-- Code Action
|
||||||
vim.keymap.set("n", "<leader>ca", [[<cmd>call VSCodeNotify('editor.action.codeAction')<cr>]])
|
vim.keymap.set("n", "<leader>ca", vscode_action("editor.action.codeAction"))
|
||||||
-- Open terminal
|
-- Open terminal
|
||||||
vim.keymap.set("n", "<leader>ft", [[<cmd>call VSCodeNotify('workbench.action.terminal.focus')<cr>]])
|
vim.keymap.set("n", "<leader>ft", vscode_action("workbench.action.terminal.focus"))
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -60,6 +74,10 @@ return {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
opts = { highlight = { enable = false } },
|
opts = {
|
||||||
|
highlight = {
|
||||||
|
enable = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue