diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua index 4a808fe..03de663 100644 --- a/lua/config/keymaps.lua +++ b/lua/config/keymaps.lua @@ -82,3 +82,63 @@ end, { desc = "Run ./shell_test" }) -- quick fix map("n", "gn", ":cnext", { desc = "Next quickfix occurrency" }) map("n", "gp", ":cprev", { desc = "Previous quickfix occurrency" }) + +-- rm file +map("n", "rm", ":Delete", { desc = "Delete file" }) + +-- Last buffer +map("n", "o", "", { desc = "Last buffer" }) + +-- Escape terminal mode with jj +map("t", "", "", { desc = "Escape terminal mode" }) +map("t", "jj", "", { desc = "Escape terminal mode with jj" }) + +-- Buffer changing +map("n", "bn", ":bn", { desc = "Next buffer" }) +map("n", "bp", ":bp", { desc = "Previous buffer" }) + +-- Find buffer file +map("n", "b", ":b", { desc = "Find buffer file" }) + +-- Search +map("n", "*", "*N", { desc = "Search and stay" }) + +-- Select all +map("n", "a", "ggVG", { desc = "Select all" }) + +-- New tab +map("n", "t", ":tabnew", { desc = "New tab" }) + +-- Jumps to the next position after the closest closing char +map("i", ",e", "/[\\]})\"']:nohlsearcha", { desc = "Jump to next closing char" }) + +-- Adds arrow +map("i", "", "=>", { desc = "Insert arrow" }) + +-- Rails specific +map( + "v", + "h", + ':s/\\:\\([a-zA-Z_]\\+\\)\\s\\+=>/\\=printf("%s:", submatch(1))/g:let @/ = ""', + { desc = "Convert hash rocket to symbol" } +) +map("n", "qq", ":q", { desc = "Quit" }) + +-- Reload buffer +map("n", "rel", ":e", { desc = "Reload buffer" }) + +-- Find +map("n", "f", "/", { desc = "Find" }) +map("n", "*", ":find", { desc = "Find file" }) + +-- Use Q for formatting the current paragraph (or selection) +map("v", "Q", "gq", { desc = "Format selection" }) +map("n", "Q", "gqap", { desc = "Format paragraph" }) + +-- Buffer resizing mappings (shift + arrow key) +map("n", "", "+", { desc = "Resize buffer up" }) +map("n", "", "-", { desc = "Resize buffer down" }) +map("n", "", "<", { desc = "Resize buffer left" }) +map("n", "", ">", { desc = "Resize buffer right" }) + +map("n", "xx", ":!chmod +x %", { desc = "Make file executable" })