Is it possible to access vim's command-line arguments in vimscript?
vim
Solution
Strangely, I think the answer may be "No, there is no direct way to access startup options specified on the command line".
The `:args` command and `argv()` can be used to access the filename(s) specified on startup, but that's not what you want.
I see on Vim's forums that someone offered this solution to get the startup command line on Linux:
:exe '!tr "\0" " " </proc/' . getpid() . '/cmdline'
I assume there's analogous command on Windows. . . .
You can look over that forum thread here:
http://groups.google.com/group/vim_use/browse_thread/thread/43773f27cdc10265/ad17ae8180c0fb6e?show_docid=ad17ae8180c0fb6e
Problem
I found the answer to this question while writing it, so I've broadened it a little. I wanted to access the `--servername` argument, in order to create dynamic settings in my `.vimrc` file. Through vim's help, I found the `v:servername` variable, and my script is working. However, now I'm curious if it's possible to access any arbitrary command-line argument. For example, if I wanted to know if vim was in Lisp mode (`-l`) or Debugging mode (`-D`), how would I do it? There seems to be no corresponding `v:` variable for them. Here are the variables I found by autocompleting `:help v:<Tab>` Is there a general way to access command-line arguments from vimscript?