diff --git a/.config/nvim/lua/config/keymaps.lua b/.config/nvim/lua/config/keymaps.lua index cb3715e7..87d613c9 100644 --- a/.config/nvim/lua/config/keymaps.lua +++ b/.config/nvim/lua/config/keymaps.lua @@ -34,61 +34,13 @@ map("n", ">", ">>", { desc = "Indent" }) -- Save without formatting map({ "n", "i" }, "", "noautocmd w", { desc = "Save Without Formatting" }) --- Cursor navigation on insert mode -map("i", "", "", { desc = "Move Cursor Left" }) -map("i", "", "", { desc = "Move Cursor Left" }) -map("i", "", "", { desc = "Move Cursor Left" }) -map("i", "", "", { desc = "Move Cursor Left" }) - --- End of the word backwards -map("n", "E", "ge") - -- Increment/decrement map("n", "+", "") map("n", "-", "") --- Tabs -map("n", "]", "tabnext", { desc = "Next Tab" }) -map("n", "[", "tabprevious", { desc = "Previous Tab" }) -map("n", "", "tabnext", { desc = "Next Tab" }) -map("n", "", "tabprevious", { desc = "Previous Tab" }) -for i = 1, 9 do - map("n", "" .. i, "tabn " .. i .. "", { desc = "Tab " .. i }) -end -map("n", "f", function() - vim.ui.select(vim.api.nvim_list_tabpages(), { - prompt = "Select Tab:", - format_item = function(tabid) - local wins = vim.api.nvim_tabpage_list_wins(tabid) - local not_floating_win = function(winid) - return vim.api.nvim_win_get_config(winid).relative == "" - end - wins = vim.tbl_filter(not_floating_win, wins) - local bufs = {} - for _, win in ipairs(wins) do - local buf = vim.api.nvim_win_get_buf(win) - local buftype = vim.api.nvim_get_option_value("buftype", { buf = buf }) - if buftype ~= "nofile" then - local fname = vim.api.nvim_buf_get_name(buf) - table.insert(bufs, vim.fn.fnamemodify(fname, ":t")) - end - end - local tabnr = vim.api.nvim_tabpage_get_number(tabid) - local cwd = string.format(" %8s: ", vim.fn.fnamemodify(vim.fn.getcwd(-1, tabnr), ":t")) - local is_current = vim.api.nvim_tabpage_get_number(0) == tabnr and "✸" or " " - return tabnr .. is_current .. cwd .. table.concat(bufs, ", ") - end, - }, function(tabid) - if tabid ~= nil then - vim.cmd(tabid .. "tabnext") - end - end) -end, { desc = "Tabs" }) - -- Buffers map("n", "bf", "bfirst", { desc = "First Buffer" }) map("n", "ba", "blast", { desc = "Last Buffer" }) -map("n", "b", "tabnew %", { desc = "Current Buffer in New Tab" }) map("n", "", "e #", { desc = "Switch to Other Buffer" }) -- Toggle statusline @@ -100,10 +52,6 @@ map("n", "uS", function() end end, { desc = "Toggle Statusline" }) --- Comment box -map("n", "]/", "/\\S\\zs\\s*╭zt", { desc = "Next Block Comment" }) -map("n", "[/", "?\\S\\zs\\s*╭zt", { desc = "Prev Block Comment" }) - -- Plugin Info map("n", "cif", "LazyFormatInfo", { desc = "Formatting" }) map("n", "cic", "ConformInfo", { desc = "Conform" }) @@ -128,44 +76,16 @@ end map("n", "ciL", linters, { desc = "Lint" }) map("n", "cir", "LazyRoot", { desc = "Root" }) --- U for redo -map("n", "U", "", { desc = "Redo" }) - -- Copy whole text to clipboard map("n", "", ":%y+", { desc = "Copy Whole Text to Clipboard", silent = true }) --- Motion -map("c", "", "", { desc = "Start Of Line" }) -map("i", "", "", { desc = "Start Of Line" }) -map("i", "", "", { desc = "End Of Line" }) - -- Select all text map("n", "", "ggG", { desc = "Select all Text", silent = true, noremap = true }) --- Paste options -map("i", "", '"', { desc = "Paste on Insert Mode" }) -map("v", "p", '"_dP', { desc = "Paste Without Overwriting" }) - -- Delete and change without yanking map({ "n", "x" }, "", '"_d', { desc = "Delete Without Yanking" }) map({ "n", "x" }, "", '"_c', { desc = "Change Without Yanking" }) --- Deleting without yanking empty line -map("n", "dd", function() - local is_empty_line = vim.api.nvim_get_current_line():match("^%s*$") - if is_empty_line then - return '"_dd' - else - return "dd" - end -end, { noremap = true, expr = true, desc = "Don't Yank Empty Line to Clipboard" }) - --- Search inside visually highlighted text -map("x", "g/", "/\\%V", { silent = false, desc = "Search Inside Visual Selection" }) - --- Search visually selected text (slightly better than builtins in Neovim>=0.8) -map("x", "*", [[y/\V=escape(@", '/\')]], { desc = "Search Selected Text", silent = true }) -map("x", "#", [[y?\V=escape(@", '?\')]], { desc = "Search Selected Text (Backwards)", silent = true }) -- Dashboard map("n", "fd", function() @@ -215,13 +135,6 @@ map("n", "dm", function() end end, { noremap = true, desc = "Mark on Current Line" }) --- Empty Line -map("n", "gO", "call append(line('.') - 1, repeat([''], v:count1))", { desc = "Empty Line Above" }) -map("n", "go", "call append(line('.'), repeat([''], v:count1))", { desc = "Empty Line Below" }) - --- Insert Mode -map({ "c", "i", "t" }, "", "", { desc = "Delete Word" }) - -- Git map("n", "ghb", Snacks.git.blame_line, { desc = "Blame Line" })