Vim editor on Linux: How to reduce numbering indentation

vim

I am working on RHEL 6.6. When i open vim editor and set numbers, the line numbers appear but there is a very big indentation from the left side of the screen. is there a way to reduce that gap: Here is a sample:

  1 #!/bin/sh
  2
  3 echo "Hello World"
  4
  5 echo "bye"

Its almost 6 spaces empty to the left of numbers 1, 2, 3 …

I tried googling but could not find an answer to this problem (though found some other useful commands around vim)

enter image description here

Here is the image for set numberwidth:
enter image description here

Here is the image for vim version:
enter image description here

Best Answer

Just adapt it with the width you want (the 4 there is the number of characters you want the number to have).

echo "set numberwidth=4" >> ~/.vimrc

Note that you must have the +linebreak compile option on in order for this to work. To check if you have this flag type :echo has('linebreak') in your vim (0 means you don't have it).

Related Question