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

Custom tab names not restored when loading session within Neovim #174

Open
FelixLisczyk opened this issue Jan 15, 2025 · 2 comments
Open

Comments

@FelixLisczyk
Copy link

Hi! First of all, thanks for this amazing plugin - it's been a game-changer for my workflow! 😊

I've run into a small issue that I thought I should report. When restoring sessions, the custom tab names behave differently depending on how the session is loaded:

  • When I load a session from the terminal (nvim -S <path-to-session-file>), everything works perfectly! The tab names are restored just as I left them.
  • However, when I load the same session from within Neovim using :lua vim.cmd.source("<path-to-session-file>"), the custom tab names don't come back.

This caught my attention because I'm using the nvim-possession session manager, which uses the second method to load sessions.

How to reproduce

  1. Create a few tabs and give them custom names
  2. Save the session
  3. Try both loading methods:
    # Terminal (works fine):
    nvim -S <path-to-session-file>
    
    # Within Neovim (tab names don't restore):
    :lua vim.cmd.source("<path-to-session-file>")
    

My setup

  • Neovim: 0.10.3
  • Tabby.nvim: 2.7.4
  • OS: macOS 15.2

My config

{
  "nanozuki/tabby.nvim",
  dependencies = "nvim-tree/nvim-web-devicons",
  config = function()
    require("tabby").setup({
      preset = "active_wins_at_tail",
      options = {
        theme = {
          fill = "TabLineFill", -- tabline background
          head = "TabLine", -- head element highlight
          current_tab = "TabLineSel", -- current tab label highlight
          tab = "TabLine", -- other tab label highlight
          win = "TabLine", -- window highlight
          tail = "TabLine", -- tail element highlight
        },
        nerdfont = true, -- whether use nerdfont
        lualine_theme = nil, -- lualine theme name
        buf_name = {
          mode = "unique",
        },
      },
    })

    vim.o.showtabline = 2 -- always show tabline
    vim.opt.sessionoptions = "curdir,folds,globals,help,tabpages,terminal,winsize" -- Save tab names in the session

    vim.api.nvim_set_keymap(
      "n",
      "<leader>tr",
      ":lua require('tabby').tab_rename(vim.fn.input('New tab name: '))<CR>",
      { noremap = true, silent = true, desc = "Rename current tab" }
    )
  end,
}

Let me know if you need any additional information! Happy to help track this down. 🙂

Thanks again for maintaining this plugin!

@nanozuki
Copy link
Owner

nanozuki commented Jan 16, 2025

Does the nvim-possession setup after tabby? tabby.nvim load tabs' name from globals only once.

@FelixLisczyk
Copy link
Author

Thanks for the quick reply!

I've done some additional testing based on your suggestion:

  1. I tried loading the plugins in different orders (both tabby.nvim before nvim-possession and vice versa), but the behavior remains the same.
  2. To isolate the issue further, I tested without nvim-possession at all - just using :lua vim.cmd.source("<path-to-session-file>") directly in Neovim. The tab names still don't restore in this case.

Since the issue occurs even without nvim-possession, I don't think it's a plugin conflict. Given that tab names restore correctly when loading from the terminal but not when sourcing the session file within Neovim, perhaps there's a different hook or event that Tabby could use when Neovim is loading the session file internally?

(I'm fairly new to Neovim's internals, so I apologize if I'm missing something obvious here!)

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

No branches or pull requests

2 participants