mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-13 17:40:25 +00:00
Open a harpoon file from the quickmenu in a vertical or horizontal split
or a new tab.
This commit is contained in:
parent
21d0d1bfa3
commit
edf29292da
@ -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
|
||||||
|
@ -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 = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user