You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is kind of hard to explain, but setting variables using vim.api.nvim_tabpage_set_var doesn't always bind them to the tab itself, rather, it binds them to the tab page number, and vim.api.nvim_tabpage_get_var doesn't always return the variable that's bound to the tab, sometimes it returns a variable that was bound to the tab page number with vim.api.nvim_tabpage_set_var.
The result is that the variable isn't really bound in a predictable way, and if you move or otherwise rearrange tabs, the variables will no longer be bound to the correct tab.
Steps to reproduce
Type nvim --clean
Open 3 tabs by typing :tabnew and enter three times.
Make sure you are on the last tab by typing 3gt.
Type :lua vim.api.nvim_tabpage_set_var(vim.fn.tabpagenr(), "foo", "foo")
Type :echo t:foo, observe that it echos foo
Type :lua print(vim.api.nvim_tabpage_get_var(vim.fn.tabpagenr(), "foo")), observe that it prints foo
Type :tabmove 0 to move this tab to the first tab in the list.
Type :echo t:foo, observe that it echos foo
Type :lua print(vim.api.nvim_tabpage_get_var(vim.fn.tabpagenr(), "foo")), it is an error!
Type 3gt to go to the last tab in the list
Type :echo t:foo, it is an error (expected)
Type :lua print(vim.api.nvim_tabpage_get_var(vim.fn.tabpagenr(), "foo")), it prints foo!
It's like vim.api.nvim_tabpage_get_var and vim.api.nvim_tabpage_set_var use an intermediary storage place and it is NOT properly synced when tabs are rearranged.
Expected behavior
The variable should be bound to the tab, not the tab page number, and vim.api.nvim_tabpage_get_var and vim.api.nvim_tabpage_set_var should synchronize with tab rearrangements correctly.
Neovim version (nvim -v)
v0.10.0-dev-2173+g6cbfe4545-Homebrew
Vim (not Nvim) behaves the same?
This is Neovim only
Operating system/version
MacOS 14.3.1
Terminal name/version
Iterm 3.4.23
$TERM environment variable
xterm-256color
Installation
Homebrew
The text was updated successfully, but these errors were encountered:
nvim_tabpage_set_var and nvim_tabpage_get_var do not take tabpage numbers as argument. They take tabpage handles. You need to use nvim_list_tabpages to map tabpage numbers to tabpage handles.
Problem
This is kind of hard to explain, but setting variables using
vim.api.nvim_tabpage_set_var
doesn't always bind them to the tab itself, rather, it binds them to the tab page number, andvim.api.nvim_tabpage_get_var
doesn't always return the variable that's bound to the tab, sometimes it returns a variable that was bound to the tab page number withvim.api.nvim_tabpage_set_var
.The result is that the variable isn't really bound in a predictable way, and if you move or otherwise rearrange tabs, the variables will no longer be bound to the correct tab.
Steps to reproduce
nvim --clean
:tabnew
and enter three times.3gt
.:lua vim.api.nvim_tabpage_set_var(vim.fn.tabpagenr(), "foo", "foo")
:echo t:foo
, observe that it echosfoo
:lua print(vim.api.nvim_tabpage_get_var(vim.fn.tabpagenr(), "foo"))
, observe that it printsfoo
:tabmove 0
to move this tab to the first tab in the list.:echo t:foo
, observe that it echosfoo
:lua print(vim.api.nvim_tabpage_get_var(vim.fn.tabpagenr(), "foo"))
, it is an error!3gt
to go to the last tab in the list:echo t:foo
, it is an error (expected):lua print(vim.api.nvim_tabpage_get_var(vim.fn.tabpagenr(), "foo"))
, it prints foo!It's like
vim.api.nvim_tabpage_get_var
andvim.api.nvim_tabpage_set_var
use an intermediary storage place and it is NOT properly synced when tabs are rearranged.Expected behavior
The variable should be bound to the tab, not the tab page number, and
vim.api.nvim_tabpage_get_var
andvim.api.nvim_tabpage_set_var
should synchronize with tab rearrangements correctly.Neovim version (nvim -v)
v0.10.0-dev-2173+g6cbfe4545-Homebrew
Vim (not Nvim) behaves the same?
This is Neovim only
Operating system/version
MacOS 14.3.1
Terminal name/version
Iterm 3.4.23
$TERM environment variable
xterm-256color
Installation
Homebrew
The text was updated successfully, but these errors were encountered: