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

Make tabs pick custom name if they have been renamed #2

Open
griimick opened this issue Mar 25, 2024 · 2 comments
Open

Make tabs pick custom name if they have been renamed #2

griimick opened this issue Mar 25, 2024 · 2 comments

Comments

@griimick
Copy link

griimick commented Mar 25, 2024

I added a keybind to rename active tab title as described in here and am trying to make the plugin pick the custom renamed title.

Then, made a change in the format-tab-title event handler to get the custom title using tab:get_title() instead of tab.active_pane.title. I am getting this unexpected output.

lmk if you have inputs on what I might be doing wrong. Thanks!

After change: ("nani" was set using the keybind that uses tab:set_title(line))
image

Original:
image

@griimick
Copy link
Author

It works now! Let me know if you think it's a good addition to plugin, I can open PR.

image

@eljamm
Copy link

eljamm commented Apr 10, 2024

I wanted to have the abiltiy to hide or show inactive tabs and I found your proposal, so I decided to combine them 😄

You can include it in your PR if the author thinks it's a good idea.

    local function hide_or_display_inactive(tabtitle)
      if not tab.is_active and C.tabs.hide_inactive.enabled then
        return ""
      end
      return tabtitle
    end

    local tabtitle = tab.tab_title
    if #tabtitle > 0 then
      if not C.tabs.hide_inactive.ignore_renamed then
        tabtitle = hide_or_display_inactive(tabtitle)
      end
    else
      tabtitle = hide_or_display_inactive(tab.active_pane.title)
    end

I have the following config structure in mind, but we can change it to something else if it makes more sense:

  tabs = {
    hide_inactive = {
      enabled = false,
      ignore_renamed = false,
    },
  },

Examples:

Screenshot from 2024-04-10 21-59-25

Screenshot from 2024-04-10 22-03-52

Screenshot from 2024-04-10 22-00-39

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