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
This commit is contained in:
Lexey Khom 2023-05-13 12:58:50 +03:00 committed by GitHub
parent e1631629b9
commit 699aeaa442
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,63 +5,63 @@ local M = {}
M.general = { M.general = {
i = { i = {
-- go to beginning and end -- go to beginning and end
["<C-b>"] = { "<ESC>^i", "beginning of line" }, ["<C-b>"] = { "<ESC>^i", "Beginning of line" },
["<C-e>"] = { "<End>", "end of line" }, ["<C-e>"] = { "<End>", "End of line" },
-- navigate within insert mode -- navigate within insert mode
["<C-h>"] = { "<Left>", "move left" }, ["<C-h>"] = { "<Left>", "Move left" },
["<C-l>"] = { "<Right>", "move right" }, ["<C-l>"] = { "<Right>", "Move right" },
["<C-j>"] = { "<Down>", "move down" }, ["<C-j>"] = { "<Down>", "Move down" },
["<C-k>"] = { "<Up>", "move up" }, ["<C-k>"] = { "<Up>", "Move up" },
}, },
n = { n = {
["<Esc>"] = { ":noh <CR>", "clear highlights" }, ["<Esc>"] = { ":noh <CR>", "Clear highlights" },
-- switch between windows -- switch between windows
["<C-h>"] = { "<C-w>h", "window left" }, ["<C-h>"] = { "<C-w>h", "Window left" },
["<C-l>"] = { "<C-w>l", "window right" }, ["<C-l>"] = { "<C-w>l", "Window right" },
["<C-j>"] = { "<C-w>j", "window down" }, ["<C-j>"] = { "<C-w>j", "Window down" },
["<C-k>"] = { "<C-w>k", "window up" }, ["<C-k>"] = { "<C-w>k", "Window up" },
-- save -- save
["<C-s>"] = { "<cmd> w <CR>", "save file" }, ["<C-s>"] = { "<cmd> w <CR>", "Save file" },
-- Copy all -- Copy all
["<C-c>"] = { "<cmd> %y+ <CR>", "copy whole file" }, ["<C-c>"] = { "<cmd> %y+ <CR>", "Copy whole file" },
-- line numbers -- line numbers
["<leader>n"] = { "<cmd> set nu! <CR>", "toggle line number" }, ["<leader>n"] = { "<cmd> set nu! <CR>", "Toggle line number" },
["<leader>rn"] = { "<cmd> set rnu! <CR>", "toggle relative number" }, ["<leader>rn"] = { "<cmd> set rnu! <CR>", "Toggle relative number" },
-- Allow moving the cursor through wrapped lines with j, k, <Up> and <Down> -- Allow moving the cursor through wrapped lines with j, k, <Up> and <Down>
-- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/ -- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/
-- empty mode is same as using <cmd> :map -- empty mode is same as using <cmd> :map
-- also don't use g[j|k] when in operator pending mode, so it doesn't alter d, y or c behaviour -- 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 } }, ["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 } }, ["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move up", opts = { expr = true } },
["<Up>"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "move up", opts = { expr = true } }, ["<Up>"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move up", opts = { expr = true } },
["<Down>"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "move down", opts = { expr = true } }, ["<Down>"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } },
-- new buffer -- new buffer
["<leader>b"] = { "<cmd> enew <CR>", "new buffer" }, ["<leader>b"] = { "<cmd> enew <CR>", "New buffer" },
["<leader>ch"] = { "<cmd> NvCheatsheet <CR>", "Mapping cheatsheet" }, ["<leader>ch"] = { "<cmd> NvCheatsheet <CR>", "Mapping cheatsheet" },
}, },
t = { t = {
["<C-x>"] = { vim.api.nvim_replace_termcodes("<C-\\><C-N>", true, true, true), "escape terminal mode" }, ["<C-x>"] = { vim.api.nvim_replace_termcodes("<C-\\><C-N>", true, true, true), "Escape terminal mode" },
}, },
v = { v = {
["<Up>"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "move up", opts = { expr = true } }, ["<Up>"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move up", opts = { expr = true } },
["<Down>"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "move down", opts = { expr = true } }, ["<Down>"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } },
}, },
x = { x = {
["j"] = { '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 } }, ["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 -- 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 -- https://vim.fandom.com/wiki/Replace_a_word_with_yanked_text#Alternative_mapping_for_paste
["p"] = { 'p:let @+=@0<CR>:let @"=@0<CR>', "dont copy replaced text", opts = { silent = true } }, ["p"] = { 'p:let @+=@0<CR>:let @"=@0<CR>', "Dont copy replaced text", opts = { silent = true } },
}, },
} }
@ -74,14 +74,14 @@ M.tabufline = {
function() function()
require("nvchad_ui.tabufline").tabuflineNext() require("nvchad_ui.tabufline").tabuflineNext()
end, end,
"goto next buffer", "Goto next buffer",
}, },
["<S-tab>"] = { ["<S-tab>"] = {
function() function()
require("nvchad_ui.tabufline").tabuflinePrev() require("nvchad_ui.tabufline").tabuflinePrev()
end, end,
"goto prev buffer", "Goto prev buffer",
}, },
-- close buffer + hide terminal buffer -- close buffer + hide terminal buffer
@ -89,7 +89,7 @@ M.tabufline = {
function() function()
require("nvchad_ui.tabufline").close_buffer() require("nvchad_ui.tabufline").close_buffer()
end, end,
"close buffer", "Close buffer",
}, },
}, },
} }
@ -103,14 +103,14 @@ M.comment = {
function() function()
require("Comment.api").toggle.linewise.current() require("Comment.api").toggle.linewise.current()
end, end,
"toggle comment", "Toggle comment",
}, },
}, },
v = { v = {
["<leader>/"] = { ["<leader>/"] = {
"<ESC><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<CR>", "<ESC><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<CR>",
"toggle comment", "Toggle comment",
}, },
}, },
} }
@ -125,119 +125,119 @@ M.lspconfig = {
function() function()
vim.lsp.buf.declaration() vim.lsp.buf.declaration()
end, end,
"lsp declaration", "LSP declaration",
}, },
["gd"] = { ["gd"] = {
function() function()
vim.lsp.buf.definition() vim.lsp.buf.definition()
end, end,
"lsp definition", "LSP definition",
}, },
["K"] = { ["K"] = {
function() function()
vim.lsp.buf.hover() vim.lsp.buf.hover()
end, end,
"lsp hover", "LSP hover",
}, },
["gi"] = { ["gi"] = {
function() function()
vim.lsp.buf.implementation() vim.lsp.buf.implementation()
end, end,
"lsp implementation", "LSP implementation",
}, },
["<leader>ls"] = { ["<leader>ls"] = {
function() function()
vim.lsp.buf.signature_help() vim.lsp.buf.signature_help()
end, end,
"lsp signature_help", "LSP signature help",
}, },
["<leader>D"] = { ["<leader>D"] = {
function() function()
vim.lsp.buf.type_definition() vim.lsp.buf.type_definition()
end, end,
"lsp definition type", "LSP definition type",
}, },
["<leader>ra"] = { ["<leader>ra"] = {
function() function()
require("nvchad_ui.renamer").open() require("nvchad_ui.renamer").open()
end, end,
"lsp rename", "LSP rename",
}, },
["<leader>ca"] = { ["<leader>ca"] = {
function() function()
vim.lsp.buf.code_action() vim.lsp.buf.code_action()
end, end,
"lsp code_action", "LSP code action",
}, },
["gr"] = { ["gr"] = {
function() function()
vim.lsp.buf.references() vim.lsp.buf.references()
end, end,
"lsp references", "LSP references",
}, },
["<leader>f"] = { ["<leader>f"] = {
function() function()
vim.diagnostic.open_float { border = "rounded" } vim.diagnostic.open_float { border = "rounded" }
end, end,
"floating diagnostic", "Floating diagnostic",
}, },
["[d"] = { ["[d"] = {
function() function()
vim.diagnostic.goto_prev() vim.diagnostic.goto_prev()
end, end,
"goto prev", "Goto prev",
}, },
["]d"] = { ["]d"] = {
function() function()
vim.diagnostic.goto_next() vim.diagnostic.goto_next()
end, end,
"goto_next", "Goto next",
}, },
["<leader>q"] = { ["<leader>q"] = {
function() function()
vim.diagnostic.setloclist() vim.diagnostic.setloclist()
end, end,
"diagnostic setloclist", "Diagnostic setloclist",
}, },
["<leader>fm"] = { ["<leader>fm"] = {
function() function()
vim.lsp.buf.format { async = true } vim.lsp.buf.format { async = true }
end, end,
"lsp formatting", "LSP formatting",
}, },
["<leader>wa"] = { ["<leader>wa"] = {
function() function()
vim.lsp.buf.add_workspace_folder() vim.lsp.buf.add_workspace_folder()
end, end,
"add workspace folder", "Add workspace folder",
}, },
["<leader>wr"] = { ["<leader>wr"] = {
function() function()
vim.lsp.buf.remove_workspace_folder() vim.lsp.buf.remove_workspace_folder()
end, end,
"remove workspace folder", "Remove workspace folder",
}, },
["<leader>wl"] = { ["<leader>wl"] = {
function() function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders())) print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, end,
"list workspace folders", "List workspace folders",
}, },
}, },
} }
@ -247,10 +247,10 @@ M.nvimtree = {
n = { n = {
-- toggle -- toggle
["<C-n>"] = { "<cmd> NvimTreeToggle <CR>", "toggle nvimtree" }, ["<C-n>"] = { "<cmd> NvimTreeToggle <CR>", "Toggle nvimtree" },
-- focus -- focus
["<leader>e"] = { "<cmd> NvimTreeFocus <CR>", "focus nvimtree" }, ["<leader>e"] = { "<cmd> NvimTreeFocus <CR>", "Focus nvimtree" },
}, },
} }
@ -259,23 +259,23 @@ M.telescope = {
n = { n = {
-- find -- find
["<leader>ff"] = { "<cmd> Telescope find_files <CR>", "find files" }, ["<leader>ff"] = { "<cmd> Telescope find_files <CR>", "Find files" },
["<leader>fa"] = { "<cmd> Telescope find_files follow=true no_ignore=true hidden=true <CR>", "find all" }, ["<leader>fa"] = { "<cmd> Telescope find_files follow=true no_ignore=true hidden=true <CR>", "Find all" },
["<leader>fw"] = { "<cmd> Telescope live_grep <CR>", "live grep" }, ["<leader>fw"] = { "<cmd> Telescope live_grep <CR>", "Live grep" },
["<leader>fb"] = { "<cmd> Telescope buffers <CR>", "find buffers" }, ["<leader>fb"] = { "<cmd> Telescope buffers <CR>", "Find buffers" },
["<leader>fh"] = { "<cmd> Telescope help_tags <CR>", "help page" }, ["<leader>fh"] = { "<cmd> Telescope help_tags <CR>", "Help page" },
["<leader>fo"] = { "<cmd> Telescope oldfiles <CR>", "find oldfiles" }, ["<leader>fo"] = { "<cmd> Telescope oldfiles <CR>", "Find oldfiles" },
["<leader>fz"] = { "<cmd> Telescope current_buffer_fuzzy_find <CR>", "find in current buffer" }, ["<leader>fz"] = { "<cmd> Telescope current_buffer_fuzzy_find <CR>", "Find in current buffer" },
-- git -- git
["<leader>cm"] = { "<cmd> Telescope git_commits <CR>", "git commits" }, ["<leader>cm"] = { "<cmd> Telescope git_commits <CR>", "Git commits" },
["<leader>gt"] = { "<cmd> Telescope git_status <CR>", "git status" }, ["<leader>gt"] = { "<cmd> Telescope git_status <CR>", "Git status" },
-- pick a hidden term -- pick a hidden term
["<leader>pt"] = { "<cmd> Telescope terms <CR>", "pick hidden term" }, ["<leader>pt"] = { "<cmd> Telescope terms <CR>", "Pick hidden term" },
-- theme switcher -- theme switcher
["<leader>th"] = { "<cmd> Telescope themes <CR>", "nvchad themes" }, ["<leader>th"] = { "<cmd> Telescope themes <CR>", "Nvchad themes" },
}, },
} }
@ -288,21 +288,21 @@ M.nvterm = {
function() function()
require("nvterm.terminal").toggle "float" require("nvterm.terminal").toggle "float"
end, end,
"toggle floating term", "Toggle floating term",
}, },
["<A-h>"] = { ["<A-h>"] = {
function() function()
require("nvterm.terminal").toggle "horizontal" require("nvterm.terminal").toggle "horizontal"
end, end,
"toggle horizontal term", "Toggle horizontal term",
}, },
["<A-v>"] = { ["<A-v>"] = {
function() function()
require("nvterm.terminal").toggle "vertical" require("nvterm.terminal").toggle "vertical"
end, end,
"toggle vertical term", "Toggle vertical term",
}, },
}, },
@ -312,21 +312,21 @@ M.nvterm = {
function() function()
require("nvterm.terminal").toggle "float" require("nvterm.terminal").toggle "float"
end, end,
"toggle floating term", "Toggle floating term",
}, },
["<A-h>"] = { ["<A-h>"] = {
function() function()
require("nvterm.terminal").toggle "horizontal" require("nvterm.terminal").toggle "horizontal"
end, end,
"toggle horizontal term", "Toggle horizontal term",
}, },
["<A-v>"] = { ["<A-v>"] = {
function() function()
require("nvterm.terminal").toggle "vertical" require("nvterm.terminal").toggle "vertical"
end, end,
"toggle vertical term", "Toggle vertical term",
}, },
-- new -- new
@ -334,14 +334,14 @@ M.nvterm = {
function() function()
require("nvterm.terminal").new "horizontal" require("nvterm.terminal").new "horizontal"
end, end,
"new horizontal term", "New horizontal term",
}, },
["<leader>v"] = { ["<leader>v"] = {
function() function()
require("nvterm.terminal").new "vertical" require("nvterm.terminal").new "vertical"
end, end,
"new vertical term", "New vertical term",
}, },
}, },
} }
@ -354,14 +354,14 @@ M.whichkey = {
function() function()
vim.cmd "WhichKey" vim.cmd "WhichKey"
end, end,
"which-key all keymaps", "Which-key all keymaps",
}, },
["<leader>wk"] = { ["<leader>wk"] = {
function() function()
local input = vim.fn.input "WhichKey: " local input = vim.fn.input "WhichKey: "
vim.cmd("WhichKey " .. input) vim.cmd("WhichKey " .. input)
end, end,
"which-key query lookup", "Which-key query lookup",
}, },
}, },
} }
@ -383,7 +383,7 @@ M.blankline = {
end end
end, end,
"Jump to current_context", "Jump to current context",
}, },
}, },
} }