Run vim command from .... the command line!
Generally vim is started at the command line with the vim
command and it comes equipped with the -c
flag for running commands.
-c
will open vim, run a command, and stay open, so if you wanted to open vim with a smile you could run:
vim -c ':smile'
If you wanted to run a subsitution on a file with vim's substitute command, then save, then quit, that would look like:
vim -c '%s/frown/upside-down/g | write | quit' frowns.txt
Tweet