From baeab79398c598dd3800fb92dea0ce0e55a7cae9 Mon Sep 17 00:00:00 2001 From: gwbeip Date: Wed, 16 Apr 2025 13:39:31 +0800 Subject: [PATCH] feat(LazyVSCode): tabs-related and file search --- .gitignore | 5 ++-- .neoconfig.json | 15 ++++++++++++ README.md | 32 ++++++++++++++---------- lua/config/lazyvscode.lua | 51 +++++++++++++++++++++++++++++++-------- stylua.toml | 3 +++ 5 files changed, 81 insertions(+), 25 deletions(-) create mode 100644 .neoconfig.json create mode 100644 stylua.toml diff --git a/.gitignore b/.gitignore index 848faab..1524cea 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ -*.json -*.toml +.vscode/ +lazy-lock.json +lazyvim.json baremetal \ No newline at end of file diff --git a/.neoconfig.json b/.neoconfig.json new file mode 100644 index 0000000..70e9a25 --- /dev/null +++ b/.neoconfig.json @@ -0,0 +1,15 @@ +{ + "neodev": { + "library": { + "enabled": true, + "plugins": true + } + }, + "neoconf": { + "plugins": { + "lua_ls": { + "enabled": true + } + } + } + } \ No newline at end of file diff --git a/README.md b/README.md index 6948d61..2d1c079 100644 --- a/README.md +++ b/README.md @@ -2,16 +2,22 @@ ## Configuration for VSCode-Neovim ### `` + -|L1 |L2 |L3 |Function | -|--- |--- |--- |--- | -|`` |b |- | Toggle Side Bar Visibility| -|`` |B |- | Toggle Side Bar Position | -|`` |l |- | Toggle Line Number Mode | -|`` |z |- | Toggle Zen Mode | -|`` |/ |- | Toggle Flash.nvim Search | -|c (code) |f |- | Format Code | -|c |t |- | Flash.nvim Treesitter | -|b (side bar) |e |- | Open Explorer | -|s (search) | -|t (tab) |n |- | Next Tab | -|w (window) | | \ No newline at end of file +|L1 |L2 |L3 |Function | +|--- |--- |--- |--- | +|``(toggle) |b |- | Toggle Side Bar Visibility | +|`` |B |- | Toggle Side Bar Position | +|`` |l |- | Toggle Line Number Mode | +|`` |t |- | Toggle Tabs Inside Group | +|`` |T |- | Toggle Tabs Cross-Groups | +|`` |z |- | Toggle Zen Mode | +|`` |/ |- | Toggle Flash.nvim Search | +|b (side bar) |e |- | Open Sidebar Explorer | +|b |s |- | Open Sidebar Search | +|c (code) |f |- | Format Code | +|c |t |- | Flash.nvim Treesitter | +|f (file) |s |- | File search with VSCode ctrl-p | +|s (search) | +|t (tab) |l |- | Search Tabs Inside Group: Least | +|t (tab) |p |- | Search Tabs Inside Group: Previous | +|t (tab) |s |- | Search Tabs Cross-Groups: Previous | +|g (group) | | diff --git a/lua/config/lazyvscode.lua b/lua/config/lazyvscode.lua index 79f7545..19daf1f 100644 --- a/lua/config/lazyvscode.lua +++ b/lua/config/lazyvscode.lua @@ -69,13 +69,17 @@ local sidebar = { togglePosition = function() vscode.action("workbench.action.toggleSidebarPosition") end, - open = function() + openExplorer = function() vscode.action("workbench.view.explorer") + end, + openSearch = function() + vscode.action("workbench.view.search") end } vim.keymap.set("n", "b", sidebar.toggleVisibility, { desc = "Toggle Sidebar Vidibility" }) vim.keymap.set("n", "B", sidebar.togglePosition, { desc = "Toggle Sidebar Position" }) -vim.keymap.set("n", "be", sidebar.open, { desc = "Open Side bar Explorer" }) +vim.keymap.set("n", "be", sidebar.openExplorer, { desc = "Open Sidebar Explorer" }) +vim.keymap.set("n", "bs", sidebar.openSearch, { desc = "Open Sidebar Explorer" }) -- Toggle Line-Number Mode vim.keymap.set("n", "l", function() @@ -95,21 +99,48 @@ vim.keymap.set("n", "cf", function() end, { desc = "Format Code" }) -- Window - - +-- TODO: g to toggle between two groups +-- TODO: gv to split vertically +-- TODO: gs to split horizontally +-- TODO: gd to delete a group -- Tab +-- TODO: td to delete a tab +-- TODO: tm + hjkl to move a tab to another group local tabs = { - next = function() - -- vscode.action("workbench.action.quickOpen") - -- vscode.action("workbench.action.quickOpenNavigateNextInFilePicker") - -- vscode.action("workbench.action.quickOpenSelectNext") - -- vscode.action("workbench.action.quickOpenPreviousRecentlyUsedEditor") + toggleInGroup = function() vscode.action("workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup") + vscode.action("list.select") + end, + toggleCrossGroups = function() + vscode.action("workbench.action.quickOpenPreviousRecentlyUsedEditor") + vscode.action("list.select") + end, + previous = function() + vscode.action("workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup") + end, + least = function() + vscode.action("workbench.action.quickOpenLeastRecentlyUsedEditorInGroup") + end, + select = function() + vscode.action("workbench.action.quickOpenPreviousRecentlyUsedEditor") end } -vim.keymap.set("n", "tp", tabs.next, { desc = "Previous Tab" }) +vim.keymap.set("n", "t", tabs.toggleInGroup, { desc = "Toggle Between Two Tabs inside Group" }) +vim.keymap.set("n", "T", tabs.toggleCrossGroups, { desc = "Toggle Between Two Tabs Cross-Groups" }) +vim.keymap.set("n", "ts", tabs.select, { desc = "Select Tab Cross-Groups" }) +vim.keymap.set("n", "tp", tabs.previous, { desc = "Select Tab in Group: Previous" }) +vim.keymap.set("n", "tl", tabs.least, { desc = "Select Tab in Group: Least" }) +-- Files +local files = { + search = function() + vscode.action("workbench.action.quickOpen") + -- vscode.action("workbench.action.quickOpenNavigateNextInFilePicker") + vscode.action("workbench.action.quickOpenSelectNext") + end +} +vim.keymap.set("n", "fs", files.search, { desc = "Search Files with VSCode ctrl-p" }) -- Use Lazy.nvim as the plugin manager require("lazy").setup({ diff --git a/stylua.toml b/stylua.toml new file mode 100644 index 0000000..5d6c50d --- /dev/null +++ b/stylua.toml @@ -0,0 +1,3 @@ +indent_type = "Spaces" +indent_width = 2 +column_width = 120 \ No newline at end of file