docs: extract keymap cheatsheet into CHEATSHEET.md

This commit is contained in:
2026-04-29 10:14:36 +02:00
parent ff5ac1e74e
commit 0766c7f11e
2 changed files with 84 additions and 54 deletions
-54
View File
@@ -145,9 +145,6 @@ vim.keymap.set("n", "<Leader>r", function()
end
end)
vim.keymap.set("n", "]c", ":cn<CR>")
vim.keymap.set("n", "[c", ":cp<CR>")
vim.keymap.set("n", "<C-k>", vim.diagnostic.open_float)
vim.keymap.set("n", "[d", function()
vim.diagnostic.jump({ count = -1, float = true })
@@ -232,54 +229,3 @@ vim.keymap.set("n", "<leader>fd", vim.diagnostic.setloclist)
vim.keymap.set("n", "<leader>fD", vim.diagnostic.setqflist)
vim.keymap.set("n", "grt", vim.lsp.buf.type_definition)
vim.keymap.set("n", "gd", vim.lsp.buf.definition)
-- Default bindings that are good to know:
-- insert mode:
-- <C-T> - indent, see :h i_CTRL-T
-- <C-D> - un-indent, see :h i_CTRL-D
-- normal mode:
-- H/M/L - Jump to highest/middle/lowest line in window.
-- <count?><C-E> - scroll window down <count> lines, see :h CTRL-E
-- <count?><C-Y> - scroll window up <count> lines, see :h CTRL-Y
-- <C-A> - Increment
-- <C-X> - Decrement
-- <C-w>H - Move window to the left
-- <C-w>J - Move window down
-- <C-w>K - Move window up
-- <C-w>L - Move window to the right
-- gq{motion} - format word-wrap of the line that {motion} moves over
-- {Visual}gq - format word-wrap of the visually selected area
-- gqq - format word-wrap of the current line
-- commands:
-- :make - execute makeprg with given args, and put the output in
-- quickfix list
-- :grep - execute grepprg with given args, and put the results in
-- quickfix list
-- :cex {expr} - Create a quickfix list using the result of {expr} and
-- jump to the first error. For example:
-- :cex system('make')
-- :cgete {expr} - same as :cex but don't jump to the first error
-- :copen - open quickfix list
-- :cdo {cmd} - execute {cmd} in each valid entry in the quickfix list.
-- works like this:
-- :cfirst
-- :{cmd}
-- :cnext
-- :{cmd}
-- etc.
-- :cfdo {cmd} - same as :cdo but on each file in quickfix list
-- :cn - go to the next error in quickfix list that includes a file name
-- :cp - go to the previous error in quickfix list that includes a file name
-- :cc [num] - go to the specified error in quickfix list
-- @: - repeat last command
-- :s/foo/bar/ - substitute the first match of foo with bar in the current line
-- :s/foo/bar/g - same as above but for all matches in the current line
-- :%s/foo/bar/g - same as above, but for all lines in buffer
-- :%s/foo/bar/gc - same as above but asking for confirmation on each match
-- :lua << EOF - run a lua snippet using lua-heredoc syntax
-- local tbl = {1, 2, 3}
-- for k, v in ipairs(tbl) do
-- print(v)
-- end
-- EOF
-- :diffsplit <other-file> - open diff split