waneck / vaxe

A modern, modular vim mode for Haxe.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Vaxe is a vim bundle for Haxe. It provides support for syntax highlighting, indenting, compiling, and many more options. vaxe has "vimdoc" documentation, so check that for in depth details. This page will describe some of the special or optional features that vaxe supports, in addition to recommended configuration settings.

Vaxe Screenshot (screenshot shows neocomplcache completion mode, vim-powerline, tagbar, and monokai color theme)

The recommended way to install vaxe is using a bundle management system such as pathogen, vundle, or vam.

Install with Pathogen

  1. Install pathogen using the instructions.
  2. Create/cd into ~/.vim/bundle/
  3. Make a clone of the vaxe repo: git clone https://github.com/jdonaldson/vaxe.git

To update:

  1. cd into ~/.vim/bundle/vaxe/
  2. git pull

Install with Vundle

  1. Install vundle using the instructions
  2. Add vaxe to your bundle list in .vimrc and re-source it: Bundle 'jdonaldson/vaxe'
  3. Run :BundleInstall

To update, just run :BundleInstall!

Install with VAM

  1. Install VAM using the instructions
  2. Add vaxe to the list of your activated bundles and re-source it: call vam#ActivateAddons(['github:jdonaldson/vaxe'])

Compiling Haxe Projects with vaxe

HXML File Support

Vaxe supports hxml build files, which provide all of the arguments for the compiler, similar to a [make file](http://en.wikipedia.org/wiki/Make_(software).

Vaxe will automatically try to determine the appropriate hxml file you are using. It will also let you easily override this with a specific file (see vim docs for more details).

Vaxe will specify a custom makeprg using the given hxml file. The makeprg will cd to the directory containing the hxml, execute the haxe compiler with the hxml file, and pipe output to stdout.

Vaxe will also specify an errorformat, so that errors and trace messages show up in the quickfix window.

NME Project Support

Nme

Vaxe also supports NME workflows. If an Nmml project is found, Vaxe will use it for builds and completions. You can specify a default target if you only work with one platform.

Omni-completions

Vaxe provides an omnicompletion function that can use the haxe compiler in order to display field completions. Visual Studio users will recognize this as being similar to "intellisense".

You can trigger an omnicompletion (C-X C-O in Insert Mode) after the period at the start of a field, submodule, or class access, or after the first parentheses of a function invocation. See the haxe documentation for more details.

Active Targets: Dealing with --next

In some cases, an hxml file may specify multiple targets via a --next directive. Vaxe will use the first target it finds in order to generate completions. It is possible to specify a different target by inserting a line like this into your hxml:

# display completions

If Vaxe finds that line, it will use that target to generate completions and perform other miscellaneous tasks. The target that Vaxe uses is called the "active" target here.

Recommended Plugins/Additions

Vaxe will work fine on its own, but it is designed to integrate cleanly with a number of other bundles and plugins. Once again, it is recommended to use pathogen, vundle, or vam to manage installation and updates.

Powerline

Powerline ( by Kim Silkebækken) is a handy status line replacement. I think it looks better, and provides a good deal more functionality over a normal status line setting. Unfortunately, Powerline is still fairly new, and doesn't have a plugin framework for it yet. So, I have a special branch of it available here on github.

When it is installed, the current hxml build file will be displayed next to the file info.

Tags

Vim has great support for ctags, which are really useful for navigating a large code base.

You'll need to define some patterns for ctags in order for it to work with Haxe. Put these lines in your .ctags file in your home directory:

--langdef=haxe
--langmap=haxe:.hx
--regex-haxe=/^[ \t]*((@:?[a-zA-Z]+) )*((macro|private|public|static|inline) )*function[ \t]+([A-Za-z0-9_]+)/\5/f,function,functions/
--regex-haxe=/^[ \t]*((@:?[a-zA-Z]+) )*((private|public|static|inline) )+var[ \t]+([A-Za-z0-9_]+)/\5/v,variable,variables/
--regex-haxe=/^[ \t]*package[ \t]*([A-Za-z0-9_]+)/\1/p,package/
--regex-haxe=/^[ \t]*((@:?[a-zA-Z]+) )*(extern[ \t]+)?class[ \t]+([A-Za-z0-9_]+)[ \t]*[^\{]*/\4/c,class,classes/
--regex-haxe=/^[ \t]*((@:?[a-zA-Z]+) )*(extern[ \t]+)?interface[ \t]+([A-Za-z0-9_]+)/\4/i,interface/
--regex-haxe=/^[ \t]*typedef[ \t]+([A-Za-z0-9_]+)/\1/t,typedef/
--regex-haxe=/^[ \t]*enum[ \t]+([A-Za-z0-9_]+)/\1/e,enum/

Vaxe can generate a set of tags specific to the given build by running: vaxe#Ctags() This will feed the paths used by the compiler into ctags. Only the relevant paths for the current target will be used.

Other utilities, like vaxe#ImportClass() can then use this tag information in order to programmatically import classes. E.g. calling vaxe#ImportClass on this line:

var l = new FastList<Int>();

will generate:

import haxe.FastList;
...
var l = new FastList<Int>();

Tagbar

Using the ctags lines above, the Tagbar bundle can display a nice overview of the classes, methods, and variables in your current haxe file. You do not need to call vaxe#Ctags() in order to use Tagbar, it works automatically, but only for the current vaxe buffer.

Neocomplcache

Neocomplcache is a plugin for vim that can manage virtually any type of completion (omni, keyword, file, etc). It won't use omnicompletion by default since it is slow for some languages. However, since completions are built into the compiler with Haxe, they are very fast. In order to enable automatic completions, you will need to add this to your .vimrc:

if !exists('g:neocomplcache_omni_patterns')
    let g:neocomplcache_omni_patterns = {}
endif
let g:neocomplcache_omni_patterns.haxe = '\v([\]''"]|\w)(\.|\()'

Once enabled, Neocomplcache will automatically invoke vaxe omnicompletion when you type a "." after a variable with fields, etc.

Acknowledgements

About

A modern, modular vim mode for Haxe.


Languages

Language:Vim Script 94.9%Language:Python 5.1%