2

This question might seem identical to This One but its not. I can :set number from within a file I'm editing but how can I have them always be on by default? Now as per that answer its recommended to add set number to ~/.vimrc file. But you see there's no such file in my home file. From this question I tried to create that .vimrc file. It works and line number is shown. But problem is then all code highlighting is gone. How to resolve this? How to show line number with keeping code highlighting?

Community
  • 1
  • 1
Milon Sarker
  • 478
  • 8
  • 25

2 Answers2

4

Add set nu and syntax on to your .vimrc

echo 'set nu' >> ~/.vimrc    
echo 'syntax on' >> ~/.vimrc
sa77
  • 3,563
  • 3
  • 24
  • 37
0

added syntax on along with set number in ~/.vimrc file. It works perfectly.

Milon Sarker
  • 478
  • 8
  • 25