-- 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 local map = vim.keymap.set local wk = require("which-key") -- unbind ctrl S since it's tmux prefix -- vim.keymap.del({ "i", "n" }, "") vim.keymap.set({ "i", "n" }, "", "") local dirmap = { up = "w0", down = "w$", } local function move_cursor_to(direction) end -- TODO: finish this -- local function scroll(direction) -- -- current window for now; could extend later -- local win_id = 0 -- -- in form {line, column} -- local current_cursor = vim.api.nvim_win_get_cursor(win_id) -- -- -- this is the height of the window in lines -- local win_height = vim.api.nvim_win_get_height(win_id) -- -- local new_top = vim.fn.line(dirmap[direction]) -- -- end -- Bind arrows to hjkl to my colemak-dh motions work as expected map({ "n", "x" }, "", "k", { desc = "Up", remap = true }) map({ "n", "x" }, "", "j", { desc = "Down", remap = true }) map({ "n", "x" }, "", "h", { desc = "Left", remap = true }) map({ "n", "x" }, "", "l", { desc = "Right", remap = true }) map({ "n", "t", "i" }, "", " TmuxNavigateLeft", { desc = "Switch Window Left", remap = true }) map({ "n", "t", "i" }, "", " TmuxNavigateRight", { desc = "Switch Window Right", remap = true }) map({ "n", "t", "i" }, "", " TmuxNavigateUp", { remap = true }) map({ "n", "t", "i" }, "", " TmuxNavigateDown", { desc = "Switch Window Down", remap = true }) map({ "x" }, "", "", { remap = true }) map({ "x" }, "", "", { remap = true }) map({ "n", "x", "v" }, "", "", { remap = true }) map({ "n", "x", "v" }, "", "", { remap = true }) map({ "n" }, "", "[b", { desc = "Previous Buffer", remap = true }) map({ "n" }, "", "]b", { desc = "Next Buffer", remap = true }) map({ "n" }, "", "5j", { remap = true }) map({ "n" }, "", "5k", { remap = true }) map({ "i" }, "", "", { desc = "Escape insert mode", remap = true }) -- better navigation map({ "n" }, "", "zz", { remap = false }) map({ "n" }, "", "zz", { remap = false }) map({ "n" }, "n", "nzz", { remap = false }) map({ "n" }, "N", "Nzz", { remap = false }) map({ "n" }, "", "zz", { remap = false }) map({ "n" }, "", "zz", { remap = false }) map({ "n", "x" }, "", "$", { remap = false }) map({ "n", "x" }, "", "0", { remap = false }) -- remove the default lazyvim, and also swap H and L (for move cursor) to make more sense on colemak vim.keymap.del({ "n" }, "") vim.keymap.del({ "n" }, "") map({ "n" }, "", "L", { remap = false }) map({ "n" }, "", "H", { remap = false }) -- better delete and put -- map({ "n" }, "dT", "dvT", { remap = false }) -- map({ "n", "x" }, "p", '"_p', { remap = false }) -- map({ "n", "x" }, "P", '"_P', { remap = false }) -- map({ "n", "x" }, "d", '"_d', { remap = false }) -- map({ "n", "x" }, "dd", '"_dd', { remap = false }) -- map({ "n", "x" }, "D", '"_D', { remap = false }) -- yank history map({ "n", "x" }, "fp", function() if LazyVim.pick.picker.name == "telescope" then require("telescope").extensions.yank_history.yank_history({}) else vim.cmd([[YankyRingHistory]]) end end, { desc = "Open Yank History", remap = false }) -- -- Remap spelling suggestions -- map({ "n" }, "z-", "z=", { desc = "Spelling Suggestions", remap = true }) -- Oil.nvim open parent directory map("n", "-", "Oil", { desc = "Open Oil" }) -- TODO: add leader + y for save current buf, leader + Y to write all map({ "n", "x" }, "y", "w", { desc = "Save" }) map({ "n", "x" }, "Y", "wa", { desc = "Save All" }) -- Zen Mode map("n", "uz", "ZenMode", { desc = "Toggle Zen Mode" }) -- Source Current File map("n", "x", "source %", { desc = "Source current file" }) -- Obsidian -- o is the prefix for all Obsidian bindings wk.add({ { "o", group = "Obsidian" }, { "od", group = "Daily Note" }, { "ol", group = "Follow Link" }, }) map("n", "oo", "ObsidianQuickSwitch", { desc = "Obsidian Quick Switch" }) map("n", "o/", "ObsidianSearch", { desc = "Obsidian Grep" }) -- This one will open the command line and let the user type the arg map("n", "on", function() require("command-key").command("ObsidianNew") end, { desc = "Obsidian New Note" }) map("n", "ob", "ObsidianBacklinks", { desc = "Obsidian Backlinks" }) -- map("n", "ot", function() -- require("command-key").command("ObsidianTags") -- end, { desc = "Obsidian Tags" }) map("n", "ot", "ObsidianTags", { desc = "Obsidian Tags" }) map("n", "olv", "ObsidianFollowLink vsplit", { desc = "Obsidian Follow Link Vsplit" }) map("n", "olh", "ObsidianFollowLink hsplit", { desc = "Obsidian Follow Link Hsplit" }) map("n", "odt", "ObsidianToday", { desc = "Obsidian Open Today's Daily" }) map("n", "ods", "ObsidianDailies", { desc = "Obsidian Search Dailies" }) map("n", "ols", "ObsidianLinks", { desc = "Obsidian Search Links" }) map("x", "oll", function() require("command-key").command("ObsidianLink") end, { desc = "Obsidian Link Visual To Existing Note" }) map("x", "oln", function() require("command-key").command("ObsidianLinkNew") end, { desc = "Obsidian Link Visual To New Note" }) map("x", "ole", function() require("command-key").command("ObsidianExtractNote") end, { desc = "Obsidian Copy Selection To New Note & Link" }) map("n", "or", function() require("command-key").command("ObsidianRename") end, { desc = "Obsidian Rename" }) map("n", "oc", "ObsidianTOC", { desc = "Obsidian Table Of Contents" }) -- TODO: Add binds for templates