I want to see what shell command line were used to start Vim. For example, I used command

vim -S Session.vim

argv() and argc() don't show switches and it's parameters.


:echo tr(join(readfile("/proc/" . getpid() . "/cmdline")), "\n", " ")

shows command line. But, is there more elegant (shorter) method?

1 Answer 1


You can use the special v: variable v:argv, which would show, when running vim -S Session.vim exactly this:

:echo v:argv
['vim', '-S', 'Session.vim']

In addition, to get the proper vim binary, you should probably also use the v:progpath variable, which specifies the exact path of the vim binary that was run (which matters if you have several vim binaries installed, because e.g. you compile your own version)

  • There is no v:argv in Vim 7.4 that I use. But thanks for hint.
    – hobo-mts
    May 17, 2023 at 8:29
  • yeah, it was added later in v8.1.2233 You should really consider to upgrade, 7.4 is really old now May 17, 2023 at 8:44
  • I like classic versions when I start use'n Vim. :terminal, VimL9...
    – hobo-mts
    May 17, 2023 at 15:30
  • I do to. But still you wouldn't get all the security updates and some of the core vim feature enhancements May 19, 2023 at 20:09
  • I'm inspired Your problem with Vim.... And Vim 7.4 never sum up me on 2 machines: Linux 2.6 and Cygwin. New features are OK. But for me 7.4 is enough.
    – hobo-mts
    May 20, 2023 at 8:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.