Merge pull request #235 from psaikido/master

Open a harpoon file from the quickmenu in a vertical or horizontal split
This commit is contained in:
ThePrimeagen 2023-02-21 09:30:27 -07:00 committed by GitHub
commit 8faeac2b91
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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_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
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,
})
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 = {