5

Is there any way to show line numbers by default, for all windows, buffers, and tabs opened inside Vim (including man pages, netrw buffers, etc.)?

What I have already tried to edit _vimrc by putting set number. This changes the behavior of the all new file buffers. But while I am opening a man page or navigating a directory listing using netrw or NERDTree, the line numbers are not showing up. And for each kind of those windows, buffers and tabs, I have to run :se nu. Are there any way to enable Vim to show up line numbers for all its buffers?


Why do I need this?

I am very new to Vim and try to adopt its culture. Previously, I was using Epsilon — a EMACS-style text editor editor for a long time. But, some time ago, I found this question at Stack Overflow and was very astonished to see its answer and started to learn Vim.

Now, in my previous editor these are easy settings for me, what my eyes are very familiar with. And I believe there must some way to do this in Vim too.


Can anybody help me or at least give me some hint to get this setting done?

  • One question per post, please. Either split up your post, or ask how to apply your general settings to netrw/NerdTree buffers. – muru Feb 11 '16 at 13:55
  • @muru: those are very similar and perhaps...would guide me to the same same direction... – Cylian Feb 11 '16 at 13:59
  • Exactly. So why post as if these are two wildly differing things? – muru Feb 11 '16 at 14:01
  • @muru: perhaps not...may be the questions are divided into...but it also ends up with one conclusion...as those are slightly different in nature and that is why those are split likewise... – Cylian Feb 11 '16 at 14:03
  • yet your title is combined. – muru Feb 11 '16 at 14:05
5

From mMontu's answer, to my another similar question.... that this can easily be solved by adding below line in vimrc:

au BufWinEnter * set number
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.