jeffkreeftmeijer / vim-numbertoggle

Toggles between hybrid and absolute line numbers automatically
https://jeffkreeftmeijer.com/vim-number/#automatic-toggling-between-line-number-modes
MIT License
682 stars 49 forks source link

Only show numbers on listed buffers #18

Closed frace closed 9 years ago

frace commented 11 years ago

This reverts commit c5a9e6d0290db4697084e35e1a4eacd1a09a26d1.

jeffkreeftmeijer commented 11 years ago

Hey farce,

Thanks again for your help, but could you explain what problem this is solving? I'm sorry if this is something really obvious, my vim-fu is lacking. ;)

frace commented 11 years ago

Hi Jeff,

well, I guess I just entered the first chamber of vim-fu, too. It's a long way to reach the 36th chamber. XD Personally I find it very disturbing to have line numbers appear in utilities like NERDTree, Tabbar and others at all. I found out the buffers of those utilities are not listed as a buffer in the list of buffers (:buffers). So the commit tries to avoid to show line numbers in unlisted buffers by validating buflisted(bufnr("%")). It returns 0 for unlisted buffers and 1 for listed buffers. So far I can say it seems to work fine over here.

If there is a better approach then I hope some masters from the 36th chamber would hopefully raise their voices. ;) Making it an optional feature would possibly make sense.

Cheers

greduan commented 11 years ago

@frace it seems you implemented the stuff that I implemented in my fork: https://github.com/Greduan/vim-numbertoggle/tree/master/ftplugin

In an almost entirely different method though. :)

It seems you are checking if the buffer counts as a preview buffer correct? And if it does count as one then disable line numbers on it?

In comparison to my method which checks for individual buffers and weeds them out basically.

Am I correct? Cause this is almost purely guessing. lol

frace commented 11 years ago

Great minds. XD

Hah, I really don't know what a preview buffer is. But if a preview buffer is a buffer which does not appear in the buffer list when calling :buffers then I'd say you are right.

So what do you think? Which approach "should" be the way to go? Which gives the most flexibility?

greduan commented 11 years ago

@frace I believe preview buffers aren't on the buffer list usually. Not sure myself of what preview buffers are but that's something I've noticed.

My thoughts on it are that while it is a good method, sometimes you do want to show line numbers on this kind of buffer.

For example, in Vundle buffers it's useful to know which entry in the bundle list you are, this would just disable it.

So make things short, it's a good way to go about it, but I don't think it's the best.

frace commented 11 years ago

Thanks for your input!

greduan commented 11 years ago

@frace No problem. :)