From 6a0d9bfa52f4067d0ba196c6b117e1427db96aac Mon Sep 17 00:00:00 2001 From: hndrk <51416554+hendriknielaender@users.noreply.github.com> Date: Thu, 1 Jun 2023 09:55:57 +0200 Subject: [PATCH] chore: add CHEATSHEET.md list all custom keymaps for vim --- CHEATSHEET.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 CHEATSHEET.md diff --git a/CHEATSHEET.md b/CHEATSHEET.md new file mode 100644 index 0000000..6b5f65c --- /dev/null +++ b/CHEATSHEET.md @@ -0,0 +1,27 @@ +# Vim Remaps Cheatsheet + +## Normal & Visual Mode +```vim +vim.keymap.set("x", "p", [["_dP]]) # `x` delete the selected text and paste it before the current line. +vim.keymap.set({"n", "v"}, "y", [["+y]]) # `n` and `v` yank the selected text to the system clipboard. +vim.keymap.set("n", "Y", [["+Y]]) # `n` in normal mode to yank the current line to the system clipboard. +vim.keymap.set({"n", "v"}, "d", [["_d]]) # `n` and `v` delete the selected text. +``` + +## Insert Mode +```vim +vim.keymap.set("i", "", "") # `i` in insert mode to `` for quicker escape. +``` + +## Misc +```vim +vim.keymap.set("n", "Q", "") # `Q` in normal mode to do nothing (). +vim.keymap.set("n", "", "silent !tmux neww tmux-sessionizer") # `Ctrl+f` in normal mode to open a new tmux window with a specific command. +vim.keymap.set("n", "f", vim.lsp.buf.format) # `f` in normal mode to format the current buffer using LSP. +vim.keymap.set("n", "", "cnextzz") # `Ctrl+k` jump to the next error location and center the screen +vim.keymap.set("n", "", "cprevzz") # `Ctrl+j` jump to the previous error location and center the screen. +vim.keymap.set("n", "k", "lnextzz") # `k` jump to the next location list error and center the screen. +vim.keymap.set("n", "j", "lprevzz") # `j` jump to the previous location list error and center the screen. +vim.keymap.set("n", "s", [[:%s/\<\>//gI]]) # `s` perform a global case-insensitive search and replace using the word under the cursor. +vim.keymap.set("n", "x", "!chmod +x %", { silent = true }) # `x` make the current file executable by running a chmod command. +```