New answers tagged

0

This comment by Matt led me to the solution: creating an autocommand for the FileChangedShell event seems to suppress the warning. I ended up using the following no-op autocommand: autocmd FileChangedShell * :


2

You can cheat a little using this method: vim -S Session.vim -c ":e OTHER_FILE" This will source your Session.vim then load the file you want. From what I have read in the man page, the commands specified with -c will be executed last: +{command} -c {command} {command} will be executed after the first file has been read. {command} is ...


2

Yes, it's possible to do an if check in a -c from the command-line, you just need to get the syntax right with the Vim command separator which is actually |. (Also, there's no then in Vim's if syntax.) You probably also want to reserve the use of single quotes for the shell (use them on the outside), to prevent the shell from trying to interpret $ as a meta-...


2

In fact, it's more correct to handle this by shell script, so you can skip creating Vim process completely. However, if you wonder if Vim is able to process conditions on command-line - yes, why not? The problem is you misuse some kind of arbitrary syntax, while Vim wants only VimScript. So the following should be okay: vim $files -c 'if !argc() | qa | endif'...


5

VimScript makes a difference between commands and expressions. Whatever you type in the command-line is a command. Commands can output some text, but they cannot "return" anything, and so they cannot be nested one into another (except string arguments). On the other hand, expression cannot stand in the command-line alone. E.g. 2+2 is an expression, ...


Top 50 recent answers are included