How to change the width of file tabs in sublime text

2

I want all the file tabs in Sublime text to be of uniform size that increase or decrease uniformly depending on the number of tabs that are added or removed (Like how tabs work in Google Chrome). Currently the size of the tab changes according to the length of the file name that is open in that tab. This results in uneven sized tabs. I am currently using the Default Sublime theme Adaptive.sublime-theme. I tried adding the tab_width property to this theme but it didn't make any difference.

 // Tabs
{
    "class": "tabset_control",
    "layer0.opacity": 1.0,
    "content_margin": [4, 0, 8, 0],
    "tint_index": 0,
    "tab_height": 34,
    "tab_overlap": 16,
    "tab_width":10
},

Ghos3t

Posted 2018-04-19T05:37:46.167

Reputation: 382

Ended up here because I also want this. Did you ever manage it? – Chud37 – 2019-03-05T13:18:26.310

@Chud37 I kind of gave up on it, I am hoping someone with better understanding of sublime text will come along and read this question and give me some kind of hint. But considering the low number of upvotes on this question I doubt anyone will see this question unless they search for similar keywords. – Ghos3t – 2019-03-06T01:07:31.463

Answers

0

I was looking for the exact functionality you described. You can check out Sublime's theme docs on tabs, and unfortunately, there is no tab_max_width property, which would be ideal, but there is a work around.

Basically the strategy I went with is to set the tab_min_width wide enough to fit almost any file name. So since you're using the Adaptive theme, create a file of the same name in the Sublime User folder called Adaptive.sublime-theme, and add the following:

[
  {
    "class": "tabset_control",
    "tab_min_width": 270,
  }
]

Since the file is of the same name as the current theme, it will overwrite any rules set there. 270 is what worked for me since I'm dealing with pretty long file names. The downside is that short file names have a lot of padding in their tabs. Also, really, really long file names will still have tabs wider than the others, so it's not a perfect solution, but works for me 99% of the time.

n_i_c_k

Posted 2018-04-19T05:37:46.167

Reputation: 101