local M = {} M.disabled = { n = { ["wa"] = "", ["wr"] = "", ["wl"] = "", ["wK"] = "", ["wk"] = "", ["cm"] = "", }, } M.crates = { plugin = true, n = { ["rcu"] = { function() require("crates").upgrade_all_crates() end, "update crates", }, }, } M.dap = { plugin = true, n = { ["db"] = { " DapToggleBreakpoint " }, ["dr"] = { " DapContinue ", "Run or continue the debugger", }, ["dus"] = { function() local widgets = require("dap.ui.widgets") local sidebar = widgets.sidebar(widgets.scopes) sidebar.open() end, "Open debugging sidebar", }, ["drr"] = { " RustLsp debuggables ", "Run rust debug on current file", }, }, } M.dap_go = { plugin = true, n = { ["dgr"] = { function() require("dap-go").debug_test() end, "Debug go test", }, ["dgl"] = { function() require("dap-go").debug_last() end, "Debug last go test", }, }, } M.gopher = { plugin = true, n = { ["gsj"] = { " GoTagAdd json ", "Add json struct tags", }, ["gsy"] = { " GoTagAdd yaml ", "Add yaml struct tags", }, }, } M.lspsaga = { n = { [""] = { function() vim.lsp.buf.code_action() end, "󰅱 Code Action", }, --[[ ["gf"] = { function() vim.cmd "Lspsaga lsp_finder" end, " Go to definition", }, ["gt"] = { "Lspsaga goto_definition", " Go to definition", }, ["lp"] = { "Lspsaga peek_definition", " Peek definition", }, ]] ["gh"] = { function() --[[ vim.lsp.buf.hover() ]] require("pretty_hover").hover() end, "󱙼 Hover lsp", }, ["gr"] = { "Telescope lsp_references", " Lsp references" }, ["gd"] = { "Telescope lsp_definitions ", " Lsp definitions" }, }, } M.rua = { n = { [""] = { " tabNext ", "Goto next tab", }, [""] = { " tabprevious ", "Goto prev tab", }, [""] = { function() require("nvchad.tabufline").tabuflineNext() end, "Goto next buffer", }, [""] = { function() require("nvchad.tabufline").tabuflinePrev() end, "Goto prev buffer", }, ["pa"] = { " %bd|e#|bd# ", "Close all other buffers", }, [""] = { "ggG" }, -- $ 跳到行尾不带空格 ["$"] = { "g_" }, -- motion ["f"] = { function() local hop = require("hop") local directions = require("hop.hint").HintDirection hop.hint_char1({ direction = directions.AFTER_CURSOR, current_line_only = false }) end, "Hop motion search in current line after cursor", }, ["F"] = { function() local hop = require("hop") local directions = require("hop.hint").HintDirection hop.hint_char1({ direction = directions.BEFORE_CURSOR, current_line_only = false }) end, "Hop motion search in current line before cursor", }, ["w"] = { function() local hop = require("hop") local directions = require("hop.hint").HintDirection hop.hint_words({ direction = directions.AFTER_CURSOR, current_line_only = false }) end, "Hop motion search words after cursor", }, ["b"] = { function() local hop = require("hop") local directions = require("hop.hint").HintDirection hop.hint_words({ direction = directions.BEFORE_CURSOR, current_line_only = false }) end, "Hop motion search words before cursor", }, -- term [""] = { function() require("nvterm.terminal").toggle("horizontal") end, "Toggle horizontal term", }, [""] = { function() require("nvterm.terminal").toggle("horizontal") end, "Toggle horizontal term", }, [""] = { function() require("nvterm.terminal").toggle("float") end, "Toggle floating term", }, [""] = { function() require("nvterm.terminal").toggle("vertical") end, "Toggle vertical term", }, [""] = { function() require("nvterm.terminal").toggle("vertical") end, "Toggle vertical term", }, -- arrange buffer ["pl"] = { function() require("nvchad.tabufline").move_buf(1) end, "Move buffer right", }, ["ph"] = { function() require("nvchad.tabufline").move_buf(-1) end, "Move buffer left", }, -- notify ["un"] = { function() require("notify").dismiss({ silent = true, pending = true }) end, "Dismiss all Notifications", }, -- markdown preview ["pm"] = { " MarkdownPreview ", "Preview Markdown file", }, -- window split ["|"] = { " vs ", "Split window vertically", }, ["_"] = { " sp ", "Split window horizontally", }, -- spectre search ["ss"] = { 'lua require("spectre").toggle()', "Toggle Spectre", }, ["sw"] = { 'lua require("spectre").open_visual({select_word=true})', "Spectre search current word", }, ["sp"] = { 'lua require("spectre").open_file_search({select_word=true})', "Spectre search on current file", }, }, v = { ["$"] = { "g_" }, -- motion ["f"] = { function() local hop = require("hop") local directions = require("hop.hint").HintDirection hop.hint_char1({ direction = directions.AFTER_CURSOR, current_line_only = false }) end, "Hop motion search in current line after cursor", }, ["F"] = { function() local hop = require("hop") local directions = require("hop.hint").HintDirection hop.hint_char1({ direction = directions.BEFORE_CURSOR, current_line_only = false }) end, "Hop motion search in current line before cursor", }, ["w"] = { function() local hop = require("hop") local directions = require("hop.hint").HintDirection hop.hint_words({ direction = directions.AFTER_CURSOR, current_line_only = false }) end, "Hop motion search words after cursor", }, ["b"] = { function() local hop = require("hop") local directions = require("hop.hint").HintDirection hop.hint_words({ direction = directions.BEFORE_CURSOR, current_line_only = false }) end, "Hop motion search words before cursor", }, -- spectre search ["sw"] = { 'lua require("spectre").open_visual()', "Spectre search current word", }, }, -- term t = { [""] = { function() require("nvterm.terminal").toggle("horizontal") end, "Toggle horizontal term", }, [""] = { function() require("nvterm.terminal").toggle("horizontal") end, "Toggle horizontal term", }, [""] = { function() require("nvterm.terminal").toggle("float") end, "Toggle floating term", }, [""] = { function() require("nvterm.terminal").toggle("vertical") end, "Toggle vertical term", }, [""] = { function() require("nvterm.terminal").toggle("vertical") end, "Toggle vertical term", }, --[[ [""] = { vim.api.nvim_replace_termcodes("", true, true, true), "Escape terminal mode" }, ]] }, } M.trouble = { n = { ["tx"] = { "TroubleToggle" }, ["tw"] = { "TroubleToggle workspace_diagnostics" }, ["td"] = { "TroubleToggle document_diagnostics" }, ["tq"] = { "TroubleToggle quickfix" }, ["tl"] = { "TroubleToggle loclist" }, ["gR"] = { "TroubleToggle lsp_references" }, }, } M.telescope = { plugin = true, n = { ["gm"] = { " Telescope git_commits ", "Git commits" }, ["gd"] = { " DiffviewOpen ", "Open diff view" }, ["gg"] = { " LazyGit ", "Open LazyGit" }, ["gf"] = { " LazyGitFilterCurrentFile ", "Open LazyGit fitler current file" }, ["gh"] = { " DiffviewFileHistory % ", "Open current file history" }, ["gc"] = { " DiffviewClose ", "Close Diffview" }, ["fc"] = { function() require("telescope.builtin").command_history() end, "Search command history", }, ["fr"] = { function() require("telescope.builtin").resume() end, "Resume last search", }, ["ft"] = { function() require("telescope.builtin").filetypes() end, "Set current filetype", }, ["fd"] = { function() require("telescope.builtin").diagnostics() end, "Find Diagnostics", }, ["fn"] = { function() require("telescope").extensions.notify.notify() end, "View notify history", }, }, } M.whichkey = { plugin = true, n = { ["K"] = { function() vim.cmd("WhichKey") end, "Which-key all keymaps", }, ["k"] = { function() local input = vim.fn.input("WhichKey: ") vim.cmd("WhichKey " .. input) end, "Which-key query lookup", }, }, } M.lspconfig = { plugin = true, --[[ n = { ["ca"] = { function() vim.ui.select(vim.lsp.buf.code_action) end, "LSP code action", }, }, ]] n = { ["co"] = { " OrganizeImports ", "Organize imports", }, }, } return M