diff --git a/after/indent/html.vim b/after/indent/html.vim
new file mode 100644
index 0000000..10ca6ce
--- /dev/null
+++ b/after/indent/html.vim
@@ -0,0 +1,33 @@
+" Language: CoffeeScript
+" Maintainer: Mick Koch
+" URL: http://github.com/kchmck/vim-coffee-script
+" License: WTFPL
+
+" Load the coffee and html indent functions.
+unlet b:did_indent
+runtime indent/coffee.vim
+let s:coffeeIndentExpr = &l:indentexpr
+
+" Load html last so it can overwrite coffee settings.
+unlet b:did_indent
+runtime indent/html.vim
+let s:htmlIndentExpr = &l:indentexpr
+
+" Inject our wrapper indent function.
+setlocal indentexpr=GetCoffeeHtmlIndent(v:lnum)
+
+function! GetCoffeeHtmlIndent(curlinenum)
+ " See if we're inside a coffeescript block.
+ let scriptlnum = searchpair('', 'bWn')
+ let prevlnum = prevnonblank(a:curlinenum)
+
+ " If we're in the script block and the previous line isn't the script tag
+ " itself, use coffee indenting.
+ if scriptlnum && scriptlnum != prevlnum
+ exec 'return ' s:coffeeIndentExpr
+ endif
+
+ " Otherwise use html indenting.
+ exec 'return ' s:htmlIndentExpr
+endfunction
diff --git a/after/syntax/coffee.vim b/after/syntax/coffee.vim
new file mode 100644
index 0000000..92b8359
--- /dev/null
+++ b/after/syntax/coffee.vim
@@ -0,0 +1,21 @@
+" This file describes a very basic syntax for TomDoc comments in a
+" CoffeeScript file.
+"
+" For more information on TomDoc, check it out here: http://tomdoc.org/
+"
+
+syn keyword tomdocKeywords Returns containedin=coffeeComment contained
+syn keyword tomdocKeywords Yields containedin=coffeeComment contained
+syn keyword tomdocKeywords Raises containedin=coffeeComment contained
+syn keyword tomdocKeywords Examples containedin=coffeeComment contained
+syn keyword tomdocKeywords Signature containedin=coffeeComment contained
+
+syn match tomdocArguments +\s*[A-Za-z0-9_\-&\*:]*\(\s*- \)+he=e-3 containedin=coffeeComment contained
+
+syn match tomdocDescriptions +\s*Public:+he=e-1 containedin=coffeeComment contained
+syn match tomdocDescriptions +\s*Internal:+he=e-1 containedin=coffeeComment contained
+syn match tomdocDescriptions +\s*Deprecated:+he=e-1 containedin=coffeeComment contained
+
+hi default link tomdocDescriptions TODO
+hi default link tomdocKeywords TODO
+hi default link tomdocArguments HELP
diff --git a/after/syntax/haml.vim b/after/syntax/haml.vim
new file mode 100644
index 0000000..4c517eb
--- /dev/null
+++ b/after/syntax/haml.vim
@@ -0,0 +1,13 @@
+" Language: CoffeeScript
+" Maintainer: Sven Felix Oberquelle
+" URL: http://github.com/kchmck/vim-coffee-script
+" License: WTFPL
+
+" Inherit coffee from html so coffeeComment isn't redefined and given higher
+" priority than hamlInterpolation.
+syn cluster hamlCoffeescript contains=@htmlCoffeeScript
+syn region hamlCoffeescriptFilter matchgroup=hamlFilter
+\ start="^\z(\s*\):coffee\z(script\)\?\s*$"
+\ end="^\%(\z1 \| *$\)\@!"
+\ contains=@hamlCoffeeScript,hamlInterpolation
+\ keepend
diff --git a/after/syntax/html.vim b/after/syntax/html.vim
new file mode 100644
index 0000000..9e2eb3a
--- /dev/null
+++ b/after/syntax/html.vim
@@ -0,0 +1,11 @@
+" Language: CoffeeScript
+" Maintainer: Mick Koch
+" URL: http://github.com/kchmck/vim-coffee-script
+" License: WTFPL
+
+" Syntax highlighting for text/coffeescript script tags
+syn include @htmlCoffeeScript syntax/coffee.vim
+syn region coffeeScript start=##me=s-1 keepend
+\ contains=@htmlCoffeeScript,htmlScriptTag,@htmlPreproc
+\ containedin=htmlHead
diff --git a/after/syntax/ruby.vim b/after/syntax/ruby.vim
new file mode 100644
index 0000000..1d164fd
--- /dev/null
+++ b/after/syntax/ruby.vim
@@ -0,0 +1,20 @@
+" This file describes a very basic syntax for TomDoc comments in a Ruby file.
+"
+" For more information on TomDoc, check it out here: http://tomdoc.org/
+"
+
+syn keyword tomdocKeywords Returns containedin=rubyComment contained
+syn keyword tomdocKeywords Yields containedin=rubyComment contained
+syn keyword tomdocKeywords Raises containedin=rubyComment contained
+syn keyword tomdocKeywords Examples containedin=rubyComment contained
+syn keyword tomdocKeywords Signature containedin=rubyComment contained
+
+syn match tomdocArguments +\s*[A-Za-z0-9_\-&\*:]*\(\s*- \)+he=e-3 containedin=rubyComment contained
+
+syn match tomdocDescriptions +\s*Public:+he=e-1 containedin=rubyComment contained
+syn match tomdocDescriptions +\s*Internal:+he=e-1 containedin=rubyComment contained
+syn match tomdocDescriptions +\s*Deprecated:+he=e-1 containedin=rubyComment contained
+
+hi default link tomdocDescriptions TODO
+hi default link tomdocKeywords TODO
+hi default link tomdocArguments HELP
diff --git a/autoload/coffee.vim b/autoload/coffee.vim
new file mode 100644
index 0000000..04d5efb
--- /dev/null
+++ b/autoload/coffee.vim
@@ -0,0 +1,54 @@
+" Language: CoffeeScript
+" Maintainer: Mick Koch
+" URL: http://github.com/kchmck/vim-coffee-script
+" License: WTFPL
+
+" Set up some common global/buffer variables.
+function! coffee#CoffeeSetUpVariables()
+ " Path to coffee executable
+ if !exists('g:coffee_compiler')
+ let g:coffee_compiler = 'coffee'
+ endif
+
+ " Options passed to coffee with make
+ if !exists('g:coffee_make_options')
+ let g:coffee_make_options = ''
+ endif
+
+ " Path to cake executable
+ if !exists('g:coffee_cake')
+ let g:coffee_cake = 'cake'
+ endif
+
+ " Extra options passed to cake
+ if !exists('g:coffee_cake_options')
+ let g:coffee_cake_options = ''
+ endif
+
+ " Path to coffeelint executable
+ if !exists('g:coffee_linter')
+ let g:coffee_linter = 'coffeelint'
+ endif
+
+ " Options passed to CoffeeLint
+ if !exists('g:coffee_lint_options')
+ let g:coffee_lint_options = ''
+ endif
+
+ " Pass the litcoffee flag to tools in this buffer if a litcoffee file is open.
+ " Let the variable be overwritten so it can be updated if a different filetype
+ " is set.
+ if &filetype == 'litcoffee'
+ let b:coffee_litcoffee = '--literate'
+ else
+ let b:coffee_litcoffee = ''
+ endif
+endfunction
+
+function! coffee#CoffeeSetUpErrorFormat()
+ CompilerSet errorformat=Error:\ In\ %f\\,\ %m\ on\ line\ %l,
+ \Error:\ In\ %f\\,\ Parse\ error\ on\ line\ %l:\ %m,
+ \SyntaxError:\ In\ %f\\,\ %m,
+ \%f:%l:%c:\ error:\ %m,
+ \%-G%.%#
+endfunction
diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim
new file mode 100644
index 0000000..df7ef5c
--- /dev/null
+++ b/autoload/rubycomplete.vim
@@ -0,0 +1,831 @@
+" Vim completion script
+" Language: Ruby
+" Maintainer: Mark Guzman
+" URL: https://github.com/vim-ruby/vim-ruby
+" Release Coordinator: Doug Kearns
+" Maintainer Version: 0.8.1
+" ----------------------------------------------------------------------------
+"
+" Ruby IRB/Complete author: Keiju ISHITSUKA(keiju@ishitsuka.com)
+" ----------------------------------------------------------------------------
+
+" {{{ requirement checks
+
+function! s:ErrMsg(msg)
+ echohl ErrorMsg
+ echo a:msg
+ echohl None
+endfunction
+
+if !has('ruby')
+ call s:ErrMsg( "Error: Rubycomplete requires vim compiled with +ruby" )
+ call s:ErrMsg( "Error: falling back to syntax completion" )
+ " lets fall back to syntax completion
+ setlocal omnifunc=syntaxcomplete#Complete
+ finish
+endif
+
+if version < 700
+ call s:ErrMsg( "Error: Required vim >= 7.0" )
+ finish
+endif
+" }}} requirement checks
+
+" {{{ configuration failsafe initialization
+if !exists("g:rubycomplete_rails")
+ let g:rubycomplete_rails = 0
+endif
+
+if !exists("g:rubycomplete_classes_in_global")
+ let g:rubycomplete_classes_in_global = 0
+endif
+
+if !exists("g:rubycomplete_buffer_loading")
+ let g:rubycomplete_buffer_loading = 0
+endif
+
+if !exists("g:rubycomplete_include_object")
+ let g:rubycomplete_include_object = 0
+endif
+
+if !exists("g:rubycomplete_include_objectspace")
+ let g:rubycomplete_include_objectspace = 0
+endif
+" }}} configuration failsafe initialization
+
+" {{{ vim-side support functions
+let s:rubycomplete_debug = 0
+
+function! s:dprint(msg)
+ if s:rubycomplete_debug == 1
+ echom a:msg
+ endif
+endfunction
+
+function! s:GetBufferRubyModule(name, ...)
+ if a:0 == 1
+ let [snum,enum] = s:GetBufferRubyEntity(a:name, "module", a:1)
+ else
+ let [snum,enum] = s:GetBufferRubyEntity(a:name, "module")
+ endif
+ return snum . '..' . enum
+endfunction
+
+function! s:GetBufferRubyClass(name, ...)
+ if a:0 >= 1
+ let [snum,enum] = s:GetBufferRubyEntity(a:name, "class", a:1)
+ else
+ let [snum,enum] = s:GetBufferRubyEntity(a:name, "class")
+ endif
+ return snum . '..' . enum
+endfunction
+
+function! s:GetBufferRubySingletonMethods(name)
+endfunction
+
+function! s:GetBufferRubyEntity( name, type, ... )
+ let lastpos = getpos(".")
+ let lastline = lastpos
+ if (a:0 >= 1)
+ let lastline = [ 0, a:1, 0, 0 ]
+ call cursor( a:1, 0 )
+ endif
+
+ let stopline = 1
+
+ let crex = '^\s*\<' . a:type . '\>\s*\<' . escape(a:name, '*') . '\>\s*\(<\s*.*\s*\)\?'
+ let [lnum,lcol] = searchpos( crex, 'w' )
+ "let [lnum,lcol] = searchpairpos( crex . '\zs', '', '\(end\|}\)', 'w' )
+
+ if lnum == 0 && lcol == 0
+ call cursor(lastpos[1], lastpos[2])
+ return [0,0]
+ endif
+
+ let curpos = getpos(".")
+ let [enum,ecol] = searchpairpos( crex, '', '\(end\|}\)', 'wr' )
+ call cursor(lastpos[1], lastpos[2])
+
+ if lnum > enum
+ return [0,0]
+ endif
+ " we found a the class def
+ return [lnum,enum]
+endfunction
+
+function! s:IsInClassDef()
+ return s:IsPosInClassDef( line('.') )
+endfunction
+
+function! s:IsPosInClassDef(pos)
+ let [snum,enum] = s:GetBufferRubyEntity( '.*', "class" )
+ let ret = 'nil'
+
+ if snum < a:pos && a:pos < enum
+ let ret = snum . '..' . enum
+ endif
+
+ return ret
+endfunction
+
+function! s:GetRubyVarType(v)
+ let stopline = 1
+ let vtp = ''
+ let pos = getpos('.')
+ let sstr = '^\s*#\s*@var\s*'.escape(a:v, '*').'\>\s\+[^ \t]\+\s*$'
+ let [lnum,lcol] = searchpos(sstr,'nb',stopline)
+ if lnum != 0 && lcol != 0
+ call setpos('.',pos)
+ let str = getline(lnum)
+ let vtp = substitute(str,sstr,'\1','')
+ return vtp
+ endif
+ call setpos('.',pos)
+ let ctors = '\(now\|new\|open\|get_instance'
+ if exists('g:rubycomplete_rails') && g:rubycomplete_rails == 1 && s:rubycomplete_rails_loaded == 1
+ let ctors = ctors.'\|find\|create'
+ else
+ endif
+ let ctors = ctors.'\)'
+
+ let fstr = '=\s*\([^ \t]\+.' . ctors .'\>\|[\[{"''/]\|%[xwQqr][(\[{@]\|[A-Za-z0-9@:\-()\.]\+...\?\|lambda\|&\)'
+ let sstr = ''.escape(a:v, '*').'\>\s*[+\-*/]*'.fstr
+ let [lnum,lcol] = searchpos(sstr,'nb',stopline)
+ if lnum != 0 && lcol != 0
+ let str = matchstr(getline(lnum),fstr,lcol)
+ let str = substitute(str,'^=\s*','','')
+
+ call setpos('.',pos)
+ if str == '"' || str == '''' || stridx(tolower(str), '%q[') != -1
+ return 'String'
+ elseif str == '[' || stridx(str, '%w[') != -1
+ return 'Array'
+ elseif str == '{'
+ return 'Hash'
+ elseif str == '/' || str == '%r{'
+ return 'Regexp'
+ elseif strlen(str) >= 4 && stridx(str,'..') != -1
+ return 'Range'
+ elseif stridx(str, 'lambda') != -1 || str == '&'
+ return 'Proc'
+ elseif strlen(str) > 4
+ let l = stridx(str,'.')
+ return str[0:l-1]
+ end
+ return ''
+ endif
+ call setpos('.',pos)
+ return ''
+endfunction
+
+"}}} vim-side support functions
+
+"{{{ vim-side completion function
+function! rubycomplete#Init()
+ execute "ruby VimRubyCompletion.preload_rails"
+endfunction
+
+function! rubycomplete#Complete(findstart, base)
+ "findstart = 1 when we need to get the text length
+ if a:findstart
+ let line = getline('.')
+ let idx = col('.')
+ while idx > 0
+ let idx -= 1
+ let c = line[idx-1]
+ if c =~ '\w'
+ continue
+ elseif ! c =~ '\.'
+ idx = -1
+ break
+ else
+ break
+ endif
+ endwhile
+
+ return idx
+ "findstart = 0 when we need to return the list of completions
+ else
+ let g:rubycomplete_completions = []
+ execute "ruby VimRubyCompletion.get_completions('" . a:base . "')"
+ return g:rubycomplete_completions
+ endif
+endfunction
+"}}} vim-side completion function
+
+"{{{ ruby-side code
+function! s:DefRuby()
+ruby << RUBYEOF
+# {{{ ruby completion
+
+begin
+ require 'rubygems' # let's assume this is safe...?
+rescue Exception
+ #ignore?
+end
+class VimRubyCompletion
+# {{{ constants
+ @@debug = false
+ @@ReservedWords = [
+ "BEGIN", "END",
+ "alias", "and",
+ "begin", "break",
+ "case", "class",
+ "def", "defined", "do",
+ "else", "elsif", "end", "ensure",
+ "false", "for",
+ "if", "in",
+ "module",
+ "next", "nil", "not",
+ "or",
+ "redo", "rescue", "retry", "return",
+ "self", "super",
+ "then", "true",
+ "undef", "unless", "until",
+ "when", "while",
+ "yield",
+ ]
+
+ @@Operators = [ "%", "&", "*", "**", "+", "-", "/",
+ "<", "<<", "<=", "<=>", "==", "===", "=~", ">", ">=", ">>",
+ "[]", "[]=", "^", ]
+# }}} constants
+
+# {{{ buffer analysis magic
+ def load_requires
+ buf = VIM::Buffer.current
+ enum = buf.line_number
+ nums = Range.new( 1, enum )
+ nums.each do |x|
+ ln = buf[x]
+ begin
+ eval( "require %s" % $1 ) if /.*require\s*(.*)$/.match( ln )
+ rescue Exception
+ #ignore?
+ end
+ end
+ end
+
+ def load_gems
+ fpath = VIM::evaluate("get(g:, 'rubycomplete_gemfile_path', 'Gemfile')")
+ return unless File.file?(fpath) && File.readable?(fpath)
+ want_bundler = VIM::evaluate("get(g:, 'rubycomplete_use_bundler')")
+ parse_file = !want_bundler
+ begin
+ require 'bundler'
+ Bundler.setup
+ Bundler.require
+ rescue Exception
+ parse_file = true
+ end
+ if parse_file
+ File.new(fpath).each_line do |line|
+ begin
+ require $1 if /\s*gem\s*['"]([^'"]+)/.match(line)
+ rescue Exception
+ end
+ end
+ end
+ end
+
+ def load_buffer_class(name)
+ dprint "load_buffer_class(%s) START" % name
+ classdef = get_buffer_entity(name, 's:GetBufferRubyClass("%s")')
+ return if classdef == nil
+
+ pare = /^\s*class\s*(.*)\s*<\s*(.*)\s*\n/.match( classdef )
+ load_buffer_class( $2 ) if pare != nil && $2 != name # load parent class if needed
+
+ mixre = /.*\n\s*(include|prepend)\s*(.*)\s*\n/.match( classdef )
+ load_buffer_module( $2 ) if mixre != nil && $2 != name # load mixins if needed
+
+ begin
+ eval classdef
+ rescue Exception
+ VIM::evaluate( "s:ErrMsg( 'Problem loading class \"%s\", was it already completed?' )" % name )
+ end
+ dprint "load_buffer_class(%s) END" % name
+ end
+
+ def load_buffer_module(name)
+ dprint "load_buffer_module(%s) START" % name
+ classdef = get_buffer_entity(name, 's:GetBufferRubyModule("%s")')
+ return if classdef == nil
+
+ begin
+ eval classdef
+ rescue Exception
+ VIM::evaluate( "s:ErrMsg( 'Problem loading module \"%s\", was it already completed?' )" % name )
+ end
+ dprint "load_buffer_module(%s) END" % name
+ end
+
+ def get_buffer_entity(name, vimfun)
+ loading_allowed = VIM::evaluate("exists('g:rubycomplete_buffer_loading') && g:rubycomplete_buffer_loading")
+ return nil if loading_allowed.to_i.zero?
+ return nil if /(\"|\')+/.match( name )
+ buf = VIM::Buffer.current
+ nums = eval( VIM::evaluate( vimfun % name ) )
+ return nil if nums == nil
+ return nil if nums.min == nums.max && nums.min == 0
+
+ dprint "get_buffer_entity START"
+ visited = []
+ clscnt = 0
+ bufname = VIM::Buffer.current.name
+ classdef = ""
+ cur_line = VIM::Buffer.current.line_number
+ while (nums != nil && !(nums.min == 0 && nums.max == 0) )
+ dprint "visited: %s" % visited.to_s
+ break if visited.index( nums )
+ visited << nums
+
+ nums.each do |x|
+ if x != cur_line
+ next if x == 0
+ ln = buf[x]
+ if /^\s*(module|class|def|include)\s+/.match(ln)
+ clscnt += 1 if $1 == "class"
+ #dprint "\$1$1
+ classdef += "%s\n" % ln
+ classdef += "end\n" if /def\s+/.match(ln)
+ dprint ln
+ end
+ end
+ end
+
+ nm = "%s(::.*)*\", %s, \"" % [ name, nums.last ]
+ nums = eval( VIM::evaluate( vimfun % nm ) )
+ dprint "nm: \"%s\"" % nm
+ dprint "vimfun: %s" % (vimfun % nm)
+ dprint "got nums: %s" % nums.to_s
+ end
+ if classdef.length > 1
+ classdef += "end\n"*clscnt
+ # classdef = "class %s\n%s\nend\n" % [ bufname.gsub( /\/|\\/, "_" ), classdef ]
+ end
+
+ dprint "get_buffer_entity END"
+ dprint "classdef====start"
+ lns = classdef.split( "\n" )
+ lns.each { |x| dprint x }
+ dprint "classdef====end"
+ return classdef
+ end
+
+ def get_var_type( receiver )
+ if /(\"|\')+/.match( receiver )
+ "String"
+ else
+ VIM::evaluate("s:GetRubyVarType('%s')" % receiver)
+ end
+ end
+
+ def dprint( txt )
+ print txt if @@debug
+ end
+
+ def escape_vim_singlequote_string(str)
+ str.to_s.gsub(/'/,"\\'")
+ end
+
+ def get_buffer_entity_list( type )
+ # this will be a little expensive.
+ loading_allowed = VIM::evaluate("exists('g:rubycomplete_buffer_loading') && g:rubycomplete_buffer_loading")
+ allow_aggressive_load = VIM::evaluate("exists('g:rubycomplete_classes_in_global') && g:rubycomplete_classes_in_global")
+ return [] if allow_aggressive_load.to_i.zero? || loading_allowed.to_i.zero?
+
+ buf = VIM::Buffer.current
+ eob = buf.length
+ ret = []
+ rg = 1..eob
+ re = eval( "/^\s*%s\s*([A-Za-z0-9_:-]*)(\s*<\s*([A-Za-z0-9_:-]*))?\s*/" % type )
+
+ rg.each do |x|
+ if re.match( buf[x] )
+ next if type == "def" && eval( VIM::evaluate("s:IsPosInClassDef(%s)" % x) ) != nil
+ ret.push $1
+ end
+ end
+
+ return ret
+ end
+
+ def get_buffer_modules
+ return get_buffer_entity_list( "modules" )
+ end
+
+ def get_buffer_methods
+ return get_buffer_entity_list( "def" )
+ end
+
+ def get_buffer_classes
+ return get_buffer_entity_list( "class" )
+ end
+
+
+ def load_rails
+ allow_rails = VIM::evaluate("exists('g:rubycomplete_rails') && g:rubycomplete_rails")
+ return if allow_rails.to_i.zero?
+
+ buf_path = VIM::evaluate('expand("%:p")')
+ file_name = VIM::evaluate('expand("%:t")')
+ vim_dir = VIM::evaluate('getcwd()')
+ file_dir = buf_path.gsub( file_name, '' )
+ file_dir.gsub!( /\\/, "/" )
+ vim_dir.gsub!( /\\/, "/" )
+ vim_dir << "/"
+ dirs = [ vim_dir, file_dir ]
+ sdirs = [ "", "./", "../", "../../", "../../../", "../../../../" ]
+ rails_base = nil
+
+ dirs.each do |dir|
+ sdirs.each do |sub|
+ trail = "%s%s" % [ dir, sub ]
+ tcfg = "%sconfig" % trail
+
+ if File.exists?( tcfg )
+ rails_base = trail
+ break
+ end
+ end
+ break if rails_base
+ end
+
+ return if rails_base == nil
+ $:.push rails_base unless $:.index( rails_base )
+
+ rails_config = rails_base + "config/"
+ rails_lib = rails_base + "lib/"
+ $:.push rails_config unless $:.index( rails_config )
+ $:.push rails_lib unless $:.index( rails_lib )
+
+ bootfile = rails_config + "boot.rb"
+ envfile = rails_config + "environment.rb"
+ if File.exists?( bootfile ) && File.exists?( envfile )
+ begin
+ require bootfile
+ require envfile
+ begin
+ require 'console_app'
+ require 'console_with_helpers'
+ rescue Exception
+ dprint "Rails 1.1+ Error %s" % $!
+ # assume 1.0
+ end
+ #eval( "Rails::Initializer.run" ) #not necessary?
+ VIM::command('let s:rubycomplete_rails_loaded = 1')
+ dprint "rails loaded"
+ rescue Exception
+ dprint "Rails Error %s" % $!
+ VIM::evaluate( "s:ErrMsg('Error loading rails environment')" )
+ end
+ end
+ end
+
+ def get_rails_helpers
+ allow_rails = VIM::evaluate("exists('g:rubycomplete_rails') && g:rubycomplete_rails")
+ rails_loaded = VIM::evaluate('s:rubycomplete_rails_loaded')
+ return [] if allow_rails.to_i.zero? || rails_loaded.to_i.zero?
+
+ buf_path = VIM::evaluate('expand("%:p")')
+ buf_path.gsub!( /\\/, "/" )
+ path_elm = buf_path.split( "/" )
+ dprint "buf_path: %s" % buf_path
+ types = [ "app", "db", "lib", "test", "components", "script" ]
+
+ i = nil
+ ret = []
+ type = nil
+ types.each do |t|
+ i = path_elm.index( t )
+ break if i
+ end
+ type = path_elm[i]
+ type.downcase!
+
+ dprint "type: %s" % type
+ case type
+ when "app"
+ i += 1
+ subtype = path_elm[i]
+ subtype.downcase!
+
+ dprint "subtype: %s" % subtype
+ case subtype
+ when "views"
+ ret += ActionView::Base.instance_methods
+ ret += ActionView::Base.methods
+ when "controllers"
+ ret += ActionController::Base.instance_methods
+ ret += ActionController::Base.methods
+ when "models"
+ ret += ActiveRecord::Base.instance_methods
+ ret += ActiveRecord::Base.methods
+ end
+
+ when "db"
+ ret += ActiveRecord::ConnectionAdapters::SchemaStatements.instance_methods
+ ret += ActiveRecord::ConnectionAdapters::SchemaStatements.methods
+ end
+
+
+ return ret
+ end
+
+ def add_rails_columns( cls )
+ allow_rails = VIM::evaluate("exists('g:rubycomplete_rails') && g:rubycomplete_rails")
+ rails_loaded = VIM::evaluate('s:rubycomplete_rails_loaded')
+ return [] if allow_rails.to_i.zero? || rails_loaded.to_i.zero?
+
+ begin
+ eval( "#{cls}.establish_connection" )
+ return [] unless eval( "#{cls}.ancestors.include?(ActiveRecord::Base).to_s" )
+ col = eval( "#{cls}.column_names" )
+ return col if col
+ rescue
+ dprint "add_rails_columns err: (cls: %s) %s" % [ cls, $! ]
+ return []
+ end
+ return []
+ end
+
+ def clean_sel(sel, msg)
+ ret = sel.reject{|x|x.nil?}.uniq
+ ret = ret.grep(/^#{Regexp.quote(msg)}/) if msg != nil
+ ret
+ end
+
+ def get_rails_view_methods
+ allow_rails = VIM::evaluate("exists('g:rubycomplete_rails') && g:rubycomplete_rails")
+ rails_loaded = VIM::evaluate('s:rubycomplete_rails_loaded')
+ return [] if allow_rails.to_i.zero? || rails_loaded.to_i.zero?
+
+ buf_path = VIM::evaluate('expand("%:p")')
+ buf_path.gsub!( /\\/, "/" )
+ pelm = buf_path.split( "/" )
+ idx = pelm.index( "views" )
+
+ return [] unless idx
+ idx += 1
+
+ clspl = pelm[idx].camelize.pluralize
+ cls = clspl.singularize
+
+ ret = []
+ begin
+ ret += eval( "#{cls}.instance_methods" )
+ ret += eval( "#{clspl}Helper.instance_methods" )
+ rescue Exception
+ dprint "Error: Unable to load rails view helpers for %s: %s" % [ cls, $! ]
+ end
+
+ return ret
+ end
+# }}} buffer analysis magic
+
+# {{{ main completion code
+ def self.preload_rails
+ a = VimRubyCompletion.new
+ require 'Thread'
+ Thread.new(a) do |b|
+ begin
+ b.load_rails
+ rescue
+ end
+ end
+ a.load_rails
+ rescue
+ end
+
+ def self.get_completions(base)
+ b = VimRubyCompletion.new
+ b.get_completions base
+ end
+
+ def get_completions(base)
+ loading_allowed = VIM::evaluate("exists('g:rubycomplete_buffer_loading') && g:rubycomplete_buffer_loading")
+ if loading_allowed.to_i == 1
+ load_requires
+ load_rails
+ end
+
+ want_gems = VIM::evaluate("get(g:, 'rubycomplete_load_gemfile')")
+ load_gems unless want_gems.to_i.zero?
+
+
+ input = VIM::Buffer.current.line
+ cpos = VIM::Window.current.cursor[1] - 1
+ input = input[0..cpos]
+ input += base
+ input.sub!(/.*[ \t\n\"\\'`><=;|&{(]/, '') # Readline.basic_word_break_characters
+ input.sub!(/self\./, '')
+ input.sub!(/.*((\.\.[\[(]?)|([\[(]))/, '')
+
+ dprint 'input %s' % input
+ message = nil
+ receiver = nil
+ methods = []
+ variables = []
+ classes = []
+ constants = []
+
+ case input
+ when /^(\/[^\/]*\/)\.([^.]*)$/ # Regexp
+ receiver = $1
+ message = Regexp.quote($2)
+ methods = Regexp.instance_methods(true)
+
+ when /^([^\]]*\])\.([^.]*)$/ # Array
+ receiver = $1
+ message = Regexp.quote($2)
+ methods = Array.instance_methods(true)
+
+ when /^([^\}]*\})\.([^.]*)$/ # Proc or Hash
+ receiver = $1
+ message = Regexp.quote($2)
+ methods = Proc.instance_methods(true) | Hash.instance_methods(true)
+
+ when /^(:[^:.]*)$/ # Symbol
+ dprint "symbol"
+ if Symbol.respond_to?(:all_symbols)
+ receiver = $1
+ message = $1.sub( /:/, '' )
+ methods = Symbol.all_symbols.collect{|s| s.id2name}
+ methods.delete_if { |c| c.match( /'/ ) }
+ end
+
+ when /^::([A-Z][^:\.\(]*)$/ # Absolute Constant or class methods
+ dprint "const or cls"
+ receiver = $1
+ methods = Object.constants
+ methods.grep(/^#{receiver}/).collect{|e| "::" + e}
+
+ when /^(((::)?[A-Z][^:.\(]*)+?)::?([^:.]*)$/ # Constant or class methods
+ receiver = $1
+ message = Regexp.quote($4)
+ dprint "const or cls 2 [recv: \'%s\', msg: \'%s\']" % [ receiver, message ]
+ load_buffer_class( receiver )
+ begin
+ classes = eval("#{receiver}.constants")
+ #methods = eval("#{receiver}.methods")
+ rescue Exception
+ dprint "exception: %s" % $!
+ methods = []
+ end
+ methods.grep(/^#{message}/).collect{|e| receiver + "::" + e}
+
+ when /^(:[^:.]+)\.([^.]*)$/ # Symbol
+ dprint "symbol"
+ receiver = $1
+ message = Regexp.quote($2)
+ methods = Symbol.instance_methods(true)
+
+ when /^([0-9_]+(\.[0-9_]+)?(e[0-9]+)?)\.([^.]*)$/ # Numeric
+ dprint "numeric"
+ receiver = $1
+ message = Regexp.quote($4)
+ begin
+ methods = eval(receiver).methods
+ rescue Exception
+ methods = []
+ end
+
+ when /^(\$[^.]*)$/ #global
+ dprint "global"
+ methods = global_variables.grep(Regexp.new(Regexp.quote($1)))
+
+ when /^((\.?[^.]+)+?)\.([^.]*)$/ # variable
+ dprint "variable"
+ receiver = $1
+ message = Regexp.quote($3)
+ load_buffer_class( receiver )
+
+ cv = eval("self.class.constants")
+ vartype = get_var_type( receiver )
+ dprint "vartype: %s" % vartype
+ if vartype != ''
+ load_buffer_class( vartype )
+
+ begin
+ methods = eval("#{vartype}.instance_methods")
+ variables = eval("#{vartype}.instance_variables")
+ rescue Exception
+ dprint "load_buffer_class err: %s" % $!
+ end
+ elsif (cv).include?(receiver)
+ # foo.func and foo is local var.
+ methods = eval("#{receiver}.methods")
+ vartype = receiver
+ elsif /^[A-Z]/ =~ receiver and /\./ !~ receiver
+ vartype = receiver
+ # Foo::Bar.func
+ begin
+ methods = eval("#{receiver}.methods")
+ rescue Exception
+ end
+ else
+ # func1.func2
+ ObjectSpace.each_object(Module){|m|
+ next if m.name != "IRB::Context" and
+ /^(IRB|SLex|RubyLex|RubyToken)/ =~ m.name
+ methods.concat m.instance_methods(false)
+ }
+ end
+ variables += add_rails_columns( "#{vartype}" ) if vartype && vartype.length > 0
+
+ when /^\(?\s*[A-Za-z0-9:^@.%\/+*\(\)]+\.\.\.?[A-Za-z0-9:^@.%\/+*\(\)]+\s*\)?\.([^.]*)/
+ message = $1
+ methods = Range.instance_methods(true)
+
+ when /^\.([^.]*)$/ # unknown(maybe String)
+ message = Regexp.quote($1)
+ methods = String.instance_methods(true)
+
+ else
+ dprint "default/other"
+ inclass = eval( VIM::evaluate("s:IsInClassDef()") )
+
+ if inclass != nil
+ dprint "inclass"
+ classdef = "%s\n" % VIM::Buffer.current[ inclass.min ]
+ found = /^\s*class\s*([A-Za-z0-9_-]*)(\s*<\s*([A-Za-z0-9_:-]*))?\s*\n$/.match( classdef )
+
+ if found != nil
+ receiver = $1
+ message = input
+ load_buffer_class( receiver )
+ begin
+ methods = eval( "#{receiver}.instance_methods" )
+ variables += add_rails_columns( "#{receiver}" )
+ rescue Exception
+ found = nil
+ end
+ end
+ end
+
+ if inclass == nil || found == nil
+ dprint "inclass == nil"
+ methods = get_buffer_methods
+ methods += get_rails_view_methods
+
+ cls_const = Class.constants
+ constants = cls_const.select { |c| /^[A-Z_-]+$/.match( c ) }
+ classes = eval("self.class.constants") - constants
+ classes += get_buffer_classes
+ classes += get_buffer_modules
+
+ include_objectspace = VIM::evaluate("exists('g:rubycomplete_include_objectspace') && g:rubycomplete_include_objectspace")
+ ObjectSpace.each_object(Class) { |cls| classes << cls.to_s } if include_objectspace == "1"
+ message = receiver = input
+ end
+
+ methods += get_rails_helpers
+ methods += Kernel.public_methods
+ end
+
+
+ include_object = VIM::evaluate("exists('g:rubycomplete_include_object') && g:rubycomplete_include_object")
+ methods = clean_sel( methods, message )
+ methods = (methods-Object.instance_methods) if include_object == "0"
+ rbcmeth = (VimRubyCompletion.instance_methods-Object.instance_methods) # lets remove those rubycomplete methods
+ methods = (methods-rbcmeth)
+
+ variables = clean_sel( variables, message )
+ classes = clean_sel( classes, message ) - ["VimRubyCompletion"]
+ constants = clean_sel( constants, message )
+
+ valid = []
+ valid += methods.collect { |m| { :name => m.to_s, :type => 'm' } }
+ valid += variables.collect { |v| { :name => v.to_s, :type => 'v' } }
+ valid += classes.collect { |c| { :name => c.to_s, :type => 't' } }
+ valid += constants.collect { |d| { :name => d.to_s, :type => 'd' } }
+ valid.sort! { |x,y| x[:name] <=> y[:name] }
+
+ outp = ""
+
+ rg = 0..valid.length
+ rg.step(150) do |x|
+ stpos = 0+x
+ enpos = 150+x
+ valid[stpos..enpos].each { |c| outp += "{'word':'%s','item':'%s','kind':'%s'}," % [ c[:name], c[:name], c[:type] ].map{|x|escape_vim_singlequote_string(x)} }
+ outp.sub!(/,$/, '')
+
+ VIM::command("call extend(g:rubycomplete_completions, [%s])" % outp)
+ outp = ""
+ end
+ end
+# }}} main completion code
+
+end # VimRubyCompletion
+# }}} ruby completion
+RUBYEOF
+endfunction
+
+let s:rubycomplete_rails_loaded = 0
+
+call s:DefRuby()
+"}}} ruby-side code
+
+
+" vim:tw=78:sw=4:ts=8:et:fdm=marker:ft=vim:norl:
diff --git a/build.sh b/build.sh
index ca03a02..31804c1 100755
--- a/build.sh
+++ b/build.sh
@@ -3,7 +3,7 @@
set -E
DIRS="
- syntax indent ftplugin ftdetect autoload compiler doc
+ syntax indent ftplugin ftdetect autoload compiler
after/syntax after/indent
"
@@ -44,3 +44,10 @@ syntax 'acustodioo/vim-tmux' &
syntax 'groenewege/vim-less' &
syntax 'wavded/vim-stylus' &
syntax 'tpope/vim-cucumber' &
+syntax 'jrk/vim-ocaml' &
+syntax 'wlangstroth/vim-haskell' &
+syntax 'slim-template/vim-slim' &
+
+wait
+
+rm -rf tmp
diff --git a/compiler/bundler.vim b/compiler/bundler.vim
new file mode 100644
index 0000000..b129793
--- /dev/null
+++ b/compiler/bundler.vim
@@ -0,0 +1,26 @@
+" Vim compiler file
+
+if exists("current_compiler")
+ finish
+endif
+let current_compiler = "bundler"
+
+let s:cpo_save = &cpo
+set cpo-=C
+
+CompilerSet makeprg=bundle
+
+CompilerSet errorformat=
+ \%+E%f:%l:\ parse\ error,
+ \%W%f:%l:\ warning:\ %m,
+ \%E%f:%l:in\ %*[^:]:\ %m,
+ \%E%f:%l:\ %m,
+ \%-C%\tfrom\ %f:%l:in\ %.%#,
+ \%-Z%\tfrom\ %f:%l,
+ \%-Z%p^,
+ \%-G%.%#
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim: sw=2:
diff --git a/compiler/cake.vim b/compiler/cake.vim
new file mode 100644
index 0000000..0a3c703
--- /dev/null
+++ b/compiler/cake.vim
@@ -0,0 +1,15 @@
+" Language: CoffeeScript
+" Maintainer: Mick Koch
+" URL: http://github.com/kchmck/vim-coffee-script
+" License: WTFPL
+
+if exists('current_compiler')
+ finish
+endif
+
+let current_compiler = 'cake'
+call coffee#CoffeeSetUpVariables()
+
+exec 'CompilerSet makeprg=' . escape(g:coffee_cake . ' ' .
+\ g:coffee_cake_options . ' $*', ' ')
+call coffee#CoffeeSetUpErrorFormat()
diff --git a/compiler/coffee.vim b/compiler/coffee.vim
new file mode 100644
index 0000000..f521ca9
--- /dev/null
+++ b/compiler/coffee.vim
@@ -0,0 +1,82 @@
+" Language: CoffeeScript
+" Maintainer: Mick Koch
+" URL: http://github.com/kchmck/vim-coffee-script
+" License: WTFPL
+
+" All this is needed to support compiling filenames with spaces, quotes, and
+" such. The filename is escaped and embedded into the `makeprg` setting.
+"
+" Because of this, `makeprg` must be updated on every file rename. And because
+" of that, `CompilerSet` can't be used because it doesn't exist when the
+" rename autocmd is ran. So, we have to do some checks to see whether `compiler`
+" was called locally or globally, and respect that in the rest of the script.
+
+if exists('current_compiler')
+ finish
+endif
+
+let current_compiler = 'coffee'
+call coffee#CoffeeSetUpVariables()
+
+" Pattern to check if coffee is the compiler
+let s:pat = '^' . current_compiler
+
+" Get a `makeprg` for the current filename.
+function! s:GetMakePrg()
+ return g:coffee_compiler .
+ \ ' -c' .
+ \ ' ' . b:coffee_litcoffee .
+ \ ' ' . g:coffee_make_options .
+ \ ' ' . fnameescape(expand('%')) .
+ \ ' $*'
+endfunction
+
+" Set `makeprg` and return 1 if coffee is still the compiler, else return 0.
+function! s:SetMakePrg()
+ if &l:makeprg =~ s:pat
+ let &l:makeprg = s:GetMakePrg()
+ elseif &g:makeprg =~ s:pat
+ let &g:makeprg = s:GetMakePrg()
+ else
+ return 0
+ endif
+
+ return 1
+endfunction
+
+" Set a dummy compiler so we can check whether to set locally or globally.
+exec 'CompilerSet makeprg=' . current_compiler
+" Then actually set the compiler.
+call s:SetMakePrg()
+call coffee#CoffeeSetUpErrorFormat()
+
+function! s:CoffeeMakeDeprecated(bang, args)
+ echoerr 'CoffeeMake is deprecated! Please use :make instead, its behavior ' .
+ \ 'is identical.'
+ sleep 5
+ exec 'make' . a:bang a:args
+endfunction
+
+" Compile the current file.
+command! -bang -bar -nargs=* CoffeeMake
+\ call s:CoffeeMakeDeprecated(, )
+
+" Set `makeprg` on rename since we embed the filename in the setting.
+augroup CoffeeUpdateMakePrg
+ autocmd!
+
+ " Update `makeprg` if coffee is still the compiler, else stop running this
+ " function.
+ function! s:UpdateMakePrg()
+ if !s:SetMakePrg()
+ autocmd! CoffeeUpdateMakePrg
+ endif
+ endfunction
+
+ " Set autocmd locally if compiler was set locally.
+ if &l:makeprg =~ s:pat
+ autocmd BufFilePost,BufWritePost call s:UpdateMakePrg()
+ else
+ autocmd BufFilePost,BufWritePost call s:UpdateMakePrg()
+ endif
+augroup END
diff --git a/compiler/cucumber.vim b/compiler/cucumber.vim
new file mode 100644
index 0000000..c020be6
--- /dev/null
+++ b/compiler/cucumber.vim
@@ -0,0 +1,29 @@
+" Vim compiler file
+" Compiler: Cucumber
+" Maintainer: Tim Pope
+" Last Change: 2010 Aug 09
+
+if exists("current_compiler")
+ finish
+endif
+let current_compiler = "cucumber"
+
+if exists(":CompilerSet") != 2 " older Vim always used :setlocal
+ command -nargs=* CompilerSet setlocal
+endif
+
+let s:cpo_save = &cpo
+set cpo-=C
+
+CompilerSet makeprg=cucumber
+
+CompilerSet errorformat=
+ \%W%m\ (Cucumber::Undefined),
+ \%E%m\ (%.%#),
+ \%Z%f:%l,
+ \%Z%f:%l:%.%#
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim:set sw=2 sts=2:
diff --git a/compiler/eruby.vim b/compiler/eruby.vim
new file mode 100644
index 0000000..45ad5ee
--- /dev/null
+++ b/compiler/eruby.vim
@@ -0,0 +1,39 @@
+" Vim compiler file
+" Language: eRuby
+" Maintainer: Doug Kearns
+" URL: https://github.com/vim-ruby/vim-ruby
+" Release Coordinator: Doug Kearns
+
+if exists("current_compiler")
+ finish
+endif
+let current_compiler = "eruby"
+
+if exists(":CompilerSet") != 2 " older Vim always used :setlocal
+ command -nargs=* CompilerSet setlocal
+endif
+
+let s:cpo_save = &cpo
+set cpo-=C
+
+if exists("eruby_compiler") && eruby_compiler == "eruby"
+ CompilerSet makeprg=eruby
+else
+ CompilerSet makeprg=erb
+endif
+
+CompilerSet errorformat=
+ \eruby:\ %f:%l:%m,
+ \%+E%f:%l:\ parse\ error,
+ \%W%f:%l:\ warning:\ %m,
+ \%E%f:%l:in\ %*[^:]:\ %m,
+ \%E%f:%l:\ %m,
+ \%-C%\tfrom\ %f:%l:in\ %.%#,
+ \%-Z%\tfrom\ %f:%l,
+ \%-Z%p^,
+ \%-G%.%#
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim: nowrap sw=2 sts=2 ts=8:
diff --git a/compiler/haml.vim b/compiler/haml.vim
new file mode 100644
index 0000000..b06a672
--- /dev/null
+++ b/compiler/haml.vim
@@ -0,0 +1,28 @@
+" Vim compiler file
+" Compiler: Haml
+" Maintainer: Tim Pope
+" Last Change: 2013 May 30
+
+if exists("current_compiler")
+ finish
+endif
+let current_compiler = "haml"
+
+if exists(":CompilerSet") != 2 " older Vim always used :setlocal
+ command -nargs=* CompilerSet setlocal
+endif
+
+let s:cpo_save = &cpo
+set cpo-=C
+
+CompilerSet makeprg=haml\ -c
+
+CompilerSet errorformat=
+ \Haml\ %trror\ on\ line\ %l:\ %m,
+ \Syntax\ %trror\ on\ line\ %l:\ %m,
+ \%-G%.%#
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim:set sw=2 sts=2:
diff --git a/compiler/rake.vim b/compiler/rake.vim
new file mode 100644
index 0000000..3bd9da0
--- /dev/null
+++ b/compiler/rake.vim
@@ -0,0 +1,35 @@
+" Vim compiler file
+" Language: Rake
+" Maintainer: Tim Pope
+" URL: https://github.com/vim-ruby/vim-ruby
+" Release Coordinator: Doug Kearns
+
+if exists("current_compiler")
+ finish
+endif
+let current_compiler = "rake"
+
+if exists(":CompilerSet") != 2 " older Vim always used :setlocal
+ command -nargs=* CompilerSet setlocal
+endif
+
+let s:cpo_save = &cpo
+set cpo-=C
+
+CompilerSet makeprg=rake
+
+CompilerSet errorformat=
+ \%D(in\ %f),
+ \%\\s%#from\ %f:%l:%m,
+ \%\\s%#from\ %f:%l:,
+ \%\\s%##\ %f:%l:%m,
+ \%\\s%##\ %f:%l,
+ \%\\s%#[%f:%l:\ %#%m,
+ \%\\s%#%f:%l:\ %#%m,
+ \%\\s%#%f:%l:,
+ \%m\ [%f:%l]:
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim: nowrap sw=2 sts=2 ts=8:
diff --git a/compiler/rspec.vim b/compiler/rspec.vim
new file mode 100644
index 0000000..7c340ba
--- /dev/null
+++ b/compiler/rspec.vim
@@ -0,0 +1,33 @@
+" Vim compiler file
+" Language: RSpec
+" Maintainer: Tim Pope
+" URL: https://github.com/vim-ruby/vim-ruby
+" Release Coordinator: Doug Kearns
+
+if exists("current_compiler")
+ finish
+endif
+let current_compiler = "rspec"
+
+if exists(":CompilerSet") != 2 " older Vim always used :setlocal
+ command -nargs=* CompilerSet setlocal
+endif
+
+let s:cpo_save = &cpo
+set cpo-=C
+
+CompilerSet makeprg=rspec
+
+CompilerSet errorformat=
+ \%f:%l:\ %tarning:\ %m,
+ \%E%.%#:in\ `load':\ %f:%l:%m,
+ \%E%f:%l:in\ `%*[^']':\ %m,
+ \%-Z\ \ \ \ \ \#\ %f:%l:%.%#,
+ \%E\ \ %\\d%\\+)%.%#,
+ \%C\ \ \ \ \ %m,
+ \%-G%.%#
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim: nowrap sw=2 sts=2 ts=8:
diff --git a/compiler/ruby.vim b/compiler/ruby.vim
new file mode 100644
index 0000000..dcf7a40
--- /dev/null
+++ b/compiler/ruby.vim
@@ -0,0 +1,45 @@
+" Vim compiler file
+" Language: Ruby
+" Function: Syntax check and/or error reporting
+" Maintainer: Tim Pope
+" URL: https://github.com/vim-ruby/vim-ruby
+" Release Coordinator: Doug Kearns
+" ----------------------------------------------------------------------------
+
+if exists("current_compiler")
+ finish
+endif
+let current_compiler = "ruby"
+
+if exists(":CompilerSet") != 2 " older Vim always used :setlocal
+ command -nargs=* CompilerSet setlocal
+endif
+
+let s:cpo_save = &cpo
+set cpo-=C
+
+" default settings runs script normally
+" add '-c' switch to run syntax check only:
+"
+" CompilerSet makeprg=ruby\ -wc\ $*
+"
+" or add '-c' at :make command line:
+"
+" :make -c %
+"
+CompilerSet makeprg=ruby\ -w\ $*
+
+CompilerSet errorformat=
+ \%+E%f:%l:\ parse\ error,
+ \%W%f:%l:\ warning:\ %m,
+ \%E%f:%l:in\ %*[^:]:\ %m,
+ \%E%f:%l:\ %m,
+ \%-C%\tfrom\ %f:%l:in\ %.%#,
+ \%-Z%\tfrom\ %f:%l,
+ \%-Z%p^,
+ \%-G%.%#
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim: nowrap sw=2 sts=2 ts=8:
diff --git a/compiler/rubyunit.vim b/compiler/rubyunit.vim
new file mode 100644
index 0000000..93a0c8e
--- /dev/null
+++ b/compiler/rubyunit.vim
@@ -0,0 +1,33 @@
+" Vim compiler file
+" Language: Test::Unit - Ruby Unit Testing Framework
+" Maintainer: Doug Kearns
+" URL: https://github.com/vim-ruby/vim-ruby
+" Release Coordinator: Doug Kearns
+
+if exists("current_compiler")
+ finish
+endif
+let current_compiler = "rubyunit"
+
+if exists(":CompilerSet") != 2 " older Vim always used :setlocal
+ command -nargs=* CompilerSet setlocal
+endif
+
+let s:cpo_save = &cpo
+set cpo-=C
+
+CompilerSet makeprg=testrb
+
+CompilerSet errorformat=\%W\ %\\+%\\d%\\+)\ Failure:,
+ \%C%m\ [%f:%l]:,
+ \%E\ %\\+%\\d%\\+)\ Error:,
+ \%C%m:,
+ \%C\ \ \ \ %f:%l:%.%#,
+ \%C%m,
+ \%Z\ %#,
+ \%-G%.%#
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim: nowrap sw=2 sts=2 ts=8:
diff --git a/compiler/sass.vim b/compiler/sass.vim
new file mode 100644
index 0000000..376a52b
--- /dev/null
+++ b/compiler/sass.vim
@@ -0,0 +1,30 @@
+" Vim compiler file
+" Compiler: Sass
+" Maintainer: Tim Pope
+" Last Change: 2013 May 30
+
+if exists("current_compiler")
+ finish
+endif
+let current_compiler = "sass"
+
+if exists(":CompilerSet") != 2 " older Vim always used :setlocal
+ command -nargs=* CompilerSet setlocal
+endif
+
+let s:cpo_save = &cpo
+set cpo-=C
+
+CompilerSet makeprg=sass\ -c
+
+CompilerSet errorformat=
+ \%f:%l:%m\ (Sass::Syntax%trror),
+ \%ESyntax\ %trror:%m,
+ \%C%\\s%\\+on\ line\ %l\ of\ %f,
+ \%Z%.%#,
+ \%-G%.%#
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim:set sw=2 sts=2:
diff --git a/ftdetect/coffee.vim b/ftdetect/coffee.vim
new file mode 100644
index 0000000..5056929
--- /dev/null
+++ b/ftdetect/coffee.vim
@@ -0,0 +1,17 @@
+" Language: CoffeeScript
+" Maintainer: Mick Koch
+" URL: http://github.com/kchmck/vim-coffee-script
+" License: WTFPL
+
+autocmd BufNewFile,BufRead *.coffee set filetype=coffee
+autocmd BufNewFile,BufRead *Cakefile set filetype=coffee
+autocmd BufNewFile,BufRead *.coffeekup,*.ck set filetype=coffee
+autocmd BufNewFile,BufRead *._coffee set filetype=coffee
+
+function! s:DetectCoffee()
+ if getline(1) =~ '^#!.*\'
+ set filetype=coffee
+ endif
+endfunction
+
+autocmd BufNewFile,BufRead * call s:DetectCoffee()
diff --git a/ftdetect/cucumber.vim b/ftdetect/cucumber.vim
new file mode 100644
index 0000000..f00f9e2
--- /dev/null
+++ b/ftdetect/cucumber.vim
@@ -0,0 +1,2 @@
+" Cucumber
+autocmd BufNewFile,BufReadPost *.feature,*.story set filetype=cucumber
diff --git a/ftdetect/haml.vim b/ftdetect/haml.vim
new file mode 100644
index 0000000..bf1de75
--- /dev/null
+++ b/ftdetect/haml.vim
@@ -0,0 +1,3 @@
+autocmd BufNewFile,BufRead *.haml,*.hamlbars setf haml
+autocmd BufNewFile,BufRead *.sass setf sass
+autocmd BufNewFile,BufRead *.scss setf scss
diff --git a/ftdetect/haskell.vim b/ftdetect/haskell.vim
new file mode 100644
index 0000000..1f51141
--- /dev/null
+++ b/ftdetect/haskell.vim
@@ -0,0 +1,2 @@
+" autocommand
+au BufRead,BufNewFile *.hs set comments=sl:{-,mb:--,elx:-}
diff --git a/ftdetect/javascript.vim b/ftdetect/javascript.vim
new file mode 100644
index 0000000..805e197
--- /dev/null
+++ b/ftdetect/javascript.vim
@@ -0,0 +1,11 @@
+au BufNewFile,BufRead *.js setf javascript
+au BufNewFile,BufRead *.jsm setf javascript
+au BufNewFile,BufRead *.json setf javascript
+au BufNewFile,BufRead Jakefile setf javascript
+
+fun! s:SelectJavascript()
+ if getline(1) =~# '^#!.*/bin/env\s\+node\>'
+ set ft=javascript
+ endif
+endfun
+au BufNewFile,BufRead * call s:SelectJavascript()
diff --git a/ftdetect/json.vim b/ftdetect/json.vim
new file mode 100644
index 0000000..5f6757d
--- /dev/null
+++ b/ftdetect/json.vim
@@ -0,0 +1,8 @@
+autocmd BufNewFile,BufRead *.json set filetype=json
+
+augroup json_autocmd
+ autocmd!
+ autocmd FileType json setlocal autoindent
+ autocmd FileType json setlocal formatoptions=tcq2l
+ autocmd FileType json setlocal foldmethod=syntax
+augroup END
diff --git a/ftdetect/less.vim b/ftdetect/less.vim
new file mode 100644
index 0000000..f1cb1d7
--- /dev/null
+++ b/ftdetect/less.vim
@@ -0,0 +1 @@
+autocmd BufNewFile,BufRead *.less setf less
diff --git a/ftdetect/nginx.vim b/ftdetect/nginx.vim
new file mode 100644
index 0000000..45bb1c1
--- /dev/null
+++ b/ftdetect/nginx.vim
@@ -0,0 +1 @@
+au BufRead,BufNewFile /etc/nginx/*,/usr/local/nginx/*,*/nginx/vhosts.d/*,nginx.conf if &ft == '' | setfiletype nginx | endif
diff --git a/ftdetect/ruby.vim b/ftdetect/ruby.vim
new file mode 100644
index 0000000..a4e9a6d
--- /dev/null
+++ b/ftdetect/ruby.vim
@@ -0,0 +1,62 @@
+" Ruby
+au BufNewFile,BufRead *.rb,*.rbw,*.gemspec set filetype=ruby
+
+" Ruby on Rails
+au BufNewFile,BufRead *.builder,*.rxml,*.rjs set filetype=ruby
+
+" Rakefile
+au BufNewFile,BufRead [rR]akefile,*.rake set filetype=ruby
+
+" Rantfile
+au BufNewFile,BufRead [rR]antfile,*.rant set filetype=ruby
+
+" IRB config
+au BufNewFile,BufRead .irbrc,irbrc set filetype=ruby
+
+" Pry config
+au BufNewFile,BufRead .pryrc set filetype=ruby
+
+" Rackup
+au BufNewFile,BufRead *.ru set filetype=ruby
+
+" Capistrano
+au BufNewFile,BufRead Capfile set filetype=ruby
+
+" Bundler
+au BufNewFile,BufRead Gemfile set filetype=ruby
+
+" Guard
+au BufNewFile,BufRead Guardfile,.Guardfile set filetype=ruby
+
+" Chef
+au BufNewFile,BufRead Cheffile set filetype=ruby
+au BufNewFile,BufRead Berksfile set filetype=ruby
+
+" Vagrant
+au BufNewFile,BufRead [vV]agrantfile set filetype=ruby
+
+" Autotest
+au BufNewFile,BufRead .autotest set filetype=ruby
+
+" eRuby
+au BufNewFile,BufRead *.erb,*.rhtml set filetype=eruby
+
+" Thor
+au BufNewFile,BufRead [tT]horfile,*.thor set filetype=ruby
+
+" Rabl
+au BufNewFile,BufRead *.rabl set filetype=ruby
+
+" Jbuilder
+au BufNewFile,BufRead *.jbuilder set filetype=ruby
+
+" Puppet librarian
+au BufNewFile,BufRead Puppetfile set filetype=ruby
+"
+" Buildr Buildfile
+au BufNewFile,BufRead [Bb]uildfile set filetype=ruby
+
+" Appraisal
+au BufNewFile,BufRead Appraisals set filetype=ruby
+
+" vim: nowrap sw=2 sts=2 ts=8 noet:
diff --git a/ftdetect/slim.vim b/ftdetect/slim.vim
new file mode 100644
index 0000000..b3415ce
--- /dev/null
+++ b/ftdetect/slim.vim
@@ -0,0 +1 @@
+autocmd BufNewFile,BufRead *.slim setf slim
diff --git a/ftdetect/stylus.vim b/ftdetect/stylus.vim
new file mode 100644
index 0000000..49e04ec
--- /dev/null
+++ b/ftdetect/stylus.vim
@@ -0,0 +1,3 @@
+" Stylus
+autocmd BufNewFile,BufReadPost *.styl set filetype=stylus
+autocmd BufNewFile,BufReadPost *.stylus set filetype=stylus
diff --git a/ftdetect/textile.vim b/ftdetect/textile.vim
new file mode 100644
index 0000000..d02f942
--- /dev/null
+++ b/ftdetect/textile.vim
@@ -0,0 +1,8 @@
+" textile.vim
+"
+" Tim Harper (tim.theenchanter.com)
+
+" Force filetype to be textile even if already set
+" This will override the system ftplugin/changelog
+" set on some distros
+au BufRead,BufNewFile *.textile set filetype=textile
diff --git a/ftdetect/tmux.vim b/ftdetect/tmux.vim
new file mode 100644
index 0000000..62cad9d
--- /dev/null
+++ b/ftdetect/tmux.vim
@@ -0,0 +1 @@
+autocmd BufNewFile,BufRead .tmux.conf*,tmux.conf* setf tmux
diff --git a/ftplugin/coffee.vim b/ftplugin/coffee.vim
new file mode 100644
index 0000000..c44fe97
--- /dev/null
+++ b/ftplugin/coffee.vim
@@ -0,0 +1,404 @@
+" Language: CoffeeScript
+" Maintainer: Mick Koch
+" URL: http://github.com/kchmck/vim-coffee-script
+" License: WTFPL
+
+if exists('b:did_ftplugin')
+ finish
+endif
+
+let b:did_ftplugin = 1
+call coffee#CoffeeSetUpVariables()
+
+setlocal formatoptions-=t formatoptions+=croql
+setlocal comments=:# commentstring=#\ %s
+setlocal omnifunc=javascriptcomplete#CompleteJS
+
+" Create custom augroups.
+augroup CoffeeBufUpdate | augroup END
+augroup CoffeeBufNew | augroup END
+
+" Enable coffee compiler if a compiler isn't set already.
+if !len(&l:makeprg)
+ compiler coffee
+endif
+
+" Switch to the window for buf.
+function! s:SwitchWindow(buf)
+ exec bufwinnr(a:buf) 'wincmd w'
+endfunction
+
+" Create a new scratch buffer and return the bufnr of it. After the function
+" returns, vim remains in the scratch buffer so more set up can be done.
+function! s:ScratchBufBuild(src, vert, size)
+ if a:size <= 0
+ if a:vert
+ let size = winwidth(bufwinnr(a:src)) / 2
+ else
+ let size = winheight(bufwinnr(a:src)) / 2
+ endif
+ endif
+
+ if a:vert
+ vertical belowright new
+ exec 'vertical resize' size
+ else
+ belowright new
+ exec 'resize' size
+ endif
+
+ setlocal bufhidden=wipe buftype=nofile nobuflisted noswapfile nomodifiable
+ nnoremap q :hide
+
+ return bufnr('%')
+endfunction
+
+" Replace buffer contents with text and delete the last empty line.
+function! s:ScratchBufUpdate(buf, text)
+ " Move to the scratch buffer.
+ call s:SwitchWindow(a:buf)
+
+ " Double check we're in the scratch buffer before overwriting.
+ if bufnr('%') != a:buf
+ throw 'unable to change to scratch buffer'
+ endif
+
+ setlocal modifiable
+ silent exec '% delete _'
+ silent put! =a:text
+ silent exec '$ delete _'
+ setlocal nomodifiable
+endfunction
+
+" Parse the output of coffee into a qflist entry for src buffer.
+function! s:ParseCoffeeError(output, src, startline)
+ " Coffee error is always on first line?
+ let match = matchlist(a:output,
+ \ '^\(\f\+\|\[stdin\]\):\(\d\):\(\d\): error: \(.\{-}\)' . "\n")
+
+ if !len(match)
+ return
+ endif
+
+ " Consider the line number from coffee as relative and add it to the beginning
+ " line number of the range the command was called on, then subtract one for
+ " zero-based relativity.
+ call setqflist([{'bufnr': a:src, 'lnum': a:startline + str2nr(match[2]) - 1,
+ \ 'type': 'E', 'col': str2nr(match[3]), 'text': match[4]}], 'r')
+endfunction
+
+" Reset source buffer variables.
+function! s:CoffeeCompileResetVars()
+ " Variables defined in source buffer:
+ " b:coffee_compile_buf: bufnr of output buffer
+ " Variables defined in output buffer:
+ " b:coffee_src_buf: bufnr of source buffer
+ " b:coffee_compile_pos: previous cursor position in output buffer
+
+ let b:coffee_compile_buf = -1
+endfunction
+
+function! s:CoffeeWatchResetVars()
+ " Variables defined in source buffer:
+ " b:coffee_watch_buf: bufnr of output buffer
+ " Variables defined in output buffer:
+ " b:coffee_src_buf: bufnr of source buffer
+ " b:coffee_watch_pos: previous cursor position in output buffer
+
+ let b:coffee_watch_buf = -1
+endfunction
+
+function! s:CoffeeRunResetVars()
+ " Variables defined in CoffeeRun source buffer:
+ " b:coffee_run_buf: bufnr of output buffer
+ " Variables defined in CoffeeRun output buffer:
+ " b:coffee_src_buf: bufnr of source buffer
+ " b:coffee_run_pos: previous cursor position in output buffer
+
+ let b:coffee_run_buf = -1
+endfunction
+
+" Clean things up in the source buffers.
+function! s:CoffeeCompileClose()
+ " Switch to the source buffer if not already in it.
+ silent! call s:SwitchWindow(b:coffee_src_buf)
+ call s:CoffeeCompileResetVars()
+endfunction
+
+function! s:CoffeeWatchClose()
+ silent! call s:SwitchWindow(b:coffee_src_buf)
+ silent! autocmd! CoffeeAuWatch *
+ call s:CoffeeWatchResetVars()
+endfunction
+
+function! s:CoffeeRunClose()
+ silent! call s:SwitchWindow(b:coffee_src_buf)
+ call s:CoffeeRunResetVars()
+endfunction
+
+" Compile the lines between startline and endline and put the result into buf.
+function! s:CoffeeCompileToBuf(buf, startline, endline)
+ let src = bufnr('%')
+ let input = join(getline(a:startline, a:endline), "\n")
+
+ " Coffee doesn't like empty input.
+ if !len(input)
+ " Function should still return within output buffer.
+ call s:SwitchWindow(a:buf)
+ return
+ endif
+
+ " Pipe lines into coffee.
+ let output = system(g:coffee_compiler .
+ \ ' -scb' .
+ \ ' ' . b:coffee_litcoffee .
+ \ ' 2>&1', input)
+
+ " Paste output into output buffer.
+ call s:ScratchBufUpdate(a:buf, output)
+
+ " Highlight as JavaScript if there were no compile errors.
+ if v:shell_error
+ call s:ParseCoffeeError(output, src, a:startline)
+ setlocal filetype=
+ else
+ " Clear the quickfix list.
+ call setqflist([], 'r')
+ setlocal filetype=javascript
+ endif
+endfunction
+
+" Peek at compiled CoffeeScript in a scratch buffer. We handle ranges like this
+" to prevent the cursor from being moved (and its position saved) before the
+" function is called.
+function! s:CoffeeCompile(startline, endline, args)
+ if a:args =~ '\'
+ echoerr 'CoffeeCompile watch is deprecated! Please use CoffeeWatch instead'
+ sleep 5
+ call s:CoffeeWatch(a:args)
+ return
+ endif
+
+ " Switch to the source buffer if not already in it.
+ silent! call s:SwitchWindow(b:coffee_src_buf)
+
+ " Bail if not in source buffer.
+ if !exists('b:coffee_compile_buf')
+ return
+ endif
+
+ " Build the output buffer if it doesn't exist.
+ if bufwinnr(b:coffee_compile_buf) == -1
+ let src = bufnr('%')
+
+ let vert = exists('g:coffee_compile_vert') || a:args =~ '\'
+ let size = str2nr(matchstr(a:args, '\<\d\+\>'))
+
+ " Build the output buffer and save the source bufnr.
+ let buf = s:ScratchBufBuild(src, vert, size)
+ let b:coffee_src_buf = src
+
+ " Set the buffer name.
+ exec 'silent! file [CoffeeCompile ' . src . ']'
+
+ " Clean up the source buffer when the output buffer is closed.
+ autocmd BufWipeout call s:CoffeeCompileClose()
+ " Save the cursor when leaving the output buffer.
+ autocmd BufLeave let b:coffee_compile_pos = getpos('.')
+
+ " Run user-defined commands on new buffer.
+ silent doautocmd CoffeeBufNew User CoffeeCompile
+
+ " Switch back to the source buffer and save the output bufnr. This also
+ " triggers BufLeave above.
+ call s:SwitchWindow(src)
+ let b:coffee_compile_buf = buf
+ endif
+
+ " Fill the scratch buffer.
+ call s:CoffeeCompileToBuf(b:coffee_compile_buf, a:startline, a:endline)
+ " Reset cursor to previous position.
+ call setpos('.', b:coffee_compile_pos)
+
+ " Run any user-defined commands on the scratch buffer.
+ silent doautocmd CoffeeBufUpdate User CoffeeCompile
+endfunction
+
+" Update the scratch buffer and switch back to the source buffer.
+function! s:CoffeeWatchUpdate()
+ call s:CoffeeCompileToBuf(b:coffee_watch_buf, 1, '$')
+ call setpos('.', b:coffee_watch_pos)
+ silent doautocmd CoffeeBufUpdate User CoffeeWatch
+ call s:SwitchWindow(b:coffee_src_buf)
+endfunction
+
+" Continually compile a source buffer.
+function! s:CoffeeWatch(args)
+ silent! call s:SwitchWindow(b:coffee_src_buf)
+
+ if !exists('b:coffee_watch_buf')
+ return
+ endif
+
+ if bufwinnr(b:coffee_watch_buf) == -1
+ let src = bufnr('%')
+
+ let vert = exists('g:coffee_watch_vert') || a:args =~ '\'
+ let size = str2nr(matchstr(a:args, '\<\d\+\>'))
+
+ let buf = s:ScratchBufBuild(src, vert, size)
+ let b:coffee_src_buf = src
+
+ exec 'silent! file [CoffeeWatch ' . src . ']'
+
+ autocmd BufWipeout call s:CoffeeWatchClose()
+ autocmd BufLeave let b:coffee_watch_pos = getpos('.')
+
+ silent doautocmd CoffeeBufNew User CoffeeWatch
+
+ call s:SwitchWindow(src)
+ let b:coffee_watch_buf = buf
+ endif
+
+ " Make sure only one watch autocmd is defined on this buffer.
+ silent! autocmd! CoffeeAuWatch *
+
+ augroup CoffeeAuWatch
+ autocmd InsertLeave call s:CoffeeWatchUpdate()
+ autocmd BufWritePost call s:CoffeeWatchUpdate()
+ augroup END
+
+ call s:CoffeeWatchUpdate()
+endfunction
+
+" Run a snippet of CoffeeScript between startline and endline.
+function! s:CoffeeRun(startline, endline, args)
+ silent! call s:SwitchWindow(b:coffee_src_buf)
+
+ if !exists('b:coffee_run_buf')
+ return
+ endif
+
+ if bufwinnr(b:coffee_run_buf) == -1
+ let src = bufnr('%')
+
+ let buf = s:ScratchBufBuild(src, exists('g:coffee_run_vert'), 0)
+ let b:coffee_src_buf = src
+
+ exec 'silent! file [CoffeeRun ' . src . ']'
+
+ autocmd BufWipeout call s:CoffeeRunClose()
+ autocmd BufLeave let b:coffee_run_pos = getpos('.')
+
+ silent doautocmd CoffeeBufNew User CoffeeRun
+
+ call s:SwitchWindow(src)
+ let b:coffee_run_buf = buf
+ endif
+
+ if a:startline == 1 && a:endline == line('$')
+ let output = system(g:coffee_compiler .
+ \ ' ' . b:coffee_litcoffee .
+ \ ' ' . fnameescape(expand('%')) .
+ \ ' ' . a:args)
+ else
+ let input = join(getline(a:startline, a:endline), "\n")
+
+ if !len(input)
+ return
+ endif
+
+ let output = system(g:coffee_compiler .
+ \ ' -s' .
+ \ ' ' . b:coffee_litcoffee .
+ \ ' ' . a:args, input)
+ endif
+
+ call s:ScratchBufUpdate(b:coffee_run_buf, output)
+ call setpos('.', b:coffee_run_pos)
+
+ silent doautocmd CoffeeBufUpdate User CoffeeRun
+endfunction
+
+" Run coffeelint on a file, and add any errors between startline and endline
+" to the quickfix list.
+function! s:CoffeeLint(startline, endline, bang, args)
+ let input = join(getline(a:startline, a:endline), "\n")
+
+ if !len(input)
+ return
+ endif
+
+ let output = system(g:coffee_linter .
+ \ ' -s --csv' .
+ \ ' ' . b:coffee_litcoffee .
+ \ ' ' . g:coffee_lint_options .
+ \ ' ' . a:args .
+ \ ' 2>&1', input)
+
+ " Convert output into an array and strip off the csv header.
+ let lines = split(output, "\n")[1:]
+ let buf = bufnr('%')
+ let qflist = []
+
+ for line in lines
+ let match = matchlist(line, '^stdin,\(\d\+\),\d*,\(error\|warn\),\(.\+\)$')
+
+ " Ignore unmatched lines.
+ if !len(match)
+ continue
+ endif
+
+ " The 'type' will result in either 'E' or 'W'.
+ call add(qflist, {'bufnr': buf, 'lnum': a:startline + str2nr(match[1]) - 1,
+ \ 'type': toupper(match[2][0]), 'text': match[3]})
+ endfor
+
+ " Replace the quicklist with our items.
+ call setqflist(qflist, 'r')
+
+ " If not given a bang, jump to first error.
+ if !len(a:bang)
+ silent! cc 1
+ endif
+endfunction
+
+" Complete arguments for Coffee* commands.
+function! s:CoffeeComplete(cmd, cmdline, cursor)
+ let args = ['vertical']
+
+ " If no partial command, return all possibilities.
+ if !len(a:cmd)
+ return args
+ endif
+
+ let pat = '^' . a:cmd
+
+ for arg in args
+ if arg =~ pat
+ return [arg]
+ endif
+ endfor
+endfunction
+
+" Set initial state variables if they don't exist
+if !exists('b:coffee_compile_buf')
+ call s:CoffeeCompileResetVars()
+endif
+
+if !exists('b:coffee_watch_buf')
+ call s:CoffeeWatchResetVars()
+endif
+
+if !exists('b:coffee_run_buf')
+ call s:CoffeeRunResetVars()
+endif
+
+command! -range=% -bar -nargs=* -complete=customlist,s:CoffeeComplete
+\ CoffeeCompile call s:CoffeeCompile(, , )
+command! -bar -nargs=* -complete=customlist,s:CoffeeComplete
+\ CoffeeWatch call s:CoffeeWatch()
+command! -range=% -bar -nargs=* CoffeeRun
+\ call s:CoffeeRun(, , )
+command! -range=% -bang -bar -nargs=* CoffeeLint
+\ call s:CoffeeLint(, , , )
diff --git a/ftplugin/cucumber.vim b/ftplugin/cucumber.vim
new file mode 100644
index 0000000..1c1f0f2
--- /dev/null
+++ b/ftplugin/cucumber.vim
@@ -0,0 +1,148 @@
+" Vim filetype plugin
+" Language: Cucumber
+" Maintainer: Tim Pope
+" Last Change: 2010 Aug 09
+
+" Only do this when not done yet for this buffer
+if (exists("b:did_ftplugin"))
+ finish
+endif
+let b:did_ftplugin = 1
+
+setlocal formatoptions-=t formatoptions+=croql
+setlocal comments=:# commentstring=#\ %s
+setlocal omnifunc=CucumberComplete
+
+let b:undo_ftplugin = "setl fo< com< cms< ofu<"
+
+let b:cucumber_root = expand('%:p:h:s?.*[\/]\%(features\|stories\)\zs[\/].*??')
+
+if !exists("g:no_plugin_maps") && !exists("g:no_cucumber_maps")
+ nnoremap :exe jump('edit',v:count)
+ nnoremap [ :exe jump('edit',v:count)
+ nnoremap ] :exe jump('edit',v:count)
+ nnoremap ] :exe jump('split',v:count)
+ nnoremap :exe jump('split',v:count)
+ nnoremap d :exe jump('split',v:count)
+ nnoremap :exe jump('split',v:count)
+ nnoremap } :exe jump('pedit',v:count)
+ nnoremap [d :exe jump('pedit',v:count)
+ nnoremap ]d :exe jump('pedit',v:count)
+ let b:undo_ftplugin .=
+ \ "|sil! nunmap " .
+ \ "|sil! nunmap [" .
+ \ "|sil! nunmap ]" .
+ \ "|sil! nunmap ]" .
+ \ "|sil! nunmap " .
+ \ "|sil! nunmap d" .
+ \ "|sil! nunmap " .
+ \ "|sil! nunmap }" .
+ \ "|sil! nunmap [d" .
+ \ "|sil! nunmap ]d"
+endif
+
+function! s:jump(command,count)
+ let steps = s:steps('.')
+ if len(steps) == 0 || len(steps) < a:count
+ return 'echoerr "No matching step found"'
+ elseif len(steps) > 1 && !a:count
+ return 'echoerr "Multiple matching steps found"'
+ else
+ let c = a:count ? a:count-1 : 0
+ return a:command.' +'.steps[c][1].' '.escape(steps[c][0],' %#')
+ endif
+endfunction
+
+function! s:allsteps()
+ let step_pattern = '\C^\s*\K\k*\>\s*(\=\s*\zs\S.\{-\}\ze\s*)\=\s*\%(do\|{\)\s*\%(|[^|]*|\s*\)\=\%($\|#\)'
+ let steps = []
+ for file in split(glob(b:cucumber_root.'/**/*.rb'),"\n")
+ let lines = readfile(file)
+ let num = 0
+ for line in lines
+ let num += 1
+ if line =~ step_pattern
+ let type = matchstr(line,'\w\+')
+ let steps += [[file,num,type,matchstr(line,step_pattern)]]
+ endif
+ endfor
+ endfor
+ return steps
+endfunction
+
+function! s:steps(lnum)
+ let c = match(getline(a:lnum), '\S') + 1
+ while synIDattr(synID(a:lnum,c,1),'name') !~# '^$\|Region$'
+ let c = c + 1
+ endwhile
+ let step = matchstr(getline(a:lnum)[c-1 : -1],'^\s*\zs.\{-\}\ze\s*$')
+ return filter(s:allsteps(),'s:stepmatch(v:val[3],step)')
+endfunction
+
+function! s:stepmatch(receiver,target)
+ if a:receiver =~ '^[''"].*[''"]$'
+ let pattern = '^'.escape(substitute(a:receiver[1:-2],'$\w\+','(.*)','g'),'/').'$'
+ elseif a:receiver =~ '^/.*/$'
+ let pattern = a:receiver[1:-2]
+ elseif a:receiver =~ '^%r..*.$'
+ let pattern = escape(a:receiver[3:-2],'/')
+ else
+ return 0
+ endif
+ try
+ let vimpattern = substitute(substitute(pattern,'\\\@
+" URL: https://github.com/vim-ruby/vim-ruby
+" Release Coordinator: Doug Kearns
+
+" Only do this when not done yet for this buffer
+if exists("b:did_ftplugin")
+ finish
+endif
+
+let s:save_cpo = &cpo
+set cpo-=C
+
+" Define some defaults in case the included ftplugins don't set them.
+let s:undo_ftplugin = ""
+let s:browsefilter = "All Files (*.*)\t*.*\n"
+let s:match_words = ""
+
+if !exists("g:eruby_default_subtype")
+ let g:eruby_default_subtype = "html"
+endif
+
+if &filetype =~ '^eruby\.'
+ let b:eruby_subtype = matchstr(&filetype,'^eruby\.\zs\w\+')
+elseif !exists("b:eruby_subtype")
+ let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$")
+ let b:eruby_subtype = matchstr(s:lines,'eruby_subtype=\zs\w\+')
+ if b:eruby_subtype == ''
+ let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\|\.erubis\)\+$','',''),'\.\zs\w\+$')
+ endif
+ if b:eruby_subtype == 'rhtml'
+ let b:eruby_subtype = 'html'
+ elseif b:eruby_subtype == 'rb'
+ let b:eruby_subtype = 'ruby'
+ elseif b:eruby_subtype == 'yml'
+ let b:eruby_subtype = 'yaml'
+ elseif b:eruby_subtype == 'js'
+ let b:eruby_subtype = 'javascript'
+ elseif b:eruby_subtype == 'txt'
+ " Conventional; not a real file type
+ let b:eruby_subtype = 'text'
+ elseif b:eruby_subtype == ''
+ let b:eruby_subtype = g:eruby_default_subtype
+ endif
+endif
+
+if exists("b:eruby_subtype") && b:eruby_subtype != ''
+ exe "runtime! ftplugin/".b:eruby_subtype.".vim ftplugin/".b:eruby_subtype."_*.vim ftplugin/".b:eruby_subtype."/*.vim"
+else
+ runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
+endif
+unlet! b:did_ftplugin
+
+" Override our defaults if these were set by an included ftplugin.
+if exists("b:undo_ftplugin")
+ let s:undo_ftplugin = b:undo_ftplugin
+ unlet b:undo_ftplugin
+endif
+if exists("b:browsefilter")
+ let s:browsefilter = b:browsefilter
+ unlet b:browsefilter
+endif
+if exists("b:match_words")
+ let s:match_words = b:match_words
+ unlet b:match_words
+endif
+
+runtime! ftplugin/ruby.vim ftplugin/ruby_*.vim ftplugin/ruby/*.vim
+let b:did_ftplugin = 1
+
+" Combine the new set of values with those previously included.
+if exists("b:undo_ftplugin")
+ let s:undo_ftplugin = b:undo_ftplugin . " | " . s:undo_ftplugin
+endif
+if exists ("b:browsefilter")
+ let s:browsefilter = substitute(b:browsefilter,'\cAll Files (\*\.\*)\t\*\.\*\n','','') . s:browsefilter
+endif
+if exists("b:match_words")
+ let s:match_words = b:match_words . ',' . s:match_words
+endif
+
+" Change the browse dialog on Win32 to show mainly eRuby-related files
+if has("gui_win32")
+ let b:browsefilter="eRuby Files (*.erb, *.rhtml)\t*.erb;*.rhtml\n" . s:browsefilter
+endif
+
+" Load the combined list of match_words for matchit.vim
+if exists("loaded_matchit")
+ let b:match_words = s:match_words
+endif
+
+" TODO: comments=
+setlocal commentstring=<%#%s%>
+
+let b:undo_ftplugin = "setl cms< "
+ \ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin
+
+let &cpo = s:save_cpo
+unlet s:save_cpo
+
+" vim: nowrap sw=2 sts=2 ts=8:
diff --git a/ftplugin/haml.vim b/ftplugin/haml.vim
new file mode 100644
index 0000000..8c693fa
--- /dev/null
+++ b/ftplugin/haml.vim
@@ -0,0 +1,68 @@
+" Vim filetype plugin
+" Language: Haml
+" Maintainer: Tim Pope
+" Last Change: 2010 May 21
+
+" Only do this when not done yet for this buffer
+if exists("b:did_ftplugin")
+ finish
+endif
+
+let s:save_cpo = &cpo
+set cpo-=C
+
+" Define some defaults in case the included ftplugins don't set them.
+let s:undo_ftplugin = ""
+let s:browsefilter = "All Files (*.*)\t*.*\n"
+let s:match_words = ""
+
+runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
+unlet! b:did_ftplugin
+set matchpairs-=<:>
+
+" Override our defaults if these were set by an included ftplugin.
+if exists("b:undo_ftplugin")
+ let s:undo_ftplugin = b:undo_ftplugin
+ unlet b:undo_ftplugin
+endif
+if exists("b:browsefilter")
+ let s:browsefilter = b:browsefilter
+ unlet b:browsefilter
+endif
+if exists("b:match_words")
+ let s:match_words = b:match_words
+ unlet b:match_words
+endif
+
+runtime! ftplugin/ruby.vim ftplugin/ruby_*.vim ftplugin/ruby/*.vim
+let b:did_ftplugin = 1
+
+" Combine the new set of values with those previously included.
+if exists("b:undo_ftplugin")
+ let s:undo_ftplugin = b:undo_ftplugin . " | " . s:undo_ftplugin
+endif
+if exists ("b:browsefilter")
+ let s:browsefilter = substitute(b:browsefilter,'\cAll Files (\*\.\*)\t\*\.\*\n','','') . s:browsefilter
+endif
+if exists("b:match_words")
+ let s:match_words = b:match_words . ',' . s:match_words
+endif
+
+" Change the browse dialog on Win32 to show mainly Haml-related files
+if has("gui_win32")
+ let b:browsefilter="Haml Files (*.haml)\t*.haml\nSass Files (*.sass)\t*.sass\n" . s:browsefilter
+endif
+
+" Load the combined list of match_words for matchit.vim
+if exists("loaded_matchit")
+ let b:match_words = s:match_words
+endif
+
+setlocal comments= commentstring=-#\ %s
+
+let b:undo_ftplugin = "setl cms< com< "
+ \ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin
+
+let &cpo = s:save_cpo
+
+" vim:set sw=2:
diff --git a/ftplugin/haskell.vim b/ftplugin/haskell.vim
new file mode 100644
index 0000000..9025b0e
--- /dev/null
+++ b/ftplugin/haskell.vim
@@ -0,0 +1,13 @@
+"
+" general Haskell source settings
+" (shared functions are in autoload/haskellmode.vim)
+"
+" (Claus Reinke, last modified: 28/04/2009)
+"
+" part of haskell plugins: http://projects.haskell.org/haskellmode-vim
+" please send patches to
+
+" try gf on import line, or ctrl-x ctrl-i, or [I, [i, ..
+setlocal include=^import\\s*\\(qualified\\)\\?\\s*
+setlocal includeexpr=substitute(v:fname,'\\.','/','g').'.'
+setlocal suffixesadd=hs,lhs,hsc
\ No newline at end of file
diff --git a/ftplugin/less.vim b/ftplugin/less.vim
new file mode 100644
index 0000000..b6eaf6a
--- /dev/null
+++ b/ftplugin/less.vim
@@ -0,0 +1,25 @@
+" Vim filetype plugin
+" Language: LessCSS
+" Author: Tim Pope
+" Maintainer: Leonard Ehrenfried
+" Last Change: 2011 Sep 30
+
+" Only do this when not done yet for this buffer
+if exists("b:did_ftplugin")
+ finish
+endif
+let b:did_ftplugin = 1
+
+let b:undo_ftplugin = "setl cms< def< inc< inex< ofu< sua<"
+
+setlocal iskeyword+=-
+setlocal commentstring=//\ %s
+setlocal define=^\\s*\\%(@mixin\\\|=\\)
+setlocal includeexpr=substitute(v:fname,'\\%(.*/\\\|^\\)\\zs','_','')
+setlocal omnifunc=csscomplete#CompleteCSS
+setlocal suffixesadd=.less
+setlocal comments=s1:/*,mb:*,ex:*/
+
+let &l:include = '^\s*@import\s\+\%(url(\)\=["'']\='
+
+" vim:set sw=2:
diff --git a/ftplugin/ocaml.vim b/ftplugin/ocaml.vim
new file mode 100644
index 0000000..2b39d27
--- /dev/null
+++ b/ftplugin/ocaml.vim
@@ -0,0 +1,505 @@
+" Language: OCaml
+" Maintainer: David Baelde
+" Mike Leary
+" Markus Mottl
+" Stefano Zacchiroli
+" URL: http://www.ocaml.info/vim/ftplugin/ocaml.vim
+" Last Change: 2009 Nov 10 - Improved .annot support
+" (MM for )
+" 2009 Nov 10 - Added support for looking up definitions
+" (MM for )
+"
+if exists("b:did_ftplugin")
+ finish
+endif
+let b:did_ftplugin=1
+
+" Error handling -- helps moving where the compiler wants you to go
+let s:cposet=&cpoptions
+set cpo-=C
+setlocal efm=
+ \%EFile\ \"%f\"\\,\ line\ %l\\,\ characters\ %c-%*\\d:,
+ \%EFile\ \"%f\"\\,\ line\ %l\\,\ character\ %c:%m,
+ \%+EReference\ to\ unbound\ regexp\ name\ %m,
+ \%Eocamlyacc:\ e\ -\ line\ %l\ of\ \"%f\"\\,\ %m,
+ \%Wocamlyacc:\ w\ -\ %m,
+ \%-Zmake%.%#,
+ \%C%m,
+ \%D%*\\a[%*\\d]:\ Entering\ directory\ `%f',
+ \%X%*\\a[%*\\d]:\ Leaving\ directory\ `%f',
+ \%D%*\\a:\ Entering\ directory\ `%f',
+ \%X%*\\a:\ Leaving\ directory\ `%f',
+ \%DMaking\ %*\\a\ in\ %f
+
+" Add mappings, unless the user didn't want this.
+if !exists("no_plugin_maps") && !exists("no_ocaml_maps")
+ " (un)commenting
+ if !hasmapto('Comment')
+ nmap c LUncomOn
+ vmap c BUncomOn
+ nmap C LUncomOff
+ vmap C BUncomOff
+ endif
+
+ nnoremap LUncomOn mz0i(* $A *)`z
+ nnoremap LUncomOff :s/^(\* \(.*\) \*)/\1/:noh
+ vnoremap BUncomOn :'<,'>`0i(*`>o0i*)`<
+ vnoremap BUncomOff :'<,'>`dd`<
+
+ if !hasmapto('Abbrev')
+ iabbrev ASF (assert false (* XXX *))
+ iabbrev ASS (assert (0=1) (* XXX *))
+ endif
+endif
+
+" Let % jump between structure elements (due to Issac Trotts)
+let b:mw = ''
+let b:mw = b:mw . ',\:\:\(\\|;;\)'
+let b:mw = b:mw . ',\:\:\'
+let b:mw = b:mw . ',\<\(for\|while\)\>:\:\,'
+let b:mw = b:mw . ',\<\(object\|sig\|struct\|begin\)\>:\'
+let b:mw = b:mw . ',\<\(match\|try\)\>:\'
+let b:match_words = b:mw
+
+let b:match_ignorecase=0
+
+" switching between interfaces (.mli) and implementations (.ml)
+if !exists("g:did_ocaml_switch")
+ let g:did_ocaml_switch = 1
+ map s :call OCaml_switch(0)
+ map S :call OCaml_switch(1)
+ fun OCaml_switch(newwin)
+ if (match(bufname(""), "\\.mli$") >= 0)
+ let fname = substitute(bufname(""), "\\.mli$", ".ml", "")
+ if (a:newwin == 1)
+ exec "new " . fname
+ else
+ exec "arge " . fname
+ endif
+ elseif (match(bufname(""), "\\.ml$") >= 0)
+ let fname = bufname("") . "i"
+ if (a:newwin == 1)
+ exec "new " . fname
+ else
+ exec "arge " . fname
+ endif
+ endif
+ endfun
+endif
+
+" Folding support
+
+" Get the modeline because folding depends on indentation
+let s:s = line2byte(line('.'))+col('.')-1
+if search('^\s*(\*:o\?caml:')
+ let s:modeline = getline(".")
+else
+ let s:modeline = ""
+endif
+if s:s > 0
+ exe 'goto' s:s
+endif
+
+" Get the indentation params
+let s:m = matchstr(s:modeline,'default\s*=\s*\d\+')
+if s:m != ""
+ let s:idef = matchstr(s:m,'\d\+')
+elseif exists("g:omlet_indent")
+ let s:idef = g:omlet_indent
+else
+ let s:idef = 2
+endif
+let s:m = matchstr(s:modeline,'struct\s*=\s*\d\+')
+if s:m != ""
+ let s:i = matchstr(s:m,'\d\+')
+elseif exists("g:omlet_indent_struct")
+ let s:i = g:omlet_indent_struct
+else
+ let s:i = s:idef
+endif
+
+" Set the folding method
+if exists("g:ocaml_folding")
+ setlocal foldmethod=expr
+ setlocal foldexpr=OMLetFoldLevel(v:lnum)
+endif
+
+" - Only definitions below, executed once -------------------------------------
+
+if exists("*OMLetFoldLevel")
+ finish
+endif
+
+function s:topindent(lnum)
+ let l = a:lnum
+ while l > 0
+ if getline(l) =~ '\s*\%(\\|\\|\