Skip to content

Commit

Permalink
feat(esupports.hop): Add tab drop as option for open_mode
Browse files Browse the repository at this point in the history
  • Loading branch information
devansh08 committed Sep 13, 2024
1 parent ba35900 commit 484614f
Showing 1 changed file with 9 additions and 1 deletion.
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

0 comments on commit 484614f

Please sign in to comment.