Coder Social home page Coder Social logo

autovim's Introduction

Autovim (UNDER DEVELOPMENT)

Build Status

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.

Installation

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!

Usage

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.

Why

  • It is less verbose for normal commands that require variables. A good example is execute "normal qqqqqyy".@x."pj@qq@q", which can be expressed qñÿ®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

Syntax

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.

Contributing

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.

How does it work?

Three things are happening:

  1. ./bin/autovim takes the command line inputs and forward them to vim by setting a g:autovim_cmd variable using --cmd
  2. ./src/vimrc is used to provide the runtime environment common to the scripts and autovim itself - it also defines mappings like ÿ
  3. ./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

Fun facts

All of Autovim and its documentation was written on an Android phone (Samsung S7 Edge) thanks to the awesome Termux.

Resources

autovim's People

Contributors

christianrondeau avatar

Stargazers

 avatar  avatar

Watchers

 avatar

autovim's Issues

Compatibility with VIM 7.4

Not sure how important it is but I tried running the samples with VIM 7.4 and got the following error:

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Dec 9 2014 17:36:41)
Unknown option argument: "--not-a-term"
More info with: "vim -h"

Issue was resolved by upgrade to VIM 8.0

Running on ZorinOS (built on Lubuntu I believe)

No LSB modules are available.
Distributor ID: Zorin
Description: Zorin 10
Release: 10
Codename: vivid

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.