Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/MicahElliott/Rocannon

Vim for Ansible playbooks: omni-completion, abbreviations, syntax, folding, K-docs, and colorscheme
https://github.com/MicahElliott/Rocannon

ansible color-scheme completion documentation folding highlighting vim

Last synced: about 2 months ago
JSON representation

Vim for Ansible playbooks: omni-completion, abbreviations, syntax, folding, K-docs, and colorscheme

Awesome Lists containing this project

README

        

# Rocannon: Operator of the Ansible

Command the Ansible, Relish the Rainbow. Never visit the Ansible docs again.

![Rocannon!](https://raw.githubusercontent.com/MicahElliott/Rocannon/master/img/rainbow.jpg)

Ansible is a unique DSL with semantics way beyond an editor’s simple
built-in YAML treatment. Thus, Ansible files need a totally different type of
syntax highlighting — and of course completion of actions and their args.

## Features
* Completion system that’s aware of all ansible modules/actions and their
args, and even the unique `state=` values
* Syntax for semantics of Ansible, way beyond vanilla YAML
* A 256-color scheme to make use of the extended syntax
* Local, comprehensive documentation system that mirrors online docs (use `K`)
* Folding regions to collapse task blocks into simple, readable lists
* Simple skeleton for new `.ans`/`.yaml` files
* “Bouncing” between related roles files
* Execution of individual plays (via implicit tags and `:make`)

(This is a somewhat simplistic Vim implementation, but mostly works if you
stick to Ansible best practices
[http://docs.ansible.com/playbooks_best_practices.html]().)

## Demo
- Vanilla YAML file with default highlighting
- Change the filetype to ansible (can be done in other ways)
- Reopen file to reflect filetype
- Notice the folding
- Create a new "stat" play to not install pbzip2 otherwise
- Notice the completion of action and arg (other args also completable)
- Pull up documentation for `stat` with `K`

![Rocannon Demo!](https://raw.githubusercontent.com/MicahElliott/Rocannon/master/examples/demo4.gif)

## Installation
Here I’m using [Vundle](https://github.com/VundleVim/Vundle.vim) (but
[Pathogen](https://github.com/tpope/vim-pathogen) should also work):

% vim ~/.vimrc " add line inside vundle block
Plugin 'MicahElliott/Rocannon'

Then install it with Vundle.

% vim +PluginInstall +qa

I recommend the above, but — just for fun — you could even use Ansible to get
it! (This also assumes Vundle is managing your `~/.vim/bundle` area, and that
you’ve added the _Plugin_ line above to your `~/.vimrc`.)

% ansible localhost -m git -a 'repo=https://github.com/MicahElliott/Rocannon dest=~/.vim/bundle/Rocannon'

Rocannon should automatically detect a file with extension `.yaml` (but not
`.yml`) as an Ansible file type. If you want to be explicit, though, you could
add to the top (or bottom) of each Ansible YAML file:

# vim:ft=ansible:

Now open an Ansible file and your should notice that the filetype is
“ansible”, and you’ll see some fancy colors, completions, etc:

% vim foo.yaml

_(It would be really nice if Ansible supported a `*.ans` file extension.)_

## Comprehensive Help
This README is just to get you started. Use the extensive [vim
help](https://github.com/MicahElliott/Rocannon/blob/master/doc/rocannon.txt)
to learn the important details:

:help rocannon

Every Ansible module’s online documentation is also available via vim’s `K`.

## Completions
All known Ansible **actions** are omni-completed, and a short description is
shown. Actions also have abbreviations, so that when you type `yum: ` it will
complete to `yum: name=`. There are also completions for each arg, so if you
type `yum: name=zsh ` you will see a list of all possible args. Even
`state` values are completed.

## Syntax/Highlighting (colorscheme)
Yes, it’s very colorful. Although initially jarring, I find this quite
helpful. The scheme is called _rocannon_. I recommend that you embrace this
rainbow (though it can be turned off).

## Folding
Plays can be folded into a single line containing just the `name:`
description.

## Jumping between files (like vim-rails)
Several files in a role often need to be bounced around between. Vim-Rails
supports this nicely, bouncing between controllers, views, models, tests, etc.
Rocannon should do the same between tasks, handlers, templates, files, and
vars.

## To its fullest
It’s helpful to have a terminal and font that fully support 256 colors, bold,
underline, italic, etc. If you don't already have that covered, I recommend
[Urxvt](https://wiki.archlinux.org/index.php/rxvt-unicode) and
[Orp-Font](https://github.com/MicahElliott/Orp-Font) (if you like bitmapped).

## License
Copyright © Micah Elliott. Distributed under the same terms as Vim itself. See
`:help license`.