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 MacBook Pro (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?


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
Huge version without GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +tag_binary
+arabic          +file_in_path    +mouse_sgr       +tag_old_static
+autocmd         +find_in_path    -mouse_sysmouse  -tag_any_white
-balloon_eval    +float           +mouse_urxvt     -tcl
-browse          +folding         +mouse_xterm     +terminfo
++builtin_terms  -footer          +multi_byte      +termresponse
+byte_offset     +fork()          +multi_lang      +textobjects
+channel         -gettext         -mzscheme        +timers
+cindent         -hangul_input    +netbeans_intg   +title
-clientserver    +iconv           +packages        -toolbar
+clipboard       +insert_expand   +path_extra      +user_commands
+cmdline_compl   +job             +perl            +vertsplit
+cmdline_hist    +jumplist        +persistent_undo +virtualedit
+cmdline_info    +keymap          +postscript      +visual
+comments        +langmap         +printer         +visualextra
+conceal         +libcall         +profile         +viminfo
+cryptv          +linebreak       +python          +vreplace
+cscope          +lispindent      -python3         +wildignore
+cursorbind      +listcmds        +quickfix        +wildmenu
+cursorshape     +localmap        +reltime         +windows
+dialog_con      -lua             +rightleft       +writebackup
+diff            +menu            +ruby            -X11
+digraphs        +mksession       +scrollbind      -xfontset
-dnd             +modify_fname    +signs           -xim
-ebcdic          +mouse           +smartindent     -xsmp
+emacs_tags      -mouseshape      +startuptime     -xterm_clipboard
+eval            +mouse_dec       +statusline      -xterm_save
+ex_extra        -mouse_gpm       -sun_workshop    -xpm
+extra_search    -mouse_jsbterm   +syntax          
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H   -F/usr/local/Frameworks -DMACOS_X_UNIX  -Os -w -pipe -march=native -mmacosx-version-min=10.11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1      
Linking: /usr/bin/clang   -L. -L/usr/local/lib -L/usr/local/lib -F/usr/local/Frameworks -Wl,-headerpad_max_install_names -o vim        -lm  -lncurses -liconv -framework Cocoa   -fstack-protector  -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl -framework Python   -lruby.2.0.0 -lobjc


Vim 7.4 installed via Homebrew on my iMac desktop has hybrid number mode working fine, so there must be something specific about my laptop, but I have no idea what. Moving my .vimrc and packages somewhere else didn't change anything.

  • It might be a bug. Consider reporting at github.com/macvim-dev/macvim/issues
    – muru
    Apr 6 '16 at 12:17
  • I thought Vim was different from MacVim. If I used brew install vim and not brew install macvim would that still be the place to report it? Apr 6 '16 at 12:28
  • No, I assumed you were on MacVim. Sorry about that.
    – muru
    Apr 6 '16 at 12:29

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.

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.