📅 2015-Sep-30 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ command, mkspell, spellfile, vim ⬩ 📚 Archive
Vim can be started just for the purpose of executing one or more Vim commands. This can be done using the -c
commandline option to Vim. When one or more of these is provided, Vim is started, then executes these commands first and then renders the edit window.
For example, to open Vim with its internal help documentation:
$ vim -c help
Note how the internal help command is :help
and we can drop the colon when using the command option.
To open a file named foo
in Vim using this command option:
$ vim -c "e foo"
To open two files named foo
and bar
in Vim using this command option:
$ vim -c "e foo" -c "e bar"
The above examples are convoluted, since files can be opened directly without using this command option.
Here is a problem that I could solve only using this command option: I update the Vim text spellfile manually and I want to compile the binary spellfile from the shell or from a script. Easy to achieve by calling the command to compile spellfile mkspell
and then quit q
:
$ vim -c "mkspell! ~/.vim/spell/en.utf-8.add" -c q
Tried with: Vim 7.4.52 and Ubuntu 14.04