0

I successfully applied the solution to this question: Vim: how to restore the cursor's logical and physical positions?

However, the above solution appears to override +<lnum> passed on the command line. How can I have vim give the command line precedence over this entry in _vimrc:

au BufWinLeave *? mkview
au VimEnter *? silent loadview
Bernhard Wagner
  • 1,681
  • 12
  • 15

1 Answers1

2

From :help VimEnter, emphasis mine:

After doing all the startup stuff, including loading .vimrc files, executing the "-c cmd" arguments, creating all windows and loading the buffers in them.

Since the VimEnter event is triggered after +<lnum>, autocommands bound to that event will always be executed after +<lnum>.

From there, you have two paths…

  • use another autocommand in your command-line argument:

    $ vimfilename +au\ VimEnter\ *\ 34
    
  • find a more appropriate event.

romainl
  • 186,200
  • 21
  • 280
  • 313