-- Keymaps are automatically loaded on the VeryLazy event -- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua -- Add any additional keymaps here -- -- -- KEYMAPS SPIDER vim.keymap.set({ "n", "o", "x" }, "w", "lua require('spider').motion('w')", { desc = "Spider-w" }) vim.keymap.set({ "n", "o", "x" }, "e", "lua require('spider').motion('e')", { desc = "Spider-e" }) vim.keymap.set({ "n", "o", "x" }, "b", "lua require('spider').motion('b')", { desc = "Spider-b" }) vim.keymap.set({ "n", "o", "x" }, "C-D", "", { desc = "page down" }) -- :SnipRun lua require’sniprun’.run() SnipRun -- (normal node) lua require’sniprun’.run(‘n’) SnipRunOperator -- :’<,’>SnipRun (visual mode) lua require’sniprun’.run(‘v’) SnipRun -- :SnipInfo lua require’sniprun’.info() SnipInfo -- :SnipReset lua require’sniprun’.reset() SnipReset -- :SnipReplMemoryClean lua require’sniprun’.clear_repl() SnipReplMemoryClean -- :SnipClose lua require’sniprun.display’.close_all() SnipClose -- :SnipLive lua require’sniprun.live_mode’.toggle() SnipLive -- vim.keymap.set({ "n", "x" }, "r", "SnipRun", { desc = "SnipRun" }) -- vim.keymap.set({ "v" }, "r", "'<,'>SnipRun", { desc = "SnipRun v" }) vim.api.nvim_set_keymap("v", "r", "SnipRun", { silent = true }) vim.api.nvim_set_keymap("n", "r", "SnipRun", { silent = true }) vim.api.nvim_set_keymap("n", "f", "SnipRunOperator", { silent = true }) -- AI -- vim.keymap.set({ "n", "o", "x" }, "ac", "GpChatToggle split", { desc = "toggle GP chat" }) -- vim.keymap.set({ "n", "o", "x" }, "aa", "GpAppend", { desc = "Add with Copilot" }) -- vim.keymap.set("n", "ap", ":GpPrepend", { noremap = true, silent = true, desc = "Prepend with copilot" }) -- vim.keymap.set({ "v" }, "ar", "'<,'>GpRewrite", { desc = "replace with Copilot" }) local bm = require("bookmarks") local map = vim.keymap.set map("n", "mm", bm.bookmark_toggle, { desc = "Toggle bookmark" }) map("n", "mi", bm.bookmark_ann, { desc = "Edit annotation" }) map("n", "mc", bm.bookmark_clean, { desc = "Clean marks" }) map("n", "mn", bm.bookmark_next, { desc = "Next mark" }) map("n", "mp", bm.bookmark_prev, { desc = "Prev mark" }) map("n", "ml", "Telescope bookmarks list", { desc = "List marks" }) map("n", "mx", bm.bookmark_clear_all, { desc = "Clear all bookmarks" }) map("n", "srf", function() local file_path = vim.api.nvim_buf_get_name(0) print(file_path) require("grug-far").open({ transient = true, prefills = { paths = file_path, }, }) end, { desc = "Search n replace in file" }) map("n", "ff", "FzfLua", { desc = "FZF commands" }) -- tab to accept copilot suggestion map("i", "", function() require("copilot.suggestion").accept() end, { desc = "Accept Copilot suggestion" }) -- map("i", "M-m", "LLMSuggestion", { desc = "LLM Suggestion" }) -- map("n", "mm", bm.bookmark_toggle) -- add or remove bookmark at current line -- map("n", "mi", bm.bookmark_ann) -- add or edit mark annotation at current line -- map("n", "mc", bm.bookmark_clean) -- clean all marks in local buffer -- map("n", "mn", bm.bookmark_next) -- jump to next mark in local buffer -- map("n", "mp", bm.bookmark_prev) -- jump to previous mark in local buffer -- map("n", "ml", "Telescope bookmarks list") -- show marked file list in quickfix window -- map("n", "mx", bm.bookmark_clear_all) -- removes all bookmarks -- -- floating terminal -- map("n", "fT", function() Snacks.terminal() end, { desc = "Terminal (cwd)" }) -- map("n", "ft", function() Snacks.terminal(nil, { cwd = LazyVim.root() }) end, { desc = "Terminal (Root Dir)" }) -- map("n", "", function() Snacks.terminal(nil, { cwd = LazyVim.root() }) end, { desc = "Terminal (Root Dir)" }) -- map("n", "", function() Snacks.terminal(nil, { cwd = LazyVim.root() }) end, { desc = "which_key_ignore" }) -- -- -- Terminal Mappings -- map("t", "", "close", { desc = "Hide Terminal" }) -- map("t", "", "close", { desc = "which_key_ignore" }) map("n", "qw", "wq", { desc = "save & quit" }) -- local td_cli = require("toggleterm.terminal").Terminal:new({ -- cmd = "node /home/omnissiah/git/td/dist/cli.js", -- direction = "float", -- close_on_exit = false, -- hidden = true, -- on_open = function(term) -- vim.api.nvim_buf_set_keymap(term.bufnr, "n", "q", "close", { noremap = true, silent = true }) -- vim.api.nvim_buf_set_keymap(term.bufnr, "t", "", ":close", { noremap = true, silent = true }) -- vim.api.nvim_buf_set_keymap(term.bufnr, "t", "", "close", { noremap = true, silent = true }) -- end, -- }) -- vim.keymap.set("t", "\\", function() -- td_cli:toggle() -- end, { desc = "Toggle TD CLI floating terminal" }) vim.keymap.set("n", "\\", function() vim.cmd("!tmux-td") end, { desc = "Toggle TD CLI floating terminal and run tmux-td" }) -- vim.keymap.set("t", "", "ToggleTerm", { noremap = true, silent = true }) -- -- local harpoon = require("harpoon") vim.keymap.set("n", "H", function() harpoon:list("file_with_line"):add() end, { desc = "Harpoon add" }) vim.keymap.set("n", "h", function() harpoon.ui:toggle_quick_menu(harpoon:list("file_with_line")) end, { desc = "Harpoon list" }) -- DIFFVIEW local function diffOpenWithInput() local user_input = vim.fn.input("Revision to Open: ") vim.cmd("DiffviewOpen " .. user_input) end local function diffOpenFileHistory() local user_input = vim.fn.input("Files to Open: ") vim.cmd("DiffviewFileHistory" .. user_input) end local function command(cmd) return function() vim.cmd(cmd) end end -- Key maps require("which-key").add({ -- { "g", group = "Git" }, { "gvf", diffOpenFileHistory, desc = "Open DiffView on Files" }, { "gvt", command("DiffviewToggleFiles"), desc = "toggle diffviewfiles" }, { "gvc", command("DiffviewClose"), desc = "Open DiffView on Files" }, { "gvh", function() print("gvf with . opens commit wise history of entire codebase.") print("gvf with % opens commit wise history of current file.") print("gvf with opens commit wise history of that file.") print("gvo with HEAD opens diff of latest commit.") print("gvo with HEAD~3 opens diff of last 3 commits.") print("gvo with master..HEAD opens changes of your feature branch.") end, desc = "gvo help", }, { "gvo", diffOpenWithInput, desc = "Open DiffView" }, }) -- -- vim.api.nvim_set_keymap("c", "", "", { noremap = true, silent = true }) vim.api.nvim_set_keymap("c", "", "", { noremap = true, silent = true }) print("dupsko") -- exec lua map("v", "ce", "'<,'>lua", { desc = "exec Lua" }) -- GP map("n", "agf", "GpChatFinder", { desc = "gp chat finder" }) map("n", "agt", "GpChatToggle", { desc = "gp chat toggle" }) map("n", "agn", "GpChatNew", { desc = "gp chat new " }) map("n", "agr", "GpChatRespond", { desc = "gp chat respond" }) -- JSON FORMAT map("n", "cjf", "%!jq .", { desc = "Json Format" })