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

feature to rename tabs #574

Merged
merged 6 commits into from
Feb 7, 2022
Merged

feature to rename tabs #574

merged 6 commits into from
Feb 7, 2022

Conversation

Tokubara
Copy link
Contributor

@Tokubara Tokubara commented Feb 7, 2022

with

command! -nargs=1 TabRename call TabRename("<args>")

function! TabRename(tabname)
  let t:tabname = a:tabname
  normal gTgt
endfunction

@shadmansaleh
Copy link
Member

shadmansaleh commented Feb 7, 2022

Add the TabRename as LualineRenameTab here . Also instead of :noramal gTgt you should use :redrawtabline .

@Tokubara
Copy link
Contributor Author

Tokubara commented Feb 7, 2022

Now with set sessionoptions+=tabpages,globals, tabnames can be saved and restored with session files.

@shadmansaleh
Copy link
Member

lgtm. Thanks for taking your time to implement this :)

@shadmansaleh shadmansaleh merged commit d52ff47 into nvim-lualine:master Feb 7, 2022
Copy link
Contributor Author

@Tokubara Tokubara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meet a situation(quite common) in which :LualineTabRename will lead to a crash.

  1. create 2 tabs.
  2. close first tab(:tabc).

Then tabline get crashed.

This happen because, when closing a tab, tabnr(tabpagenr) of a tab will change(2->1). But in tab.lua, self.tabnr does not change. So access to vim.t will be out of index.

shadmansaleh added a commit that referenced this pull request Feb 7, 2022
fixes #574 (review)

Issue was neovim's tabpage handle used by rpc-api isn't same as tab no
in viml.
Now the tabpage handle is stores in self.tabId and tab no is stored in
self.tabnr in `Tab` so any can be used when necessary.
@shadmansaleh
Copy link
Member

@Tokubara fixed in 98dc2dd

@dakennguyen
Copy link

Hi, would it possible to save tab's names when using mksession?

craigmac pushed a commit to craigmac/lualine.nvim that referenced this pull request May 15, 2024
* (feat) add rename

* remove tabname if LualineRenameTab is ran without args

* document LualineRenameTab

Co-authored-by: shadmansaleh <13149513+shadmansaleh@users.noreply.github.com>
craigmac pushed a commit to craigmac/lualine.nvim that referenced this pull request May 15, 2024
fixes nvim-lualine#574 (review)

Issue was neovim's tabpage handle used by rpc-api isn't same as tab no
in viml.
Now the tabpage handle is stores in self.tabId and tab no is stored in
self.tabnr in `Tab` so any can be used when necessary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants