From 88fa706b7545018196f5e8ce82c54e63a14c1209 Mon Sep 17 00:00:00 2001 From: Ismo Vuorinen Date: Tue, 25 Jun 2024 09:53:48 +0300 Subject: [PATCH] chore(docs): update nvim keybindings --- docs/nvim-keybindings.md | 448 +++++++++++++++++---------------- scripts/create-nvim-keymaps.sh | 23 ++ 2 files changed, 254 insertions(+), 217 deletions(-) create mode 100755 scripts/create-nvim-keymaps.sh diff --git a/docs/nvim-keybindings.md b/docs/nvim-keybindings.md index e2c4c45..9d32b87 100644 --- a/docs/nvim-keybindings.md +++ b/docs/nvim-keybindings.md @@ -1,220 +1,234 @@ # nvim keybindings +```txt + +n * nohlsearch +n zg * :Rg + FZF: search with rg (aka live grep). +n zm * :Maps + FZF: search mappings. +n zh * :History + FZF: search history of opened files +n zb * :Buffers + FZF: search open buffers. +n zt * :Windows + FZF: search open tabs. +n zc * :Commands + FZF: search commands. +n zf * :FZF + FZF: search for files in given path. +n tc * CloakToggle + Toggle Cloak + f * + [F]ormat buffer +n 1 * + harpoon to file 1 +n xn * + harpoon to next file +n xN * + harpoon to previous file +n xa * + harpoon quick menu +n xA * + harpoon file +n 5 * + harpoon to file 5 +n 4 * + harpoon to file 4 +n 3 * + harpoon to file 3 +n 2 * + harpoon to file 2 +n tz * + Toggle ZenMode +n e * +n qq * wq! + Quickly Quit +n bq * + Open diagnostic [Q]uickfix list +n be * + Show diagnostic [E]rror messages +x # * + :help v_#-default +o % (MatchitOperationForward) +x % (MatchitVisualForward) +n % (MatchitNormalForward) +n & * :&& + :help &-default +x * * + :help v_star-default +x @ * mode() == 'V' ? ':normal! @'.getcharstr().'' : '@' + :help v_@-default +x Q * mode() == 'V' ? ':normal! @=reg_recorded()' : 'Q' + :help v_Q-default +n Y * y$ + :help Y-default +o [% (MatchitOperationMultiBackward) +x [% (MatchitVisualMultiBackward) +n [% (MatchitNormalMultiBackward) +n [d * + Jump to the previous diagnostic +o ]% (MatchitOperationMultiForward) +x ]% (MatchitVisualMultiForward) +n ]% (MatchitNormalMultiForward) +n ]d * + Jump to the next diagnostic +x a% (MatchitVisualTextObject) +o al + Around last textobject +o an + Around next textobject +x al + Around last textobject +x an + Around next textobject +o a + Around textobject +x a + Around textobject +n dj * + Go to next [D]iagnostic message +n dk * + Go to previous [D]iagnostic message +o g% (MatchitOperationBackward) +x g% (MatchitVisualBackward) +n g% (MatchitNormalBackward) +o g] + Move to right "around" +x g] + Move to right "around" +n g] + Move to right "around" +o g[ + Move to left "around" +x g[ + Move to left "around" +n g[ + Move to left "around" +n gcA * + Comment insert end of line +n gcO * + Comment insert above +n gco * + Comment insert below +x gb * (comment_toggle_blockwise_visual) + Comment toggle blockwise (visual) +n gbc * + Comment toggle current block +n gb * (comment_toggle_blockwise) + Comment toggle blockwise +o gc * + Comment textobject +n gcc * + Comment toggle current line +x gc * (comment_toggle_linewise_visual) + Comment toggle linewise (visual) +n gc * (comment_toggle_linewise) + Comment toggle linewise +x gx * + Opens filepath or URI under cursor with the system handler (file explorer, web browser, …) +n gx * + Opens filepath or URI under cursor with the system handler (file explorer, web browser, …) +o il + Inside last textobject +o in + Inside next textobject +x il + Inside last textobject +x in + Inside next textobject +o i + Inside textobject +x i + Inside textobject +n shn * + Highlight next surrounding +n sFn * + Find next left surrounding +n sfn * + Find next right surrounding +n srn * + Replace next surrounding +n sdn * + Delete next surrounding +n shl * + Highlight previous surrounding +n sFl * + Find previous left surrounding +n sfl * + Find previous right surrounding +n srl * + Replace previous surrounding +n sdl * + Delete previous surrounding +x sa * :lua MiniSurround.add('visual') + Add surrounding to selection +n sn * + Update `MiniSurround.config.n_lines` +n sh * + Highlight surrounding +n sF * + Find left surrounding +n sf * + Find right surrounding +n sr * + Replace surrounding +n sd * + Delete surrounding +n sa * + Add surrounding +x (MatchitVisualTextObject) (MatchitVisualMultiBackward)o(MatchitVisualMultiForward) +o (MatchitOperationMultiForward) * :call matchit#MultiMatch("W", "o") +o (MatchitOperationMultiBackward) * :call matchit#MultiMatch("bW", "o") +x (MatchitVisualMultiForward) * :call matchit#MultiMatch("W", "n")m'gv`` +x (MatchitVisualMultiBackward) * :call matchit#MultiMatch("bW", "n")m'gv`` +n (MatchitNormalMultiForward) * :call matchit#MultiMatch("W", "n") +n (MatchitNormalMultiBackward) * :call matchit#MultiMatch("bW", "n") +o (MatchitOperationBackward) * :call matchit#Match_wrapper('',0,'o') +o (MatchitOperationForward) * :call matchit#Match_wrapper('',1,'o') +x (MatchitVisualBackward) * :call matchit#Match_wrapper('',0,'v')m'gv`` +x (MatchitVisualForward) * :call matchit#Match_wrapper('',1,'v'):if col("''") != col("$") | exe ":normal! m'" | endifgv`` +n (MatchitNormalBackward) * :call matchit#Match_wrapper('',0,'n') +n (MatchitNormalForward) * :call matchit#Match_wrapper('',1,'n') +n PlenaryTestFile * :lua require('plenary.test_harness').test_file(vim.fn.expand("%:p")) +n * :Files + FZF: search for files starting at current directory. +o (fzf-maps-o) * :call fzf#vim#maps('o', 0) +x (fzf-maps-x) * :call fzf#vim#maps('x', 0) +n (fzf-maps-n) * :call fzf#vim#maps('n', 0) +n (fzf-normal) * +n (fzf-insert) * i +x (comment_toggle_blockwise_visual) * lua require("Comment.api").locked("toggle.blockwise")(vim.fn.visualmode()) + Comment toggle blockwise (visual) +x (comment_toggle_linewise_visual) * lua require("Comment.api").locked("toggle.linewise")(vim.fn.visualmode()) + Comment toggle linewise (visual) +n (comment_toggle_blockwise_count) * + Comment toggle blockwise with count +n (comment_toggle_linewise_count) * + Comment toggle linewise with count +n (comment_toggle_blockwise_current) * + Comment toggle current block +n (comment_toggle_linewise_current) * + Comment toggle current line +n (comment_toggle_blockwise) * + Comment toggle blockwise +n (comment_toggle_linewise) * + Comment toggle linewise +n * +n * w + Save file +n * +n * +n * +n * echo "Use j to move!!" +n * echo "Use k to move!!" +n * echo "Use l to move!!" +n * echo "Use h to move!!" +n d + Show diagnostics under the cursor +n d * + Show diagnostics under the cursor +n * ``` -n ! * lua require("which-key").show("!", {mode = "n", auto = true}) -n ' * lua require("which-key").show("'", {mode = "n", auto = true}) -n " * lua require("which-key").show("\"", {mode = "n", auto = true}) -n [ * lua require("which-key").show("[", {mode = "n", auto = true}) -n [b * Previous buffer -n [g * Previous Git hunk -n [t * Previous tab -n ] * lua require("which-key").show("]", {mode = "n", auto = true}) -n ]b * Next buffer -n ]g * Next Git hunk -n ]t * Next tab -n @ * lua require("which-key").show("@", {mode = "n", auto = true}) -n \ * split Horizontal Split -n & * :&& Nvim builtin -n `* lua require("which-key").show("`", {mode = "n", auto = true}) -n < * lua require("which-key").show("<", {mode = "n", auto = true}) -n Move buffer tab left -n * ToggleTerm Toggle terminal -n * Resize split down -n * Move to left split -n * Move to below split -n * Move to above split -n * Move to right split -n * Resize split left -n * Goto next mark -n * Goto previous mark -n * q! Force quit -n * Resize split right -n * w! Force write -n * Resize split up -n * lua require("which-key").show("\23", {mode = "n", auto = true}) -n *@ -n * Debugger: Step Over -n * Debugger: Step Into -n * Debugger: Stop -n * Debugger: Conditional Breakpoint -n * Debugger: Step Out -n * Debugger: Restart -n * Debugger: Start -n * Debugger: Pause -n * ToggleTerm Toggle terminal -n * Debugger: Toggle Breakpoint -n *@ -n PlenaryTestFile *:lua require('plenary.test_harness').test_directory(vim.fn.expand("%:p")) -n * lua require("which-key").show(" ", {mode = "n", auto = true}) -n / * Comment line -n * Harpoon -n a * Add file -n e * Toggle quick menu -n j * Goto to TMUX tmux window -n m * Show marks in Telescope -n t * Goto to terminal window -n a * Annotation -n a * Current -n ac * Class -n af * Function -n aF * File -n at * Type -n b\ * Horizontal split buffer from tabline -n b| * Vertical split buffer from tabline -n bb * Select buffer from tabline -n bC * Close all buffers -n bc * Close all buffers except current -n bd * Delete buffer from tabline -n bD * Pick to close -n bl * Close all buffers to the left -n bn * tabnew New tab -n br * Close all buffers to the right -n bse * Sort by extension (buffers) -n bsi * Sort by buffer number (buffers) -n bsm * Sort by modification (buffers) -n bsp * Sort by full path (buffers) -n bsr * Sort by relative path (buffers) -n C * Force close buffer -n c * Close buffer -n dB * Clear Breakpoints -n db * Toggle Breakpoint (F9) -n dC * Conditional Breakpoint (S-F9) -n dc * Start/Continue (F5) -n dE * Evaluate Input -n dh * Debugger Hover -n di * Step Into (F11) -n dO * Step Out (S-F11) -n do * Step Over (F10) -n dp * Pause (F6) -n dQ * Terminate Session (S-F5) -n dq * Close Session -n dR * Toggle REPL -n dr * Restart (C-F5) -n ds * Run To Cursor -n du * Toggle Debugger UI -n e * Neotree toggle Toggle Explorer -n f' * Find marks -n f * Resume previous search -n fa * Find AstroNvim config files -n fb * Find buffers -n fC * Find commands -n fc * Find for word under cursor -n fF * Find all files -n ff * Find files -n fh * Find help -n fk * Find keymaps -n fm * Find man -n fn * Find notifications -n fo * Find history -n fr * Find registers -n ft * Find themes -n fW * Find words in all files -n fw * Find words -n gb * Git branches -n gc * Git commits -n gd * View Git diff -n gg * ToggleTerm lazygit -n gh * Reset Git hunk -n gL * View full Git blame -n gl * View Git blame -n gp * Preview Git hunk -n gr * Reset Git buffer -n gS * Stage Git buffer -n gs * Stage Git hunk -n gt * Git status -n gu * Unstage Git hunk -n h * Home Screen -n lD * Search diagnostics -n ls * Search symbols -n lS * Symbols outline -n n * enew New File -n o * Toggle Explorer Focus -n p * lua require("which-key").show(" p", {mode = "n", auto = true}) -n pA * AstroUpdate AstroNvim Update -n pa * AstroUpdatePackages Update Plugins and Mason -n pi * Plugins Install -n pl * AstroChangelog AstroNvim Changelog -n pm * Mason Mason Installer -n pM * MasonUpdateAll Mason Update -n pS * Plugins Sync -n ps * Plugins Status -n pU * Plugins Update -n pu * Plugins Check Updates -n pv * AstroVersion AstroNvim Version -n q * confirm q Quit -n s * Search / Replace -n S. * SessionManager! load_current_dir_session Load current directory session -n Sd * SessionManager! delete_session Delete session -n Sf * SessionManager! load_session Search sessions -n sf * Spectre (current file) -n Sl * SessionManager! load_last_session Load last session -n Ss * SessionManager! save_current_session Save this session -n ss * Spectre -n tf * ToggleTerm direction=float ToggleTerm float -n th * ToggleTerm size=10 direction=horizontal ToggleTerm horizontal split -n tl * ToggleTerm lazygit -n tn * ToggleTerm node -n tp * ToggleTerm python -n tt * ToggleTerm btm -n tu * ToggleTerm gdu -n tv * ToggleTerm size=80 direction=vertical ToggleTerm vertical split -n ua * Toggle autopairs -n ub * Toggle background -n uC * ColorizerToggle Toggle color highlight -n uc * Toggle autocompletion -n ud * Toggle diagnostics -n ug * Toggle signcolumn -n uh * Toggle foldcolumn -n ui * Change indent setting -n ul * Toggle statusline -n uL * Toggle CodeLens -n uN * Toggle UI notifications -n un * Change line numbering -n up * Toggle paste mode -n uS * Toggle conceal -n us * Toggle spellcheck -n uT * TransparentToggle Toggle transparency -n ut * Toggle tabline -n uu * Toggle URL highlight -n uw * Toggle wrap -n uy * Toggle syntax highlight -n w * w Save -n x * Trouble -n xl * Location List (Trouble) -n xq * Quickfix List (Trouble) -n xX * Workspace Diagnostics (Trouble) -n xx * Document Diagnostics (Trouble) -n > * lua require("which-key").show(">", {mode = "n", auto = true}) -n >b * Move buffer tab right -n | * vsplit Vertical Split -n c * lua require("which-key").show("c", {mode = "n", auto = true}) -n d * lua require("which-key").show("d", {mode = "n", auto = true}) -n g * lua require("which-key").show("g", {mode = "n", auto = true}) -n gb * Comment toggle blockwise -n gc * Comment toggle linewise -n gx * Open the file under cursor with system app -n j * v:count == 0 ? 'gj' : 'j' Move cursor down -n k * v:count == 0 ? 'gk' : 'k' Move cursor up -n v * lua require("which-key").show("v", {mode = "n", auto = true}) -n y * lua require("which-key").show("y", {mode = "n", auto = true}) -n Y * y$ Nvim builtin -n z * lua require("which-key").show("z", {mode = "n", auto = true}) -n zM * Close all folds -n zm * Fold more -n zp * Peek fold -n zr * Fold less -n zR * Open all folds -v * >gv indent line -v * / * lua require('Comment.api').toggle.linewise(vim.fn.visualmode()) Toggle comment line -v dE * Evaluate Input -v gb * Comment toggle blockwise -v gc * Comment toggle linewise -x " * lua require("which-key").show("\"", {mode = "v", auto = true}) -x ** y/\V" Nvim builtin -x # * y?\V" Nvim builtin -x * lua require("which-key").show(" ", {mode = "v", auto = true}) -x s * Search / Replace -x sw * Spectre (current word) -x g * lua require("which-key").show("g", {mode = "v", auto = true}) -``` + +- Generated on Tue 25 Jun 2024 09:49:41 EEST diff --git a/scripts/create-nvim-keymaps.sh b/scripts/create-nvim-keymaps.sh new file mode 100755 index 0000000..4995569 --- /dev/null +++ b/scripts/create-nvim-keymaps.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# Create file containing key mappings for Neovim +# Usage: ./create-nvim-keymaps.sh + +source "$HOME/.dotfiles/scripts/shared.sh" +source "$HOME/.dotfiles/config/exports" +source "$HOME/.dotfiles/config/alias" +source "$HOME/.dotfiles/config/functions" + +DEST="$HOME/.dotfiles/docs/nvim-keybindings.md" + +{ + printf "# nvim keybindings\n"; + printf "\n"; + printf "\`\`\`txt"; +} > "$DEST" + +NVIM_APPNAME="nvim-kickstart" nvim -c "redir! >> $DEST" -c 'silent verbose map' -c 'redir END' -c 'q' + +printf "\n\`\`\`\n\n- Generated on %s\n" "$(date)" >> "$DEST" + +# Remove lines with "Last set from" from the file +sed -e '/^ Last set from/d' "$DEST" > "$DEST.tmp" && mv "$DEST.tmp" "$DEST"