Skip to content

Commit

Permalink
fix: unlisted buffer on new tab using :tab sb (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagovla committed Jun 27, 2022
1 parent 373e897 commit 8a064b3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lua/scope/core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ local M = {}
M.cache = {}
M.last_tab = 0

function M.on_tab_new()
vim.api.nvim_buf_set_option(0, "buflisted", true)
end

function M.on_tab_enter()
local tab = vim.api.nvim_get_current_tabpage()
local buf_nums = M.cache[tab]
Expand Down
2 changes: 2 additions & 0 deletions lua/scope/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ function M._setup_legacy()
autocmd TabEnter * lua require("scope.core").on_tab_enter()
autocmd TabLeave * lua require("scope.core").on_tab_leave()
autocmd TabClosed * lua require("scope.core").on_tab_closed()
autocmd TabNew * lua require("scope.core").on_tab_new()
augroup END
]]
end
Expand All @@ -20,6 +21,7 @@ function M._setup()
api.nvim_create_autocmd("TabEnter", { group = group, callback = core.on_tab_enter })
api.nvim_create_autocmd("TabLeave", { group = group, callback = core.on_tab_leave })
api.nvim_create_autocmd("TabClosed", { group = group, callback = core.on_tab_closed })
api.nvim_create_autocmd("TabNew", { group = group, callback = core.on_tab_new })
api.nvim_create_user_command("ScopeList", core.print_summary, {}) --TODO: improve this
end

Expand Down

0 comments on commit 8a064b3

Please sign in to comment.