add harpoon in nvim
This commit is contained in:
parent
52fa46eb43
commit
074117be1e
2 changed files with 104 additions and 43 deletions
|
|
@ -1,68 +1,38 @@
|
|||
-- Set <space> as the leader key
|
||||
-- See `:help mapleader`
|
||||
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
-- Set to true if you have a Nerd Font installed and selected in the terminal
|
||||
vim.g.have_nerd_font = true
|
||||
|
||||
-- [[ Setting options ]]
|
||||
-- See `:help vim.opt`
|
||||
-- NOTE: You can change these options as you wish!
|
||||
-- For more options, you can see `:help option-list`
|
||||
|
||||
-- Make line numbers default
|
||||
vim.opt.number = true
|
||||
-- vim.opt.relativenumber = true
|
||||
|
||||
-- Enable mouse mode, can be useful for resizing splits for example!
|
||||
vim.opt.mouse = "a"
|
||||
|
||||
-- Don't show the mode, since it's already in the status line
|
||||
vim.opt.showmode = false
|
||||
|
||||
-- Sync clipboard between OS and Neovim.
|
||||
vim.schedule(function()
|
||||
vim.opt.clipboard = "unnamedplus"
|
||||
end)
|
||||
|
||||
-- Enable break indent
|
||||
vim.opt.breakindent = true
|
||||
|
||||
-- Save undo history
|
||||
vim.opt.undofile = true
|
||||
|
||||
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
|
||||
vim.opt.ignorecase = true
|
||||
vim.opt.smartcase = true
|
||||
|
||||
-- Keep signcolumn on by default
|
||||
vim.opt.signcolumn = "yes"
|
||||
|
||||
-- Decrease update time
|
||||
vim.opt.updatetime = 250
|
||||
|
||||
-- Decrease mapped sequence wait time
|
||||
-- Displays which-key popup sooner
|
||||
vim.opt.timeoutlen = 300
|
||||
|
||||
-- Configure how new splits should be opened
|
||||
vim.opt.splitright = true
|
||||
vim.opt.splitbelow = true
|
||||
|
||||
-- Sets how neovim will display certain whitespace characters in the editor.
|
||||
-- See `:help 'list'`
|
||||
-- and `:help 'listchars'`
|
||||
vim.opt.list = true
|
||||
vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" }
|
||||
|
||||
-- Preview substitutions live, as you type!
|
||||
vim.opt.inccommand = "split"
|
||||
|
||||
-- Show which line your cursor is on
|
||||
vim.opt.cursorline = true
|
||||
|
||||
-- Minimal number of screen lines to keep above and below the cursor.
|
||||
vim.opt.scrolloff = 10
|
||||
|
||||
|
|
@ -84,12 +54,6 @@ vim.keymap.set("n", "<leader>q", vim.diagnostic.setloclist, { desc = "Open diagn
|
|||
-- or just use <C-\><C-n> to exit terminal mode
|
||||
vim.keymap.set("t", "<Esc><Esc>", "<C-\\><C-n>", { desc = "Exit terminal mode" })
|
||||
|
||||
-- TIP: Disable arrow keys in normal mode
|
||||
-- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
|
||||
-- vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
|
||||
-- vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
|
||||
-- vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
|
||||
|
||||
-- Keybinds to make split navigation easier.
|
||||
-- Use CTRL+<hjkl> to switch between windows
|
||||
--
|
||||
|
|
@ -188,7 +152,8 @@ require("lazy").setup({
|
|||
{ "<leader>s", group = "[S]earch" },
|
||||
{ "<leader>w", group = "[W]orkspace|[W]indow" },
|
||||
{ "<leader>t", group = "[T]oggle" },
|
||||
{ "<leader>h", group = "Git [H]unk", mode = { "n", "v" } },
|
||||
-- { "<leader>h", group = "Git [H]unk", mode = { "n", "v" } },
|
||||
{ "<leader>h", group = "[H]arpoon" },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -883,6 +848,101 @@ require("lazy").setup({
|
|||
hl(0, "MultiCursorDisabledSign", { link = "SignColumn" })
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"ThePrimeagen/harpoon",
|
||||
branch = "harpoon2",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
opts = {},
|
||||
config = function(_, opts)
|
||||
local harpoon = require("harpoon")
|
||||
harpoon:setup(opts)
|
||||
end,
|
||||
keys = {
|
||||
{
|
||||
"<leader>ha",
|
||||
function()
|
||||
local harpoon = require("harpoon")
|
||||
harpoon:list():add()
|
||||
end,
|
||||
desc = "[H]arpoon [A]dd",
|
||||
},
|
||||
{
|
||||
"<leader>he",
|
||||
function()
|
||||
local harpoon = require("harpoon")
|
||||
harpoon.ui:toggle_quick_menu(harpoon:list())
|
||||
end,
|
||||
desc = "[H]arpoon [E]dit",
|
||||
},
|
||||
{
|
||||
"<leader>hl",
|
||||
function()
|
||||
local harpoon = require("harpoon")
|
||||
local conf = require("telescope.config").values
|
||||
local function toggle_telescope(harpoon_files)
|
||||
local file_paths = {}
|
||||
for _, item in ipairs(harpoon_files.items) do
|
||||
table.insert(file_paths, item.value)
|
||||
end
|
||||
|
||||
require("telescope.pickers")
|
||||
.new({}, {
|
||||
prompt_title = "Harpoon",
|
||||
finder = require("telescope.finders").new_table({
|
||||
results = file_paths,
|
||||
}),
|
||||
previewer = conf.file_previewer({}),
|
||||
sorter = conf.generic_sorter({}),
|
||||
})
|
||||
:find()
|
||||
end
|
||||
toggle_telescope(harpoon:list())
|
||||
end,
|
||||
desc = "[H]arpoon [L]list",
|
||||
},
|
||||
{
|
||||
"<leader>h1",
|
||||
function()
|
||||
local harpoon = require("harpoon")
|
||||
harpoon:list():select(1)
|
||||
end,
|
||||
desc = "[H]arpoon [1]st entry",
|
||||
},
|
||||
{
|
||||
"<leader>h2",
|
||||
function()
|
||||
local harpoon = require("harpoon")
|
||||
harpoon:list():select(2)
|
||||
end,
|
||||
desc = "[H]arpoon [2]nd entry",
|
||||
},
|
||||
{
|
||||
"<leader>h3",
|
||||
function()
|
||||
local harpoon = require("harpoon")
|
||||
harpoon:list():select(3)
|
||||
end,
|
||||
desc = "[H]arpoon [3]rd entry",
|
||||
},
|
||||
{
|
||||
"<leader>h4",
|
||||
function()
|
||||
local harpoon = require("harpoon")
|
||||
harpoon:list():select(4)
|
||||
end,
|
||||
desc = "[H]arpoon [4]th entry",
|
||||
},
|
||||
{
|
||||
"<leader>h5",
|
||||
function()
|
||||
local harpoon = require("harpoon")
|
||||
harpoon:list():select(5)
|
||||
end,
|
||||
desc = "[H]arpoon [5]th entry",
|
||||
},
|
||||
},
|
||||
},
|
||||
}, {
|
||||
ui = {
|
||||
-- If you are using a Nerd Font: set icons to an empty table which will use the
|
||||
|
|
@ -916,12 +976,12 @@ vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { desc = "Chmod File E[
|
|||
vim.keymap.set("n", "<leader>lz", "<cmd>Lazy<CR>", { desc = "[L]azy", silent = true })
|
||||
vim.keymap.set("n", "<leader>lp", "<cmd>Lazy profile<CR>", { desc = "[L]azy [P]rofile", silent = true })
|
||||
|
||||
vim.keymap.set("n", "<leader><tab>l", "<cmd>tablast<cr>", { desc = "Last Tab" })
|
||||
vim.keymap.set("n", "<leader><tab>f", "<cmd>tabfirst<cr>", { desc = "First Tab" })
|
||||
vim.keymap.set("n", "<leader><tab>n", "<cmd>tabnew<cr>", { desc = "New Tab" })
|
||||
vim.keymap.set("n", "<leader><tab>]", "<cmd>tabnext<cr>", { desc = "Next Tab" })
|
||||
vim.keymap.set("n", "<leader><tab>d", "<cmd>tabclose<cr>", { desc = "Close Tab" })
|
||||
vim.keymap.set("n", "<leader><tab>[", "<cmd>tabprevious<cr>", { desc = "Previous Tab" })
|
||||
vim.keymap.set("n", "<leader><tab>j", "<cmd>tabfirst<cr>", { desc = "First Tab" })
|
||||
vim.keymap.set("n", "<leader><tab>k", "<cmd>tablast<cr>", { desc = "Last Tab" })
|
||||
vim.keymap.set("n", "<leader><tab>l", "<cmd>tabnext<cr>", { desc = "Next Tab" })
|
||||
vim.keymap.set("n", "<leader><tab>h", "<cmd>tabprevious<cr>", { desc = "Previous Tab" })
|
||||
vim.keymap.set("n", "<leader><tab>q", "<cmd>tabclose<cr>", { desc = "[Q]uit Tab" })
|
||||
|
||||
vim.keymap.set("n", "<leader>mx", "<cmd>!chmod +x %<CR>", { desc = "Chmod File E[x]ecutable", silent = true })
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@
|
|||
"fidget.nvim": { "branch": "main", "commit": "e2a175c2abe2d4f65357da1c98c59a5cfb2b543f" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "ac5aba6dce8c06ea22bea2c9016f51a2dbf90dc7" },
|
||||
"gruvbox.nvim": { "branch": "main", "commit": "49d9c0b150ba70efcd831ec7b3cb8ee740067045" },
|
||||
"gruber-darker.nvim": { "branch": "main", "commit": "a2dda61d9c1225e16951a51d6b89795b0ac35cd6" },
|
||||
"harpoon": { "branch": "harpoon2", "commit": "a84ab829eaf3678b586609888ef52f7779102263" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "7967abe55752aa90532e6bb4bd4663fe27a264cb" },
|
||||
"lazydev.nvim": { "branch": "main", "commit": "d5800897d9180cea800023f2429bce0a94ed6064" },
|
||||
"luvit-meta": { "branch": "main", "commit": "ce76f6f6cdc9201523a5875a4471dcfe0186eb60" },
|
||||
|
|
|
|||
Loading…
Reference in a new issue