diff --git a/aspects/dotfiles/files/.local/share/autojump/autojump.txt b/aspects/dotfiles/files/.local/share/autojump/autojump.txt index 50056cfc..547698f3 100644 Binary files a/aspects/dotfiles/files/.local/share/autojump/autojump.txt and b/aspects/dotfiles/files/.local/share/autojump/autojump.txt differ diff --git a/aspects/dotfiles/files/.local/share/autojump/autojump.txt.bak b/aspects/dotfiles/files/.local/share/autojump/autojump.txt.bak index fe323804..8d855591 100644 Binary files a/aspects/dotfiles/files/.local/share/autojump/autojump.txt.bak and b/aspects/dotfiles/files/.local/share/autojump/autojump.txt.bak differ diff --git a/aspects/dotfiles/files/.local/share/newsboat/cache.db b/aspects/dotfiles/files/.local/share/newsboat/cache.db index de76ee5a..96dc16c5 100644 Binary files a/aspects/dotfiles/files/.local/share/newsboat/cache.db and b/aspects/dotfiles/files/.local/share/newsboat/cache.db differ diff --git a/aspects/dotfiles/files/.local/share/zathura/bookmarks.sqlite b/aspects/dotfiles/files/.local/share/zathura/bookmarks.sqlite index 9a22f8ac..841e594d 100644 Binary files a/aspects/dotfiles/files/.local/share/zathura/bookmarks.sqlite and b/aspects/dotfiles/files/.local/share/zathura/bookmarks.sqlite differ diff --git a/aspects/nvim/files/.config/nvim/ftplugin/cpp.lua b/aspects/nvim/files/.config/nvim/ftplugin/cpp.lua index 518afd6a..fe8fa047 100644 --- a/aspects/nvim/files/.config/nvim/ftplugin/cpp.lua +++ b/aspects/nvim/files/.config/nvim/ftplugin/cpp.lua @@ -6,15 +6,13 @@ options = vim.tbl_deep_extend("force", { buffer = vim.api.nvim_get_current_buf(), }, options) -which_key.register({ - ["L"] = { - name = "Language", - a = { "ClangdAST", "Toggle AST" }, - i = { "ClangdToggleInlayHints", "Toggle Inlay Hints" }, - s = { "ClangdSwitchSourceHeader", "Switch Source Header" }, - K = { "ClangdSymbolInfo", "Symbol Info" }, - h = { "ClangdTypeHierarchy", "Type Hierarchy" }, - }, +which_key.add({ + { "L", group = "Language" }, + { "La", "ClangdAST", desc = "Toggle AST" }, + { "Li", "ClangdToggleInlayHints", desc = "Toggle Inlay Hints" }, + { "Ls", "ClangdSwitchSourceHeader", desc = "Switch Source Header" }, + { "LK", "ClangdSymbolInfo", desc = "Symbol Info" }, + { "Lh", "ClangdTypeHierarchy", desc = "Type Hierarchy" }, }, options) local dap = require("dap") diff --git a/aspects/nvim/files/.config/nvim/ftplugin/dart.lua b/aspects/nvim/files/.config/nvim/ftplugin/dart.lua index 677f9bd7..1a0ee263 100644 --- a/aspects/nvim/files/.config/nvim/ftplugin/dart.lua +++ b/aspects/nvim/files/.config/nvim/ftplugin/dart.lua @@ -6,22 +6,20 @@ options = vim.tbl_deep_extend("force", { buffer = vim.api.nvim_get_current_buf(), }, options) -which_key.register({ - ["L"] = { - name = "Language", - p = { "FlutterRun", "Run project" }, - d = { "FlutterDevices", "List connected devices" }, - e = { "FlutterEmulators", "List of emulators" }, - q = { "FlutterQuit", "End running session" }, - D = { "FlutterDetach", "End running session locally" }, - o = { "FlutterOutlineToggle", "Toggle outline window" }, - t = { "FlutterDevTools", "Start Dart Dev Tools server" }, - a = { "FlutterDevToolsActivate", "Start Dart Dev Tools server" }, - P = { "FlutterCopyProfilerUrl", "Copy profiler url to system clipboard" }, - l = { "FlutterLspRestart", "Restart LSP" }, - s = { "FlutterSuper", "Go to super class" }, - r = { "FlutterRename", "Rename and updates imports" }, - }, +which_key.add({ + { "L", group = "Language" }, + { "Lp", "FlutterRun", desc = "Run project" }, + { "Ld", "FlutterDevices", desc = "List connected devices" }, + { "Le", "FlutterEmulators", desc = "List of emulators" }, + { "Lq", "FlutterQuit", desc = "End running session" }, + { "LD", "FlutterDetach", desc = "End running session locally" }, + { "Lo", "FlutterOutlineToggle", desc = "Toggle outline window" }, + { "Lt", "FlutterDevTools", desc = "Start Dart Dev Tools server" }, + { "La", "FlutterDevToolsActivate", desc = "Start Dart Dev Tools server" }, + { "LP", "FlutterCopyProfilerUrl", desc = "Copy profiler url to system clipboard" }, + { "Ll", "FlutterLspRestart", desc = "Restart LSP" }, + { "Ls", "FlutterSuper", desc = "Go to super class" }, + { "Lr", "FlutterRename", desc = "Rename and updates imports" }, }, options) local dap = require("dap") diff --git a/aspects/nvim/files/.config/nvim/ftplugin/go.lua b/aspects/nvim/files/.config/nvim/ftplugin/go.lua index 69a0fa08..a5018f3e 100644 --- a/aspects/nvim/files/.config/nvim/ftplugin/go.lua +++ b/aspects/nvim/files/.config/nvim/ftplugin/go.lua @@ -6,76 +6,65 @@ options = vim.tbl_deep_extend("force", { buffer = vim.api.nvim_get_current_buf(), }, options) -which_key.register({ - ["L"] = { - name = "Language", - o = { "GoPkgOutline", "Package Outline" }, - m = { "GoMockGen", "Generate mocks for current file" }, - I = { "GoToggleInlay", "Toggle inlay hints" }, - r = { "GoGenReturn", "Create return value for current function" }, - f = { - name = "Auto Fill", - s = { "GoFillStruct", "Auto fill struct" }, - w = { "GoFillSwitch", "Fill switch" }, - e = { "GoIfErr", "Add if err" }, - p = { "GoFillPlurals", "change func foo(b int, a int, r int) -> func foo(b, a, r int)" }, - }, - i = { - name = "Install", - i = { "GoInstallBinaries", "Install all tools, skip the ones installed" }, - u = { "GoUpdateBinaries", "Update all tools to the latest version" }, - }, - b = { - name = "Build", - m = { "GoMake", "Make" }, - g = { "GoBuild", "Build" }, - r = { "GoGenerate", "Generate" }, - s = { "GoStop", "Stop job GoRun started" }, - }, - t = { - name = "Test", - t = { "GoTest", "Test" }, - w = { "GoTestSum -w", "Test in watch mode" }, - v = { "GoTest -v", "Test -v current file path" }, - c = { "GoTest -c", "Test -c current file path" }, - n = { "GoTest -n", "Test nearest" }, - f = { "GoTest -f", "Test current file" }, - p = { "GoTest -p", "Test current package" }, - v = { "GoVet", "Vet" }, - C = { "GoCoverage", "Test cover profile" }, - P = { "GoCoverage -p", "Test package for current buffer" }, - }, - T = { - name = "Tags", - a = { "GoAddTag", "Add tag" }, - r = { "GoRmTag", "Remove tag" }, - c = { "GoClearTag", "Clear tag" }, - }, - f = { - name = "Format", - f = { "GoFmt", "Format" }, - i = { "GoImport", "Import" }, - }, - s = { - name = "Switch between go and test file", - a = { "GoAlt!", "Alternate file" }, - s = { "GoAltS!", "Alternate file (horizontal split)" }, - v = { "GoAltv!", "Alternate file (vertical split)" }, - }, - m = { - name = "Mod", - i = { "GoModInit", "Run go mod init" }, - t = { "GoModInit", "Run go mod tidy" }, - v = { "GoModInit", "Run go mod vendor" }, - }, - u = { - name = "Unit Tests", - f = { "", "Run tests for current function" }, - F = { "", "Run tests for current file" }, - s = { "", "Select test function" }, - p = { "", "Run tests for package" }, - }, - }, +which_key.add({ + { "L", group = "Language" }, + { "Lo", "GoPkgOutline", desc = "Package Outline" }, + { "LM", "GoMockGen", desc = "Generate mocks for current file" }, + { "LI", "GoToggleInlay", desc = "Toggle inlay hints" }, + { "Lr", "GoGenReturn", desc = "Create return value for current function" }, + + { "LF", group = "Auto Fill" }, + { "LFs", "GoFillStruct", desc = "Auto fill struct" }, + { "LFw", "GoFillSwitch", desc = "Fill switch" }, + { "LFe", "GoIfErr", desc = "Add if err" }, + { "LFp", "GoFillPlurals", desc = "change func foo(b int, a int, r int) -> func foo(b, a, r int)" }, + + { "Li", group = "Install" }, + { "Lii", "GoInstallBinaries", desc = "Install all tools, skip the ones installed" }, + { "Liu", "GoUpdateBinaries", desc = "Update all tools to the latest version" }, + + { "Lb", group = "Build" }, + { "Lbm", "GoMake", desc = "Make" }, + { "Lbg", "GoBuild", desc = "Build" }, + { "Lbr", "GoGenerate", desc = "Generate" }, + { "Lbs", "GoStop", desc = "Stop job GoRun started" }, + + { "Lt", group = "Test" }, + { "Ltt", "GoTest", desc = "Test" }, + { "Ltw", "GoTestSum -w", desc = "Test in watch mode" }, + { "Ltv", "GoTest -v", desc = "Test -v current file path" }, + { "Ltc", "GoTest -c", desc = "Test -c current file path" }, + { "Ltn", "GoTest -n", desc = "Test nearest" }, + { "Ltf", "GoTest -f", desc = "Test current file" }, + { "Ltp", "GoTest -p", desc = "Test current package" }, + { "Ltv", "GoVet", desc = "Vet" }, + { "LtC", "GoCoverage", desc = "Test cover profile" }, + { "LtP", "GoCoverage -p", desc = "Test package for current buffer" }, + + { "LT", group = "Tags" }, + { "LTa", "GoAddTag", desc = "Add tag" }, + { "LTr", "GoRmTag", desc = "Remove tag" }, + { "LTc", "GoClearTag", desc = "Clear tag" }, + + { "Lf", group = "Format" }, + { "Lff", "GoFmt", desc = "Format" }, + { "Lfi", "GoImport", desc = "Import" }, + + { "Ls", group = "Switch between go and test file" }, + { "Lsa", "GoAlt!", desc = "Alternate file" }, + { "Lss", "GoAltS!", desc = "Alternate file (horizontal split)" }, + { "Lsv", "GoAltv!", desc = "Alternate file (vertical split)" }, + + { "Lm", group = "Mod" }, + { "Lmi", "GoModInit", desc = "Run go mod init" }, + { "Lmt", "GoModInit", desc = "Run go mod tidy" }, + { "Lmv", "GoModInit", desc = "Run go mod vendor" }, + + { "Lu", group = "Unit Tests" }, + { "Luf", "", desc = "Run tests for current function" }, + { "LuF", "", desc = "Run tests for current file" }, + { "Lus", "", desc = "Select test function" }, + { "Lup", "", desc = "Run tests for package" }, }, options) local dap = require("dap") diff --git a/aspects/nvim/files/.config/nvim/ftplugin/java.lua b/aspects/nvim/files/.config/nvim/ftplugin/java.lua index 0ad6ac4e..43bb590f 100644 --- a/aspects/nvim/files/.config/nvim/ftplugin/java.lua +++ b/aspects/nvim/files/.config/nvim/ftplugin/java.lua @@ -161,29 +161,25 @@ voptions = vim.tbl_deep_extend("force", { buffer = vim.api.nvim_get_current_buf(), }, voptions) -which_key.register({ - ["L"] = { - name = "Lanage", - o = { "lua require('jdtls').organize_imports()", "Organize Imports" }, - v = { "lua require('jdtls').extract_variable()", "Extract Variable" }, - c = { "lua require('jdtls').extract_constant()", "Extract Constant" }, - m = { "lua require('jdtls').extract_method()", "Extract Method" }, - t = { "lua require('jdtls').test_class()", "Test Class" }, - n = { "lua require('jdtls').test_nearest_method()", "Test Nearest Method" }, - u = { "JdtUpdateConfig", "Update Config" }, - d = { "JdtRefreshDebugConfigs", "Refresh debug config" }, - e = { "Jaq", "Execute Java" }, - r = { "JdtWipeDataAndRestart", "Wipe project data and Restart server" }, - x = { "JdtRestart", "Restart server" }, - s = { "JdtSetRuntime", "Set runtime" }, - }, +which_key.add({ + { "L", group = "Language" }, + { "Lo", "lua require('jdtls').organize_imports()", desc = "Organize Imports" }, + { "Lv", "lua require('jdtls').extract_variable()", desc = "Extract Variable" }, + { "Lc", "lua require('jdtls').extract_constant()", desc = "Extract Constant" }, + { "Lm", "lua require('jdtls').extract_method()", desc = "Extract Method" }, + { "Lt", "lua require('jdtls').test_class()", desc = "Test Class" }, + { "Ln", "lua require('jdtls').test_nearest_method()", desc = "Test Nearest Method" }, + { "Lu", "JdtUpdateConfig", desc = "Update Config" }, + { "Ld", "JdtRefreshDebugConfigs", desc = "Refresh debug config" }, + { "Le", "Jaq", desc = "Execute Java" }, + { "Lr", "JdtWipeDataAndRestart", desc = "Wipe project data and Restart server" }, + { "Lx", "JdtRestart", desc = "Restart server" }, + { "Ls", "JdtSetRuntime", desc = "Set runtime" }, }, options) -which_key.register({ - ["L"] = { - name = "Language", - v = { "lua require('jdtls').extract_variable(true)", "Extract Variable" }, - c = { "lua require('jdtls').extract_constant(true)", "Extract Constant" }, - m = { "lua require('jdtls').extract_method(true)", "Extract Method" }, - }, +which_key.add({ + { "L", group = "Language" }, + { "Lv", "lua require('jdtls').extract_variable(true)", desc = "Extract Variable" }, + { "Lc", "lua require('jdtls').extract_constant(true)", desc = "Extract Constant" }, + { "Lm", "lua require('jdtls').extract_method(true)", desc = "Extract Method" }, }, voptions) diff --git a/aspects/nvim/files/.config/nvim/ftplugin/mail.lua b/aspects/nvim/files/.config/nvim/ftplugin/mail.lua index a3228b0e..d71f73fa 100644 --- a/aspects/nvim/files/.config/nvim/ftplugin/mail.lua +++ b/aspects/nvim/files/.config/nvim/ftplugin/mail.lua @@ -17,14 +17,12 @@ options = vim.tbl_deep_extend("force", { buffer = vim.api.nvim_get_current_buf(), }, options) -which_key.register({ - ["L"] = { - name = "Language", - f = { "1G0f:C: ", "From" }, - t = { "2G0f:C: ", "To" }, - c = { "3G0f:C: ", "CC" }, - b = { "4G0f:C: ", "BCC" }, - s = { "5G0f:C: ", "Subject" }, - r = { "6G0f:C: ", "Reply To" }, - }, +which_key.add({ + { "L", group = "Language" }, + { "Lf", "1G0f:C: ", desc = "From" }, + { "Lt", "2G0f:C: ", desc = "To" }, + { "Lc", "3G0f:C: ", desc = "CC" }, + { "Lb", "4G0f:C: ", desc = "BCC" }, + { "Ls", "5G0f:C: ", desc = "Subject" }, + { "Lr", "6G0f:C: ", desc = "Reply To" }, }, options) diff --git a/aspects/nvim/files/.config/nvim/ftplugin/markdown.lua b/aspects/nvim/files/.config/nvim/ftplugin/markdown.lua index eecc22a3..aea87ec7 100644 --- a/aspects/nvim/files/.config/nvim/ftplugin/markdown.lua +++ b/aspects/nvim/files/.config/nvim/ftplugin/markdown.lua @@ -7,31 +7,25 @@ options = vim.tbl_deep_extend("force", { buffer = buffer, }, options) -which_key.register({ - ["L"] = { - name = "Language", - g = { "Glow", "Toggle Glow" }, - p = { "MarkdownPreviewToggle", "Toggle Markdown Preview" }, - t = { - name = "Table", - t = { "TableModeToggle", "Enable/Disable Table Mode" }, - n = { "ti", "Get cell info" }, - f = { - name = "Formula", - a = { "TableAddFormula", "Add formula" }, - e = { "tfe", "Evaluate formula on current row" }, - }, - d = { - name = "Delete", - r = { "tdr", "Delete row" }, - c = { "tdc", "Delete column" }, - }, - i = { - name = "Insert", - c = { "tic", "Insert column" }, - }, - }, - }, +which_key.add({ + { "L", group = "Language" }, + { "Lg", "Glow", desc = "Toggle Glow" }, + { "Lp", "MarkdownPreviewToggle", desc = "Toggle Markdown Preview" }, + + { "Lt", group = "Table" }, + { "Ltt", "TableModeToggle", desc = "Enable/Disable Table Mode" }, + { "Ltn", "ti", desc = "Get cell info" }, + + { "Lf", group = "Formula" }, + { "Lfa", "TableAddFormula", desc = "Add formula" }, + { "Lfe", "tfe", desc = "Evaluate formula on current row" }, + + { "Ld", group = "Delete" }, + { "Ldr", "tdr", desc = "Delete row" }, + { "Ldc", "tdc", desc = "Delete column" }, + + { "Li", group = "Insert" }, + { "Lic", "tic", desc = "Insert column" }, }, options) vim.keymap.set( diff --git a/aspects/nvim/files/.config/nvim/ftplugin/python.lua b/aspects/nvim/files/.config/nvim/ftplugin/python.lua index 990b16e1..56193829 100644 --- a/aspects/nvim/files/.config/nvim/ftplugin/python.lua +++ b/aspects/nvim/files/.config/nvim/ftplugin/python.lua @@ -7,27 +7,20 @@ options = vim.tbl_deep_extend("force", { buffer = vim.api.nvim_get_current_buf(), }, options) -which_key.register({ - ["L"] = { - name = "Language", - j = { - name = "Jupyter", - l = { "MoltenLoad", "Load Molten" }, - i = { "MoltenInit", "Init Molten" }, - I = { "MoltenInfo", "Info Molten" }, - e = { "MoltenEvaluateLine", "Evaluate Line Molten" }, - r = { "MoltenReevaluateCell", "Reevaluate Cell Molten" }, - }, - p = { "PyrightOrganizeImports", "Organize Imports" }, - }, +which_key.add({ + { "L", group = "Language" }, + { "Lp", "PyrightOrganizeImports", desc = "Organize Imports" }, + + { "Lj", group = "Jupyter" }, + { "Ljl", "MoltenLoad", desc = "Load Molten" }, + { "Lji", "MoltenInit", desc = "Init Molten" }, + { "LjI", "MoltenInfo", desc = "Info Molten" }, + { "Lje", "MoltenEvaluateLine", desc = "Evaluate Line Molten" }, + { "Ljr", "MoltenReevaluateCell", desc = "Reevaluate Cell Molten" }, }, options) -which_key.register({ - ["L"] = { - name = "Language", - j = { - name = "Jupyter", - e = { "MoltenEvaluateVisual", "Evaluate Highlighted Line" }, - }, - }, +which_key.add({ + { "L", group = "Language" }, + { "Lj", group = "Jupyter" }, + { "Lje", "MoltenEvaluateVisual", desc = "Evaluate Highlighted Line" }, }, voptions) diff --git a/aspects/nvim/files/.config/nvim/ftplugin/rust.lua b/aspects/nvim/files/.config/nvim/ftplugin/rust.lua index 8e16d671..4d23e422 100644 --- a/aspects/nvim/files/.config/nvim/ftplugin/rust.lua +++ b/aspects/nvim/files/.config/nvim/ftplugin/rust.lua @@ -1,8 +1,6 @@ local which_key = require("which-key") local options = require("config.global").which_key_vars.options -local keymap = require("config.global").keymap -local opts = require("config.global").opts local bufnr = vim.api.nvim_get_current_buf() options = vim.tbl_deep_extend("force", { @@ -10,27 +8,24 @@ options = vim.tbl_deep_extend("force", { buffer = bufnr, }, options) -which_key.register({ - ["L"] = { - name = "Language", - H = { - name = "Hints", - e = { "RustEnableInlayHints", "Enable Inlay Hints" }, - d = { "RustDisableInlayHints", "Disable Inlay Hints" }, - }, - d = { "RustOpenExternalDocs", "Open Docs" }, - s = { "RustSSR", "Structural Search Replace" }, - r = { "RustRunnables", "Run Runnables" }, - R = { "RustHoverRange", "Show Type in hover" }, - h = { "RustHoverActions", "Hover Actions" }, - o = { "RustOpenCargo", "Open Cargo" }, - p = { "RustParentModule", "Parent Module" }, - j = { "RustJoinLines", "Join Lines" }, - e = { "RustExpandMacro", "Expand Macro" }, - U = { "RustMoveItemUp", "Move Item Up" }, - D = { "RustMoveItemDown", "Move Item Down" }, - v = { "RustViewCrateGraph", "View Crate Graph" }, - }, +which_key.add({ + { "L", group = "Language" }, + { "Ld", "RustOpenExternalDocs", desc = "Open Docs" }, + { "Ls", "RustSSR", desc = "Structural Search Replace" }, + { "Lr", "RustRunnables", desc = "Run Runnables" }, + { "LR", "RustHoverRange", desc = "Show Type in hover" }, + { "Lh", "RustHoverActions", desc = "Hover Actions" }, + { "Lo", "RustOpenCargo", desc = "Open Cargo" }, + { "Lp", "RustParentModule", desc = "Parent Module" }, + { "Lj", "RustJoinLines", desc = "Join Lines" }, + { "Le", "RustExpandMacro", desc = "Expand Macro" }, + { "LU", "RustMoveItemUp", desc = "Move Item Up" }, + { "LD", "RustMoveItemDown", desc = "Move Item Down" }, + { "Lv", "RustViewCrateGraph", desc = "View Crate Graph" }, + + { "LH", group = "Hints" }, + { "LHe", "RustEnableInlayHints", desc = "Enable Inlay Hints" }, + { "LHd", "RustDisableInlayHints", desc = "Disable Inlay Hints" }, }, options) local dap = require("dap") diff --git a/aspects/nvim/files/.config/nvim/ftplugin/sql.lua b/aspects/nvim/files/.config/nvim/ftplugin/sql.lua index 893cb0c5..0ec523ea 100644 --- a/aspects/nvim/files/.config/nvim/ftplugin/sql.lua +++ b/aspects/nvim/files/.config/nvim/ftplugin/sql.lua @@ -11,12 +11,10 @@ voptions = vim.tbl_deep_extend("force", { buffer = vim.api.nvim_get_current_buf(), }, voptions) -which_key.register({ - ["L"] = { - name = "Language", - u = { "DBUIToggle", "Toggle UI" }, - f = { "DBUIFindBuffer", "Find buffer" }, - r = { "DBUIRenameBuffer", "Rename buffer" }, - q = { "DBUILastQueryInfo", "Last query info" }, - }, +which_key.add({ + { "L", group = "Language" }, + { "Lu", "DBUIToggle", desc = "Toggle UI" }, + { "Lf", "DBUIFindBuffer", desc = "Find buffer" }, + { "Lr", "DBUIRenameBuffer", desc = "Rename buffer" }, + { "Lq", "DBUILastQueryInfo", desc = "Last query info" }, }, options) diff --git a/aspects/nvim/files/.config/nvim/ftplugin/tex.lua b/aspects/nvim/files/.config/nvim/ftplugin/tex.lua index 4c02ed9a..3dc6b4f1 100644 --- a/aspects/nvim/files/.config/nvim/ftplugin/tex.lua +++ b/aspects/nvim/files/.config/nvim/ftplugin/tex.lua @@ -15,45 +15,36 @@ options = vim.tbl_deep_extend("force", { buffer = vim.api.nvim_get_current_buf(), }, options) -which_key.register({ - ["L"] = { - name = "Language", - m = { "VimtexContextMenu", "Open Context Menu" }, - u = { "VimtexCountLetters", "Count Letters" }, - w = { "VimtexCountWords", "Count Words" }, - d = { "VimtexDocPackage", "Open Doc for package" }, - e = { "VimtexErrors", "Look at the errors" }, - s = { "VimtexStatus", "Look at the status" }, - a = { "VimtexToggleMain", "Toggle Main" }, - v = { "VimtexView", "View pdf" }, - i = { "VimtexInfo", "Vimtex Info" }, - t = { "VimtexTocToggle", "Toggle TOC" }, - l = { - name = "Clean", - l = { "VimtexClean", "Clean Project" }, - c = { "VimtexClean", "Clean Cache" }, - }, - c = { - name = "Compile", - c = { "VimtexCompile", "Compile Project" }, - o = { - "VimtexCompileOutput", - "Compile Project and Show Output", - }, - s = { "VimtexCompileSS", "Compile project super fast" }, - e = { "VimtexCompileSelected", "Compile Selected" }, - }, - r = { - name = "Reload", - r = { "VimtexReload", "Reload" }, - s = { "VimtexReloadState", "Reload State" }, - }, - o = { - name = "Stop", - p = { "VimtexStop", "Stop" }, - a = { "VimtexStopAll", "Stop All" }, - }, - }, +which_key.add({ + { "L", group = "Language" }, + { "Lm", "VimtexContextMenu", desc = "Open Context Menu" }, + { "Lu", "VimtexCountLetters", desc = "Count Letters" }, + { "Lw", "VimtexCountWords", desc = "Count Words" }, + { "Ld", "VimtexDocPackage", desc = "Open Doc for package" }, + { "Le", "VimtexErrors", desc = "Look at the errors" }, + { "Ls", "VimtexStatus", desc = "Look at the status" }, + { "La", "VimtexToggleMain", desc = "Toggle Main" }, + { "Lv", "VimtexView", desc = "View pdf" }, + { "Li", "VimtexInfo", desc = "Vimtex Info" }, + { "Lt", "VimtexTocToggle", desc = "Toggle TOC" }, + + { "Ll", group = "Clean" }, + { "Lll", "VimtexClean", desc = "Clean Project" }, + { "Llc", "VimtexClean", desc = "Clean Cache" }, + + { "Lc", group = "Compile" }, + { "Lcc", "VimtexCompile", desc = "Compile Project" }, + { "Lco", "VimtexCompileOutput", desc = "Compile Project and Show Output", }, + { "Lcs", "VimtexCompileSS", desc = "Compile project super fast" }, + { "Lce", "VimtexCompileSelected", desc = "Compile Selected" }, + + { "Lr", group = "Reload" }, + { "Lrr", "VimtexReload", desc = "Reload" }, + { "Lrs", "VimtexReloadState", desc = "Reload State" }, + + { "Lo", group = "Stop" }, + { "Lop", "VimtexStop", desc = "Stop" }, + { "Loa", "VimtexStopAll", desc = "Stop All" }, }, options) keymap( diff --git a/aspects/nvim/files/.config/nvim/ftplugin/toml.lua b/aspects/nvim/files/.config/nvim/ftplugin/toml.lua deleted file mode 100644 index f11c9144..00000000 --- a/aspects/nvim/files/.config/nvim/ftplugin/toml.lua +++ /dev/null @@ -1,13 +0,0 @@ -local which_key = require("which-key") -local options = require("config.global").which_key_vars.options - -options = vim.tbl_deep_extend("force", { - filetype = "toml", - buffer = vim.api.nvim_get_current_buf(), -}, options) - -which_key.register({ - ["L"] = { - name = "Language", - }, -}, options) diff --git a/aspects/nvim/files/.config/nvim/ftplugin/typescript.lua b/aspects/nvim/files/.config/nvim/ftplugin/typescript.lua index f74cd074..23f66179 100644 --- a/aspects/nvim/files/.config/nvim/ftplugin/typescript.lua +++ b/aspects/nvim/files/.config/nvim/ftplugin/typescript.lua @@ -6,20 +6,17 @@ options = vim.tbl_deep_extend("force", { buffer = vim.api.nvim_get_current_buf(), }, options) -which_key.register({ - ["L"] = { - name = "Language", - d = { "TSToolsGoToSourceDefinition", "Go to Source Definition" }, - f = { "TSToolsFixAll", "Fix all fixable errors" }, - i = { - name = "Imports", - a = { "TSToolsAddMissingImports", "Add missing imports" }, - o = { "TSToolsOrganizeImports", "Organize imports" }, - r = { "TSToolsRemoveUnusedImports", "Remove Unused Imports" }, - s = { "TSToolsSortImports", "Sort Imports" }, - }, - r = { "TSToolsRemoveUnused", "Removed Unused Statements" }, - }, +which_key.add({ + { "L", group = "Language" }, + { "Ld", "TSToolsGoToSourceDefinition", desc = "Go to Source Definition" }, + { "Lf", "TSToolsFixAll", desc = "Fix all fixable errors" }, + { "Lr", "TSToolsRemoveUnused", desc = "Removed Unused Statements" }, + + { "Li", group = "Imports" }, + { "Lia", "TSToolsAddMissingImports", desc = "Add missing imports" }, + { "Lio", "TSToolsOrganizeImports", desc = "Organize imports" }, + { "Lir", "TSToolsRemoveUnusedImports", desc = "Remove Unused Imports" }, + { "Lis", "TSToolsSortImports", desc = "Sort Imports" }, }, options) local dap = require("dap") diff --git a/aspects/nvim/files/.config/nvim/lua/config/keymaps.lua b/aspects/nvim/files/.config/nvim/lua/config/keymaps.lua index db79e719..d5aff100 100644 --- a/aspects/nvim/files/.config/nvim/lua/config/keymaps.lua +++ b/aspects/nvim/files/.config/nvim/lua/config/keymaps.lua @@ -38,7 +38,6 @@ keymap("n", "", "ggVG", opts, "Highlight everything.") keymap("n", ";", ":nohl", opts, "Clear search highlight.") keymap("n", "", "za", opts, "Toggle tab.") keymap("n", "", "ciw", opts, "Detele entire word.") -keymap("n", "-", "lua require('lir.float').toggle()", opts, "Toggle Lir.") -- Insert Mode keymap("i", "", "u[s1z=`]au", opts, "Correct spelling mistake.") diff --git a/aspects/nvim/files/.config/nvim/lua/config/lazy.lua b/aspects/nvim/files/.config/nvim/lua/config/lazy.lua index e346888e..a82696b6 100644 --- a/aspects/nvim/files/.config/nvim/lua/config/lazy.lua +++ b/aspects/nvim/files/.config/nvim/lua/config/lazy.lua @@ -67,10 +67,10 @@ function Lazyload() vim.cmd([[syntax manual]]) end - local load_go = vim.tbl_contains({ "go", "gomod" }, vim.bo.filetype) - if load_go then - loader("go.nvim") - end + -- local load_go = vim.tbl_contains({ "go", "gomod" }, vim.bo.filetype) + -- if load_go then + -- loader("go.nvim") + -- end loader("plenary.nvim") diff --git a/aspects/nvim/files/.config/nvim/lua/modules/editor/config.lua b/aspects/nvim/files/.config/nvim/lua/modules/editor/config.lua index ca2489b1..b575e3be 100644 --- a/aspects/nvim/files/.config/nvim/lua/modules/editor/config.lua +++ b/aspects/nvim/files/.config/nvim/lua/modules/editor/config.lua @@ -474,76 +474,4 @@ function config.neo_tree() }) end -function config.lir() - local lir = require("lir") - - local actions = require("lir.actions") - local mark_actions = require("lir.mark.actions") - local clipboard_actions = require("lir.clipboard.actions") - local setup = { - show_hidden_files = false, - devicons = { enable = true }, - mappings = { - [""] = actions.edit, - ["l"] = actions.edit, - [""] = actions.split, - ["v"] = actions.vsplit, - [""] = actions.tabedit, - ["h"] = actions.up, - ["q"] = actions.quit, - ["A"] = actions.mkdir, - ["a"] = actions.newfile, - ["r"] = actions.rename, - ["@"] = actions.cd, - ["Y"] = actions.yank_path, - ["i"] = actions.toggle_show_hidden, - ["d"] = actions.delete, - ["J"] = function() - mark_actions.toggle_mark() - vim.cmd("normal! j") - end, - ["c"] = clipboard_actions.copy, - ["x"] = clipboard_actions.cut, - ["p"] = clipboard_actions.paste, - }, - float = { - winblend = 0, - curdir_window = { - enable = false, - highlight_dirname = true, - }, - - win_opts = function() - local width = math.floor(vim.o.columns * 0.7) - local height = math.floor(vim.o.lines * 0.7) - return { - border = "rounded", - width = width, - height = height, - } - end, - }, - hide_cursor = false, - on_init = function() - vim.api.nvim_buf_set_keymap( - 0, - "x", - "J", - ":lua require('lir.mark.actions').toggle_mark('v')", - { noremap = true, silent = true } - ) - end, - } - - lir.setup(setup) - - require("nvim-web-devicons").set_icon({ - lir_folder_icon = { - icon = "", - color = "#42A5F5", - name = "LirFolderNode", - }, - }) -end - return config diff --git a/aspects/nvim/files/.config/nvim/lua/modules/git/config.lua b/aspects/nvim/files/.config/nvim/lua/modules/git/config.lua index 13974410..2108ee06 100644 --- a/aspects/nvim/files/.config/nvim/lua/modules/git/config.lua +++ b/aspects/nvim/files/.config/nvim/lua/modules/git/config.lua @@ -2,8 +2,7 @@ local config = {} function config.gitsigns() local gitsigns = require("gitsigns") - - gitsigns.setup({ + local setup = { signs = { add = { text = "▎" }, change = { text = "▎" }, @@ -32,8 +31,9 @@ function config.gitsigns() sign_priority = 6, update_debounce = 200, status_formatter = nil, - yadm = { enable = false }, - }) + } + + gitsigns.setup(setup) end return config diff --git a/aspects/nvim/files/.config/nvim/lua/modules/lsp/config.lua b/aspects/nvim/files/.config/nvim/lua/modules/lsp/config.lua index 6d82792e..de6a34c7 100644 --- a/aspects/nvim/files/.config/nvim/lua/modules/lsp/config.lua +++ b/aspects/nvim/files/.config/nvim/lua/modules/lsp/config.lua @@ -223,7 +223,6 @@ function config.navigator() "typescriptreact", }, }, - golangci_lint_ls = { filetypes = { "go", "gomod" } }, gopls = require("modules.lsp.settings.gopls"), jdtls = { filetypes = { "java" } }, solidity_ls = { filetypes = { "solidity" }, install_server_name = "solidity" }, @@ -235,6 +234,14 @@ function config.navigator() }, } + -- nav_cfg.lsp.gopls = function() + -- if vim.tbl_contains({ "go", "gomod" }, vim.bo.filetype) then + -- if pcall(require, "go") then + -- return require("go.lsp").config() + -- end + -- end + -- end + require("navigator").setup(nav_cfg) -- require("navigator").setup() end @@ -259,6 +266,53 @@ function config.glance() }) end +function config.go() + local setup = { + fillstruct = "gopls", + log_path = "/tmp/gonvim.log", + lsp_codelens = false, -- use navigator + lsp_gofumpt = true, + dap_debug = true, + gofmt = "gopls", + goimports = "gopls", + dap_debug_vt = true, + dap_debug_gui = true, + diagnostic = false, + test_runner = "go", + run_in_floaterm = true, + lsp_document_formatting = true, + preludes = { + default = function() + return { "AWS_PROFILE=test" } + end, + GoRun = function() + local pwd = vim.fn.getcwd() + local cmdl = { "watchexec", "--restart", "-v", "-e", "go" } + -- if current folder contains sub folder with name pattern .\w+-env + -- list all subfolders see if match .\w+-env + local hasenv = false + for _, v in ipairs(vim.fn.readdir(pwd)) do + if string.match(v, "%p%a+%p*env") then + hasenv = true + break + end + end + + if hasenv then + local cwdl = vim.split(pwd, "/") + local cwd = cwdl[#cwdl] + local cwdp = vim.split(cwd, "-") + local cwdps = cwdp[#cwdp] + return vim.list_extend(cmdl, { "awsenv", cwdps }) + end + return {} + end, + }, + } + + require("go").setup(setup) +end + function config.flutter_tools() local line = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" } diff --git a/aspects/nvim/files/.config/nvim/lua/modules/lsp/handlers.lua b/aspects/nvim/files/.config/nvim/lua/modules/lsp/handlers.lua index dc70a6be..64538e2b 100644 --- a/aspects/nvim/files/.config/nvim/lua/modules/lsp/handlers.lua +++ b/aspects/nvim/files/.config/nvim/lua/modules/lsp/handlers.lua @@ -38,43 +38,50 @@ lsp.attach_mappings = function(_, bufnr) buffer = bufnr, }, options) - which_key.register({ - l = { - name = "LSP", - c = { "lua vim.lsp.buf.code_action()", "Show code actions" }, - e = { "lua vim.diagnostic.open_float()", "Show line diagnostics" }, - E = { "Telescope diagnostics", "Show all diagnostics" }, - f = { "lua vim.lsp.buf.format { async = true }", "Format" }, - r = { "lua vim.lsp.buf.rename()", "Rename" }, - i = { "LspInfo", "LSP info" }, - o = { "OutlineOpen", "Symbols Outline" }, - j = { "lua vim.diagnostic.goto_next()", "Go to next diagnostic" }, - k = { "lua vim.diagnostic.goto_prev()", "Go to previous diagnostic" }, - l = { "lua require('lsp_lines').toggle()", "Toggle LSP Lines" }, - s = { "lua vim.lsp.buf.signature_help()", "Signature" }, - D = { "Telescope lsp_document_symbols", "Document Symbols" }, - d = { - name = "Definition", - d = { "Glance definitions", "Definition" }, - p = { - function() - require("nvim-treesitter.textobjects.lsp_interop").peek_definition_code("@function.outer", nil, "textDocument/typeDefinition") - end, - "Preview Definition" - }, - r = { "Glance references", "References" }, - t = { "Glance type_definitions", "Type Definition" }, - i = { "Glance implementations", "Implementation" }, - }, - w = { - name = "Workspace", - s = { "Telescope lsp_workspace_symbols", "Symbols" }, - a = { "lua vim.lsp.buf.add_workspace_folder()", "Add workspace folder" }, - r = { "lua vim.lsp.buf.remove_workspace_folder()", "Remove workspace folder" }, - l = { "lua vim.lsp.buf.list_workspace_folders()", "List workspace folders" }, - }, + which_key.add({ + { "l", group = "LSP" }, + { "lc", vim.lsp.buf.code_action, desc = "Show code actions" }, + { "le", vim.diagnostic.open_float, desc = "Show line diagnostics" }, + { "lE", "Telescope diagnostics", desc = "Show all diagnostics" }, + { + "lf", + function() + vim.lsp.buf.format({ async = true }) + end, + desc = "Format", }, - }, options) + { "lr", vim.lsp.buf.rename, desc = "Rename" }, + { "li", vim.cmd.LspInfo, desc = "LSP info" }, + { "lo", vim.cmd.OutlineOpen, desc = "Symbols Outline" }, + { "lj", vim.diagnostic.goto_next, desc = "Go to next diagnostic" }, + { "lk", vim.diagnostic.goto_prev, desc = "Go to previous diagnostic" }, + { "ll", require("lsp_lines").toggle, desc = "Toggle LSP Lines" }, + { "ls", vim.lsp.buf.signature_help, desc = "Signature" }, + { "lD", "Telescope lsp_document_symbols", desc = "Document Symbols" }, + + { "ld", group = "Definition" }, + { "ldd", "Glance definitions", desc = "Definition" }, + { + "ldp", + function() + require("nvim-treesitter.textobjects.lsp_interop").peek_definition_code( + "@function.outer", + nil, + "textDocument/typeDefinition" + ) + end, + desc = "Preview Definition", + }, + { "ldr", "Glance references", desc = "References" }, + { "ldt", "Glance type_definitions", desc = "Type Definition" }, + { "ldi", "Glance implementations", desc = "Implementation" }, + + { "lw", group = "Workspace" }, + { "lws", vim.diagnostic.LspSymbols, desc = "Symbols" }, + { "lwa", vim.lsp.buf.add_workspace_folder, desc = "Add workspace folder" }, + { "lwr", vim.lsp.buf.remove_workspace_folder, desc = "Remove workspace folder" }, + { "lwl", vim.lsp.buf.list_workspace_folders, desc = "List workspace folders" }, + }) end lsp.on_attach = function(client, bufnr) @@ -92,7 +99,7 @@ lsp.on_attach = function(client, bufnr) require("modules.lsp.filetypes.cpp").clangd_extensions() end - -- require("inlay-hints").on_attach(client, bufnr) + require("inlay-hints").on_attach(client, bufnr) lsp.setup_codelens_refresh(client, bufnr) lsp.attach_mappings(client, bufnr) @@ -121,24 +128,10 @@ lsp.on_attach = function(client, bufnr) client.config.capabilities.textDocument.completion.completionItem.snippetSupport = true client.config.capabilities.textDocument.foldingRange = { dynamicRegistration = false, - lineFoldingOnly = true + lineFoldingOnly = true, } lsp.capabilities = client.config.capabilities - - -- if client.resolved_capabilities.code_lens then - -- local codelens = vim.api.nvim_create_augroup( - -- "LSPCodeLens", - -- { clear = true } - -- ) - -- vim.api.nvim_create_autocmd({ "BufEnter", "InsertLeave", "CursorHold" }, { - -- group = codelens, - -- callback = function() - -- vim.lsp.codelens.refresh() - -- end, - -- buffer = bufnr, - -- }) - -- end end return lsp diff --git a/aspects/nvim/files/.config/nvim/lua/modules/lsp/plugins.lua b/aspects/nvim/files/.config/nvim/lua/modules/lsp/plugins.lua index b8f73531..ccf54b33 100644 --- a/aspects/nvim/files/.config/nvim/lua/modules/lsp/plugins.lua +++ b/aspects/nvim/files/.config/nvim/lua/modules/lsp/plugins.lua @@ -202,9 +202,7 @@ return function(use) "nvim-lspconfig", "nvim-treesitter", }, - config = function() - require("go").setup() - end, + config = conf.go, ft = { "go", "gomod" }, build = ":lua require('go.install').update_all_sync()", }) diff --git a/aspects/nvim/files/.config/nvim/lua/modules/lsp/settings/gopls.lua b/aspects/nvim/files/.config/nvim/lua/modules/lsp/settings/gopls.lua index ab6d861d..cb0d926b 100644 --- a/aspects/nvim/files/.config/nvim/lua/modules/lsp/settings/gopls.lua +++ b/aspects/nvim/files/.config/nvim/lua/modules/lsp/settings/gopls.lua @@ -1,5 +1,6 @@ return { filtypes = { "go", "gomod", "gowork", "gotmpl" }, + cmd = {'gopls', '--remote=auto'}, settings = { gopls = { analyses = { diff --git a/aspects/nvim/files/.config/nvim/lua/modules/ui/which-key.lua b/aspects/nvim/files/.config/nvim/lua/modules/ui/which-key.lua index 7aeff7d1..e85787d7 100644 --- a/aspects/nvim/files/.config/nvim/lua/modules/ui/which-key.lua +++ b/aspects/nvim/files/.config/nvim/lua/modules/ui/which-key.lua @@ -1,9 +1,11 @@ +local which_key = require("which-key") + local setup = { plugins = { - marks = true, - registers = true, + marks = false, + registers = false, spelling = { - enabled = true, + enabled = false, suggestions = 20, }, presets = { @@ -16,24 +18,14 @@ local setup = { g = true, }, }, - key_labels = { - [""] = "SPC", - }, icons = { breadcrumb = "»", separator = "➜", group = "+", + mappings = false, }, - popup_mappings = { - scroll_down = "", - scroll_up = "", - }, - window = { + win = { border = "rounded", - position = "bottom", - margin = { 1, 0, 1, 0 }, - padding = { 2, 2, 2, 2 }, - winblend = 0, }, layout = { height = { min = 4, max = 25 }, @@ -41,15 +33,11 @@ local setup = { spacing = 3, align = "center", }, - ignore_missing = true, - hidden = { "", "", "", "", "call", "lua", "^:", "^ " }, show_help = false, - triggers_blacklist = { - i = { "j", "k" }, - v = { "j", "k" }, - }, } +which_key.setup(setup) + local vars = require("config.global").which_key_vars local function search_config_files() @@ -57,151 +45,163 @@ local function search_config_files() builtin.find_files({ cwd = vim.fn.stdpath("config") }) end -vars.vmappings["/"] = { - "lua require('Comment.api').toggle.linewise(vim.fn.visualmode())", - "Comment", -} +vars.mappings[1] = { + { "d", group = "Debugging" }, -vars.mappings[" "] = { "normal ", "Jump to previous buffer" } --- vars.mappings["-"] = { require("lir.float").toggle, "Toggle Lir" } -vars.mappings["/"] = { require("Comment.api").toggle.linewise, "Comment out current line" } -vars.mappings["a"] = { require("harpoon.mark").add_file, "Add file to harpoon" } --- vars.mappings["e"] = { "Neotree toggle", "Toggle NeoTree" } -vars.mappings["h"] = { vim.cmd.split, "Horizontal Split" } -vars.mappings["t"] = { require("alternate-toggler").toggleAlternate, "Alternate" } -vars.mappings["v"] = { vim.cmd.vsplit, "Vertical Split" } -vars.mappings["z"] = { vim.cmd.ZenMode, "Zen Mode" } - -vars.mappings["d"] = { - name = "Debug", - t = { require("dap").toggle_breakpoint, "Toggle Breakpoint" }, - b = { require("dap").step_back, "Step Back" }, - c = { require("dap").continue, "Continue" }, - C = { require("dap").run_to_cursor, "Run To Cursor" }, - d = { require("dap").disconnect, "Disconnect" }, - g = { require("dap").session, "Get Session" }, - i = { require("dap").step_into, "Step Into" }, - o = { require("dap").step_over, "Step Over" }, - u = { require("dap").step_out, "Step Out" }, - p = { require("dap").pause, "Pause" }, - r = { require("dap").repl.toggle, "Toggle Repl" }, - s = { require("dap").continue, "Start" }, - q = { require("dap").close, "Quit" }, - U = { require("dapui").toggle, "Enable/Disable UI" }, + { "dt", require("dap").toggle_breakpoint, desc = "Toggle Breakpoint" }, + { "db", require("dap").step_back, desc = "Step Back" }, + { "dc", require("dap").continue, desc = "Continue" }, + { "dC", require("dap").run_to_cursor, desc = "Run To Cursor" }, + { "dd", require("dap").disconnect, desc = "Disconnect" }, + { "dg", require("dap").session, desc = "Get Session" }, + { "di", require("dap").step_into, desc = "Step Into" }, + { "do", require("dap").step_over, desc = "Step Over" }, + { "du", require("dap").step_out, desc = "Step Out" }, + { "dp", require("dap").pause, desc = "Pause" }, + { "dr", require("dap").repl.toggle, desc = "Toggle Repl" }, + { "ds", require("dap").continue, desc = "Start" }, + { "dq", require("dap").close, desc = "Quit" }, + { "dU", require("dapui").toggle, desc = "Enable/Disable UI" }, } -vars.mappings["g"] = { - name = "Git", - j = { require("gitsigns").next_hunk, "Next Hunk" }, - k = { require("gitsigns").prev_hunk, "Prev Hunk" }, - l = { require("gitsigns").blame_line, "Blame" }, - p = { require("gitsigns").preview_hunk, "Preview Hunk" }, - m = { vim.cmd.GitMessenger, "View message" }, - r = { require("gitsigns").reset_hunk, "Reset Hunk" }, - R = { require("gitsigns").reset_buffer, "Reset Buffer" }, - s = { require("gitsigns").stage_hunk, "Stage Hunk" }, - u = { require("gitsigns").undo_stage_hunk, "Undo Stage Hunk" }, - o = { "Telescope git_status", "Open changed file" }, - b = { "Telescope git_branches", "Checkout branch" }, - c = { "Telescope git_commits", "Checkout commit" }, - C = { "Telescope git_bcommits", "Checkout commit" }, - d = { "Gitsigns diffthis HEAD", "Git Diff" }, +vars.mappings[2] = { + { "g", group = "Git" }, + + { "gj", require("gitsigns").next_hunk, desc = "Next Hunk" }, + { "gk", require("gitsigns").prev_hunk, desc = "Prev Hunk" }, + { "gl", require("gitsigns").blame_line, desc = "Blame" }, + { "gp", require("gitsigns").preview_hunk, desc = "Preview Hunk" }, + { "gm", vim.cmd.GitMessenger, desc = "View message" }, + { "gr", require("gitsigns").reset_hunk, desc = "Reset Hunk" }, + { "gR", require("gitsigns").reset_buffer, desc = "Reset Buffer" }, + { "gs", require("gitsigns").stage_hunk, desc = "Stage Hunk" }, + { "gu", require("gitsigns").undo_stage_hunk, desc = "Undo Stage Hunk" }, + { "go", "Telescope git_status", desc = "Open changed file" }, + { "gb", "Telescope git_branches", desc = "Checkout branch" }, + { "gc", "Telescope git_commits", desc = "Checkout commit" }, + { "gC", "Telescope git_bcommits", desc = "Checkout commit" }, + { "gd", "Gitsigns diffthis HEAD", desc = "Git Diff" }, } -vars.mappings["G"] = { - name = "ChatGPT", - a = { vim.cmd.ChatGPTActAs, "Have ChatGPT act as" }, - c = { vim.cmd.ChatGPTCompleteCode, "Have ChatGPT complete code" }, - t = { vim.cmd.ChatGPT, "Toggle ChatGPT" }, - i = { vim.cmd.ChatGPTEditWithInstructions, "Have ChatGPT edit with instructions" }, - r = { - name = "Run", - a = { "ChatGPTRun add_test", "Implement tests for the code" }, - c = { "ChatGPTRun code_readability_analysis", "Identify any readability issues in the code" }, - C = { "ChatGPTRun complete_code", "Complete the code" }, - d = { "ChatGPTRun docstring", "Write docstring for the code" }, - e = { "ChatGPTRun explain_code", "Explain the code" }, - f = { "ChatGPTRun fix_bugs", "Fix bugs in the code" }, - g = { "ChatGPTRun grammar_correction", "Correct grammar" }, - k = { "ChatGPTRun keywords", "Extract the main keywords from the code" }, - o = { "ChatGPTRun optimize_code", "Optimize the code" }, - r = { "ChatGPTRun optimize_code", "Insert a roxygen skeleton to code" }, - s = { "ChatGPTRun summarize", "Summarize the code" }, - t = { "ChatGPTRun translate", "Translate code" }, +vars.mappings[3] = { + { "G", group = "ChatGPT" }, + + { "Ga", vim.cmd.ChatGPTActAs, desc = "Have ChatGPT act as" }, + { "Gc", vim.cmd.ChatGPTCompleteCode, desc = "Have ChatGPT complete code" }, + { "Gt", vim.cmd.ChatGPT, desc = "Toggle ChatGPT" }, + { "Gi", vim.cmd.ChatGPTEditWithInstructions, desc = "Have ChatGPT edit with instructions" }, + { "Gr", group = "Run" }, + { "Gra", "ChatGPTRun add_test", desc = "Implement tests for the code" }, + { + "Grc", + "ChatGPTRun code_readability_analysis", + desc = "Identify any readability issues in the code", }, + { "GrC", "ChatGPTRun complete_code", desc = "Complete the code" }, + { "Grd", "ChatGPTRun docstring", desc = "Write docstring for the code" }, + { "Gre", "ChatGPTRun explain_code", desc = "Explain the code" }, + { "Grf", "ChatGPTRun fix_bugs", desc = "Fix bugs in the code" }, + { "Grg", "ChatGPTRun grammar_correction", desc = "Correct grammar" }, + { "Grk", "ChatGPTRun keywords", desc = "Extract the main keywords from the code" }, + { "Gro", "ChatGPTRun optimize_code", desc = "Optimize the code" }, + { "Grr", "ChatGPTRun optimize_code", desc = "Insert a roxygen skeleton to code" }, + { "Grs", "ChatGPTRun summarize", desc = "Summarize the code" }, + { "Grt", "ChatGPTRun translate", desc = "Translate code" }, } -vars.mappings["n"] = { - name = "Neotest", - a = { require("neotest").run.attach, "Attach to the nearest test" }, - c = { +vars.mappings[4] = { + { "n", group = "NeoTest" }, + + { "na", require("neotest").run.attach, desc = "Attach to the nearest test" }, + { + "nc", function() require("neotest").run.run(vim.fn.expand("%")) end, - "Run the current file", + desc = "Run the current file", }, - d = { + { + "nd", function() require("neotest").run.run({ strategy = "dap" }) end, - "Debug the nearest test", + desc = "Debug the nearest test", }, - e = { + { + "ne", function() require("neotest").output.open({ enter = true, auto_close = true }) end, - "Open the output of a test result", + desc = "Open the output of a test result", }, - j = { + { + "nj", function() require("neotest").jump.prev({ status = "failed" }) end, - "Jump to next error", + desc = "Jump to next error", }, - k = { + { + "nk", function() require("neotest").jump.next({ status = "failed" }) end, - "Jump to previous error", + desc = "Jump to previous error", }, - n = { require("neotest").run.run, "Run the nearest test" }, - s = { require("neotest").run.stop, "Stop the nearest test" }, - S = { require("neotest").summary.toggle, "Toggle the summary window" }, + { "nn", require("neotest").run.run, desc = "Run the nearest test" }, + { "ns", require("neotest").run.stop, desc = "Stop the nearest test" }, + { "nS", require("neotest").summary.toggle, desc = "Toggle the summary window" }, } -vars.mappings["r"] = { - name = "Refactor", - e = { "lua require('refactoring').refactor('Extract Function')", "Extract Function" }, - f = { "lua require('refactoring').refactor('Extract Function to File')", "Extract Function to File" }, - v = { "lua require('refactoring').refactor('Extract Variable')", "Extract Variable" }, - i = { "lua require('refactoring').refactor('Inline Variable')", "Inline Variable" }, - r = { "lua require('telescope').extensions.refactoring.refactors()", "Refactor" }, - V = { "lua require('refactoring').debug.print_var({})", "Debug Print Var" }, +vars.mappings[5] = { + { "r", group = "Refactor" }, + + { "re", "lua require('refactoring').refactor('Extract Function')", desc = "Extract Function" }, + { + "rf", + "lua require('refactoring').refactor('Extract Function to File')", + desc = "Extract Function to File", + }, + { "rv", "lua require('refactoring').refactor('Extract Variable')", desc = "Extract Variable" }, + { "ri", "lua require('refactoring').refactor('Inline Variable')", desc = "Inline Variable" }, + { "rr", "lua require('telescope').extensions.refactoring.refactors()", desc = "Refactor" }, + { "rV", "lua require('refactoring').debug.print_var({})", desc = "Debug Print Var" }, } -vars.mappings["s"] = { - name = "Search", - f = { "Telescope find_files", "Fuzzy find files" }, - g = { "Telescope grep_string", "Fuzzy find string" }, - b = { "Telescope buffers", "Fuzzy find buffers" }, - l = { "Telescope live_grep", "Fuzzy find words" }, - s = { "Telescope symbols", "Fuzzy find symbols" }, - h = { "Telescope harpoon marks", "View harpoon" }, - d = { "Telescope diagnostics", "Fuzzy find diagnostics" }, - n = { search_config_files, "Fuzzy find config files" }, - c = { +vars.mappings[6] = { + { "s", group = "Search" }, + + { "sf", "Telescope find_files", desc = "Fuzzy find files" }, + { "sg", "Telescope grep_string", desc = "Fuzzy find string" }, + { "sb", "Telescope buffers", desc = "Fuzzy find buffers" }, + { "sl", "Telescope live_grep", desc = "Fuzzy find words" }, + { "ss", "Telescope symbols", desc = "Fuzzy find symbols" }, + { "sh", "Telescope harpoon marks", desc = "View harpoon" }, + { "sd", "Telescope diagnostics", desc = "Fuzzy find diagnostics" }, + { "sn", search_config_files, desc = "Fuzzy find config files" }, + { + "sc", function() require("telescope.builtin").current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({ winblend = 10, previewer = false, })) end, - "Fuzzily search in current buffer", + desc = "Fuzzily search in current buffer", }, } -local which_key = require("which-key") +which_key.add(vars.mappings) +which_key.add({ + { " ", "normal ", desc = "Jump to previous buffer" }, + { "/", "lua require('Comment.api').toggle.linewise()", desc = "Comment out current line" }, + { "a", require("harpoon.mark").add_file, desc = "Add file to harpoon" }, + { "h", vim.cmd.split, desc = "Horizontal Split" }, + { "t", require("alternate-toggler").toggleAlternate, desc = "Toggle Alternate" }, + { "v", vim.cmd.vsplit, desc = "Vertical Split" }, + { "z", vim.cmd.ZenMode, desc = "Zen Mode" }, +}) -which_key.setup(setup) -which_key.register(vars.mappings, vars.options) -which_key.register(vars.vmappings, vars.voptions) +which_key.add({ + { "/", "lua require('Comment.api').toggle.linewise(vim.fn.visualmode())", desc = "Comment", mode = "v" }, +})