From fb57b670fade7e20352d1f9f99a089fdb1e466ff Mon Sep 17 00:00:00 2001 From: Stephen Leece Date: Wed, 10 Jan 2024 07:52:35 -0800 Subject: [PATCH] add harpoon. add old keymaps --- init.lua | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++ lazy-lock.json | 1 + 2 files changed, 54 insertions(+) diff --git a/init.lua b/init.lua index c3ec0e36..16734f64 100644 --- a/init.lua +++ b/init.lua @@ -78,6 +78,7 @@ require('lazy').setup({ "nvim-tree/nvim-web-devicons", "github/copilot.vim", + "ThePrimeagen/harpoon", -- NOTE: This is where your plugins related to LSP can be installed. -- The configuration is done below. Search for lspconfig to find it below. @@ -542,6 +543,7 @@ end -- document existing key chains require('which-key').register { + ['m'] = { name = 'Harpoon [M]ark file', _ = 'which_key_ignore' }, ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, ['g'] = { name = '[G]it', _ = 'which_key_ignore' }, @@ -670,12 +672,63 @@ cmp.setup { }, } + + +-- Harpoon commands +-- leader a | add file to harpoon marks +-- C-e | toggle quick menu +-- C-(zxcv) | nav to each marked file +vim.keymap.set("n", "m", function() require("harpoon.mark").add_file() end, { silent = true }) +vim.keymap.set("n", "", function() require("harpoon.ui").toggle_quick_menu() end, { silent = true }) +vim.keymap.set("n", "", function() require("harpoon.ui").nav_file(1) end, { silent = true }) +vim.keymap.set("n", "", function() require("harpoon.ui").nav_file(2) end, { silent = true }) +vim.keymap.set("n", "", function() require("harpoon.ui").nav_file(3) end, { silent = true }) +vim.keymap.set("n", "", function() require("harpoon.ui").nav_file(4) end, { silent = true }) + -- Set Copilot related settings vim.g.copilot_no_tab_map = true vim.g.copilot_assume_mapped = true vim.g.copilot_tab_fallback = "" vim.api.nvim_set_keymap("i", "", 'copilot#Accept("")', { silent = true, expr = true }) +-- General Keymaps +-- paste and keep current paste text after pasting over a selection +vim.keymap.set("x", "p", "\"_dP") +-- Normal Mode +-- select all text +vim.keymap.set("n", "sa", "ggVG") +-- open file explorer netrw +vim.keymap.set("n", "pv", ":Ex") +vim.keymap.set("n", "ex", ":Ex") +-- when using J, append subsequent line to current line keeping cursor in place +vim.keymap.set("n", "J", "mzJ`z") +-- center cursor with certain commands +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "n", "nzzzv") +vim.keymap.set("n", "N", "Nzzzv") +-- Visual Mode +-- yank to clipboard +vim.keymap.set("v", "yc", "\"+y") +-- Move selected lines up or down one line at a time +vim.keymap.set("v", "J", ":m '>+1gv=gv") +vim.keymap.set("v", "K", ":m '<-2gv=gv") + + +-- General options +-- Completion (cmp) +vim.opt.completeopt = "menu,menuone,noselect" + +vim.opt.incsearch = true +vim.opt.scrolloff = 10 + +vim.opt.colorcolumn = "80" +vim.opt.signcolumn = "yes:1" +vim.opt.equalalways = true -- equal splits automatically +vim.opt.termguicolors = true +vim.opt.updatetime = 50 +vim.opt.wrap = true + -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et diff --git a/lazy-lock.json b/lazy-lock.json index 997488bb..e135c97d 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -8,6 +8,7 @@ "fidget.nvim": { "branch": "main", "commit": "a1493d94ecb3464ab3ae4d5855765310566dace4" }, "friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" }, "gitsigns.nvim": { "branch": "main", "commit": "5fc573f2d2a49aec74dd6dc977e8b137429d1897" }, + "harpoon": { "branch": "master", "commit": "ccae1b9bec717ae284906b0bf83d720e59d12b91" }, "indent-blankline.nvim": { "branch": "master", "commit": "29be0919b91fb59eca9e90690d76014233392bef" }, "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, "lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" },