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

NERDTree always shows line numbers #19

Closed AdamWhittingham closed 7 years ago

AdamWhittingham commented 11 years ago

Hi,

NERDTree no longer honours the setting for hiding line numbers. I tried adding let nerdtreeshowlinenumbers=0 to the end of the update function to no avail. Is there an easy way to make NERDTree exempt from showing the line numbers please?

Thanks for a neat plugin!

aostrega commented 11 years ago

Adding this to the top of UpdateMode() helped me make the line numbers not appear in NERDTree:

    if(exists('t:NERDTreeBufName') && bufname('%') == t:NERDTreeBufName)
        return
    end

However, I'm having trouble getting it to check the NERDTreeShowLineNumbers variable. For some reason, Vim will complain that it's undefined inside the script.

AdamWhittingham commented 11 years ago

Setting them off is good enough for me at the moment, many thanks!

eddiemonge commented 11 years ago

should it check the buffer first to see if line numbers are showing before switching/setting them?

aostrega commented 11 years ago

That is a better idea.

Leandros commented 7 years ago

Reappeared with 2.0 update.

jeffkreeftmeijer commented 7 years ago

Instead of adding exceptions for tools like NERDTree, I'd like numbertoggle to disable itself automatically in buffers without line numbers. This means users would have to set number and relativenumber in their ~/.vimrc files themselves, which I think would be acceptable.

I opened a pull request in #38 to disable numbertoggle automatically when number is not set, which works for me in Goyo. @Leandros since I don't have NERDTree installed, could you switch your install to the if-number branch to check if this fix works with NERDTree as well?

Leandros commented 7 years ago

Yes, seems to work. NERDTree isn't showing line-numbers anymore after switching to it.