From 699aeaa44203b62003da8aacd838a5bdac4c2d46 Mon Sep 17 00:00:00 2001 From: Lexey Khom <92052116+LexeyKhom@users.noreply.github.com> Date: Sat, 13 May 2023 12:58:50 +0300 Subject: [PATCH] style(mappings): One style for descriptions (#2018) * style(mappings.lua): Abbreviations in Upper case (like "LSP") * style(mappings.lua): One description style - Sentence case Only the first word of a sentence and proper nouns are capitalized, with the rest of the words in lowercase. * style(mappings.lua): Replase "_" to " " in descriptions --- lua/core/mappings.lua | 144 +++++++++++++++++++++--------------------- 1 file changed, 72 insertions(+), 72 deletions(-) diff --git a/lua/core/mappings.lua b/lua/core/mappings.lua index 8fbbf22..b06bdc9 100644 --- a/lua/core/mappings.lua +++ b/lua/core/mappings.lua @@ -5,63 +5,63 @@ local M = {} M.general = { i = { -- go to beginning and end - [""] = { "^i", "beginning of line" }, - [""] = { "", "end of line" }, + [""] = { "^i", "Beginning of line" }, + [""] = { "", "End of line" }, -- navigate within insert mode - [""] = { "", "move left" }, - [""] = { "", "move right" }, - [""] = { "", "move down" }, - [""] = { "", "move up" }, + [""] = { "", "Move left" }, + [""] = { "", "Move right" }, + [""] = { "", "Move down" }, + [""] = { "", "Move up" }, }, n = { - [""] = { ":noh ", "clear highlights" }, + [""] = { ":noh ", "Clear highlights" }, -- switch between windows - [""] = { "h", "window left" }, - [""] = { "l", "window right" }, - [""] = { "j", "window down" }, - [""] = { "k", "window up" }, + [""] = { "h", "Window left" }, + [""] = { "l", "Window right" }, + [""] = { "j", "Window down" }, + [""] = { "k", "Window up" }, -- save - [""] = { " w ", "save file" }, + [""] = { " w ", "Save file" }, -- Copy all - [""] = { " %y+ ", "copy whole file" }, + [""] = { " %y+ ", "Copy whole file" }, -- line numbers - ["n"] = { " set nu! ", "toggle line number" }, - ["rn"] = { " set rnu! ", "toggle relative number" }, + ["n"] = { " set nu! ", "Toggle line number" }, + ["rn"] = { " set rnu! ", "Toggle relative number" }, -- Allow moving the cursor through wrapped lines with j, k, and -- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/ -- empty mode is same as using :map -- also don't use g[j|k] when in operator pending mode, so it doesn't alter d, y or c behaviour - ["j"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "move down", opts = { expr = true } }, - ["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "move up", opts = { expr = true } }, - [""] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "move up", opts = { expr = true } }, - [""] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "move down", opts = { expr = true } }, + ["j"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } }, + ["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move up", opts = { expr = true } }, + [""] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move up", opts = { expr = true } }, + [""] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } }, -- new buffer - ["b"] = { " enew ", "new buffer" }, + ["b"] = { " enew ", "New buffer" }, ["ch"] = { " NvCheatsheet ", "Mapping cheatsheet" }, }, t = { - [""] = { vim.api.nvim_replace_termcodes("", true, true, true), "escape terminal mode" }, + [""] = { vim.api.nvim_replace_termcodes("", true, true, true), "Escape terminal mode" }, }, v = { - [""] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "move up", opts = { expr = true } }, - [""] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "move down", opts = { expr = true } }, + [""] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move up", opts = { expr = true } }, + [""] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } }, }, x = { - ["j"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "move down", opts = { expr = true } }, - ["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "move up", opts = { expr = true } }, + ["j"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } }, + ["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move up", opts = { expr = true } }, -- Don't copy the replaced text after pasting in visual mode -- https://vim.fandom.com/wiki/Replace_a_word_with_yanked_text#Alternative_mapping_for_paste - ["p"] = { 'p:let @+=@0:let @"=@0', "dont copy replaced text", opts = { silent = true } }, + ["p"] = { 'p:let @+=@0:let @"=@0', "Dont copy replaced text", opts = { silent = true } }, }, } @@ -74,14 +74,14 @@ M.tabufline = { function() require("nvchad_ui.tabufline").tabuflineNext() end, - "goto next buffer", + "Goto next buffer", }, [""] = { function() require("nvchad_ui.tabufline").tabuflinePrev() end, - "goto prev buffer", + "Goto prev buffer", }, -- close buffer + hide terminal buffer @@ -89,7 +89,7 @@ M.tabufline = { function() require("nvchad_ui.tabufline").close_buffer() end, - "close buffer", + "Close buffer", }, }, } @@ -103,14 +103,14 @@ M.comment = { function() require("Comment.api").toggle.linewise.current() end, - "toggle comment", + "Toggle comment", }, }, v = { ["/"] = { "lua require('Comment.api').toggle.linewise(vim.fn.visualmode())", - "toggle comment", + "Toggle comment", }, }, } @@ -125,119 +125,119 @@ M.lspconfig = { function() vim.lsp.buf.declaration() end, - "lsp declaration", + "LSP declaration", }, ["gd"] = { function() vim.lsp.buf.definition() end, - "lsp definition", + "LSP definition", }, ["K"] = { function() vim.lsp.buf.hover() end, - "lsp hover", + "LSP hover", }, ["gi"] = { function() vim.lsp.buf.implementation() end, - "lsp implementation", + "LSP implementation", }, ["ls"] = { function() vim.lsp.buf.signature_help() end, - "lsp signature_help", + "LSP signature help", }, ["D"] = { function() vim.lsp.buf.type_definition() end, - "lsp definition type", + "LSP definition type", }, ["ra"] = { function() require("nvchad_ui.renamer").open() end, - "lsp rename", + "LSP rename", }, ["ca"] = { function() vim.lsp.buf.code_action() end, - "lsp code_action", + "LSP code action", }, ["gr"] = { function() vim.lsp.buf.references() end, - "lsp references", + "LSP references", }, ["f"] = { function() vim.diagnostic.open_float { border = "rounded" } end, - "floating diagnostic", + "Floating diagnostic", }, ["[d"] = { function() vim.diagnostic.goto_prev() end, - "goto prev", + "Goto prev", }, ["]d"] = { function() vim.diagnostic.goto_next() end, - "goto_next", + "Goto next", }, ["q"] = { function() vim.diagnostic.setloclist() end, - "diagnostic setloclist", + "Diagnostic setloclist", }, ["fm"] = { function() vim.lsp.buf.format { async = true } end, - "lsp formatting", + "LSP formatting", }, ["wa"] = { function() vim.lsp.buf.add_workspace_folder() end, - "add workspace folder", + "Add workspace folder", }, ["wr"] = { function() vim.lsp.buf.remove_workspace_folder() end, - "remove workspace folder", + "Remove workspace folder", }, ["wl"] = { function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, - "list workspace folders", + "List workspace folders", }, }, } @@ -247,10 +247,10 @@ M.nvimtree = { n = { -- toggle - [""] = { " NvimTreeToggle ", "toggle nvimtree" }, + [""] = { " NvimTreeToggle ", "Toggle nvimtree" }, -- focus - ["e"] = { " NvimTreeFocus ", "focus nvimtree" }, + ["e"] = { " NvimTreeFocus ", "Focus nvimtree" }, }, } @@ -259,23 +259,23 @@ M.telescope = { n = { -- find - ["ff"] = { " Telescope find_files ", "find files" }, - ["fa"] = { " Telescope find_files follow=true no_ignore=true hidden=true ", "find all" }, - ["fw"] = { " Telescope live_grep ", "live grep" }, - ["fb"] = { " Telescope buffers ", "find buffers" }, - ["fh"] = { " Telescope help_tags ", "help page" }, - ["fo"] = { " Telescope oldfiles ", "find oldfiles" }, - ["fz"] = { " Telescope current_buffer_fuzzy_find ", "find in current buffer" }, + ["ff"] = { " Telescope find_files ", "Find files" }, + ["fa"] = { " Telescope find_files follow=true no_ignore=true hidden=true ", "Find all" }, + ["fw"] = { " Telescope live_grep ", "Live grep" }, + ["fb"] = { " Telescope buffers ", "Find buffers" }, + ["fh"] = { " Telescope help_tags ", "Help page" }, + ["fo"] = { " Telescope oldfiles ", "Find oldfiles" }, + ["fz"] = { " Telescope current_buffer_fuzzy_find ", "Find in current buffer" }, -- git - ["cm"] = { " Telescope git_commits ", "git commits" }, - ["gt"] = { " Telescope git_status ", "git status" }, + ["cm"] = { " Telescope git_commits ", "Git commits" }, + ["gt"] = { " Telescope git_status ", "Git status" }, -- pick a hidden term - ["pt"] = { " Telescope terms ", "pick hidden term" }, + ["pt"] = { " Telescope terms ", "Pick hidden term" }, -- theme switcher - ["th"] = { " Telescope themes ", "nvchad themes" }, + ["th"] = { " Telescope themes ", "Nvchad themes" }, }, } @@ -288,21 +288,21 @@ M.nvterm = { function() require("nvterm.terminal").toggle "float" end, - "toggle floating term", + "Toggle floating term", }, [""] = { function() require("nvterm.terminal").toggle "horizontal" end, - "toggle horizontal term", + "Toggle horizontal term", }, [""] = { function() require("nvterm.terminal").toggle "vertical" end, - "toggle vertical term", + "Toggle vertical term", }, }, @@ -312,21 +312,21 @@ M.nvterm = { function() require("nvterm.terminal").toggle "float" end, - "toggle floating term", + "Toggle floating term", }, [""] = { function() require("nvterm.terminal").toggle "horizontal" end, - "toggle horizontal term", + "Toggle horizontal term", }, [""] = { function() require("nvterm.terminal").toggle "vertical" end, - "toggle vertical term", + "Toggle vertical term", }, -- new @@ -334,14 +334,14 @@ M.nvterm = { function() require("nvterm.terminal").new "horizontal" end, - "new horizontal term", + "New horizontal term", }, ["v"] = { function() require("nvterm.terminal").new "vertical" end, - "new vertical term", + "New vertical term", }, }, } @@ -354,14 +354,14 @@ M.whichkey = { function() vim.cmd "WhichKey" end, - "which-key all keymaps", + "Which-key all keymaps", }, ["wk"] = { function() local input = vim.fn.input "WhichKey: " vim.cmd("WhichKey " .. input) end, - "which-key query lookup", + "Which-key query lookup", }, }, } @@ -383,7 +383,7 @@ M.blankline = { end end, - "Jump to current_context", + "Jump to current context", }, }, }