Autovim is simply Vimscript optimized for processing files using the command line. It also has special syntax additions, built-in mappings and updated defaults to make it better suited for code golfing. It is directly inspired by V.
Autovim currently works on Linux and Windows using Git Bash (not in PowerShell or cmd.exe). You also need to have VIM installed and available in your PATH
. It is tested against VIM 7.4.1721
and 8.0
.
Since this is still under development, installation is done manually; simply checkout this repo, run chmod +x ./bin/autovim
and you're good to go!
autovim run script.autovim
will run the specified script on whatever is provided to stdin, and write the output to stdout.
See the tutorial to get started.
See the documentation for more information.
- It is less verbose for normal commands that require variables. A good example is
execute "normal qqqqqyy".@x."pj@qq@q"
, which can be expressedqñÿ®xpj
- It can be used as a simple command line tool. The command
autovim run myscript.autovim
will output the script result to stdout (or to a file if you specify--out
) - It allows compressing commands, e.g.
yy
can be expressed asÿ
(and also offers tools to compress/uncompress any Vimscript file) - It can receive input parameters from the command line, e.g.
autovim run myscript.autovim -@n "John Doe"
- It uses
nocompatible
and very magic / global regex by default - It has no dependencies other than Vim itself
Any Vimscript script file will work as is; Autovim will simply expand compressed expressions. Therefore, this:
ñÿ®xp
is the exact equivalent of
execute "normal! yy" . @x . "p"
See Autovim Documentation for more syntax examples.
This project is mostly for learning purposes, but if you think you can use it yourself and feel like contributing, please do so. The only requirements is that tests still pass, the coding style is similar to the rest and new functionality has been discussed with me first.
To run tests, simply run chmod +x ./tests/test
and run the script.
Three things are happening:
./bin/autovim
takes the command line inputs and forward them to vim by setting ag:autovim_cmd
variable using--cmd
./src/vimrc
is used to provide the runtime environment common to the scripts and autovim itself - it also defines mappings likeÿ
./src/autovim.vim
then parses the input, loads the script, do some regex replacements on it, and finally runs (source) the result on the input file
All of Autovim and its documentation was written on an Android phone (Samsung S7 Edge) thanks to the awesome Termux.
- The tutorial and documentation should (hppefully) be helpful
- Learn Vimscript the Hard Way for a great introduction to Vimscript
- Programming Puzzles and Code Golf for crazy examples of efficient Vim (and other languages) usage
- And remember Vim's built-in help:
:help
and:helpgrep