Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(esupports.hop): Add tab drop as option for open_mode #1580

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lua/neorg/modules/core/esupports/hop/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ module.load = function()
dirman_utils = module.required["core.dirman.utils"]
vim.keymap.set("", "<Plug>(neorg.esupports.hop.hop-link)", module.public.hop_link)
vim.keymap.set("", "<Plug>(neorg.esupports.hop.hop-link.vsplit)", lib.wrap(module.public.hop_link, "vsplit"))
vim.keymap.set("", "<Plug>(neorg.esupports.hop.hop-link.tab-drop)", lib.wrap(module.public.hop_link, "tab-drop"))
end

module.config.public = {
Expand Down Expand Up @@ -208,9 +209,16 @@ module.public = {
end,

buffer = function()
open_split()
if open_mode ~= "tab-drop" then
open_split()
end

if located_link_information.buffer ~= vim.api.nvim_get_current_buf() then
if open_mode ~= "tab-drop" then
vim.cmd("tab drop " .. vim.api.nvim_buf_get_name(located_link_information.buffer))
return
end

vim.api.nvim_buf_set_option(located_link_information.buffer, "buflisted", true)
vim.api.nvim_set_current_buf(located_link_information.buffer)
end
Expand Down