Quantcast

reduce space around filenames in tabs

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

reduce space around filenames in tabs

Richard Mitchell
Specifically I'm talking about the GUI tabs by doing: ":tabedit FILE"

The excessive space around each filename causes the tab bar to fill, getting the ">>" tab.  Is there a way to each tab be the size of the filename plus a little padding?

Thanks,
Richard

--
--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_mac" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: reduce space around filenames in tabs

Andrew Long-7

> On 20 Oct 2016, at 13:37, Richard Mitchell <[hidden email]> wrote:
>
> Specifically I'm talking about the GUI tabs by doing: ":tabedit FILE"
>
> The excessive space around each filename causes the tab bar to fill, getting the ">>" tab.  Is there a way to each tab be the size of the filename plus a little padding?
>
> Thanks,
> Richard

I hacked this out of a very nice little book called ‘Hacking VIM’ by Kim Schultz. It shortens the tab names to a ‘reasonable’ size, truncating as necessary. I’m sure there’s more thatcould be done, but this works well enough for me.

Put it in your .gvimrc

Regards, Andy

"
" function ShortTabLabel from 'Hacking VIM' (Kim Schulz)
"
function! ShortTabLabel()
        let bufnrlist = tabpagebuflist(v:lnum)
        let ret = ''
"
" Show up to 12 letters of the file name, truncated to 10
" plus an ellipsis if the name is longer then 12
"
        let label = bufname(bufnrlist[tabpagewinnr(v:lnum) - 1])
        let filename = fnamemodify(label,':t')
        if strlen( filename ) > 12
"
" Show up to 12 letters of the file name, truncated to 10
" plus an ellipsis if the name is longer then 12
"
                let ret .= filename[0:9] . '..'
                else
"
" Pad the file name, out to 12 letters
"
                let ret .= strpart(filename . '          ',0, 12 )
        endif
        return ret
endfunction

" set guitablabel=%{ShortTabLabel()}
set guitabtooltip=%!bufname($)


--
Andrew Long
Andrew dot Long at Mac dot com

--
Andrew Long
Andrew dot Long at Mac dot com

--
--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_mac" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: reduce space around filenames in tabs

Richard Mitchell
On Thursday, October 20, 2016 at 12:17:58 PM UTC-4, Andrew Long wrote:

> > On 20 Oct 2016, at 13:37, Richard Mitchell wrote:
> >
> > Specifically I'm talking about the GUI tabs by doing: ":tabedit FILE"
> >
> > The excessive space around each filename causes the tab bar to fill, getting the ">>" tab.  Is there a way to each tab be the size of the filename plus a little padding?
> >
> > Thanks,
> > Richard
>
> I hacked this out of a very nice little book called ‘Hacking VIM’ by Kim Schultz. It shortens the tab names to a ‘reasonable’ size, truncating as necessary. I’m sure there’s more thatcould be done, but this works well enough for me.
>
> Put it in your .gvimrc
>
> Regards, Andy
>
> "
> " function ShortTabLabel from 'Hacking VIM' (Kim Schulz)
> "
> function! ShortTabLabel()
> let bufnrlist = tabpagebuflist(v:lnum)
> let ret = ''
> "
> " Show up to 12 letters of the file name, truncated to 10
> " plus an ellipsis if the name is longer then 12
> "
> let label = bufname(bufnrlist[tabpagewinnr(v:lnum) - 1])
> let filename = fnamemodify(label,':t')
> if strlen( filename ) > 12
> "
> " Show up to 12 letters of the file name, truncated to 10
> " plus an ellipsis if the name is longer then 12
> "
> let ret .= filename[0:9] . '..'
> else
> "
> " Pad the file name, out to 12 letters
> "
> let ret .= strpart(filename . '          ',0, 12 )
> endif
> return ret
> endfunction
>
> " set guitablabel=%{ShortTabLabel()}
> set guitabtooltip=%!bufname($)
>
>
> --
> Andrew Long
> Andrew dot Long at Mac dot com
>
> --
> Andrew Long
> Andrew dot Long at Mac dot com
Interesting solution, but doesn't fix my issue.  Here's a screenshot showing the absurd padding:

--
--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_mac" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

Screen Shot 2016-10-21 at 05.35.56.png (16K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: reduce space around filenames in tabs

Frank Hellenkamp-2

> Interesting solution, but doesn't fix my issue.  Here's a screenshot showing the absurd padding:

That's not padding, if you are talking about the space on the left and
right - that is the min-width of the tabs.

I haven't tried if this still works:
https://groups.google.com/forum/#!topic/vim_mac/EdHky0bzfPs


Frank

--
frank hellenkamp | interface designer
solmsstraße 7 | 10961 berlin

+49.30.49 78 20 70 | tel
+49.176.32 13 88 89 | mbl
[hidden email]

http://depage.net | bureau
http://everydayisexactlythesame.net | see
https://twitter.com/depage_net | twitter


--
--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_mac" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: reduce space around filenames in tabs

Richard Mitchell
On Friday, October 21, 2016 at 10:35:44 AM UTC-4, jonas_jonas wrote:

> > Interesting solution, but doesn't fix my issue.  Here's a screenshot showing the absurd padding:
>
> That's not padding, if you are talking about the space on the left and
> right - that is the min-width of the tabs.
>
> I haven't tried if this still works:
> https://groups.google.com/forum/#!topic/vim_mac/EdHky0bzfPs
>
>
> Frank
>
> --
> frank hellenkamp | interface designer
That does help, sort of.  The tab width should be defined dynamically by the size of the filename and the amount of space available.  Dropping back to the minimal size and then leaving unused space isn't very helpful.  It forces one to make compromises when there shouldn't be a need to do so.

--
--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_mac" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

Screen Shot 2016-10-21 at 10.45.35.png (8K) Download Attachment
Loading...