-- TODO: There are mappings that I did not port yet -- For instance: https://github.com/mjacobus/lvim/tree/main/after/ftplugin -- https://github.com/mjacobus/lvim/tree/main/after/plugin -- https://github.com/mjacobus/lvim/tree/main/autoload -- https://github.com/mjacobus/lvim/blob/main/after/plugin/legacy_setup.vim#L179-L212 -- Maybe some here: https://github.com/mjacobus/lvim/blob/main/lua/config/mappings.lua local map = vim.keymap.set local opts = { noremap = true, silent = true } map('n', 'cd', vim.diagnostic.open_float, { desc = 'Line Diagnostics' }) map("n", "pv", vim.cmd.Ex) map("n", "w", ":w", { desc = "Save file" }) map("i", "jj", "") map("i", "jj", "", { desc = "Go to normal mode" }) map("n", "w", "write", { desc = "Save file" }) -- Placeholder: Replace with actual function if needed -- map("v", "", function() alternative_file.open("next", "--exists") end) -- Buffer management map("n", "Q", "q!", opts) map("n", "q", "bdelete", opts) map("n", "bdd", "bdelete!", opts) map("n", "bda", "bufdo %bd!", opts) -- Alternate file map("n", "af", "", { desc = "Alternate file" }) -- Avoid arrow keys in command mode map("c", "", "", { desc = "Move left" }) map("c", "", "", { desc = "Move down" }) map("c", "", "", { desc = "Move up" }) map("c", "", "", { desc = "Move right" }) map("c", "", "", { desc = "Delete" }) -- Notes map("n", "et", ":e ~/.tmp/notes/", opts) map("n", "on", ":e ~/.tmp/notes/notes.md", opts) map("n", "con", ":e ~/.tmp/notes/notes.md", opts) -- Terminal escape map("t", "", "", opts) map("t", "jj", "", opts) -- Search map("n", "f", "/", opts) map("n", "F", "nohlsearch", opts) map("n", "*", "*N", { desc = "Search and stay" }) -- Quickfix map("n", "gn", ":cnext", { desc = "Next quickfix occurrency" }) map("n", "gp", ":cprev", { desc = "Previous quickfix occurrency" }) -- Buffer navigation map("n", "bn", ":bn", opts) map("n", "bp", ":bp", opts) map("n", "b", ":b", opts) map("n", "a", "ggVG", { desc = "Select all" }) -- Tabs map("n", "t", ":tabnew", { desc = "New tab" }) -- Insert helpers map("i", ",e", "/[\\]})\"']:nohlsearcha", opts) map("i", "", "=>", opts) -- Hashrocket map("v", "h", [[:s/\:\([a-zA-Z_]\+\)\s\+=>/\=printf("%s:", submatch(1))/g:let @/ = ""]], opts) -- Quit map("n", "qq", ":q", opts) -- Reload map("n", "rel", ":e", opts) -- File finder (stub) map("n", "*", ":find", opts) map("n", "rm", ":Delete", { desc = "Delete file" }) map("n", "o", "", { desc = "Last buffer" }) -- Formatting map("v", "Q", "gq", opts) map("n", "Q", "gqap", opts) -- Resizing map("n", "", "+", opts) map("n", "", "-", opts) map("n", "", "<", opts) map("n", "", ">", opts) -- Make file executable map("n", "xx", ":!chmod +x %", opts) -- Marks map("n", "mA", "ma", opts) map("n", "ma", "'a", opts) map("n", "m1", "'a", opts) map("n", "mB", "mb", opts) map("n", "mb", "'b", opts) map("n", "m2", "'b", opts) map("n", "mC", "mc", opts) map("n", "mc", "'c", opts) map("n", "m3", "'c", opts) map("n", "mD", "md", opts) map("n", "md", "'d", opts) map("n", "m4", "'d", opts) map("n", "mE", "me", opts) map("n", "me", "'e", opts) map("n", "m5", "'e", opts) -- Open notes map("n", "no", ":vs ~/.tmp/notes.md", opts) -- Open shell_test map("n", "1", ":e shell_test", opts) map("n", "at", function() require("mj.test_runner").run_all_tests() end, { desc = "Run all tests" }) map("n", "t", function() require("mj.test_runner").test_line() end, { desc = "Run test for current line" }) map("n", "t", function() require("mj.test_runner").test_line() end, { desc = "Run test for current line" }) map("n", "T", function() require("mj.test_runner").run_test_file() end, { desc = "Run test file" }) map("n", "st", function() require("mj.test_runner").run_shell_test() end, { desc = "Run ./shell_test" }) map("v", "", function() alternative_file.open("next", "--exists") end, { desc = "Open next alternative file" }) local alternative_file = require("mj.alternate_file") map("n", "irc", function() require("mj.ruby_utils").insert_ruby_class_based_on_file_path() end, { desc = "Insert ruby class" }) -- this is not working correctly -- map("v", "irc", function() -- require("mj.ruby_utils").replace_selected_text_with_ruby_class() -- end, { desc = "Replace selected text ruby class" }) map("n", "aj", function() alternative_file.open("prev", "--exists") end, { desc = "Open previous alternative file" }) map("n", "j", function() require("mj.utils").close_terminal_buffer(true) end, { desc = "Close terminal buffer (true)" }) map("n", "k", function() require("mj.utils").close_terminal_buffer(false) end, { desc = "Close terminal buffer (false)" }) -- Alternative file navigation map("n", "ak", function() alternative_file.open("next", "--exists") end, { desc = "Next alternative file" }) map("n", "aj", function() alternative_file.open("prev", "--exists") end, { desc = "Previous alternative file" }) map("t", "", "", { desc = "Escape terminal mode" }) map("t", "jj", "", { desc = "Escape terminal mode with jj" }) -- From old, might be dup -- -- 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" }) -- -- map("n", "b", "Telescope current_buffer_fuzzy_find", { desc = "Search in current buffer" }) -- -- -- Marks -- map("n", "mA", "ma", { desc = "Set mark 'a'" }) -- map("n", "ma", "'a", { desc = "Go to mark 'a'" }) -- map("n", "m1", "'a", { desc = "Go to mark 'a'" }) -- -- map("n", "mB", "mb", { desc = "Set mark 'b'" }) -- map("n", "mb", "'b", { desc = "Go to mark 'b'" }) -- map("n", "m2", "'b", { desc = "Go to mark 'b'" }) -- -- map("n", "mC", "mc", { desc = "Set mark 'c'" }) -- map("n", "mc", "'c", { desc = "Go to mark 'c'" }) -- map("n", "m3", "'c", { desc = "Go to mark 'c'" }) -- -- map("n", "mD", "md", { desc = "Set mark 'd'" }) -- map("n", "md", "'d", { desc = "Go to mark 'd'" }) -- map("n", "m4", "'d", { desc = "Go to mark 'd'" }) -- -- map("n", "mE", "me", { desc = "Set mark 'e'" }) -- map("n", "me", "'e", { desc = "Go to mark 'e'" }) -- map("n", "m5", "'e", { desc = "Go to mark 'e'" }) -- -- -- Notes -- map("n", "no", ":vs ~/.tmp/notes.md", { desc = "Open notes" })