diff options
| author | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2023-04-10 10:18:01 +0200 |
|---|---|---|
| committer | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2023-04-10 10:18:01 +0200 |
| commit | 08d5556ab2f104cc2daff59c078c12816b8c9acc (patch) | |
| tree | 2e72e8d8e555d92195ae7e1d9f34c732f5be7886 | |
| parent | 11fa125e9ed415021a2c5223e396c8f73fa05a13 (diff) | |
| download | nvim-conf-08d5556ab2f104cc2daff59c078c12816b8c9acc.tar.gz nvim-conf-08d5556ab2f104cc2daff59c078c12816b8c9acc.zip | |
feat(general): update keymaps
32 files changed, 168 insertions, 134 deletions
@@ -1,2 +1,8 @@ +-- TODO: remove once 0.9 is more widly available +if vim.fn.has "nvim-0.9.0" ~= 1 then + vim.treesitter.query.get = vim.treesitter.get_query + vim.treesitter.query.set = vim.treesitter.set_query +end + require "config" require "alpha.globals" diff --git a/lazy-lock.json b/lazy-lock.json index 148f851..4eb14d4 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,7 +1,7 @@ { "Comment.nvim": { "branch": "master", "commit": "8d3aa5c22c2d45e788c7a5fe13ad77368b783c20" }, "LuaSnip": { "branch": "master", "commit": "500981ff6cefc7343e3959ef0f939bd0bfd49ba9" }, - "NeoColumn.nvim": { "branch": "main", "commit": "9cdfa8213a9d89aa0ab64a855d1136fccf369e28" }, + "NeoColumn.nvim": { "branch": "main", "commit": "566afd9caf0045e379f62782e9d375353118429b" }, "SmoothCursor.nvim": { "branch": "main", "commit": "b61173fb107455f18099715b88d86002579f2736" }, "catppuccin": { "branch": "main", "commit": "73587f9c454da81679202f1668c30fea6cdafd5e" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, @@ -14,7 +14,7 @@ "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, "color-picker.nvim": { "branch": "master", "commit": "e23de39cff3babdc97c39ae79bb68fedf1a1fe00" }, - "dressing.nvim": { "branch": "master", "commit": "c705b3890779ea05bd910e9d06af8a209bfb6ad8" }, + "dressing.nvim": { "branch": "master", "commit": "91b9ba8a9474d2c4156dc2f3e858e07ae8faecf0" }, "fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" }, "fzf.vim": { "branch": "master", "commit": "dc71692255b62d1f67dc55c8e51ab1aa467b1d46" }, "git-worktree.nvim": { "branch": "master", "commit": "d7f4e2584e81670154f07ca9fa5dd791d9c1b458" }, @@ -26,44 +26,44 @@ "lazy.nvim": { "branch": "main", "commit": "57cce98dfdb2f2dd05a0567d89811e6d0505e13b" }, "lsp-inlayhints.nvim": { "branch": "main", "commit": "84ca3abe8aaecbb5b30ad89e4701d4a9c821b72c" }, "lspkind-nvim": { "branch": "master", "commit": "c68b3a003483cf382428a43035079f78474cd11e" }, - "lualine.nvim": { "branch": "master", "commit": "c28a7427c3fb29322db136f0564ec58807b26747" }, + "lualine.nvim": { "branch": "master", "commit": "84ffb80e452d95e2c46fa29a98ea11a240f7843e" }, "markdown-preview.nvim": { "branch": "main", "commit": "cc05a30393e2bf9f12e2d59fc35a1aa928ed1727" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "b64fdede85fd5e0b720ce722919e0a9b95ed6547" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "a8d5db8f227b9b236d1c54a9c6234bc033825ce7" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "a6c4d7df448a78b0a05fd2065bef11ed52bee51c" }, - "mason.nvim": { "branch": "main", "commit": "e57d9bd671adce24970480a194690d207e2a141d" }, + "mason.nvim": { "branch": "main", "commit": "2311d9d883eb709ad9979a726a38c5ce1343b63c" }, "neogen": { "branch": "main", "commit": "9c17225aac94bdbf93baf16e1b2d2c6dcffb0901" }, "null-ls.nvim": { "branch": "main", "commit": "5855128178fa78293acdfb5b4e41ef046779240b" }, - "nvim-autopairs": { "branch": "master", "commit": "0fd6519d44eac3a6736aafdb3fe9da916c3701d4" }, + "nvim-autopairs": { "branch": "master", "commit": "7470af886ffb3df32800e5ef9c072a6cd825770d" }, "nvim-cmp": { "branch": "main", "commit": "777450fd0ae289463a14481673e26246b5e38bf2" }, "nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" }, - "nvim-dap": { "branch": "master", "commit": "1dd02e82c77d558e30ba831db4c2e7ed534e874f" }, + "nvim-dap": { "branch": "master", "commit": "debd7c2f80eaf20c5f5df25db8d8c1b9b18f4421" }, "nvim-dap-go": { "branch": "main", "commit": "b4ded7de579b4e2a85c203388233b54bf1028816" }, - "nvim-dap-ui": { "branch": "master", "commit": "56a2df0e96bfa64ebd6967e7cad877a1530633d5" }, + "nvim-dap-ui": { "branch": "master", "commit": "286f682f366fbc652b38dff893569374e9433dd3" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "9dc45a6eb33871f4c5cb2ba08fa307467657471e" }, "nvim-dap-vscode-js": { "branch": "main", "commit": "03bd29672d7fab5e515fc8469b7d07cc5994bbf6" }, - "nvim-lspconfig": { "branch": "master", "commit": "7179a46c2345050783d14397e672e7b152a7af4f" }, + "nvim-lspconfig": { "branch": "master", "commit": "27e9e1d2638ffd133b06f314a49ac55825cb1017" }, "nvim-notify": { "branch": "master", "commit": "50d037041ada0895aeba4c0215cde6d11b7729c4" }, "nvim-projectconfig": { "branch": "master", "commit": "05fd34831e170db269d1b84597615bcdcdde930e" }, "nvim-spectre": { "branch": "master", "commit": "6e5ce371f93625c7dc43f5e2647d3647f2ea15e2" }, "nvim-transparent": { "branch": "main", "commit": "2d8d650fc8a3b8da6a01031295547295eb473b7d" }, - "nvim-treesitter": { "branch": "master", "commit": "411e771d511442ab81670701f5c830f6c74aadd7" }, + "nvim-treesitter": { "branch": "master", "commit": "fa9fe9a95ba481e26e11eede4657f8c5350a0eaa" }, "nvim-treesitter-refactor": { "branch": "master", "commit": "65ad2eca822dfaec2a3603119ec3cc8826a7859e" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "b55fe6175f0001347a433c9df358c8cbf8a4e90f" }, - "nvim-various-textobjs": { "branch": "main", "commit": "a717bd2c30d352d98e3a2e5aea9f14b570954a70" }, - "nvim-web-devicons": { "branch": "master", "commit": "0568104bf8d0c3ab16395433fcc5c1638efc25d4" }, + "nvim-various-textobjs": { "branch": "main", "commit": "b0ec67f8d06f03b5e84aa90eac96f6153100c963" }, + "nvim-web-devicons": { "branch": "master", "commit": "f16ec8f6e5d23e4349501dae46e0a661918e086e" }, "phpactor.nvim": { "branch": "main", "commit": "013d9727c983bd4f0f8b3b25b77f3afb9e1eb98e" }, - "playground": { "branch": "master", "commit": "4044b53c4d4fcd7a78eae20b8627f78ce7dc6f56" }, + "playground": { "branch": "master", "commit": "934cb4c4adc2e7f4f351846a63c9532018c996ed" }, "plenary.nvim": { "branch": "master", "commit": "253d34830709d690f013daf2853a9d21ad7accab" }, "popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" }, "refactoring.nvim": { "branch": "master", "commit": "e7c40818b2995016ede93c5620055206b1aba44f" }, "rest.nvim": { "branch": "main", "commit": "0fdb69f328529b34a2279c14be63b3325dc52740" }, - "smart-splits.nvim": { "branch": "master", "commit": "a39f98d40152aa293c55ab00d4730842da12cfe8" }, + "smart-splits.nvim": { "branch": "master", "commit": "68a7fedd4032d230fea11dfe4f2e7409b3a01345" }, "telescope-dap.nvim": { "branch": "master", "commit": "313d2ea12ae59a1ca51b62bf01fc941a983d9c9c" }, "telescope-file-browser.nvim": { "branch": "master", "commit": "e0fcb12702ad0d2873544a31730f9aaef04fd032" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "580b6c48651cabb63455e97d7e131ed557b8c7e2" }, "telescope-fzy-native.nvim": { "branch": "master", "commit": "282f069504515eec762ab6d6c89903377252bf5b" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "62ea5e58c7bbe191297b983a9e7e89420f581369" }, - "telescope.nvim": { "branch": "master", "commit": "942fe5faef47b21241e970551eba407bc10d9547" }, + "telescope.nvim": { "branch": "master", "commit": "7141515a7cabde46449675a403ed564416363887" }, "todo-comments.nvim": { "branch": "main", "commit": "8febc60a76feefd8203077ef78b6a262ea1a41f9" }, "trouble.nvim": { "branch": "main", "commit": "2ae7237c2917d661f458443c9a88680f8ca2d7b2" }, "vim-blade": { "branch": "master", "commit": "9534101808cc320eef003129a40cab04b026a20c" }, diff --git a/lua/alpha/lsp/attach.lua b/lua/alpha/lsp/attach.lua index d9f32bf..45ce904 100644 --- a/lua/alpha/lsp/attach.lua +++ b/lua/alpha/lsp/attach.lua @@ -8,11 +8,11 @@ local filetype_attach = setmetatable({}, { return function(client, bufnr) local filetype = vim.api.nvim_buf_get_option(0, "filetype") -- keymaps for lsp - vim.keymap.set("n", "K", vim.lsp.buf.hover, { buffer = 0 }) - vim.keymap.set("n", "<leader>vrn", vim.lsp.buf.rename, { buffer = 0 }) - vim.keymap.set("i", "<c-h>", vim.lsp.buf.signature_help, { buffer = 0 }) - vim.keymap.set("n", "<leader>vo", ":LspRestart<cr>", { noremap = true }) - vim.keymap.set({ "n", "v" }, "<leader>vca", vim.lsp.buf.code_action, {}) + vim.keymap.set("n", "K", vim.lsp.buf.hover, { buffer = 0, desc = "LSP Help information of symbol under the cursor" }) + vim.keymap.set("n", "<leader>vrn", vim.lsp.buf.rename, { buffer = 0, desc = "LSP Rename symbol under cursor" }) + vim.keymap.set("i", "<c-h>", vim.lsp.buf.signature_help, { buffer = 0, desc = "LSP Signature help" }) + vim.keymap.set("n", "<leader>vo", ":LspRestart<cr>", { noremap = true, desc = "LSP Restart Server" }) + vim.keymap.set({ "n", "v" }, "<leader>vca", vim.lsp.buf.code_action, { buffer = 0, desc = "LSP Code actions" }) vim.keymap.set("n", "<leader>vf", function() return vim.lsp.buf.format { async = true, @@ -20,12 +20,12 @@ return function(client, bufnr) return cli.name ~= "lua_ls" end, } - end, {}) + end, { buffer = 0, desc = "LSP format file" }) - telescope_mapper("gr", "lsp_references", nil, true) - telescope_mapper("<leader>pv", "find_symbol", nil, true) - telescope_mapper("<leader>pd", "lsp_document_symbols", nil, true) - telescope_mapper("<c-]>", "lsp_definitions", nil, true) + telescope_mapper("gr", "lsp_references", { buffer = true, desc = "LSP References of symbol on cursor" }) + telescope_mapper("<leader>pv", "find_symbol", { buffer = true, desc = "LSP find symbol on the project" }) + telescope_mapper("<leader>pd", "lsp_document_symbols", { buffer = true, desc = "LSP document symbols" }) + telescope_mapper("<c-]>", "lsp_definitions", { buffer = true, desc = "LSP go to definition" }) vim.bo.omnifunc = "v:lua.vim.lsp.omnifunc" diff --git a/lua/alpha/lsp/null-ls.lua b/lua/alpha/lsp/null-ls.lua index 0a4443a..2c4c3bc 100644 --- a/lua/alpha/lsp/null-ls.lua +++ b/lua/alpha/lsp/null-ls.lua @@ -4,7 +4,7 @@ local php_actions = require "php-code-actions" null_ls.setup { sources = { - null_ls.builtins.code_actions.gitsigns, + -- null_ls.builtins.code_actions.gitsigns, null_ls.builtins.formatting.jq, null_ls.builtins.code_actions.refactoring, null_ls.builtins.formatting.alejandra, @@ -32,7 +32,7 @@ null_ls.setup { }, } -vim.keymap.set({ "n", "v" }, "<leader>vca", vim.lsp.buf.code_action, {}) +vim.keymap.set({ "n", "v" }, "<leader>vca", vim.lsp.buf.code_action, {desc = "LSP (null ls) Code actions"}) vim.keymap.set("n", "<leader>vf", function() return vim.lsp.buf.format { async = true } -end, {}) +end, {desc = "LSP (null ls) Format file"}) diff --git a/lua/alpha/php/gateway.lua b/lua/alpha/php/gateway.lua index 614c4f2..07fad33 100644 --- a/lua/alpha/php/gateway.lua +++ b/lua/alpha/php/gateway.lua @@ -49,7 +49,7 @@ end --- @param bufnr integer Buff id gateway.get_graphql_definitions = function(bufnr) - vim.treesitter.set_query( + vim.treesitter.query.set( "yaml", "GraphQL_endpoints", [[ @@ -69,7 +69,7 @@ gateway.get_graphql_definitions = function(bufnr) ]] ) - local query = vim.treesitter.get_query("yaml", "GraphQL_endpoints") + local query = vim.treesitter.query.get("yaml", "GraphQL_endpoints") local elements = {} diff --git a/lua/alpha/snips/ft/go.lua b/lua/alpha/snips/ft/go.lua index 637f57d..9c3977f 100644 --- a/lua/alpha/snips/ft/go.lua +++ b/lua/alpha/snips/ft/go.lua @@ -13,11 +13,6 @@ local ts_utils = require "nvim-treesitter.ts_utils" local get_node_text = vim.treesitter.get_node_text -if vim.fn.has "nvim-0.9.0" ~= 1 then - vim.treesitter.query.get = vim.treesitter.get_query - vim.treesitter.query.set = vim.treesitter.set_query -end - vim.treesitter.query.set( "go", "LuaSnip_Result", @@ -88,7 +83,7 @@ local function go_result_type(info) end end - local query = vim.treesitter.query.get_query("go", "LuaSnip_Result") + local query = vim.treesitter.query.get("go", "LuaSnip_Result") for _, node in query:iter_captures(function_node, 0) do if handlers[node:type()] then return handlers[node:type()](node, info) diff --git a/lua/alpha/telescope/actions.lua b/lua/alpha/telescope/actions.lua index c7cdaa8..b0e9f10 100644 --- a/lua/alpha/telescope/actions.lua +++ b/lua/alpha/telescope/actions.lua @@ -9,8 +9,9 @@ M.create_plugin = function(prompt_bufnr) vim.cmd(string.format("edit ~/.config/nvim/lua/plugins/%s.lua", new_plugin)) end + local get_disable_stm_node = function(bufnr, tree) - vim.treesitter.set_query( + vim.treesitter.query.set( "lua", "alpha_plugin_is_disabled", [[ @@ -27,7 +28,7 @@ local get_disable_stm_node = function(bufnr, tree) ]] ) - local query = vim.treesitter.get_query("lua", "alpha_plugin_is_disabled") + local query = vim.treesitter.query.get("lua", "alpha_plugin_is_disabled") for id, node in query:iter_captures(tree:root(), bufnr) do if query.captures[id] == "enabled" then @@ -39,7 +40,7 @@ local get_disable_stm_node = function(bufnr, tree) end local get_enabled_node = function(bufnr, tree) - vim.treesitter.set_query( + vim.treesitter.query.set( "lua", "alpha_plugin_has_enable_property", [[ @@ -55,7 +56,7 @@ local get_enabled_node = function(bufnr, tree) ]] ) - local query = vim.treesitter.get_query("lua", "alpha_plugin_has_enable_property") + local query = vim.treesitter.query.get("lua", "alpha_plugin_has_enable_property") for id, node in query:iter_captures(tree:root(), bufnr) do if query.captures[id] == "enabled" then @@ -67,7 +68,7 @@ local get_enabled_node = function(bufnr, tree) end local get_return_node = function(bufnr, tree) - vim.treesitter.set_query( + vim.treesitter.query.set( "lua", "alpha_plugin_return_table_constructor", [[ @@ -79,7 +80,7 @@ local get_return_node = function(bufnr, tree) ]] ) - local query = vim.treesitter.get_query("lua", "alpha_plugin_return_table_constructor") + local query = vim.treesitter.query.get("lua", "alpha_plugin_return_table_constructor") for id, node in query:iter_captures(tree:root(), bufnr) do if query.captures[id] == "table_constructor" then diff --git a/lua/alpha/telescope/init.lua b/lua/alpha/telescope/init.lua index 28397b0..70ef47f 100644 --- a/lua/alpha/telescope/init.lua +++ b/lua/alpha/telescope/init.lua @@ -84,7 +84,7 @@ function M.find_symbol() end function M.my_plugins() - if vim.fn.isdirectory "~/code/plugins/" == 0 then + if vim.fn.isdirectory(vim.fn.getenv "HOME" .. "/code/plugins/") == 0 then vim.notify("Directory ~/code/plugins does not exists", vim.log.levels.WARN, { title = "Telescope Mappings" }) return end @@ -98,11 +98,11 @@ function M.scratchs() prompt_title = "Scratchs", no_ignore = true, cwd = "~/.config/nvim/lua/scratchs/", - attach_mappings = function (_, map) + attach_mappings = function(_, map) map("i", "<c-t>", my_actions.create_scratch_file) return true - end + end, } end diff --git a/lua/alpha/telescope/mappings.lua b/lua/alpha/telescope/mappings.lua index be59eaf..4843731 100644 --- a/lua/alpha/telescope/mappings.lua +++ b/lua/alpha/telescope/mappings.lua @@ -1,44 +1,50 @@ -TelescopeMapArgs = TelescopeMapArgs or {} - -local map_tele = function(key, f, options, buffer, mode) - mode = mode or "n" +local map_tele = function(key, f, opts) + local default = { + mode = "n", + options = {}, + buffer = nil, + desc = nil, + } + opts = opts or {} + opts = vim.tbl_deep_extend("force", default, opts or {}) local rhs = function() - R("alpha.telescope")[f](options or {}) + R("alpha.telescope")[f](opts.options) end local map_options = { remap = false, silent = true, } - if buffer then - map_options.buffer = buffer + if opts.buffer then + map_options.buffer = opts.buffer + end + if opts.desc then + map_options.desc = "Telescope: " .. opts.desc end - vim.keymap.set(mode, key, rhs, map_options) + vim.keymap.set(opts.mode, key, rhs, map_options) end -- not shure what this line does vim.api.nvim_set_keymap("c", "<c-r><c-r>", "<Plug>(TelescopeFuzzyCommandSearch)", { noremap = false, nowait = true }) -map_tele("<leader>pp", "project_files") -map_tele("<leader>gc", "branches") -map_tele("<leader>pw", "grep_word") -map_tele("<leader>ps", "grep_string") -map_tele("<leader>pf", "projectionist") -map_tele("<leader>rc", "search_config") -map_tele("<leader>rn", "find_nvim_config") -map_tele("<leader>rp", "find_nvim_plugin") -map_tele("<leader>rs", "scratchs") -map_tele("<leader>ph", "help_tags") -map_tele("<leader>pe", "buffers") -map_tele("<leader>pr", "treesitter") -map_tele("<leader>bb", "file_browser_relative") -map_tele("<leader>bp", "file_browser") -map_tele("<leader>gs", "git_status") -map_tele("<leader>ve", "diagnostics") -map_tele("<leader>fp", "my_plugins") -map_tele("<leader>po", "api_specs") -map_tele("<leader>pm", "gateway") +map_tele("<leader>pp", "project_files", { desc = "Open Project files" }) +map_tele("<leader>gc", "branches", { desc = "Git Branches selector" }) +map_tele("<leader>pw", "grep_word", { desc = "Grep word under cursor" }) +map_tele("<leader>ps", "grep_string", { desc = "Grep provided input string" }) +map_tele("<leader>rc", "search_config", { desc = "Search Files in .dotfiles directory" }) +map_tele("<leader>rn", "find_nvim_config", { desc = "Search Files in nvim config directory" }) +map_tele("<leader>rp", "find_nvim_plugin", { desc = "Search Neovim plugins" }) +map_tele("<leader>rs", "scratchs", { desc = "Search Neovim Scratchs files" }) +map_tele("<leader>ph", "help_tags", { desc = "Neovim Help" }) +map_tele("<leader>pe", "buffers", { desc = "Open buffers" }) +map_tele("<leader>pr", "treesitter", { desc = "Treesitter buffer elements" }) +map_tele("<leader>bb", "file_browser_relative", { desc = "Current directory" }) +map_tele("<leader>bp", "file_browser", { desc = "Project directory" }) +map_tele("<leader>gs", "git_status", { desc = "Git status" }) +map_tele("<leader>ve", "diagnostics", { desc = "Diagnostic of the buffer" }) +map_tele("<leader>po", "api_specs", { desc = "Openapi directory" }) +map_tele("<leader>pm", "gateway", { desc = "Graphql mutations and queries" }) return map_tele diff --git a/lua/alpha/utils.lua b/lua/alpha/utils.lua index b1202d6..ee80a1c 100644 --- a/lua/alpha/utils.lua +++ b/lua/alpha/utils.lua @@ -1,21 +1,21 @@ local M = {} M.save_and_exec = function() - local source_commands = { - lua = "luafi %", - vim = "source %", - } - - local ft = vim.api.nvim_buf_get_option(0, "filetype") - local command = source_commands[ft] - if command == nil then - vim.notify("This type cant not be sourced", vim.log.levels.ERROR, { title = "Alpha Developer" }) - return - end + -- local source_commands = { + -- lua = "luafi %", + -- vim = "source %", + -- } + -- + -- local ft = vim.api.nvim_buf_get_option(0, "filetype") + -- local command = source_commands[ft] + -- if command == nil then + -- vim.notify("This type cant not be sourced", vim.log.levels.ERROR, { title = "Alpha Developer" }) + -- return + -- end -- Save and source vim.api.nvim_command "silent w" - vim.api.nvim_command(command) + vim.api.nvim_command "so" local current_file_name = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(0), ":t") vim.notify(string.format("File %s Sourced", current_file_name), vim.log.levels.INFO, { title = "Alpha Developer" }) diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua index ae03444..39831ed 100644 --- a/lua/config/keymaps.lua +++ b/lua/config/keymaps.lua @@ -4,36 +4,33 @@ map("v", "<leader>p", function() local val = vim.fn.getreg '"' vim.api.nvim_command [[normal! p]] vim.fn.setreg('"', val) -end) +end, { desc = "Special paste, paste without replacing copy register content" }) -map("n", "<leader>bd", ":bd!<CR>") +map("n", "<leader>bd", ":bd!<CR>", { desc = "Deletes the current buffer" }) -- lists navigation -map("n", "<leader>j", ":cnext<CR>zz") -map("n", "<leader>k", ":cprev<CR>zz") -map("n", "<leader>i", ":lnext<CR>zz") -map("n", "<leader>o", ":lprev<CR>zz") -map("n", "<leader>cc", ":cclose<CR>") - --- quick split -map("n", "<leader>wsv", ":vsp<CR>") +map("n", "<C-j>", ":cnext<CR>zz", { desc = "Goes to the next item in the quickfixlist and center to the screen" }) +map("n", "<C-k>", ":cprev<CR>zz", { desc = "Goes to the previous item in the quickfixlist and center to the screen" }) +-- map("n", "<leader>i", ":lnext<CR>zz") +-- map("n", "<leader>o", ":lprev<CR>zz") +map("n", "<leader>cc", ":cclose<CR>", { desc = "Close the quick fix list" }) -- tabulation -map("v", "<", "<gv") -map("v", ">", ">gv") +map("v", "<", "<gv", { desc = "Indent out and keeps the selection" }) +map("v", ">", ">gv", { desc = "Indent in and keeps the selection" }) -- symbols to add undo points local symbols = { ",", ".", "!", "?", "$", ">", "<" } for _, symbol in pairs(symbols) do - map("i", symbol, symbol .. "<c-g>u") + map("i", symbol, symbol .. "<c-g>u", { desc = string.format("Add symbol %s to the undo list and writes it", symbol) }) end -- search result focus -map("n", "n", "nzzzv") -map("n", "N", "Nzzzv") +map("n", "n", "nzzzv", { desc = "Goes to next result on the search and put the cursor in the middle of the screen" }) +map("n", "N", "Nzzzv", { desc = "Goes to prev result on the search and put the cursor in the middle of the screen" }) -- join lines focus -map("n", "J", "mzJ`z") +map("n", "J", "mzJ`z", { desc = "Join lines and keep in the same place the cursor" }) -- Terminal map("t", "<Esc><Esc>", "<C-\\><C-n>") @@ -43,10 +40,15 @@ map("t", "<C-w>k", "<C-\\><C-n><C-w>k") map("t", "<C-w>l", "<C-\\><C-n><C-w>l") -- quick env file edit -map("n", "<leader>ee", ":vsp .env<CR>") +map("n", "<leader>ee", ":vsp .env<CR>", { desc = "Open .env file in a vertical split" }) -- quick save and exec -map("n", "<leader><leader>x", require("alpha.utils").save_and_exec) - -map("n", "<leader>vn", vim.diagnostic.goto_next, {}) -map("n", "<leader>vp", vim.diagnostic.goto_prev, {}) +map( + "n", + "<leader><leader>x", + require("alpha.utils").save_and_exec, + { desc = "Save the current file and source it for .vim and .lua files" } +) + +map("n", "<leader>vn", vim.diagnostic.goto_next, { desc = "Goes to next diagnostic error" }) +map("n", "<leader>vp", vim.diagnostic.goto_prev, { desc = "Goes to prev diagnostic error" }) diff --git a/lua/plugins/color-picker.lua b/lua/plugins/color-picker.lua index 482103f..1e6c88b 100644 --- a/lua/plugins/color-picker.lua +++ b/lua/plugins/color-picker.lua @@ -1,7 +1,7 @@ return { "ziontee113/color-picker.nvim", keys = { - {"<C-c>", "<cmd>PickColorInsert<cr>", mode = "i"}, + { "<C-c>", "<cmd>PickColorInsert<cr>", mode = "i", desc = "ColorPicker" }, }, config = true, } diff --git a/lua/plugins/comment.lua b/lua/plugins/comment.lua index 84de2ba..801223b 100644 --- a/lua/plugins/comment.lua +++ b/lua/plugins/comment.lua @@ -1,5 +1,5 @@ return { "numToStr/Comment.nvim", - keys = { { "gcc" }, { "gbc" }, { "gc", mode = "v" }, { "gb", mode = "v" } }, + keys = { { "gcc", desc = "Comment current line" }, { "gc", mode = "v", desc = "Comment selected text" } }, config = true, } diff --git a/lua/plugins/dap.lua b/lua/plugins/dap.lua index cdcdf85..a6582a6 100644 --- a/lua/plugins/dap.lua +++ b/lua/plugins/dap.lua @@ -9,7 +9,7 @@ return { "nvim-telescope/telescope-dap.nvim", "rcarriga/cmp-dap", }, - keys = { { "<leader>d" } }, + keys = { { "<leader>d", desc = "Open Debug menu" } }, config = function() require "alpha.dap" local ok_telescope, telescope = pcall(require, "telescope") diff --git a/lua/plugins/database.lua b/lua/plugins/database.lua index c6ed7ea..5c0bddf 100644 --- a/lua/plugins/database.lua +++ b/lua/plugins/database.lua @@ -5,7 +5,7 @@ return { "kristijanhusak/vim-dadbod-completion", "tpope/vim-dotenv", }, - keys = { { "<leader><leader>db", ":tab DBUI<cr>" } }, + keys = { { "<leader><leader>db", ":tab DBUI<cr>", desc = "Open Database client" } }, init = function() require "alpha.database" end, diff --git a/lua/plugins/easy-align.lua b/lua/plugins/easy-align.lua index 6e14908..7d33478 100644 --- a/lua/plugins/easy-align.lua +++ b/lua/plugins/easy-align.lua @@ -1,4 +1,4 @@ return { "junegunn/vim-easy-align", - keys = { { "ga", "<Plug>(EasyAlign)", mode = { "n", "v" } } }, + keys = { { "ga", "<Plug>(EasyAlign)", mode = { "n", "v" }, desc = "EasyAlign" } }, } diff --git a/lua/plugins/fugitive.lua b/lua/plugins/fugitive.lua index 10df419..4698d40 100644 --- a/lua/plugins/fugitive.lua +++ b/lua/plugins/fugitive.lua @@ -1,10 +1,10 @@ return { "tpope/vim-fugitive", keys = { - { "<leader>ga", ":Git fetch --all -p<cr>" }, - { "<leader>gl", ":Git pull<cr>" }, - { "<leader>gdh", ":diffget //2<cr>" }, - { "<leader>gdl", ":diffget //3<cr>" }, + { "<leader>ga", ":Git fetch --all -p<cr>", desc = "Git fetch" }, + { "<leader>gl", ":Git pull<cr>", desc = "Git pull" }, + { "<leader>gdh", ":diffget //2<cr>", desc = "Git diff grab from left" }, + { "<leader>gdl", ":diffget //3<cr>", desc = "Git diff grab from right" }, }, cmd = { "G", "Git" }, } diff --git a/lua/plugins/harpoon.lua b/lua/plugins/harpoon.lua index 06ec2aa..a214924 100644 --- a/lua/plugins/harpoon.lua +++ b/lua/plugins/harpoon.lua @@ -7,6 +7,7 @@ table.insert(keys, { function() require("harpoon.ui").toggle_quick_menu() end, + desc = "Harpoon Menu", }) table.insert(keys, { @@ -14,15 +15,17 @@ table.insert(keys, { function() require("harpoon.mark").add_file() end, + desc = "Harpoon Add file", }) table.insert(keys, { "<leader>st", - function () - vim.api.nvim_command([[vsplit]]) + function() + vim.api.nvim_command [[vsplit]] require("harpoon.term").gotoTerminal(1) - vim.api.nvim_command([[startinsert]]) - end + vim.api.nvim_command [[startinsert]] + end, + desc = "Harpoon quick split Terminal", }) for i = 1, terms do @@ -31,6 +34,7 @@ for i = 1, terms do function() require("harpoon.term").gotoTerminal(i) end, + desc = "Harpoon go to terminal " .. i, }) end @@ -40,6 +44,7 @@ for i = 1, binds do function() require("harpoon.ui").nav_file(i) end, + desc = "Harpoon go to file " .. i, }) end diff --git a/lua/plugins/icon-picker.lua b/lua/plugins/icon-picker.lua index e9f1e94..a466b6a 100644 --- a/lua/plugins/icon-picker.lua +++ b/lua/plugins/icon-picker.lua @@ -1,9 +1,9 @@ return { "ziontee113/icon-picker.nvim", keys = { - { "<Leader><Leader>i", "<cmd>IconPickerNormal nerd_font<cr>", mode = "n" }, - { "<Leader><Leader>y", "<cmd>IconPickerYank nerd_font<cr>", mode = "n" }, - { "<C-o>", "<cmd>IconPickerInsert nerd_font<cr>", mode = "i" }, + { "<Leader><Leader>i", "<cmd>IconPickerNormal nerd_font<cr>", mode = "n", desc = "IconPicker NerdFont Insert" }, + { "<Leader><Leader>y", "<cmd>IconPickerYank nerd_font<cr>", mode = "n", desc = "IconPicker NerdFont Yank" }, + { "<C-o>", "<cmd>IconPickerInsert nerd_font<cr>", mode = "i", desc = "IconPicker NerdFont Insert mode" }, }, opts = { disable_legacy_commands = true }, } diff --git a/lua/plugins/laravel.lua b/lua/plugins/laravel.lua index b236e54..b87b12b 100644 --- a/lua/plugins/laravel.lua +++ b/lua/plugins/laravel.lua @@ -6,8 +6,8 @@ return { }, cmd = { "Sail", "Artisan", "Composer", "Npm", "Laravel" }, keys = { - { "<leader>la", ":Laravel artisan<cr>" }, - { "<leader>lr", ":Laravel routes<cr>" }, + { "<leader>la", ":Laravel artisan<cr>", desc = "Laravel Application Commands" }, + { "<leader>lr", ":Laravel routes<cr>", desc = "Laravel Application Routes" }, }, config = function() vim.g.laravel_log_level = " |