How does one set a vim option when launching from bash or another shell?
1 Answer
$ vim -c 'set ai'
See :h -c
, :h startup
and $ vim --help
.
-
4If you intend to open multiple windows (
vim -O
orvim -o
) and want to set this command for all of them, use-c windo <option>
. Example:vim -O -c 'windo set ai'
).– scaiApr 13, 2018 at 12:32 -
Example I would find useful:
vim -c 'set wrap' /path/to/file.txt
Jul 22, 2018 at 23:02 -
2If you want to set multiple options, separate them with the pipe character, like
vim -c 'set ai | set nowrap'
– wisbuckyJun 24, 2019 at 22:48 -
1Does
set ai nowrap
not work for you @wisbucky? You should be able to set multiple options with a singleset
command. Jun 28, 2019 at 14:07 -
@MartinTournoij Thanks, I didn't know about that! (Well, I guess my comment can still be helpful if you need to run different commands)– wisbuckyJun 28, 2019 at 20:14