Zvin
Zvin

Reputation: 73

Toggling line numbers in vimrc doesn't work

I'm new to vim. I'm using MacVim.

I use

:set number

which shows line numbers.

I've added

set number

to my vimrc, to make show line numbers by default.

My vimrc:

no <down> <Nop>
no <left> <Nop>
no <right> <Nop>
no <up> <Nop>
ino <down> <Nop>
ino <left> <Nop>
ino <right> <Nop>
ino <up> <Nop>
set number

But line numbers don't show up.

Everything in vimrc except set number works fine. What am I doing wrong?

Upvotes: 4

Views: 3527

Answers (3)

Geri
Geri

Reputation: 1

I know, this is a 10 years old post, but maybe someone like me is reading it... So I ran into the same issue, and tried vi -V, and found this message:
could not source "~/.vim/vimrc"
then I just ran a ln ~/.vim/.vimrc ~/.vim/vimrc to create a link, and that resolved the issue. Yeah, vim version 9.0.2155 in Cygwin reads a vim config file without the dot at the beginning. I do not know if this is a typo or it should be like this, but it is working for me.

Upvotes: 0

Zvin
Zvin

Reputation: 73

Problem was that I had one .vimrc in the ~/ and one in the ~/.vim/.vimrc. The one that was in the ~/ was overriding the one in in ~/.vim/.vimrc.

Upvotes: 3

Steve
Steve

Reputation: 388

I'd comment but I'm not allowed :(

I usually have had that problem when either the file or the line is corrupted or has Ctrl characters or in someversions of Unix if there was a space in the wrong place

try :set list and make sure there isn't a Tab, missing Line Feed or something

There's a way of viewing the Control Characters that don't display in :set list but can't remember it.

Shove comes to push delete the line and the one above and below. Save and retype it andsee if it fixes it.

Upvotes: 0

Related Questions