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
1 changed files with 72 additions and 72 deletions

View File

@ -5,63 +5,63 @@ local M = {}
M.general = {
i = {
-- go to beginning and end
["<C-b>"] = { "<ESC>^i", "beginning of line" },
["<C-e>"] = { "<End>", "end of line" },
["<C-b>"] = { "<ESC>^i", "Beginning of line" },
["<C-e>"] = { "<End>", "End of line" },
-- navigate within insert mode
["<C-h>"] = { "<Left>", "move left" },
["<C-l>"] = { "<Right>", "move right" },
["<C-j>"] = { "<Down>", "move down" },
["<C-k>"] = { "<Up>", "move up" },
["<C-h>"] = { "<Left>", "Move left" },
["<C-l>"] = { "<Right>", "Move right" },
["<C-j>"] = { "<Down>", "Move down" },
["<C-k>"] = { "<Up>", "Move up" },
},
n = {
["<Esc>"] = { ":noh <CR>", "clear highlights" },
["<Esc>"] = { ":noh <CR>", "Clear highlights" },
-- switch between windows
["<C-h>"] = { "<C-w>h", "window left" },
["<C-l>"] = { "<C-w>l", "window right" },
["<C-j>"] = { "<C-w>j", "window down" },
["<C-k>"] = { "<C-w>k", "window up" },
["<C-h>"] = { "<C-w>h", "Window left" },
["<C-l>"] = { "<C-w>l", "Window right" },
["<C-j>"] = { "<C-w>j", "Window down" },
["<C-k>"] = { "<C-w>k", "Window up" },
-- save
["<C-s>"] = { "<cmd> w <CR>", "save file" },
["<C-s>"] = { "<cmd> w <CR>", "Save file" },
-- Copy all
["<C-c>"] = { "<cmd> %y+ <CR>", "copy whole file" },
["<C-c>"] = { "<cmd> %y+ <CR>", "Copy whole file" },
-- line numbers
["<leader>n"] = { "<cmd> set nu! <CR>", "toggle line number" },
["<leader>rn"] = { "<cmd> set rnu! <CR>", "toggle relative number" },
["<leader>n"] = { "<cmd> set nu! <CR>", "Toggle line number" },
["<leader>rn"] = { "<cmd> set rnu! <CR>", "Toggle relative number" },
-- 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/
-- 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
["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 } },
["<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 } },
["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 } },
["<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 } },
-- new buffer
["<leader>b"] = { "<cmd> enew <CR>", "new buffer" },
["<leader>b"] = { "<cmd> enew <CR>", "New buffer" },
["<leader>ch"] = { "<cmd> NvCheatsheet <CR>", "Mapping cheatsheet" },
},
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 = {
["<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 } },
["<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 } },
},
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<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()
require("nvchad_ui.tabufline").tabuflineNext()
end,
"goto next buffer",
"Goto next buffer",
},
["<S-tab>"] = {
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 = {
["<leader>/"] = {
"<ESC><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<CR>",
"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",
},
["<leader>ls"] = {
function()
vim.lsp.buf.signature_help()
end,
"lsp signature_help",
"LSP signature help",
},
["<leader>D"] = {
function()
vim.lsp.buf.type_definition()
end,
"lsp definition type",
"LSP definition type",
},
["<leader>ra"] = {
function()
require("nvchad_ui.renamer").open()
end,
"lsp rename",
"LSP rename",
},
["<leader>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",
},
["<leader>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",
},
["<leader>q"] = {
function()
vim.diagnostic.setloclist()
end,
"diagnostic setloclist",
"Diagnostic setloclist",
},
["<leader>fm"] = {
function()
vim.lsp.buf.format { async = true }
end,
"lsp formatting",
"LSP formatting",
},
["<leader>wa"] = {
function()
vim.lsp.buf.add_workspace_folder()
end,
"add workspace folder",
"Add workspace folder",
},
["<leader>wr"] = {
function()
vim.lsp.buf.remove_workspace_folder()
end,
"remove workspace folder",
"Remove workspace folder",
},
["<leader>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
["<C-n>"] = { "<cmd> NvimTreeToggle <CR>", "toggle nvimtree" },
["<C-n>"] = { "<cmd> NvimTreeToggle <CR>", "Toggle nvimtree" },
-- focus
["<leader>e"] = { "<cmd> NvimTreeFocus <CR>", "focus nvimtree" },
["<leader>e"] = { "<cmd> NvimTreeFocus <CR>", "Focus nvimtree" },
},
}
@ -259,23 +259,23 @@ M.telescope = {
n = {
-- find
["<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>fw"] = { "<cmd> Telescope live_grep <CR>", "live grep" },
["<leader>fb"] = { "<cmd> Telescope buffers <CR>", "find buffers" },
["<leader>fh"] = { "<cmd> Telescope help_tags <CR>", "help page" },
["<leader>fo"] = { "<cmd> Telescope oldfiles <CR>", "find oldfiles" },
["<leader>fz"] = { "<cmd> Telescope current_buffer_fuzzy_find <CR>", "find in current buffer" },
["<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>fw"] = { "<cmd> Telescope live_grep <CR>", "Live grep" },
["<leader>fb"] = { "<cmd> Telescope buffers <CR>", "Find buffers" },
["<leader>fh"] = { "<cmd> Telescope help_tags <CR>", "Help page" },
["<leader>fo"] = { "<cmd> Telescope oldfiles <CR>", "Find oldfiles" },
["<leader>fz"] = { "<cmd> Telescope current_buffer_fuzzy_find <CR>", "Find in current buffer" },
-- git
["<leader>cm"] = { "<cmd> Telescope git_commits <CR>", "git commits" },
["<leader>gt"] = { "<cmd> Telescope git_status <CR>", "git status" },
["<leader>cm"] = { "<cmd> Telescope git_commits <CR>", "Git commits" },
["<leader>gt"] = { "<cmd> Telescope git_status <CR>", "Git status" },
-- pick a hidden term
["<leader>pt"] = { "<cmd> Telescope terms <CR>", "pick hidden term" },
["<leader>pt"] = { "<cmd> Telescope terms <CR>", "Pick hidden term" },
-- 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()
require("nvterm.terminal").toggle "float"
end,
"toggle floating term",
"Toggle floating term",
},
["<A-h>"] = {
function()
require("nvterm.terminal").toggle "horizontal"
end,
"toggle horizontal term",
"Toggle horizontal term",
},
["<A-v>"] = {
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",
},
["<A-h>"] = {
function()
require("nvterm.terminal").toggle "horizontal"
end,
"toggle horizontal term",
"Toggle horizontal term",
},
["<A-v>"] = {
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",
},
["<leader>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",
},
["<leader>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",
},
},
}