On 09/13/2012 12:54 AM, Tony Mechelynck wrote:
[...]
Ah, yes, setting 'nocompatible' automagically because a vimrc was found
doesn't work when Vim itself doesn't search for the vimrc, including
when it is loaded by -u

If your vimrc sources the vimrc_example.vim, the latter will set
'nocompatible'. Or you can set 'nocompatible' at the top of your vimrc
against the rare case when it will be loaded by -u or in the manner
shown in my earlier post.

Another possibility, to mimic even more closely what Vim normally does,
is the following slight change to the code snippet I gave earlier:

       " in batch mode, 'compatible' is on by default
       " and Vim doesn't try to find a vimrc. Let's correct that.
       if filereadable("$HOME/.vimrc")
           set nocompatible
           source ~/.vimrc
       elseif filereadable("$HOME/_vimrc")
           set nocompatible
           source ~/_vimrc
       endif
       " also, global plugins are not sourced. But what if we need them?
       runtime! plugin/*.vim

Yes, well, in my case, -N does exactly what I need, without the code snippet (that is because I do not need the .vimrc in my Makefile, of course)

And finally, to set 'verbose' from a shebang line, why not use (untested)

     #!/usr/local/bin/vim --cmd 'set verbose=1' -NesS

to which the (script's) filename will be added by the loader? OTOH, of
course you could also set 'verbose' from one of the lines in the script
itself.

Unfortunately, for reasons beyond my limited understanding of our existence, the shebang line allows at most one additional argument after the interpreter path. Maybe using some shell there instead, that in turn invokes Vim with whatever options I need ...

Thank you,
Timothy Madden

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to