Open a harpoon file from the quickmenu in a vertical or horizontal split

or a new tab.
This commit is contained in:
Hugh Carroll 2022-11-24 08:58:56 +00:00
parent 21d0d1bfa3
commit edf29292da
2 changed files with 36 additions and 0 deletions

View File

@ -65,6 +65,10 @@ you can also cycle the list in both directions
:lua require("harpoon.ui").nav_next() -- navigates to next mark :lua require("harpoon.ui").nav_next() -- navigates to next mark
:lua require("harpoon.ui").nav_prev() -- navigates to previous mark :lua require("harpoon.ui").nav_prev() -- navigates to previous mark
``` ```
from the quickmenu, open a file in:
a vertical split with control+v,
a horizontal split with control+x,
a new tab with control+t
### Terminal Navigation ### Terminal Navigation
this works like file navigation except that if there is no terminal at the specified index this works like file navigation except that if there is no terminal at the specified index

View File

@ -20,6 +20,38 @@ vim.api.nvim_create_autocmd({ "BufLeave, VimLeave" }, {
group = the_primeagen_harpoon, group = the_primeagen_harpoon,
}) })
vim.api.nvim_create_autocmd("FileType", {
pattern = "harpoon",
group = the_primeagen_harpoon,
callback = function()
-- Open harpoon file choice in useful ways
--
-- vertical split (control+v)
vim.keymap.set("n", "<C-V>", function()
local curline = vim.api.nvim_get_current_line()
local working_directory = vim.fn.getcwd() .. "/"
vim.cmd("vs")
vim.cmd("e " .. working_directory .. curline)
end, { buffer=true, noremap = true, silent = true })
-- horizontal split (control+x)
vim.keymap.set("n", "<C-x>", function()
local curline = vim.api.nvim_get_current_line()
local working_directory = vim.fn.getcwd() .. "/"
vim.cmd("sp")
vim.cmd("e " .. working_directory .. curline)
end, { buffer=true, noremap = true, silent = true })
-- new tab (control+t)
vim.keymap.set("n", "<C-t>", function()
local curline = vim.api.nvim_get_current_line()
local working_directory = vim.fn.getcwd() .. "/"
vim.cmd("tabnew")
vim.cmd("e " .. working_directory .. curline)
end, { buffer=true, noremap = true, silent = true })
end
})
--[[ --[[
{ {
projects = { projects = {