2

I recently discovered that Vim 7.4 enables a hybrid number mode, such that if you do set nu and set rnu, you'll see the absolute line number of the current line and relative line numbers everywhere else (see here and here). I set this up on a Linux machine and it works great. Unfortunately it's not working on my Mac (El Capitan). If I type :set rnu I'll get relative numbers with 0 at the cursor line, and if I then type :set nu it will switch to only absolute line numbers, unlike what I see on the Linux machine. I have Vim 7.4 installed via Homebrew. How do I get this to work? Do I need to reinstall with some particular setting?

  • Strange. It works fine for me. Also using the brew-installed 7.4 version of vim. I didn't install vim in any particular way or with any particular flags. Have you tried cleaning out your plugins and .vimrc to see if you maybe have a conflicting setting? – Ian C. Apr 6 '16 at 3:50
  • Oh. FWIW I already had :set number in my .vimrc so I was doing :set relativenumber -- maybe it's order-dependent? – Ian C. Apr 6 '16 at 3:51
  • @Ian C. Yeah I'll try cleaning out the plugins. I don't think it's order dependent. Either order works fine on my Linux machine and I tried both ways on my Mac – Ben Lindsay Apr 6 '16 at 4:03
  • @IanC. Unfortunately, even changing the names of my .vimrc file and whole .vim folder (where all my plugins are) didn't change the behavior. Really not sure what to check from here. The output of vim --version is VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Apr 5 2016 22:32:58) MacOS X (unix) version Included patches: 1-1707 Compiled by Homebrew ...etc etc... – Ben Lindsay Apr 6 '16 at 12:02
2

It turns out the problem was not with Vim 7.4, Homebrew, Macs, or any combination of the 3. Just my brain. I was used to vi pointing to the vim that I want, but in my case vim points to the Homebrewed version and vi points to the version originally on my Mac, which was Vim 7.3. I usually use vi and vim interchangeably and that shot me in the foot here. I have vi aliased to the Homebrewed Vim now and everything is dandy.

  • 1
    Ha. Well, thanks for putting me on to :set relativenumber -- that's now in my vimrc and I'm digging it. – Ian C. Apr 6 '16 at 17:37
  • Good, I'm glad something useful came out of my blinding stupidity :) – Ben Lindsay Apr 6 '16 at 17:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .