From 484614fad1ee1fd89bc135932ba7d2ec7a63d4bf Mon Sep 17 00:00:00 2001 From: Devansh Sharma Date: Fri, 13 Sep 2024 22:10:21 +0530 Subject: [PATCH] feat(esupports.hop): Add tab drop as option for open_mode --- lua/neorg/modules/core/esupports/hop/module.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lua/neorg/modules/core/esupports/hop/module.lua b/lua/neorg/modules/core/esupports/hop/module.lua index aa3748321..64d04f1ed 100644 --- a/lua/neorg/modules/core/esupports/hop/module.lua +++ b/lua/neorg/modules/core/esupports/hop/module.lua @@ -34,6 +34,7 @@ module.load = function() dirman_utils = module.required["core.dirman.utils"] vim.keymap.set("", "(neorg.esupports.hop.hop-link)", module.public.hop_link) vim.keymap.set("", "(neorg.esupports.hop.hop-link.vsplit)", lib.wrap(module.public.hop_link, "vsplit")) + vim.keymap.set("", "(neorg.esupports.hop.hop-link.tab-drop)", lib.wrap(module.public.hop_link, "tab-drop")) end module.config.public = { @@ -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