Modularized vim-ruby
This commit is contained in:
parent
f925093c39
commit
99f865f989
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -76,3 +76,6 @@
|
||||
[submodule "vim/bundle/tpope-vim-rails"]
|
||||
path = vim/bundle/tpope-vim-rails
|
||||
url = https://github.com/tpope/vim-rails.git
|
||||
[submodule "vim/bundle/vim-ruby-vim-ruby"]
|
||||
path = vim/bundle/vim-ruby-vim-ruby
|
||||
url = https://github.com/vim-ruby/vim-ruby.git
|
||||
|
@ -160,6 +160,7 @@ Included vim plugins
|
||||
|
||||
* tComment - gcc to comment a line, gcp to comment blocks, nuff said
|
||||
* sparkup - div.foo#bar - hit ctrl-e, expands into <code><div class='foo' id#bar/></code>, and that's just the beginning
|
||||
* rails.vim - syntax highlighting, gf (goto file) enhancements, and lots more. should be required for any rails dev
|
||||
|
||||
Utils
|
||||
|
||||
|
@ -1,801 +0,0 @@
|
||||
" Vim completion script
|
||||
" Language: Ruby
|
||||
" Maintainer: Mark Guzman <segfault@hasno.info>
|
||||
" URL: http://vim-ruby.rubyforge.org
|
||||
" Anon CVS: See above site
|
||||
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
|
||||
" Maintainer Version: 0.8.1
|
||||
" ----------------------------------------------------------------------------
|
||||
"
|
||||
" Ruby IRB/Complete author: Keiju ISHITSUKA(keiju@ishitsuka.com)
|
||||
" ----------------------------------------------------------------------------
|
||||
|
||||
" {{{ requirement checks
|
||||
if !has('ruby')
|
||||
s:ErrMsg( "Error: Rubycomplete requires vim compiled with +ruby" )
|
||||
s:ErrMsg( "Error: falling back to syntax completion" )
|
||||
" lets fall back to syntax completion
|
||||
setlocal omnifunc=syntaxcomplete#Complete
|
||||
finish
|
||||
endif
|
||||
|
||||
if version < 700
|
||||
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:ErrMsg(msg)
|
||||
echohl ErrorMsg
|
||||
echo a:msg
|
||||
echohl None
|
||||
endfunction
|
||||
|
||||
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*\<' . 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*'.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 = ''.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_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\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 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)
|
||||
sel.delete_if { |x| x == nil }
|
||||
sel.uniq!
|
||||
sel.grep(/^#{Regexp.quote(msg)}/) if msg != nil
|
||||
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
|
||||
|
||||
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, :type => 'm' } }
|
||||
valid += variables.collect { |v| { :name => v, :type => 'v' } }
|
||||
valid += classes.collect { |c| { :name => c, :type => 't' } }
|
||||
valid += constants.collect { |d| { :name => d, :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] ] }
|
||||
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:
|
1
vim/bundle/vim-ruby-vim-ruby
Submodule
1
vim/bundle/vim-ruby-vim-ruby
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit f265e6b09f943d79582244e487a4fa80a9584aa1
|
@ -1,40 +0,0 @@
|
||||
" Vim compiler file
|
||||
" Language: eRuby
|
||||
" Maintainer: Doug Kearns <dougkearns@gmail.com>
|
||||
" URL: http://vim-ruby.rubyforge.org
|
||||
" Anon CVS: See above site
|
||||
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
|
||||
|
||||
if exists("current_compiler")
|
||||
finish
|
||||
endif
|
||||
let current_compiler = "eruby"
|
||||
|
||||
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
|
||||
command -nargs=* CompilerSet setlocal <args>
|
||||
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:
|
@ -1,67 +0,0 @@
|
||||
" Vim compiler file
|
||||
" Language: Ruby
|
||||
" Function: Syntax check and/or error reporting
|
||||
" Maintainer: Tim Hammerquist <timh at rubyforge.org>
|
||||
" URL: http://vim-ruby.rubyforge.org
|
||||
" Anon CVS: See above site
|
||||
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
|
||||
" ----------------------------------------------------------------------------
|
||||
"
|
||||
" Changelog:
|
||||
" 0.2: script saves and restores 'cpoptions' value to prevent problems with
|
||||
" line continuations
|
||||
" 0.1: initial release
|
||||
"
|
||||
" Contributors:
|
||||
" Hugh Sasse <hgs@dmu.ac.uk>
|
||||
" Doug Kearns <djkea2@gus.gscit.monash.edu.au>
|
||||
"
|
||||
" Todo:
|
||||
" match error type %m
|
||||
"
|
||||
" Comments:
|
||||
" I know this file isn't perfect. If you have any questions, suggestions,
|
||||
" patches, etc., please don't hesitate to let me know.
|
||||
"
|
||||
" This is my first experience with 'errorformat' and compiler plugins and
|
||||
" I welcome any input from more experienced (or clearer-thinking)
|
||||
" individuals.
|
||||
" ----------------------------------------------------------------------------
|
||||
|
||||
if exists("current_compiler")
|
||||
finish
|
||||
endif
|
||||
let current_compiler = "ruby"
|
||||
|
||||
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
|
||||
command -nargs=* CompilerSet setlocal <args>
|
||||
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 %<CR>
|
||||
"
|
||||
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:
|
@ -1,34 +0,0 @@
|
||||
" Vim compiler file
|
||||
" Language: Test::Unit - Ruby Unit Testing Framework
|
||||
" Maintainer: Doug Kearns <dougkearns@gmail.com>
|
||||
" URL: http://vim-ruby.rubyforge.org
|
||||
" Anon CVS: See above site
|
||||
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
|
||||
|
||||
if exists("current_compiler")
|
||||
finish
|
||||
endif
|
||||
let current_compiler = "rubyunit"
|
||||
|
||||
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
|
||||
command -nargs=* CompilerSet setlocal <args>
|
||||
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:
|
@ -1,2 +0,0 @@
|
||||
" Cucumber
|
||||
autocmd BufNewFile,BufReadPost *.feature,*.story set filetype=cucumber
|
@ -1,18 +0,0 @@
|
||||
" Git
|
||||
autocmd BufNewFile,BufRead *.git/COMMIT_EDITMSG set ft=gitcommit
|
||||
autocmd BufNewFile,BufRead *.git/config,.gitconfig set ft=gitconfig
|
||||
autocmd BufNewFile,BufRead git-rebase-todo set ft=gitrebase
|
||||
autocmd BufNewFile,BufRead .msg.[0-9]*
|
||||
\ if getline(1) =~ '^From.*# This line is ignored.$' |
|
||||
\ set ft=gitsendemail |
|
||||
\ endif
|
||||
autocmd BufNewFile,BufRead *.git/**
|
||||
\ if getline(1) =~ '^\x\{40\}\>\|^ref: ' |
|
||||
\ set ft=git |
|
||||
\ endif
|
||||
|
||||
" This logic really belongs in scripts.vim
|
||||
autocmd BufNewFile,BufRead,StdinReadPost *
|
||||
\ if getline(1) =~ '^\(commit\|tree\|object\) \x\{40\}$\|^tag \S\+$' |
|
||||
\ set ft=git |
|
||||
\ endif
|
@ -1,2 +0,0 @@
|
||||
autocmd BufNewFile,BufRead *.haml setf haml
|
||||
autocmd BufNewFile,BufRead *.sass setf sass
|
@ -1,2 +0,0 @@
|
||||
au BufNewFile,BufRead *.less set filetype=less
|
||||
|
@ -1,26 +0,0 @@
|
||||
" Ruby
|
||||
au BufNewFile,BufRead *.rb,*.rbw,*.gem,*.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
|
||||
|
||||
" Rackup
|
||||
au BufNewFile,BufRead *.ru set filetype=ruby
|
||||
|
||||
" Capistrano
|
||||
au BufNewFile,BufRead Capfile set filetype=ruby
|
||||
|
||||
" Bundler
|
||||
au BufNewFile,BufRead Gemfile set filetype=ruby
|
||||
|
||||
" eRuby
|
||||
au BufNewFile,BufRead *.erb,*.rhtml set filetype=eruby
|
@ -1,9 +0,0 @@
|
||||
autocmd BufNewFile,BufRead *rb call s:CheckForSinatraApp()
|
||||
|
||||
function! s:CheckForSinatraApp()
|
||||
if &filetype !~ '\(^sinatra$\|\.sinatra$\|^sinatra\.\|\.sinatra\.\)'
|
||||
if search('Sinatra::Base\|require\s*[''"]sinatra[''"]', 'nwc') != 0
|
||||
let &filetype = &filetype . ".sinatra"
|
||||
endif
|
||||
endif
|
||||
endfunction
|
@ -1,125 +0,0 @@
|
||||
" Vim filetype plugin
|
||||
" Language: Cucumber
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
|
||||
|
||||
" 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")
|
||||
nmap <silent><buffer> <C-]> :<C-U>exe <SID>jump('edit',v:count)<CR>
|
||||
nmap <silent><buffer> <C-W>] :<C-U>exe <SID>jump('split',v:count)<CR>
|
||||
nmap <silent><buffer> <C-W><C-]> :<C-U>exe <SID>jump('split',v:count)<CR>
|
||||
nmap <silent><buffer> <C-W>} :<C-U>exe <SID>jump('pedit',v:count)<CR>
|
||||
let b:undo_ftplugin .= "| sil! iunmap! <C-]>| sil! iunmap! <C-W>]| sil! iunmap! <C-W><C-]>| sil! iunmap! <C-W>}"
|
||||
endif
|
||||
|
||||
function! s:jump(command,count)
|
||||
let steps = s:steps(getline('.'))
|
||||
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*\%(Giv\|[WT]h\)en\>\s*\zs.\{-\}\ze\s*\%(do\|{\)\s*\%(|[A-Za-z0-9_,() *]*|\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(step)
|
||||
let step = matchstr(a:step,'^\s*\k*\s*\zs.\{-\}\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,'\\\@<!(?:','%(','g'),'\\\@<!\*?','{-}','g')
|
||||
if a:target =~# '\v'.vimpattern
|
||||
return 1
|
||||
endif
|
||||
catch
|
||||
endtry
|
||||
if has("ruby")
|
||||
ruby VIM.command("return #{if (begin; Kernel.eval('/'+VIM.evaluate('pattern')+'/'); rescue SyntaxError; end) === VIM.evaluate('a:target') then 1 else 0 end}")
|
||||
else
|
||||
return 0
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:bsub(target,pattern,replacement)
|
||||
return substitute(a:target,'\C\\\@<!'.a:pattern,a:replacement,'g')
|
||||
endfunction
|
||||
|
||||
function! CucumberComplete(findstart,base) abort
|
||||
let indent = indent('.')
|
||||
let group = synIDattr(synID(line('.'),indent+1,1),'name')
|
||||
let type = matchstr(group,'\Ccucumber\zs\%(Given\|When\|Then\)')
|
||||
let e = matchend(getline('.'),'^\s*\S\+\s')
|
||||
if type == '' || col('.') < col('$') || e < 0
|
||||
return -1
|
||||
endif
|
||||
if a:findstart
|
||||
return e
|
||||
endif
|
||||
let steps = []
|
||||
for step in s:allsteps()
|
||||
if step[2] ==# type
|
||||
if step[3] =~ '^[''"]'
|
||||
let steps += [step[3][1:-2]]
|
||||
elseif step[3] =~ '^/\^.*\$/$'
|
||||
let pattern = step[3][2:-3]
|
||||
let pattern = s:bsub(pattern,'\\[Sw]','w')
|
||||
let pattern = s:bsub(pattern,'\\d','1')
|
||||
let pattern = s:bsub(pattern,'\\[sWD]',' ')
|
||||
let pattern = s:bsub(pattern,'[[:alnum:]. -][?*]?\=','')
|
||||
let pattern = s:bsub(pattern,'\[\([^^]\).\{-\}\]','\1')
|
||||
let pattern = s:bsub(pattern,'+?\=','')
|
||||
let pattern = s:bsub(pattern,'(\([[:alnum:]. -]\{-\}\))','\1')
|
||||
let pattern = s:bsub(pattern,'\\\([[:punct:]]\)','\1')
|
||||
if pattern !~ '[\\()*?]'
|
||||
let steps += [pattern]
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
call filter(steps,'strpart(v:val,0,strlen(a:base)) ==# a:base')
|
||||
return sort(steps)
|
||||
endfunction
|
||||
|
||||
" vim:set sts=2 sw=2:
|
@ -1,103 +0,0 @@
|
||||
" Vim filetype plugin
|
||||
" Language: eRuby
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" URL: http://vim-ruby.rubyforge.org
|
||||
" Anon CVS: See above site
|
||||
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
|
||||
|
||||
" 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 !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(&filetype,'^eruby\.\zs\w\+')
|
||||
endif
|
||||
if b:eruby_subtype == ''
|
||||
let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\)\+$','',''),'\.\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
|
||||
|
||||
" vim: nowrap sw=2 sts=2 ts=8:
|
@ -1,34 +0,0 @@
|
||||
" Vim filetype plugin
|
||||
" Language: generic git output
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
|
||||
" Last Change: 2008 Feb 27
|
||||
|
||||
" Only do this when not done yet for this buffer
|
||||
if (exists("b:did_ftplugin"))
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
if !exists('b:git_dir')
|
||||
if expand('%:p') =~# '\.git\>'
|
||||
let b:git_dir = matchstr(expand('%:p'),'.*\.git\>')
|
||||
elseif $GIT_DIR != ''
|
||||
let b:git_dir = $GIT_DIR
|
||||
endif
|
||||
if has('win32') || has('win64')
|
||||
let b:git_dir = substitute(b:git_dir,'\\','/','g')
|
||||
endif
|
||||
endif
|
||||
|
||||
if exists('*shellescape') && exists('b:git_dir') && b:git_dir != ''
|
||||
if b:git_dir =~# '/\.git$' " Not a bare repository
|
||||
let &l:path = escape(fnamemodify(b:git_dir,':t'),'\, ').','.&l:path
|
||||
endif
|
||||
let &l:path = escape(b:git_dir,'\, ').','.&l:path
|
||||
let &l:keywordprg = 'git --git-dir='.shellescape(b:git_dir).' show'
|
||||
else
|
||||
setlocal keywordprg=git\ show
|
||||
endif
|
||||
|
||||
setlocal includeexpr=substitute(v:fname,'^[^/]\\+/','','')
|
||||
let b:undo_ftplugin = "setl keywordprg< path< includeexpr<"
|
@ -1,68 +0,0 @@
|
||||
" Vim filetype plugin
|
||||
" Language: git config file
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
|
||||
" Last Change: 2008 Mar 09
|
||||
|
||||
" Only do this when not done yet for this buffer
|
||||
if (exists("b:did_ftplugin"))
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! ftplugin/git.vim
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
if &textwidth == 0
|
||||
" make sure that log messages play nice with git-log on standard terminals
|
||||
setlocal textwidth=72
|
||||
if !exists("b:undo_ftplugin")
|
||||
let b:undo_ftplugin = ""
|
||||
endif
|
||||
let b:undo_ftplugin = b:undo_ftplugin . "|setl tw<"
|
||||
endif
|
||||
|
||||
if exists("g:no_gitcommit_commands") || v:version < 700
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists("b:git_dir")
|
||||
let b:git_dir = expand("%:p:h")
|
||||
endif
|
||||
|
||||
" Automatically diffing can be done with:
|
||||
" autocmd FileType gitcommit DiffGitCached | wincmd p
|
||||
command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0,b:git_dir,<f-args>)
|
||||
|
||||
function! s:diffcomplete(A,L,P)
|
||||
let args = ""
|
||||
if a:P <= match(a:L." -- "," -- ")+3
|
||||
let args = args . "-p\n--stat\n--shortstat\n--summary\n--patch-with-stat\n--no-renames\n-B\n-M\n-C\n"
|
||||
end
|
||||
if exists("b:git_dir") && a:A !~ '^-'
|
||||
let tree = fnamemodify(b:git_dir,':h')
|
||||
if strpart(getcwd(),0,strlen(tree)) == tree
|
||||
let args = args."\n".system("git diff --cached --name-only")
|
||||
endif
|
||||
endif
|
||||
return args
|
||||
endfunction
|
||||
|
||||
function! s:gitdiffcached(bang,gitdir,...)
|
||||
let tree = fnamemodify(a:gitdir,':h')
|
||||
let name = tempname()
|
||||
let git = "git"
|
||||
if strpart(getcwd(),0,strlen(tree)) != tree
|
||||
let git .= " --git-dir=".(exists("*shellescape") ? shellescape(a:gitdir) : '"'.a:gitdir.'"')
|
||||
endif
|
||||
if a:0
|
||||
let extra = join(map(copy(a:000),has("*shellescape") ? 'shellescape(v:val)' : "'\"'.v:val.'\"'"))
|
||||
else
|
||||
let extra = "-p --stat=".&columns
|
||||
endif
|
||||
call system(git." diff --cached --no-color ".extra." > ".name)
|
||||
exe "pedit ".name
|
||||
wincmd P
|
||||
let b:git_dir = a:gitdir
|
||||
command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0,b:git_dir,<f-args>)
|
||||
nnoremap <silent> q :q<CR>
|
||||
setlocal buftype=nowrite nobuflisted noswapfile nomodifiable filetype=git
|
||||
endfunction
|
@ -1,15 +0,0 @@
|
||||
" Vim filetype plugin
|
||||
" Language: git config file
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
|
||||
" Last Change: 2007 Dec 16
|
||||
|
||||
" 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
|
||||
|
||||
let b:undo_ftplugin = "setl fo< com< cms<"
|
@ -1,41 +0,0 @@
|
||||
" Vim filetype plugin
|
||||
" Language: git rebase --interactive
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
|
||||
" Last Change: 2008 Apr 16
|
||||
|
||||
" Only do this when not done yet for this buffer
|
||||
if (exists("b:did_ftplugin"))
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! ftplugin/git.vim
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
setlocal comments=:# commentstring=#\ %s formatoptions-=t
|
||||
if !exists("b:undo_ftplugin")
|
||||
let b:undo_ftplugin = ""
|
||||
endif
|
||||
let b:undo_ftplugin = b:undo_ftplugin."|setl com< cms< fo<"
|
||||
|
||||
function! s:choose(word)
|
||||
s/^\(\w\+\>\)\=\(\s*\)\ze\x\{4,40\}\>/\=(strlen(submatch(1)) == 1 ? a:word[0] : a:word) . substitute(submatch(2),'^$',' ','')/e
|
||||
endfunction
|
||||
|
||||
function! s:cycle()
|
||||
call s:choose(get({'s':'edit','p':'squash'},getline('.')[0],'pick'))
|
||||
endfunction
|
||||
|
||||
command! -buffer -bar Pick :call s:choose('pick')
|
||||
command! -buffer -bar Squash :call s:choose('squash')
|
||||
command! -buffer -bar Edit :call s:choose('edit')
|
||||
command! -buffer -bar Cycle :call s:cycle()
|
||||
" The above are more useful when they are mapped; for example:
|
||||
"nnoremap <buffer> <silent> S :Cycle<CR>
|
||||
|
||||
if exists("g:no_plugin_maps") || exists("g:no_gitrebase_maps")
|
||||
finish
|
||||
endif
|
||||
|
||||
nnoremap <buffer> <expr> K col('.') < 7 && expand('<Lt>cword>') =~ '\X' && getline('.') =~ '^\w\+\s\+\x\+\>' ? 'wK' : 'K'
|
||||
|
||||
let b:undo_ftplugin = b:undo_ftplugin . "|nunmap <buffer> K"
|
@ -1,6 +0,0 @@
|
||||
" Vim filetype plugin
|
||||
" Language: git send-email message
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
|
||||
" Last Change: 2007 Dec 16
|
||||
|
||||
runtime! ftplugin/mail.vim
|
@ -1,66 +0,0 @@
|
||||
" Vim filetype plugin
|
||||
" Language: Haml
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
|
||||
|
||||
" 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
|
||||
|
||||
" 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 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:
|
@ -1,262 +0,0 @@
|
||||
" Vim filetype plugin
|
||||
" Language: Ruby
|
||||
" Maintainer: Gavin Sinclair <gsinclair at gmail.com>
|
||||
" URL: http://vim-ruby.rubyforge.org
|
||||
" Anon CVS: See above site
|
||||
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
|
||||
" ----------------------------------------------------------------------------
|
||||
"
|
||||
" Original matchit support thanks to Ned Konz. See his ftplugin/ruby.vim at
|
||||
" http://bike-nomad.com/vim/ruby.vim.
|
||||
" ----------------------------------------------------------------------------
|
||||
|
||||
" Only do this when not done yet for this buffer
|
||||
if (exists("b:did_ftplugin"))
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
if has("gui_running") && !has("gui_win32")
|
||||
setlocal keywordprg=ri\ -T
|
||||
else
|
||||
setlocal keywordprg=ri
|
||||
endif
|
||||
|
||||
" Matchit support
|
||||
if exists("loaded_matchit") && !exists("b:match_words")
|
||||
let b:match_ignorecase = 0
|
||||
|
||||
let b:match_words =
|
||||
\ '\<\%(if\|unless\|case\|while\|until\|for\|do\|class\|module\|def\|begin\)\>=\@!' .
|
||||
\ ':' .
|
||||
\ '\<\%(else\|elsif\|ensure\|when\|rescue\|break\|redo\|next\|retry\)\>' .
|
||||
\ ':' .
|
||||
\ '\<end\>' .
|
||||
\ ',{:},\[:\],(:)'
|
||||
|
||||
let b:match_skip =
|
||||
\ "synIDattr(synID(line('.'),col('.'),0),'name') =~ '" .
|
||||
\ "\\<ruby\\%(String\\|StringDelimiter\\|ASCIICode\\|Escape\\|" .
|
||||
\ "Interpolation\\|NoInterpolation\\|Comment\\|Documentation\\|" .
|
||||
\ "ConditionalModifier\\|RepeatModifier\\|OptionalDo\\|" .
|
||||
\ "Function\\|BlockArgument\\|KeywordAsMethod\\|ClassVariable\\|" .
|
||||
\ "InstanceVariable\\|GlobalVariable\\|Symbol\\)\\>'"
|
||||
endif
|
||||
|
||||
setlocal formatoptions-=t formatoptions+=croql
|
||||
|
||||
setlocal include=^\\s*\\<\\(load\\\|\w*require\\)\\>
|
||||
setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'$','.rb','')
|
||||
setlocal suffixesadd=.rb
|
||||
|
||||
if exists("&ofu") && has("ruby")
|
||||
setlocal omnifunc=rubycomplete#Complete
|
||||
endif
|
||||
|
||||
" To activate, :set ballooneval
|
||||
if has('balloon_eval') && exists('+balloonexpr')
|
||||
setlocal balloonexpr=RubyBalloonexpr()
|
||||
endif
|
||||
|
||||
|
||||
" TODO:
|
||||
"setlocal define=^\\s*def
|
||||
|
||||
setlocal comments=:#
|
||||
setlocal commentstring=#\ %s
|
||||
|
||||
if !exists("s:ruby_path")
|
||||
if exists("g:ruby_path")
|
||||
let s:ruby_path = g:ruby_path
|
||||
elseif has("ruby") && has("win32")
|
||||
ruby VIM::command( 'let s:ruby_path = "%s"' % ($: + begin; require %q{rubygems}; Gem.all_load_paths.sort.uniq; rescue LoadError; []; end).join(%q{,}) )
|
||||
let s:ruby_path = '.,' . substitute(s:ruby_path, '\%(^\|,\)\.\%(,\|$\)', ',,', '')
|
||||
elseif executable("ruby")
|
||||
let s:code = "print ($: + begin; require %q{rubygems}; Gem.all_load_paths.sort.uniq; rescue LoadError; []; end).join(%q{,})"
|
||||
if &shellxquote == "'"
|
||||
let s:ruby_path = system('ruby -e "' . s:code . '"')
|
||||
else
|
||||
let s:ruby_path = system("ruby -e '" . s:code . "'")
|
||||
endif
|
||||
let s:ruby_path = '.,' . substitute(s:ruby_path, '\%(^\|,\)\.\%(,\|$\)', ',,', '')
|
||||
else
|
||||
" If we can't call ruby to get its path, just default to using the
|
||||
" current directory and the directory of the current file.
|
||||
let s:ruby_path = ".,,"
|
||||
endif
|
||||
endif
|
||||
|
||||
let &l:path = s:ruby_path
|
||||
|
||||
if has("gui_win32") && !exists("b:browsefilter")
|
||||
let b:browsefilter = "Ruby Source Files (*.rb)\t*.rb\n" .
|
||||
\ "All Files (*.*)\t*.*\n"
|
||||
endif
|
||||
|
||||
let b:undo_ftplugin = "setl fo< inc< inex< sua< def< com< cms< path< kp<"
|
||||
\."| unlet! b:browsefilter b:match_ignorecase b:match_words b:match_skip"
|
||||
\."| if exists('&ofu') && has('ruby') | setl ofu< | endif"
|
||||
\."| if has('balloon_eval') && exists('+bexpr') | setl bexpr< | endif"
|
||||
|
||||
if !exists("g:no_plugin_maps") && !exists("g:no_ruby_maps")
|
||||
|
||||
noremap <silent> <buffer> [m :<C-U>call <SID>searchsyn('\<def\>','rubyDefine','b')<CR>
|
||||
noremap <silent> <buffer> ]m :<C-U>call <SID>searchsyn('\<def\>','rubyDefine','')<CR>
|
||||
noremap <silent> <buffer> [M :<C-U>call <SID>searchsyn('\<end\>','rubyDefine','b')<CR>
|
||||
noremap <silent> <buffer> ]M :<C-U>call <SID>searchsyn('\<end\>','rubyDefine','')<CR>
|
||||
|
||||
noremap <silent> <buffer> [[ :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>','rubyModule\<Bar>rubyClass','b')<CR>
|
||||
noremap <silent> <buffer> ]] :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>','rubyModule\<Bar>rubyClass','')<CR>
|
||||
noremap <silent> <buffer> [] :<C-U>call <SID>searchsyn('\<end\>','rubyModule\<Bar>rubyClass','b')<CR>
|
||||
noremap <silent> <buffer> ][ :<C-U>call <SID>searchsyn('\<end\>','rubyModule\<Bar>rubyClass','')<CR>
|
||||
|
||||
let b:undo_ftplugin = b:undo_ftplugin
|
||||
\."| sil! exe 'unmap <buffer> [[' | sil! exe 'unmap <buffer> ]]' | sil! exe 'unmap <buffer> []' | sil! exe 'unmap <buffer> ]['"
|
||||
\."| sil! exe 'unmap <buffer> [m' | sil! exe 'unmap <buffer> ]m' | sil! exe 'unmap <buffer> [M' | sil! exe 'unmap <buffer> ]M'"
|
||||
|
||||
if maparg("\<C-]>",'n') == ''
|
||||
nnoremap <silent> <buffer> <C-]> :<C-U>exe v:count1."tag <C-R>=RubyCursorIdentifier()<CR>"<CR>
|
||||
nnoremap <silent> <buffer> g<C-]> :<C-U>exe "tjump <C-R>=RubyCursorIdentifier()<CR>"<CR>
|
||||
nnoremap <silent> <buffer> g] :<C-U>exe "tselect <C-R>=RubyCursorIdentifier()<CR>"<CR>
|
||||
nnoremap <silent> <buffer> <C-W>] :<C-U>exe v:count1."stag <C-R>=RubyCursorIdentifier()<CR>"<CR>
|
||||
nnoremap <silent> <buffer> <C-W><C-]> :<C-U>exe v:count1."stag <C-R>=RubyCursorIdentifier()<CR>"<CR>
|
||||
nnoremap <silent> <buffer> <C-W>g<C-]> :<C-U>exe "stjump <C-R>=RubyCursorIdentifier()<CR>"<CR>
|
||||
nnoremap <silent> <buffer> <C-W>g] :<C-U>exe "stselect <C-R>=RubyCursorIdentifier()<CR>"<CR>
|
||||
nnoremap <silent> <buffer> <C-W>} :<C-U>exe "ptag <C-R>=RubyCursorIdentifier()<CR>"<CR>
|
||||
nnoremap <silent> <buffer> <C-W>g} :<C-U>exe "ptjump <C-R>=RubyCursorIdentifier()<CR>"<CR>
|
||||
let b:undo_ftplugin = b:undo_ftplugin
|
||||
\."| sil! exe 'nunmap <buffer> <C-]>'| sil! exe 'nunmap <buffer> g<C-]>'| sil! exe 'nunmap <buffer> g]'"
|
||||
\."| sil! exe 'nunmap <buffer> <C-W>]'| sil! exe 'nunmap <buffer> <C-W><C-]>'"
|
||||
\."| sil! exe 'nunmap <buffer> <C-W>g<C-]>'| sil! exe 'nunmap <buffer> <C-W>g]'"
|
||||
\."| sil! exe 'nunmap <buffer> <C-W>}'| sil! exe 'nunmap <buffer> <C-W>g}'"
|
||||
endif
|
||||
endif
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
if exists("g:did_ruby_ftplugin_functions")
|
||||
finish
|
||||
endif
|
||||
let g:did_ruby_ftplugin_functions = 1
|
||||
|
||||
function! RubyBalloonexpr()
|
||||
if !exists('s:ri_found')
|
||||
let s:ri_found = executable('ri')
|
||||
endif
|
||||
if s:ri_found
|
||||
let line = getline(v:beval_lnum)
|
||||
let b = matchstr(strpart(line,0,v:beval_col),'\%(\w\|[:.]\)*$')
|
||||
let a = substitute(matchstr(strpart(line,v:beval_col),'^\w*\%([?!]\|\s*=\)\?'),'\s\+','','g')
|
||||
let str = b.a
|
||||
let before = strpart(line,0,v:beval_col-strlen(b))
|
||||
let after = strpart(line,v:beval_col+strlen(a))
|
||||
if str =~ '^\.'
|
||||
let str = substitute(str,'^\.','#','g')
|
||||
if before =~ '\]\s*$'
|
||||
let str = 'Array'.str
|
||||
elseif before =~ '}\s*$'
|
||||
" False positives from blocks here
|
||||
let str = 'Hash'.str
|
||||
elseif before =~ "[\"'`]\\s*$" || before =~ '\$\d\+\s*$'
|
||||
let str = 'String'.str
|
||||
elseif before =~ '\$\d\+\.\d\+\s*$'
|
||||
let str = 'Float'.str
|
||||
elseif before =~ '\$\d\+\s*$'
|
||||
let str = 'Integer'.str
|
||||
elseif before =~ '/\s*$'
|
||||
let str = 'Regexp'.str
|
||||
else
|
||||
let str = substitute(str,'^#','.','')
|
||||
endif
|
||||
endif
|
||||
let str = substitute(str,'.*\.\s*to_f\s*\.\s*','Float#','')
|
||||
let str = substitute(str,'.*\.\s*to_i\%(nt\)\=\s*\.\s*','Integer#','')
|
||||
let str = substitute(str,'.*\.\s*to_s\%(tr\)\=\s*\.\s*','String#','')
|
||||
let str = substitute(str,'.*\.\s*to_sym\s*\.\s*','Symbol#','')
|
||||
let str = substitute(str,'.*\.\s*to_a\%(ry\)\=\s*\.\s*','Array#','')
|
||||
let str = substitute(str,'.*\.\s*to_proc\s*\.\s*','Proc#','')
|
||||
if str !~ '^\w'
|
||||
return ''
|
||||
endif
|
||||
silent! let res = substitute(system("ri -f simple -T \"".str.'"'),'\n$','','')
|
||||
if res =~ '^Nothing known about' || res =~ '^Bad argument:' || res =~ '^More than one method'
|
||||
return ''
|
||||
endif
|
||||
return res
|
||||
else
|
||||
return ""
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:searchsyn(pattern,syn,flags)
|
||||
norm! m'
|
||||
let i = 0
|
||||
let cnt = v:count ? v:count : 1
|
||||
while i < cnt
|
||||
let i = i + 1
|
||||
let line = line('.')
|
||||
let col = col('.')
|
||||
let pos = search(a:pattern,'W'.a:flags)
|
||||
while pos != 0 && s:synname() !~# a:syn
|
||||
let pos = search(a:pattern,'W'.a:flags)
|
||||
endwhile
|
||||
if pos == 0
|
||||
call cursor(line,col)
|
||||
return
|
||||
endif
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
function! s:synname()
|
||||
return synIDattr(synID(line('.'),col('.'),0),'name')
|
||||
endfunction
|
||||
|
||||
function! RubyCursorIdentifier()
|
||||
let asciicode = '\%(\w\|[]})\"'."'".']\)\@<!\%(?\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\=\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)\)'
|
||||
let number = '\%(\%(\w\|[]})\"'."'".']\s*\)\@<!-\)\=\%(\<[[:digit:]_]\+\%(\.[[:digit:]_]\+\)\=\%([Ee][[:digit:]_]\+\)\=\>\|\<0[xXbBoOdD][[:xdigit:]_]\+\>\)\|'.asciicode
|
||||
let operator = '\%(\[\]\|<<\|<=>\|[!<>]=\=\|===\=\|[!=]\~\|>>\|\*\*\|\.\.\.\=\|=>\|[~^&|*/%+-]\)'
|
||||
let method = '\%(\<[_a-zA-Z]\w*\>\%([?!]\|\s*=>\@!\)\=\)'
|
||||
let global = '$\%([!$&"'."'".'*+,./:;<=>?@\`~]\|-\=\w\+\>\)'
|
||||
let symbolizable = '\%(\%(@@\=\)\w\+\>\|'.global.'\|'.method.'\|'.operator.'\)'
|
||||
let pattern = '\C\s*\%('.number.'\|\%(:\@<!:\)\='.symbolizable.'\)'
|
||||
let [lnum, col] = searchpos(pattern,'bcn',line('.'))
|
||||
let raw = matchstr(getline('.')[col-1 : ],pattern)
|
||||
let stripped = substitute(substitute(raw,'\s\+=$','=',''),'^\s*:\=','','')
|
||||
return stripped == '' ? expand("<cword>") : stripped
|
||||
endfunction
|
||||
|
||||
"
|
||||
" Instructions for enabling "matchit" support:
|
||||
"
|
||||
" 1. Look for the latest "matchit" plugin at
|
||||
"
|
||||
" http://www.vim.org/scripts/script.php?script_id=39
|
||||
"
|
||||
" It is also packaged with Vim, in the $VIMRUNTIME/macros directory.
|
||||
"
|
||||
" 2. Copy "matchit.txt" into a "doc" directory (e.g. $HOME/.vim/doc).
|
||||
"
|
||||
" 3. Copy "matchit.vim" into a "plugin" directory (e.g. $HOME/.vim/plugin).
|
||||
"
|
||||
" 4. Ensure this file (ftplugin/ruby.vim) is installed.
|
||||
"
|
||||
" 5. Ensure you have this line in your $HOME/.vimrc:
|
||||
" filetype plugin on
|
||||
"
|
||||
" 6. Restart Vim and create the matchit documentation:
|
||||
"
|
||||
" :helptags ~/.vim/doc
|
||||
"
|
||||
" Now you can do ":help matchit", and you should be able to use "%" on Ruby
|
||||
" keywords. Try ":echo b:match_words" to be sure.
|
||||
"
|
||||
" Thanks to Mark J. Reed for the instructions. See ":help vimrc" for the
|
||||
" locations of plugin directories, etc., as there are several options, and it
|
||||
" differs on Windows. Email gsinclair@soyabean.com.au if you need help.
|
||||
"
|
||||
|
||||
" vim: nowrap sw=2 sts=2 ts=8:
|
@ -1,2 +0,0 @@
|
||||
setlocal sts=2
|
||||
setlocal sw=2
|
@ -1,18 +0,0 @@
|
||||
" Vim filetype plugin
|
||||
" Language: Sass
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
|
||||
|
||||
" 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< inc< ofu<"
|
||||
|
||||
setlocal commentstring=//\ %s
|
||||
setlocal omnifunc=csscomplete#CompleteCSS
|
||||
|
||||
let &l:include = '^\s*@import\s\+\%(url(\)\='
|
||||
|
||||
" vim:set sw=2:
|
@ -1 +0,0 @@
|
||||
setlocal equalprg=tidy\ -xml\ -quiet\ -indent
|
@ -1,35 +0,0 @@
|
||||
|
||||
" Source the standard indentation file, since we only want to adjust the
|
||||
" default indentation.
|
||||
sou $VIMRUNTIME/indent/html.vim
|
||||
|
||||
" Set the default indentation to be that of the standard indent file.
|
||||
let b:defaultIndentExpr = &indentexpr
|
||||
|
||||
" Use IndentAnything
|
||||
setlocal indentexpr=IndentAnything()
|
||||
|
||||
" Echo info about indentations
|
||||
let b:indent_anything_echo = 1
|
||||
|
||||
"
|
||||
" Adjust the default indentation for comments. Set the comments for html to
|
||||
" look like this:
|
||||
"
|
||||
" <!--
|
||||
" - comment here
|
||||
" -->
|
||||
"
|
||||
setl comments=sr:<!--,m:-,e:-->
|
||||
let b:blockCommentStartRE = '<!--'
|
||||
let b:blockCommentMiddleRE = '-'
|
||||
let b:blockCommentEndRE = '-->'
|
||||
let b:blockCommentMiddleExtra = 3
|
||||
|
||||
" Specify the syntax names for html comments and strings
|
||||
let b:blockCommentRE = 'htmlComment'
|
||||
let b:commentRE = b:blockCommentRE
|
||||
|
||||
let b:stringRE = 'htmlString'
|
||||
let b:singleQuoteStringRE = b:stringRE
|
||||
let b:doubleQuoteStringRE = b:stringRE
|
@ -1,40 +0,0 @@
|
||||
" Vim indent file
|
||||
" Language: Cucumber
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
|
||||
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal autoindent
|
||||
setlocal indentexpr=GetCucumberIndent()
|
||||
setlocal indentkeys=o,O,*<Return>,<:>,0<Bar>,0#,=,!^F
|
||||
|
||||
" Only define the function once.
|
||||
if exists("*GetCucumberIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
function! GetCucumberIndent()
|
||||
let line = getline(prevnonblank(v:lnum-1))
|
||||
let cline = getline(v:lnum)
|
||||
if cline =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):'
|
||||
return &sw
|
||||
elseif cline =~# '^\s*\%(Examples\|Scenarios\):'
|
||||
return 2 * &sw
|
||||
elseif line =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):'
|
||||
return 2 * &sw
|
||||
elseif line =~# '^\s*\%(Examples\|Scenarios\):'
|
||||
return 3 * &sw
|
||||
elseif cline =~# '^\s*|' && line =~# '^\s*|'
|
||||
return indent(prevnonblank(v:lnum-1))
|
||||
elseif cline =~# '^\s*|' && line =~# '^\s*[^|#]'
|
||||
return indent(prevnonblank(v:lnum-1)) + &sw
|
||||
elseif cline =~# '^\s*[^|#]' && line =~# '^\s*|'
|
||||
return indent(prevnonblank(v:lnum-1)) - &sw
|
||||
endif
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
" vim:set sts=2 sw=2:
|
@ -1,80 +0,0 @@
|
||||
" Vim indent file
|
||||
" Language: eRuby
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" URL: http://vim-ruby.rubyforge.org
|
||||
" Anon CVS: See above site
|
||||
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
|
||||
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! indent/ruby.vim
|
||||
unlet! b:did_indent
|
||||
setlocal indentexpr=
|
||||
|
||||
if exists("b:eruby_subtype")
|
||||
exe "runtime! indent/".b:eruby_subtype.".vim"
|
||||
else
|
||||
runtime! indent/html.vim
|
||||
endif
|
||||
unlet! b:did_indent
|
||||
|
||||
if &l:indentexpr == ''
|
||||
if &l:cindent
|
||||
let &l:indentexpr = 'cindent(v:lnum)'
|
||||
else
|
||||
let &l:indentexpr = 'indent(prevnonblank(v:lnum-1))'
|
||||
endif
|
||||
endif
|
||||
let b:eruby_subtype_indentexpr = &l:indentexpr
|
||||
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal indentexpr=GetErubyIndent()
|
||||
setlocal indentkeys=o,O,*<Return>,<>>,{,},0),0],o,O,!^F,=end,=else,=elsif,=rescue,=ensure,=when
|
||||
|
||||
" Only define the function once.
|
||||
if exists("*GetErubyIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
function! GetErubyIndent(...)
|
||||
if a:0 && a:1 == '.'
|
||||
let v:lnum = line('.')
|
||||
elseif a:0 && a:1 =~ '^\d'
|
||||
let v:lnum = a:1
|
||||
endif
|
||||
let vcol = col('.')
|
||||
call cursor(v:lnum,1)
|
||||
let inruby = searchpair('<%','','%>','W')
|
||||
call cursor(v:lnum,vcol)
|
||||
if inruby && getline(v:lnum) !~ '^<%\|^\s*-\=%>'
|
||||
let ind = GetRubyIndent()
|
||||
else
|
||||
exe "let ind = ".b:eruby_subtype_indentexpr
|
||||
endif
|
||||
let lnum = prevnonblank(v:lnum-1)
|
||||
let line = getline(lnum)
|
||||
let cline = getline(v:lnum)
|
||||
if cline =~# '^\s*<%-\=\s*\%(}\|end\|else\|\%(ensure\|rescue\|elsif\|when\).\{-\}\)\s*\%(-\=%>\|$\)'
|
||||
let ind = ind - &sw
|
||||
endif
|
||||
if line =~# '\S\s*<%-\=\s*\%(}\|end\).\{-\}\)\s*\%(-\=%>\|$\)'
|
||||
let ind = ind - &sw
|
||||
endif
|
||||
if line =~# '\%({\|\<do\)\%(\s*|[^|]*|\)\=\s*-\=%>'
|
||||
let ind = ind + &sw
|
||||
elseif line =~# '<%-\=\s*\%(module\|class\|def\|if\|for\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure\|rescue\)\>.*%>'
|
||||
let ind = ind + &sw
|
||||
endif
|
||||
if line =~# '^\s*<%[=#-]\=\s*$' && cline !~# '^\s*end\>'
|
||||
let ind = ind + &sw
|
||||
endif
|
||||
if cline =~# '^\s*-\=%>\s*$'
|
||||
let ind = ind - &sw
|
||||
endif
|
||||
return ind
|
||||
endfunction
|
||||
|
||||
" vim:set sw=2 sts=2 ts=8 noet:
|
@ -1,35 +0,0 @@
|
||||
" Vim indent file
|
||||
" Language: git config file
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
|
||||
" Last Change: 2007 Dec 16
|
||||
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal autoindent
|
||||
setlocal indentexpr=GetGitconfigIndent()
|
||||
setlocal indentkeys=o,O,*<Return>,0[,],0;,0#,=,!^F
|
||||
|
||||
" Only define the function once.
|
||||
if exists("*GetGitconfigIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
function! GetGitconfigIndent()
|
||||
let line = getline(v:lnum-1)
|
||||
let cline = getline(v:lnum)
|
||||
if line =~ '[^\\]\@<=\%(\\\\\)*\\$'
|
||||
" odd number of slashes, in a line continuation
|
||||
return -1
|
||||
elseif cline =~ '^\s*\['
|
||||
return 0
|
||||
elseif cline =~ '^\s*\a'
|
||||
return &sw
|
||||
elseif cline == '' && line =~ '^\['
|
||||
return &sw
|
||||
else
|
||||
return -1
|
||||
endif
|
||||
endfunction
|
@ -1,73 +0,0 @@
|
||||
" Vim indent file
|
||||
" Language: HAML
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
|
||||
" Last Change: 2008 Sep 11
|
||||
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
runtime! indent/ruby.vim
|
||||
unlet! b:did_indent
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal autoindent sw=2 et
|
||||
setlocal indentexpr=GetHamlIndent()
|
||||
setlocal indentkeys=o,O,*<Return>,},],0),!^F,=end,=else,=elsif,=rescue,=ensure,=when
|
||||
|
||||
" Only define the function once.
|
||||
if exists("*GetHamlIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:attributes = '\%({.\{-\}}\|\[.\{-\}\]\)'
|
||||
let s:tag = '\%([%.#][[:alnum:]_-]\+\|'.s:attributes.'\)*[<>]*'
|
||||
|
||||
if !exists('g:haml_self_closing_tags')
|
||||
let g:haml_self_closing_tags = 'meta|link|img|hr|br'
|
||||
endif
|
||||
|
||||
function! GetHamlIndent()
|
||||
let lnum = prevnonblank(v:lnum-1)
|
||||
if lnum == 0
|
||||
return 0
|
||||
endif
|
||||
let line = substitute(getline(lnum),'\s\+$','','')
|
||||
let cline = substitute(substitute(getline(v:lnum),'\s\+$','',''),'^\s\+','','')
|
||||
let lastcol = strlen(line)
|
||||
let line = substitute(line,'^\s\+','','')
|
||||
let indent = indent(lnum)
|
||||
let cindent = indent(v:lnum)
|
||||
if cline =~# '\v^-\s*%(elsif|else|when)>'
|
||||
let indent = cindent < indent ? cindent : indent - &sw
|
||||
endif
|
||||
let increase = indent + &sw
|
||||
if indent == indent(lnum)
|
||||
let indent = cindent <= indent ? -1 : increase
|
||||
endif
|
||||
"let indent = indent == indent(lnum) ? -1 : indent
|
||||
"let indent = indent > indent(lnum) + &sw ? indent(lnum) + &sw : indent
|
||||
|
||||
let group = synIDattr(synID(lnum,lastcol,1),'name')
|
||||
|
||||
if line =~ '^!!!'
|
||||
return indent
|
||||
elseif line =~ '^/\%(\[[^]]*\]\)\=$'
|
||||
return increase
|
||||
elseif line =~ '^:'
|
||||
return increase
|
||||
elseif line =~ '^'.s:tag.'[=~-]\s*\%(\%(if\|else\|elsif\|unless\|case\|when\|while\|until\|for\|begin\|module\|class\|def\)\>\%(.*\<end\>\)\@!\|.*do\%(\s*|[^|]*|\)\=\s*$\)'
|
||||
return increase
|
||||
elseif line == '-#'
|
||||
return increase
|
||||
elseif group =~? '\v^(hamlSelfCloser)$' || line =~? '^%\v%('.g:haml_self_closing_tags.')>'
|
||||
return indent
|
||||
elseif group =~? '\v^%(hamlTag|hamlAttributesDelimiter|hamlObjectDelimiter|hamlClass|hamlId|htmlTagName|htmlSpecialTagName)$'
|
||||
return increase
|
||||
elseif synIDattr(synID(v:lnum,1,1),'name') ==? 'hamlRubyFilter'
|
||||
return GetRubyIndent()
|
||||
else
|
||||
return indent
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" vim:set sw=2:
|
@ -1,121 +0,0 @@
|
||||
"
|
||||
" Copyright 2009 IGREQUE IGREQUE, All rights reserved.
|
||||
"
|
||||
" Lisence: BSD
|
||||
"
|
||||
" Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
"
|
||||
" * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
" * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
" * Neither the name of the IGREQUE IGREQUE nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
"
|
||||
" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
"
|
||||
|
||||
"
|
||||
" Script:
|
||||
"
|
||||
" Ruby Indentation with IndentAnything
|
||||
"
|
||||
" Version: 0.1.6
|
||||
"
|
||||
" Description:
|
||||
" This script requires IndentAnything version 1.2.2 or above.
|
||||
" See http://www.vim.org/scripts/script.php?script_id=1839 .
|
||||
"
|
||||
" Installation:
|
||||
"
|
||||
" Copy this file in your home directory under ~/.vim/indent/
|
||||
"
|
||||
" Maintainer: IGREQUE IGREQUE
|
||||
"
|
||||
" Note:
|
||||
" This script requires IndentAnything version 1.2.2 or above.
|
||||
" See http://www.vim.org/scripts/script.php?script_id=1839
|
||||
"
|
||||
" Thanks: Tye Zdrojewski, the creater of IndentAnything.
|
||||
"
|
||||
" History:
|
||||
" 2009.8.17: First release.
|
||||
" 2009.8.17: Corrected a simple mistake and make one of b:indentTrios better.
|
||||
" 2009.8.18: Fixed a bug that it indents by mistake after you type a line like "asif=1"
|
||||
" 2009.8.19: Fixed a bug which happens when you use a statement modifier.
|
||||
" 2009.11.21: Removed '*' and '/' from b:lineContList. Because '/' causes a mis-indent when using a Regexp literal.
|
||||
"
|
||||
" Known Bugs:
|
||||
"* doesn't work well when you type such a line like below.
|
||||
" if foo == "foo" then puts "Yes" else puts "*Not end*" end #Only if the line *starts with* "if" etc.
|
||||
"
|
||||
"* In a block( starts with a word, like 'if', 'when', 'do' etc. ), reindents by mistake when you type
|
||||
" an identifier which starts with "els", "when", "rescue", and "ensure" at the beginning of a line.
|
||||
" Example.
|
||||
" if a > 1
|
||||
" when_to_go = Time.new #Reindent by mistake here.
|
||||
" end
|
||||
|
||||
"2009.8.17: This switch must be on. But I forgot.
|
||||
let IndentAnything_Dbg = 1
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
if exists("b:did_indent") && ! IndentAnything_Dbg
|
||||
finish
|
||||
endif
|
||||
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal indentexpr=IndentAnything()
|
||||
setlocal indentkeys+=0),0},0],0=end,0=els,0=when,0=rescue,0=ensure
|
||||
|
||||
" Only define the function once.
|
||||
if exists("*IndentAnything") && ! IndentAnything_Dbg
|
||||
finish
|
||||
endif
|
||||
|
||||
setlocal indentexpr=IndentAnything()
|
||||
|
||||
""" BEGIN IndentAnything specification
|
||||
|
||||
"
|
||||
" Syntax name REs for comments and strings.
|
||||
" But these REs are perfect for avoiding matching of pairs.
|
||||
" And I'm sorry I don't know how to test this part.
|
||||
"
|
||||
let b:commentRE = 'rubyComment'
|
||||
"let b:lineCommentRE = 'javaScriptLineComment'
|
||||
"let b:blockCommentRE = 'javaScriptComment'
|
||||
let b:stringRE = 'rubyString'
|
||||
"let b:singleQuoteStringRE = 'javaScriptStringS'
|
||||
"let b:doubleQuoteStringRE = 'javaScriptStringD'
|
||||
|
||||
|
||||
"Special statement(class def do if...) and parenthesis.
|
||||
"2009.08.19: Divided keywords into two groups:
|
||||
" "usually used at the beginning of the line of the block( module, class, def, if, unless, while, until, case, and for )"
|
||||
" and not so.
|
||||
let b:indentTrios = [
|
||||
\ [
|
||||
\'\(^\s*module\|^\s*class\|^\s*def\|\<do\|^\s*if\|^\s*unless\|^\s*while\|^\s*until\|^\s*for\|^\s*case\|^\s*begin\)\>\([^#]*\(\<end\>\)\)\@!',
|
||||
\'\<\(els\|when\|rescue\|ensure\)',
|
||||
\'end'
|
||||
\ ],
|
||||
\ [ '(', '', ')' ],
|
||||
\ [ '{', '', '}' ],
|
||||
\ [ '\[', '', '\]' ],
|
||||
\]
|
||||
|
||||
"
|
||||
" Line continuations. Lines that are continued on the next line are
|
||||
" if/unless/for/while/until statements that are NOT followed by a '{' block and operators
|
||||
" at the end of a line.
|
||||
"
|
||||
|
||||
"Operators which don't have the right-hand-side, and a backslash in the end of a statement.
|
||||
"You might want more operators in this regexp.
|
||||
let b:lineContList = [
|
||||
\ { 'pattern' : '\(+\|-\|=\|+=\|\*=\|/=\|-=\|\\\)\s*\(#.*\)\?$' },
|
||||
\]
|
||||
|
||||
"
|
||||
" If a continued line and its continuation can have line-comments between them, then this should be true.
|
||||
"
|
||||
let b:contTraversesLineComments = 1
|
@ -1,39 +0,0 @@
|
||||
" Vim indent file
|
||||
" Language: SASS
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
|
||||
" Last Change: 2007 Dec 16
|
||||
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal autoindent sw=2 et
|
||||
setlocal indentexpr=GetSassIndent()
|
||||
setlocal indentkeys=o,O,*<Return>,<:>,!^F
|
||||
|
||||
" Only define the function once.
|
||||
if exists("*GetSassIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:property = '^\s*:\|^\s*[[:alnum:]-]\+:'
|
||||
|
||||
function! GetSassIndent()
|
||||
let lnum = prevnonblank(v:lnum-1)
|
||||
let line = substitute(getline(lnum),'\s\+$','','')
|
||||
let cline = substitute(substitute(getline(v:lnum),'\s\+$','',''),'^\s\+','','')
|
||||
let lastcol = strlen(line)
|
||||
let line = substitute(line,'^\s\+','','')
|
||||
let indent = indent(lnum)
|
||||
let cindent = indent(v:lnum)
|
||||
if line !~ s:property && cline =~ s:property
|
||||
return indent + &sw
|
||||
"elseif line =~ s:property && cline !~ s:property
|
||||
"return indent - &sw
|
||||
else
|
||||
return -1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" vim:set sw=2:
|
@ -1,113 +0,0 @@
|
||||
" FILE: syntax/conque_term.vim {{{
|
||||
" AUTHOR: Nico Raffo <nicoraffo@gmail.com>
|
||||
" WEBSITE: http://conque.googlecode.com
|
||||
" MODIFIED: 2011-09-02
|
||||
" VERSION: 2.3, for Vim 7.0
|
||||
" LICENSE:
|
||||
" Conque - Vim terminal/console emulator
|
||||
" Copyright (C) 2009-2011 Nico Raffo
|
||||
"
|
||||
" MIT License
|
||||
"
|
||||
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
" of this software and associated documentation files (the "Software"), to deal
|
||||
" in the Software without restriction, including without limitation the rights
|
||||
" to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
" copies of the Software, and to permit persons to whom the Software is
|
||||
" furnished to do so, subject to the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included in
|
||||
" all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
" OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
" THE SOFTWARE.
|
||||
" }}}
|
||||
|
||||
|
||||
" *******************************************************************************************************************
|
||||
" MySQL *************************************************************************************************************
|
||||
" *******************************************************************************************************************
|
||||
|
||||
" TODO Move these to syntax which is only executed for mysql
|
||||
"syn match MySQLTableBodyG "^\s*\w\+:\(.\+\)\=$" contains=MySQLTableHeadG,MySQLNullG,MySQLBool,MySQLNumberG,MySQLStorageClass oneline skipwhite skipnl
|
||||
"syn match MySQLTableHeadG "^\s*\w\+:" contains=MySQLTableColon skipwhite contained
|
||||
"syn match MySQLTableColon ":" contained
|
||||
|
||||
syn match MySQLTableHead "^ *|.*| *$" nextgroup=MySQLTableDivide contains=MySQLTableBar oneline skipwhite skipnl
|
||||
syn match MySQLTableBody "^ *|.*| *$" nextgroup=MySQLTableBody,MySQLTableEnd contains=MySQLTableBar,MySQLNull,MySQLBool,MySQLNumber,MySQLStorageClass oneline skipwhite skipnl
|
||||
syn match MySQLTableEnd "^ *+[+=-]\++ *$" oneline
|
||||
syn match MySQLTableDivide "^ *+[+=-]\++ *$" nextgroup=MySQLTableBody oneline skipwhite skipnl
|
||||
syn match MySQLTableStart "^ *+[+=-]\++ *$" nextgroup=MySQLTableHead oneline skipwhite skipnl
|
||||
syn match MySQLNull " NULL " contained contains=MySQLTableBar
|
||||
syn match MySQLStorageClass " PRI " contained
|
||||
syn match MySQLStorageClass " MUL " contained
|
||||
syn match MySQLStorageClass " UNI " contained
|
||||
syn match MySQLStorageClass " CURRENT_TIMESTAMP " contained
|
||||
syn match MySQLStorageClass " auto_increment " contained
|
||||
syn match MySQLTableBar "|" contained
|
||||
syn match MySQLNumber "|\? *\d\+\(\.\d\+\)\? *|" contained contains=MySQLTableBar
|
||||
syn match MySQLQueryStat "^\d\+ rows\? in set.*" oneline
|
||||
syn match MySQLPromptLine "^.\?mysql> .*$" contains=MySQLKeyword,MySQLPrompt,MySQLString oneline
|
||||
syn match MySQLPromptLine "^ -> .*$" contains=MySQLKeyword,MySQLPrompt,MySQLString oneline
|
||||
syn match MySQLPrompt "^.\?mysql>" contained oneline
|
||||
syn match MySQLPrompt "^ ->" contained oneline
|
||||
syn case ignore
|
||||
syn keyword MySQLKeyword select count max sum avg date show table tables status like as from left right outer inner join contained
|
||||
syn keyword MySQLKeyword where group by having limit offset order desc asc show contained and interval is null on
|
||||
syn case match
|
||||
syn region MySQLString start=+'+ end=+'+ skip=+\\'+ contained oneline
|
||||
syn region MySQLString start=+"+ end=+"+ skip=+\\"+ contained oneline
|
||||
syn region MySQLString start=+`+ end=+`+ skip=+\\`+ contained oneline
|
||||
|
||||
|
||||
hi def link MySQLPrompt Identifier
|
||||
hi def link MySQLTableHead Title
|
||||
hi def link MySQLTableBody Normal
|
||||
hi def link MySQLBool Boolean
|
||||
hi def link MySQLStorageClass StorageClass
|
||||
hi def link MySQLNumber Number
|
||||
hi def link MySQLKeyword Keyword
|
||||
hi def link MySQLString String
|
||||
|
||||
" terms which have no reasonable default highlight group to link to
|
||||
hi MySQLTableHead term=bold cterm=bold gui=bold
|
||||
if &background == 'dark'
|
||||
hi MySQLTableEnd term=NONE cterm=NONE gui=NONE ctermfg=238 guifg=#444444
|
||||
hi MySQLTableDivide term=NONE cterm=NONE gui=NONE ctermfg=238 guifg=#444444
|
||||
hi MySQLTableStart term=NONE cterm=NONE gui=NONE ctermfg=238 guifg=#444444
|
||||
hi MySQLTableBar term=NONE cterm=NONE gui=NONE ctermfg=238 guifg=#444444
|
||||
hi MySQLNull term=NONE cterm=NONE gui=NONE ctermfg=238 guifg=#444444
|
||||
hi MySQLQueryStat term=NONE cterm=NONE gui=NONE ctermfg=238 guifg=#444444
|
||||
elseif &background == 'light'
|
||||
hi MySQLTableEnd term=NONE cterm=NONE gui=NONE ctermfg=247 guifg=#9e9e9e
|
||||
hi MySQLTableDivide term=NONE cterm=NONE gui=NONE ctermfg=247 guifg=#9e9e9e
|
||||
hi MySQLTableStart term=NONE cterm=NONE gui=NONE ctermfg=247 guifg=#9e9e9e
|
||||
hi MySQLTableBar term=NONE cterm=NONE gui=NONE ctermfg=247 guifg=#9e9e9e
|
||||
hi MySQLNull term=NONE cterm=NONE gui=NONE ctermfg=247 guifg=#9e9e9e
|
||||
hi MySQLQueryStat term=NONE cterm=NONE gui=NONE ctermfg=247 guifg=#9e9e9e
|
||||
endif
|
||||
|
||||
|
||||
" *******************************************************************************************************************
|
||||
" Bash **************************************************************************************************************
|
||||
" *******************************************************************************************************************
|
||||
|
||||
" Typical Prompt
|
||||
if g:ConqueTerm_PromptRegex != ''
|
||||
silent execute "syn match ConquePromptLine '" . g:ConqueTerm_PromptRegex . ".*$' contains=ConquePrompt,ConqueString oneline"
|
||||
silent execute "syn match ConquePrompt '" . g:ConqueTerm_PromptRegex . "' contained oneline"
|
||||
hi def link ConquePrompt Identifier
|
||||
endif
|
||||
|
||||
" Strings
|
||||
syn region ConqueString start=+'+ end=+'+ skip=+\\'+ contained oneline
|
||||
syn region ConqueString start=+"+ end=+"+ skip=+\\"+ contained oneline
|
||||
syn region ConqueString start=+`+ end=+`+ skip=+\\`+ contained oneline
|
||||
hi def link ConqueString String
|
||||
|
||||
" vim: foldmethod=marker
|
@ -1,100 +0,0 @@
|
||||
" Vim syntax file
|
||||
" Language: Cucumber
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
|
||||
" Filenames: *.feature
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
syn case match
|
||||
syn sync minlines=20
|
||||
|
||||
let g:cucumber_languages = {
|
||||
\"en": {"and": "And", "background": "Background", "but": "But", "examples": "Examples|Scenarios", "feature": "Feature", "given": "Given", "scenario": "Scenario", "scenario_outline": "Scenario Outline", "then": "Then", "when": "When"},
|
||||
\"ar": {"and": "\\%u0648", "background": "\\%u0627\\%u0644\\%u062e\\%u0644\\%u0641\\%u064a\\%u0629", "but": "\\%u0644\\%u0643\\%u0646", "examples": "\\%u0627\\%u0645\\%u062b\\%u0644\\%u0629", "feature": "\\%u062e\\%u0627\\%u0635\\%u064a\\%u0629", "given": "\\%u0628\\%u0641\\%u0631\\%u0636", "scenario": "\\%u0633\\%u064a\\%u0646\\%u0627\\%u0631\\%u064a\\%u0648", "scenario_outline": "\\%u0633\\%u064a\\%u0646\\%u0627\\%u0631\\%u064a\\%u0648 \\%u0645\\%u062e\\%u0637\\%u0637", "then": "\\%u0627\\%u0630\\%u0627\\%u064b|\\%u062b\\%u0645", "when": "\\%u0645\\%u062a\\%u0649|\\%u0639\\%u0646\\%u062f\\%u0645\\%u0627"},
|
||||
\"bg": {"and": "\\%u0418", "background": "\\%u041f\\%u0440\\%u0435\\%u0434\\%u0438\\%u0441\\%u0442\\%u043e\\%u0440\\%u0438\\%u044f", "but": "\\%u041d\\%u043e", "examples": "\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440\\%u0438", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b\\%u043d\\%u043e\\%u0441\\%u0442", "given": "\\%u0414\\%u0430\\%u0434\\%u0435\\%u043d\\%u043e", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439", "scenario_outline": "\\%u0420\\%u0430\\%u043c\\%u043a\\%u0430 \\%u043d\\%u0430 \\%u0441\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439", "then": "\\%u0422\\%u043e", "when": "\\%u041a\\%u043e\\%u0433\\%u0430\\%u0442\\%u043e"},
|
||||
\"cat": {"and": "I", "background": "Rerefons|Antecedents", "but": "Per\\%u00f2", "examples": "Exemples", "feature": "Caracter\\%u00edstica", "given": "Donat|Donada", "scenario": "Escenari", "scenario_outline": "Esquema de l\'escenari", "then": "Aleshores", "when": "Quan"},
|
||||
\"cy": {"and": "A", "but": "Ond", "examples": "Enghreifftiau", "feature": "Arwedd", "given": "anrhegedig a", "scenario": "Scenario", "then": "Yna", "when": "Pryd"},
|
||||
\"cz": {"and": "A", "background": "Pozad\\%u00ed", "but": "Ale", "examples": "P\\%u0159\\%u00edklady", "feature": "Po\\%u017eadavek", "given": "Pokud", "scenario": "Sc\\%u00e9n\\%u00e1\\%u0159", "scenario_outline": "N\\%u00e1\\%u010drt Sc\\%u00e9n\\%u00e1\\%u0159e", "then": "Pak", "when": "Kdy\\%u017e"},
|
||||
\"da": {"and": "Og", "background": "Baggrund", "but": "Men", "examples": "Eksempler", "feature": "Egenskab", "given": "Givet", "scenario": "Scenarie", "scenario_outline": "Abstrakt Scenario", "then": "S\\%u00e5", "when": "N\\%u00e5r"},
|
||||
\"de": {"and": "Und", "background": "Grundlage", "but": "Aber", "examples": "Beispiele", "feature": "Funktionalit\\%u00e4t", "given": "Gegeben sei", "scenario": "Szenario", "scenario_outline": "Szenariogrundriss", "then": "Dann", "when": "Wenn"},
|
||||
\"en-au": {"and": "N", "background": "Background", "but": "Cept", "examples": "Cobber", "feature": "Crikey", "given": "Ya know how", "scenario": "Mate", "scenario_outline": "Blokes", "then": "Ya gotta", "when": "When"},
|
||||
\"en-lol": {"and": "AN", "background": "B4", "but": "BUT", "examples": "EXAMPLZ", "feature": "OH HAI", "given": "I CAN HAZ", "scenario": "MISHUN", "scenario_outline": "MISHUN SRSLY", "then": "DEN", "when": "WEN"},
|
||||
\"es": {"and": "Y", "background": "Antecedentes", "but": "Pero", "examples": "Ejemplos", "feature": "Caracter\\%u00edstica", "given": "Dado", "scenario": "Escenario", "scenario_outline": "Esquema del escenario", "then": "Entonces", "when": "Cuando"},
|
||||
\"et": {"and": "Ja", "background": "Taust", "but": "Kuid", "examples": "Juhtumid", "feature": "Omadus", "given": "Eeldades", "scenario": "Stsenaarium", "scenario_outline": "Raamstsenaarium", "then": "Siis", "when": "Kui"},
|
||||
\"fi": {"and": "Ja", "background": "Tausta", "but": "Mutta", "examples": "Tapaukset", "feature": "Ominaisuus", "given": "Oletetaan", "scenario": "Tapaus", "scenario_outline": "Tapausaihio", "then": "Niin", "when": "Kun"},
|
||||
\"fr": {"and": "Et", "background": "Contexte", "but": "Mais", "examples": "Exemples", "feature": "Fonctionnalit\\%u00e9", "given": "Soit", "scenario": "Sc\\%u00e9nario", "scenario_outline": "Plan du Sc\\%u00e9nario", "then": "Alors", "when": "Lorsque"},
|
||||
\"he": {"and": "\\%u05d5\\%u05d2\\%u05dd", "background": "\\%u05e8\\%u05e7\\%u05e2", "but": "\\%u05d0\\%u05d1\\%u05dc", "examples": "\\%u05d3\\%u05d5\\%u05d2\\%u05de\\%u05d0\\%u05d5\\%u05ea", "feature": "\\%u05ea\\%u05db\\%u05d5\\%u05e0\\%u05d4", "given": "\\%u05d1\\%u05d4\\%u05d9\\%u05e0\\%u05ea\\%u05df", "scenario": "\\%u05ea\\%u05e8\\%u05d7\\%u05d9\\%u05e9", "scenario_outline": "\\%u05ea\\%u05d1\\%u05e0\\%u05d9\\%u05ea \\%u05ea\\%u05e8\\%u05d7\\%u05d9\\%u05e9", "then": "\\%u05d0\\%u05d6|\\%u05d0\\%u05d6\\%u05d9", "when": "\\%u05db\\%u05d0\\%u05e9\\%u05e8"},
|
||||
\"hu": {"and": "\\%u00c9s", "background": "H\\%u00e1tt\\%u00e9r", "but": "De", "examples": "P\\%u00e9ld\\%u00e1k", "feature": "Jellemz\\%u0151", "given": "Ha", "scenario": "Forgat\\%u00f3k\\%u00f6nyv", "scenario_outline": "Forgat\\%u00f3k\\%u00f6nyv v\\%u00e1zlat", "then": "Akkor", "when": "Majd"},
|
||||
\"id": {"and": "Dan", "background": "Dasar", "but": "Tapi", "examples": "Contoh", "feature": "Fitur", "given": "Dengan", "scenario": "Skenario", "scenario_outline": "Skenario konsep", "then": "Maka", "when": "Ketika"},
|
||||
\"it": {"and": "E", "background": "Contesto", "but": "Ma", "examples": "Esempi", "feature": "Funzionalit\\%u00e0", "given": "Dato", "scenario": "Scenario", "scenario_outline": "Schema dello scenario", "then": "Allora", "when": "Quando"},
|
||||
\"ja": {"and": "\\%u304b\\%u3064", "background": "\\%u80cc\\%u666f", "but": "\\%u3057\\%u304b\\%u3057|\\%u4f46\\%u3057", "examples": "\\%u4f8b|\\%u30b5\\%u30f3\\%u30d7\\%u30eb", "feature": "\\%u30d5\\%u30a3\\%u30fc\\%u30c1\\%u30e3|\\%u6a5f\\%u80fd", "given": "\\%u524d\\%u63d0", "scenario": "\\%u30b7\\%u30ca\\%u30ea\\%u30aa", "scenario_outline": "\\%u30b7\\%u30ca\\%u30ea\\%u30aa\\%u30a2\\%u30a6\\%u30c8\\%u30e9\\%u30a4\\%u30f3|\\%u30b7\\%u30ca\\%u30ea\\%u30aa\\%u30c6\\%u30f3\\%u30d7\\%u30ec\\%u30fc\\%u30c8|\\%u30c6\\%u30f3\\%u30d7\\%u30ec|\\%u30b7\\%u30ca\\%u30ea\\%u30aa\\%u30c6\\%u30f3\\%u30d7\\%u30ec", "then": "\\%u306a\\%u3089\\%u3070", "when": "\\%u3082\\%u3057"},
|
||||
\"ko": {"and": "\\%uadf8\\%ub9ac\\%uace0", "background": "\\%ubc30\\%uacbd", "but": "\\%ud558\\%uc9c0\\%ub9cc", "examples": "\\%uc608", "feature": "\\%uae30\\%ub2a5", "given": "\\%uc870\\%uac74", "scenario": "\\%uc2dc\\%ub098\\%ub9ac\\%uc624", "scenario_outline": "\\%uc2dc\\%ub098\\%ub9ac\\%uc624 \\%uac1c\\%uc694", "then": "\\%uadf8\\%ub7ec\\%uba74", "when": "\\%ub9cc\\%uc77c"},
|
||||
\"lt": {"and": "Ir", "background": "Kontekstas", "but": "Bet", "examples": "Pavyzd\\%u017eiai|Scenarijai|Variantai", "feature": "Savyb\\%u0117", "given": "Duota", "scenario": "Scenarijus", "scenario_outline": "Scenarijaus \\%u0161ablonas", "then": "Tada", "when": "Kai"},
|
||||
\"lv": {"and": "Un", "background": "Konteksts|Situ\\%u0101cija", "but": "Bet", "examples": "Piem\\%u0113ri|Paraugs", "feature": "Funkcionalit\\%u0101te|F\\%u012b\\%u010da", "given": "Kad", "scenario": "Scen\\%u0101rijs", "scenario_outline": "Scen\\%u0101rijs p\\%u0113c parauga", "then": "Tad", "when": "Ja"},
|
||||
\"nl": {"and": "En", "background": "Achtergrond", "but": "Maar", "examples": "Voorbeelden", "feature": "Functionaliteit", "given": "Gegeven", "scenario": "Scenario", "scenario_outline": "Abstract Scenario", "then": "Dan", "when": "Als"},
|
||||
\"no": {"and": "Og", "background": "Bakgrunn", "but": "Men", "examples": "Eksempler", "feature": "Egenskap", "given": "Gitt", "scenario": "Scenario", "scenario_outline": "Abstrakt Scenario", "then": "S\\%u00e5", "when": "N\\%u00e5r"},
|
||||
\"pl": {"and": "Oraz", "background": "Za\\%u0142o\\%u017cenia", "but": "Ale", "examples": "Przyk\\%u0142ady", "feature": "W\\%u0142a\\%u015bciwo\\%u015b\\%u0107", "given": "Zak\\%u0142adaj\\%u0105c", "scenario": "Scenariusz", "scenario_outline": "Szablon scenariusza", "then": "Wtedy", "when": "Je\\%u017celi"},
|
||||
\"pt": {"and": "E", "background": "Contexto", "but": "Mas", "examples": "Exemplos", "feature": "Funcionalidade", "given": "Dado", "scenario": "Cen\\%u00e1rio|Cenario", "scenario_outline": "Esquema do Cen\\%u00e1rio|Esquema do Cenario", "then": "Ent\\%u00e3o|Entao", "when": "Quando"},
|
||||
\"ro": {"and": "Si", "but": "Dar", "feature": "Functionalitate", "given": "Daca", "scenario": "Scenariu", "then": "Atunci", "when": "Cand"},
|
||||
\"ro2": {"and": "\\%u0218i", "but": "Dar", "feature": "Func\\%u021bionalitate", "given": "Dac\\%u0103", "scenario": "Scenariu", "then": "Atunci", "when": "C\\%u00e2nd"},
|
||||
\"ru": {"and": "\\%u0418|\\%u041a \\%u0442\\%u043e\\%u043c\\%u0443 \\%u0436\\%u0435", "background": "\\%u041f\\%u0440\\%u0435\\%u0434\\%u044b\\%u0441\\%u0442\\%u043e\\%u0440\\%u0438\\%u044f", "but": "\\%u041d\\%u043e|\\%u0410", "examples": "\\%u0417\\%u043d\\%u0430\\%u0447\\%u0435\\%u043d\\%u0438\\%u044f", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b", "given": "\\%u0414\\%u043e\\%u043f\\%u0443\\%u0441\\%u0442\\%u0438\\%u043c", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439", "scenario_outline": "\\%u0421\\%u0442\\%u0440\\%u0443\\%u043a\\%u0442\\%u0443\\%u0440\\%u0430 \\%u0441\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u044f", "then": "\\%u0422\\%u043e", "when": "\\%u0415\\%u0441\\%u043b\\%u0438"},
|
||||
\"se": {"and": "Och", "background": "Bakgrund", "but": "Men", "examples": "Exempel", "feature": "Egenskap", "given": "Givet", "scenario": "Scenario", "scenario_outline": "Abstrakt Scenario", "then": "S\\%u00e5", "when": "N\\%u00e4r"},
|
||||
\"sk": {"and": "A", "background": "Pozadie", "but": "Ale", "examples": "Pr\\%u00edklady", "feature": "Po\\%u017eiadavka", "given": "Pokia\\%u013e", "scenario": "Scen\\%u00e1r", "scenario_outline": "N\\%u00e1\\%u010drt Scen\\%u00e1ru", "then": "Tak", "when": "Ke\\%u010f"},
|
||||
\"vi": {"and": "V\\%u00e0", "background": "B\\%u1ed1i c\\%u1ea3nh", "but": "Nh\\%u01b0ng", "examples": "D\\%u1eef li\\%u1ec7u", "feature": "T\\%u00ednh n\\%u0103ng", "given": "Bi\\%u1ebft|Cho", "scenario": "T\\%u00ecnh hu\\%u1ed1ng|K\\%u1ecbch b\\%u1ea3n", "scenario_outline": "Khung t\\%u00ecnh hu\\%u1ed1ng|Khung k\\%u1ecbch b\\%u1ea3n", "then": "Th\\%u00ec", "when": "Khi"},
|
||||
\"zh-CN": {"and": "\\%u800c\\%u4e14", "background": "\\%u80cc\\%u666f", "but": "\\%u4f46\\%u662f", "examples": "\\%u4f8b\\%u5b50", "feature": "\\%u529f\\%u80fd", "given": "\\%u5047\\%u5982", "scenario": "\\%u573a\\%u666f", "scenario_outline": "\\%u573a\\%u666f\\%u5927\\%u7eb2", "then": "\\%u90a3\\%u4e48", "when": "\\%u5f53"},
|
||||
\"zh-TW": {"and": "\\%u800c\\%u4e14|\\%u4e26\\%u4e14", "background": "\\%u80cc\\%u666f", "but": "\\%u4f46\\%u662f", "examples": "\\%u4f8b\\%u5b50", "feature": "\\%u529f\\%u80fd", "given": "\\%u5047\\%u8a2d", "scenario": "\\%u5834\\%u666f|\\%u5287\\%u672c", "scenario_outline": "\\%u5834\\%u666f\\%u5927\\%u7db1|\\%u5287\\%u672c\\%u5927\\%u7db1", "then": "\\%u90a3\\%u9ebc", "when": "\\%u7576"}}
|
||||
|
||||
function! s:pattern(key)
|
||||
return '\<\%('.join(map(values(g:cucumber_languages),'substitute(get(v:val,a:key,"\\%(a\\&b\\)"),"|","\\\\|","g")'),'\|').'\)\%(\>\|[[:alnum:]]\@<!\)'
|
||||
endfunction
|
||||
|
||||
function! s:Add(name)
|
||||
let next = " skipempty skipwhite nextgroup=".join(map(["Region","AndRegion","ButRegion","Comment","Table"],'"cucumber".a:name.v:val'),",")
|
||||
exe "syn region cucumber".a:name.'Region matchgroup=cucumber'.a:name.' start="\%(^\s*\)\@<=\%('.s:pattern(tolower(a:name)).'\)" end="$"'.next
|
||||
exe 'syn region cucumber'.a:name.'AndRegion matchgroup=cucumber'.a:name.'And start="\%(^\s*\)\@<='.s:pattern('and').'" end="$" contained'.next
|
||||
exe 'syn region cucumber'.a:name.'ButRegion matchgroup=cucumber'.a:name.'But start="\%(^\s*\)\@<='.s:pattern('but').'" end="$" contained'.next
|
||||
exe 'syn match cucumber'.a:name.'Comment "\%(^\s*\)\@<=#.*" contained'.next
|
||||
exe 'syn match cucumber'.a:name.'Table "\%(^\s*\)\@<=|.*" contained contains=cucumberDelimiter'.next
|
||||
exe 'hi def link cucumber'.a:name.'Comment cucumberComment'
|
||||
exe 'hi def link cucumber'.a:name.'But cucumber'.a:name.'And'
|
||||
exe 'hi def link cucumber'.a:name.'And cucumber'.a:name
|
||||
exe 'syn cluster cucumberStepRegions add=cucumber'.a:name.'Region,cucumber'.a:name.'AndRegion,cucumber'.a:name.'ButRegion'
|
||||
endfunction
|
||||
|
||||
syn match cucumberComment "\%(^\s*\)\@<=#.*"
|
||||
|
||||
exe 'syn match cucumberFeature "\%(^\s*\)\@<='.s:pattern('feature').':"'
|
||||
exe 'syn match cucumberBackground "\%(^\s*\)\@<='.s:pattern('background').':"'
|
||||
exe 'syn match cucumberScenario "\%(^\s*\)\@<='.s:pattern('scenario').':"'
|
||||
exe 'syn match cucumberScenarioOutline "\%(^\s*\)\@<='.s:pattern('scenario_outline').':"'
|
||||
exe 'syn match cucumberExamples "\%(^\s*\)\@<='.s:pattern('examples').':" nextgroup=cucumberExampleTable skipnl skipwhite'
|
||||
|
||||
syn match cucumberPlaceholder "<[^<>]*>" contained containedin=@cucumberStepRegions
|
||||
syn match cucumberExampleTable "\%(^\s*\)\@<=|.*" contains=cucumberDelimiter
|
||||
syn match cucumberDelimiter "|" contained
|
||||
syn match cucumberTags "\%(^\s*\)\@<=\%(@[^@[:space:]]\+\s\+\)*@[^@[:space:]]\+\s*$"
|
||||
syn region cucumberString start=+\%(^\s*\)\@<="""+ end=+"""+
|
||||
|
||||
call s:Add('Then')
|
||||
call s:Add('When')
|
||||
call s:Add('Given')
|
||||
|
||||
hi def link cucumberComment Comment
|
||||
hi def link cucumberFeature Macro
|
||||
hi def link cucumberBackground Define
|
||||
hi def link cucumberScenario Define
|
||||
hi def link cucumberScenarioOutline Define
|
||||
hi def link cucumberExamples Define
|
||||
hi def link cucumberPlaceholder Constant
|
||||
hi def link cucumberDelimiter Delimiter
|
||||
hi def link cucumberTags Tag
|
||||
hi def link cucumberString String
|
||||
hi def link cucumberGiven Conditional
|
||||
hi def link cucumberWhen Function
|
||||
hi def link cucumberThen Type
|
||||
|
||||
let b:current_syntax = "cucumber"
|
||||
|
||||
" vim:set sts=2 sw=2:
|
@ -1,76 +0,0 @@
|
||||
" Vim syntax file
|
||||
" Language: eRuby
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" URL: http://vim-ruby.rubyforge.org
|
||||
" Anon CVS: See above site
|
||||
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists("main_syntax")
|
||||
let main_syntax = 'eruby'
|
||||
endif
|
||||
|
||||
if !exists("g:eruby_default_subtype")
|
||||
let g:eruby_default_subtype = "html"
|
||||
endif
|
||||
|
||||
if !exists("b:eruby_subtype") && main_syntax == 'eruby'
|
||||
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(&filetype,'^eruby\.\zs\w\+')
|
||||
endif
|
||||
if b:eruby_subtype == ''
|
||||
let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\)\+$','',''),'\.\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_nest_level")
|
||||
let b:eruby_nest_level = strlen(substitute(substitute(substitute(expand("%:t"),'@','','g'),'\c\.\%(erb\|rhtml\)\>','@','g'),'[^@]','','g'))
|
||||
endif
|
||||
if !b:eruby_nest_level
|
||||
let b:eruby_nest_level = 1
|
||||
endif
|
||||
|
||||
if exists("b:eruby_subtype") && b:eruby_subtype != ''
|
||||
exe "runtime! syntax/".b:eruby_subtype.".vim"
|
||||
unlet! b:current_syntax
|
||||
endif
|
||||
syn include @rubyTop syntax/ruby.vim
|
||||
|
||||
syn cluster erubyRegions contains=erubyOneLiner,erubyBlock,erubyExpression,erubyComment
|
||||
|
||||
exe 'syn region erubyOneLiner matchgroup=erubyDelimiter start="^%\{1,'.b:eruby_nest_level.'\}%\@!" end="$" contains=@rubyTop containedin=ALLBUT,@erubyRegions keepend oneline'
|
||||
exe 'syn region erubyBlock matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}%\@!-\=" end="[=-]\=%\@<!%\{1,'.b:eruby_nest_level.'\}>" contains=@rubyTop containedin=ALLBUT,@erubyRegions keepend'
|
||||
exe 'syn region erubyExpression matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}=\{1,4}" end="[=-]\=%\@<!%\{1,'.b:eruby_nest_level.'\}>" contains=@rubyTop containedin=ALLBUT,@erubyRegions keepend'
|
||||
exe 'syn region erubyComment matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}#" end="%\@<!%\{1,'.b:eruby_nest_level.'\}>" contains=rubyTodo,@Spell containedin=ALLBUT,@erubyRegions keepend'
|
||||
|
||||
" Define the default highlighting.
|
||||
|
||||
hi def link erubyDelimiter Delimiter
|
||||
hi def link erubyComment Comment
|
||||
|
||||
let b:current_syntax = 'eruby'
|
||||
|
||||
if main_syntax == 'eruby'
|
||||
unlet main_syntax
|
||||
endif
|
||||
|
||||
" vim: nowrap sw=2 sts=2 ts=8:
|
@ -1,8 +0,0 @@
|
||||
runtime syntax/diff.vim
|
||||
|
||||
syntax match gitDiffStatLine /^ .\{-}\zs[+-]\+$/ contains=gitDiffStatAdd,gitDiffStatDelete
|
||||
syntax match gitDiffStatAdd /+/ contained
|
||||
syntax match gitDiffStatDelete /-/ contained
|
||||
|
||||
highlight gitDiffStatAdd ctermfg=2
|
||||
highlight gitDiffStatDelete ctermfg=5
|
@ -1,3 +0,0 @@
|
||||
syntax match gitLogCommit +^commit \x\{40}+
|
||||
|
||||
highlight link gitLogCommit Statement
|
@ -1,18 +0,0 @@
|
||||
runtime syntax/diff.vim
|
||||
setlocal filetype=
|
||||
|
||||
syntax match gitStatusComment +^#.*+ contains=ALL
|
||||
|
||||
syntax match gitStatusBranch +On branch .\++
|
||||
|
||||
syntax match gitStatusUndracked +\t\zs.\++
|
||||
syntax match gitStatusNewFile +\t\zsnew file: .\++
|
||||
syntax match gitStatusModified +\t\zsmodified: .\++
|
||||
|
||||
highlight link gitStatusComment Comment
|
||||
|
||||
highlight link gitStatusBranch Title
|
||||
|
||||
highlight link gitStatusUndracked diffOnly
|
||||
highlight link gitStatusNewFile diffAdded
|
||||
highlight link gitStatusModified diffChanged
|
@ -1,67 +0,0 @@
|
||||
" Vim syntax file
|
||||
" Language: generic git output
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
|
||||
" Last Change: 2008 Mar 21
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
syn case match
|
||||
syn sync minlines=50
|
||||
|
||||
syn include @gitDiff syntax/diff.vim
|
||||
|
||||
syn region gitHead start=/\%^/ end=/^$/
|
||||
syn region gitHead start=/\%(^commit \x\{40\}$\)\@=/ end=/^$/
|
||||
|
||||
" For git reflog and git show ...^{tree}, avoid sync issues
|
||||
syn match gitHead /^\d\{6\} \%(\w\{4} \)\=\x\{40\}\%( [0-3]\)\=\t.*/
|
||||
syn match gitHead /^\x\{40\} \x\{40}\t.*/
|
||||
|
||||
syn region gitDiff start=/^\%(diff --git \)\@=/ end=/^\%(diff --git \|$\)\@=/ contains=@gitDiff fold
|
||||
syn region gitDiff start=/^\%(@@ -\)\@=/ end=/^\%(diff --git \|$\)\@=/ contains=@gitDiff
|
||||
|
||||
syn match gitKeyword /^\%(object\|type\|tag\|commit\|tree\|parent\|encoding\)\>/ contained containedin=gitHead nextgroup=gitHash,gitType skipwhite
|
||||
syn match gitKeyword /^\%(tag\>\|ref:\)/ contained containedin=gitHead nextgroup=gitReference skipwhite
|
||||
syn match gitKeyword /^Merge:/ contained containedin=gitHead nextgroup=gitHashAbbrev skipwhite
|
||||
syn match gitMode /^\d\{6\}/ contained containedin=gitHead nextgroup=gitType,gitHash skipwhite
|
||||
syn match gitIdentityKeyword /^\%(author\|committer\|tagger\)\>/ contained containedin=gitHead nextgroup=gitIdentity skipwhite
|
||||
syn match gitIdentityHeader /^\%(Author\|Commit\|Tagger\):/ contained containedin=gitHead nextgroup=gitIdentity skipwhite
|
||||
syn match gitDateHeader /^\%(AuthorDate\|CommitDate\|Date\):/ contained containedin=gitHead nextgroup=gitDate skipwhite
|
||||
syn match gitIdentity /\S.\{-\} <[^>]*>/ contained nextgroup=gitDate skipwhite
|
||||
syn region gitEmail matchgroup=gitEmailDelimiter start=/</ end=/>/ keepend oneline contained containedin=gitIdentity
|
||||
|
||||
syn match gitReflogHeader /^Reflog:/ contained containedin=gitHead nextgroup=gitReflogMiddle skipwhite
|
||||
syn match gitReflogHeader /^Reflog message:/ contained containedin=gitHead skipwhite
|
||||
syn match gitReflogMiddle /\S\+@{\d\+} (/he=e-2 nextgroup=gitIdentity
|
||||
|
||||
syn match gitDate /\<\u\l\l \u\l\l \d\=\d \d\d:\d\d:\d\d \d\d\d\d [+-]\d\d\d\d/ contained
|
||||
syn match gitDate /-\=\d\+ [+-]\d\d\d\d\>/ contained
|
||||
syn match gitDate /\<\d\+ \l\+ ago\>/ contained
|
||||
syn match gitType /\<\%(tag\|commit\|tree\|blob\)\>/ contained nextgroup=gitHash skipwhite
|
||||
syn match gitStage /\<\d\t\@=/ contained
|
||||
syn match gitReference /\S\+\S\@!/ contained
|
||||
syn match gitHash /\<\x\{40\}\>/ contained nextgroup=gitIdentity,gitStage skipwhite
|
||||
syn match gitHash /^\<\x\{40\}\>/ containedin=gitHead contained nextgroup=gitHash skipwhite
|
||||
syn match gitHashAbbrev /\<\x\{4,39\}\.\.\./he=e-3 contained nextgroup=gitHashAbbrev skipwhite
|
||||
syn match gitHashAbbrev /\<\x\{40\}\>/ contained nextgroup=gitHashAbbrev skipwhite
|
||||
|
||||
hi def link gitDateHeader gitIdentityHeader
|
||||
hi def link gitIdentityHeader gitIdentityKeyword
|
||||
hi def link gitIdentityKeyword Label
|
||||
hi def link gitReflogHeader gitKeyword
|
||||
hi def link gitKeyword Keyword
|
||||
hi def link gitIdentity String
|
||||
hi def link gitEmailDelimiter Delimiter
|
||||
hi def link gitEmail Special
|
||||
hi def link gitDate Number
|
||||
hi def link gitMode Number
|
||||
hi def link gitHashAbbrev gitHash
|
||||
hi def link gitHash Identifier
|
||||
hi def link gitReflogMiddle gitReference
|
||||
hi def link gitReference Function
|
||||
hi def link gitStage gitType
|
||||
hi def link gitType Type
|
||||
|
||||
let b:current_syntax = "git"
|
@ -1,65 +0,0 @@
|
||||
" Vim syntax file
|
||||
" Language: git commit file
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
|
||||
" Filenames: *.git/COMMIT_EDITMSG
|
||||
" Last Change: 2008 Apr 09
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
syn case match
|
||||
syn sync minlines=50
|
||||
|
||||
if has("spell")
|
||||
syn spell toplevel
|
||||
endif
|
||||
|
||||
syn include @gitcommitDiff syntax/diff.vim
|
||||
syn region gitcommitDiff start=/\%(^diff --git \)\@=/ end=/^$\|^#\@=/ contains=@gitcommitDiff
|
||||
|
||||
syn match gitcommitFirstLine "\%^[^#].*" nextgroup=gitcommitBlank skipnl
|
||||
syn match gitcommitSummary "^.\{0,50\}" contained containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell
|
||||
syn match gitcommitOverflow ".*" contained contains=@Spell
|
||||
syn match gitcommitBlank "^[^#].*" contained contains=@Spell
|
||||
syn match gitcommitComment "^#.*"
|
||||
syn region gitcommitHead start=/^# / end=/^#$/ contained transparent
|
||||
syn match gitcommitOnBranch "\%(^# \)\@<=On branch" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite
|
||||
syn match gitcommitBranch "\S\+" contained
|
||||
syn match gitcommitHeader "\%(^# \)\@<=.*:$" contained containedin=gitcommitComment
|
||||
|
||||
syn region gitcommitUntracked start=/^# Untracked files:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitUntrackedFile fold
|
||||
syn match gitcommitUntrackedFile "\t\@<=.*" contained
|
||||
|
||||
syn region gitcommitDiscarded start=/^# Changed but not updated:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitDiscardedType fold
|
||||
syn region gitcommitSelected start=/^# Changes to be committed:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitSelectedType fold
|
||||
|
||||
syn match gitcommitDiscardedType "\t\@<=[a-z][a-z ]*[a-z]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitDiscardedFile skipwhite
|
||||
syn match gitcommitSelectedType "\t\@<=[a-z][a-z ]*[a-z]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitSelectedFile skipwhite
|
||||
syn match gitcommitDiscardedFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitDiscardedArrow
|
||||
syn match gitcommitSelectedFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitSelectedArrow
|
||||
syn match gitcommitDiscardedArrow " -> " contained nextgroup=gitcommitDiscardedFile
|
||||
syn match gitcommitSelectedArrow " -> " contained nextgroup=gitcommitSelectedFile
|
||||
|
||||
hi def link gitcommitSummary Keyword
|
||||
hi def link gitcommitComment Comment
|
||||
hi def link gitcommitUntracked gitcommitComment
|
||||
hi def link gitcommitDiscarded gitcommitComment
|
||||
hi def link gitcommitSelected gitcommitComment
|
||||
hi def link gitcommitOnBranch Comment
|
||||
hi def link gitcommitBranch Special
|
||||
hi def link gitcommitDiscardedType gitcommitType
|
||||
hi def link gitcommitSelectedType gitcommitType
|
||||
hi def link gitcommitType Type
|
||||
hi def link gitcommitHeader PreProc
|
||||
hi def link gitcommitUntrackedFile gitcommitFile
|
||||
hi def link gitcommitDiscardedFile gitcommitFile
|
||||
hi def link gitcommitSelectedFile gitcommitFile
|
||||
hi def link gitcommitFile Constant
|
||||
hi def link gitcommitDiscardedArrow gitcommitArrow
|
||||
hi def link gitcommitSelectedArrow gitcommitArrow
|
||||
hi def link gitcommitArrow gitcommitComment
|
||||
"hi def link gitcommitOverflow Error
|
||||
hi def link gitcommitBlank Error
|
||||
|
||||
let b:current_syntax = "gitcommit"
|
@ -1,37 +0,0 @@
|
||||
" Vim syntax file
|
||||
" Language: git config file
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
|
||||
" Filenames: gitconfig, .gitconfig, *.git/config
|
||||
" Last Change: 2007 Dec 16
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
syn case ignore
|
||||
setlocal iskeyword+=-
|
||||
setlocal iskeyword-=_
|
||||
|
||||
syn match gitconfigComment "[#;].*"
|
||||
syn match gitconfigSection "\%(^\s*\)\@<=\[[a-z0-9.-]\+\]"
|
||||
syn match gitconfigSection '\%(^\s*\)\@<=\[[a-z0-9.-]\+ \+\"\%([^\\"]\|\\.\)*"\]'
|
||||
syn match gitconfigVariable "\%(^\s*\)\@<=\a\k*\%(\s*\%([=#;]\|$\)\)\@=" nextgroup=gitconfigAssignment skipwhite
|
||||
syn region gitconfigAssignment matchgroup=gitconfigNone start=+=\s*+ skip=+\\+ end=+\s*$+ contained contains=gitconfigBoolean,gitconfigNumber,gitConfigString,gitConfigEscape,gitConfigError,gitconfigComment keepend
|
||||
syn keyword gitconfigBoolean true false yes no contained
|
||||
syn match gitconfigNumber "\d\+" contained
|
||||
syn region gitconfigString matchgroup=gitconfigDelim start=+"+ skip=+\\+ end=+"+ matchgroup=gitconfigError end=+[^\\"]\%#\@!$+ contained contains=gitconfigEscape,gitconfigEscapeError
|
||||
syn match gitconfigError +\\.+ contained
|
||||
syn match gitconfigEscape +\\[\\"ntb]+ contained
|
||||
syn match gitconfigEscape +\\$+ contained
|
||||
|
||||
hi def link gitconfigComment Comment
|
||||
hi def link gitconfigSection Keyword
|
||||
hi def link gitconfigVariable Identifier
|
||||
hi def link gitconfigBoolean Boolean
|
||||
hi def link gitconfigNumber Number
|
||||
hi def link gitconfigString String
|
||||
hi def link gitconfigDelim Delimiter
|
||||
hi def link gitconfigEscape Delimiter
|
||||
hi def link gitconfigError Error
|
||||
|
||||
let b:current_syntax = "gitconfig"
|
@ -1,31 +0,0 @@
|
||||
" Vim syntax file
|
||||
" Language: git rebase --interactive
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
|
||||
" Filenames: git-rebase-todo
|
||||
" Last Change: 2008 Apr 16
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
syn case match
|
||||
|
||||
syn match gitrebaseHash "\v<\x{7,40}>" contained
|
||||
syn match gitrebaseCommit "\v<\x{7,40}>" nextgroup=gitrebaseSummary skipwhite
|
||||
syn match gitrebasePick "\v^p%(ick)=>" nextgroup=gitrebaseCommit skipwhite
|
||||
syn match gitrebaseEdit "\v^e%(dit)=>" nextgroup=gitrebaseCommit skipwhite
|
||||
syn match gitrebaseSquash "\v^s%(quash)=>" nextgroup=gitrebaseCommit skipwhite
|
||||
syn match gitrebaseSummary ".*" contains=gitrebaseHash contained
|
||||
syn match gitrebaseComment "^#.*" contains=gitrebaseHash
|
||||
syn match gitrebaseSquashError "\v%^s%(quash)=>" nextgroup=gitrebaseCommit skipwhite
|
||||
|
||||
hi def link gitrebaseCommit gitrebaseHash
|
||||
hi def link gitrebaseHash Identifier
|
||||
hi def link gitrebasePick Statement
|
||||
hi def link gitrebaseEdit PreProc
|
||||
hi def link gitrebaseSquash Type
|
||||
hi def link gitrebaseSummary String
|
||||
hi def link gitrebaseComment Comment
|
||||
hi def link gitrebaseSquashError Error
|
||||
|
||||
let b:current_syntax = "gitrebase"
|
@ -1,19 +0,0 @@
|
||||
" Vim syntax file
|
||||
" Language: git send-email message
|
||||
" Maintainer: Tim Pope
|
||||
" Filenames: *.msg.[0-9]* (first line is "From ... # This line is ignored.")
|
||||
" Last Change: 2007 Dec 16
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! syntax/mail.vim
|
||||
syn case match
|
||||
|
||||
syn match gitsendemailComment "\%^From.*#.*"
|
||||
syn match gitsendemailComment "^GIT:.*"
|
||||
|
||||
hi def link gitsendemailComment Comment
|
||||
|
||||
let b:current_syntax = "gitsendemail"
|
@ -1,91 +0,0 @@
|
||||
" Vim syntax file
|
||||
" Language: Haml
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
|
||||
" Filenames: *.haml
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists("main_syntax")
|
||||
let main_syntax = 'haml'
|
||||
endif
|
||||
let b:ruby_no_expensive = 1
|
||||
|
||||
runtime! syntax/html.vim
|
||||
unlet! b:current_syntax
|
||||
silent! syn include @hamlSassTop syntax/sass.vim
|
||||
unlet! b:current_syntax
|
||||
syn include @hamlRubyTop syntax/ruby.vim
|
||||
|
||||
syn case match
|
||||
|
||||
syn cluster hamlComponent contains=hamlAttributes,hamlClassChar,hamlIdChar,hamlObject,hamlDespacer,hamlSelfCloser,hamlRuby,hamlPlainChar,hamlInterpolatable
|
||||
syn cluster hamlEmbeddedRuby contains=hamlAttributes,hamlObject,hamlRuby,hamlRubyFilter
|
||||
syn cluster hamlTop contains=hamlBegin,hamlPlainFilter,hamlRubyFilter,hamlSassFilter,hamlComment,hamlHtmlComment
|
||||
|
||||
syn match hamlBegin "^\s*\%([<>]\|&[^=~]\)\@!" nextgroup=hamlTag,hamlAttributes,hamlClassChar,hamlIdChar,hamlObject,hamlRuby,hamlPlainChar,hamlInterpolatable
|
||||
|
||||
syn match hamlTag "%\w\+" contained contains=htmlTagName,htmlSpecialTagName nextgroup=@hamlComponent
|
||||
syn region hamlAttributes matchgroup=hamlAttributesDelimiter start="{" end="}" contained contains=@hamlRubyTop nextgroup=@hamlComponent
|
||||
syn region hamlObject matchgroup=hamlObjectDelimiter start="\[" end="\]" contained contains=@hamlRubyTop nextgroup=@hamlComponent
|
||||
syn match hamlDespacer "[<>]" contained nextgroup=hamlDespacer,hamlSelfCloser,hamlRuby,hamlPlainChar,hamlInterpolatable
|
||||
syn match hamlSelfCloser "/" contained
|
||||
syn match hamlClassChar "\." contained nextgroup=hamlClass
|
||||
syn match hamlIdChar "#" contained nextgroup=hamlId
|
||||
syn match hamlClass "\%(\w\|-\)\+" contained nextgroup=@hamlComponent
|
||||
syn match hamlId "\%(\w\|-\)\+" contained nextgroup=@hamlComponent
|
||||
syn region hamlDocType start="^\s*!!!" end="$"
|
||||
|
||||
syn region hamlRuby matchgroup=hamlRubyOutputChar start="[!&]\==\|\~" end="$" contained contains=@hamlRubyTop keepend
|
||||
syn region hamlRuby matchgroup=hamlRubyChar start="-" end="$" contained contains=@hamlRubyTop keepend
|
||||
syn match hamlPlainChar "\\" contained
|
||||
syn region hamlInterpolatable matchgroup=hamlInterpolatableChar start="!\===" end="$" keepend contained contains=hamlInterpolation,@hamlHtmlTop
|
||||
syn region hamlInterpolatable matchgroup=hamlInterpolatableChar start="&==" end="$" keepend contained contains=hamlInterpolation
|
||||
syn region hamlInterpolation matchgroup=hamlInterpolationDelimiter start="#{" end="}" contained contains=@hamlRubyTop
|
||||
syn region hamlErbInterpolation matchgroup=hamlInterpolationDelimiter start="<%[=-]\=" end="-\=%>" contained contains=@hamlRubyTop
|
||||
|
||||
syn match hamlHelper "\<action_view?\|\.\@<!\<\%(flatten\|open\|puts\)" contained containedin=@hamlEmbeddedRuby,@hamlRubyTop,rubyInterpolation
|
||||
syn keyword hamlHelper capture_haml find_and_preserve html_attrs init_haml_helpers list_of preced preserve succeed surround tab_down tab_up page_class contained containedin=@hamlEmbeddedRuby,@hamlRubyTop,rubyInterpolation
|
||||
|
||||
syn cluster hamlHtmlTop contains=@htmlTop,htmlBold,htmlItalic,htmlUnderline
|
||||
syn region hamlPlainFilter matchgroup=hamlFilter start="^\z(\s*\):\%(plain\|preserve\|erb\|redcloth\|textile\|markdown\)\s*$" end="^\%(\z1 \)\@!" contains=@hamlHtmlTop,rubyInterpolation
|
||||
syn region hamlEscapedFilter matchgroup=hamlFilter start="^\z(\s*\):\%(escaped\)\s*$" end="^\%(\z1 \)\@!" contains=rubyInterpolation
|
||||
syn region hamlErbFilter matchgroup=hamlFilter start="^\z(\s*\):erb\s*$" end="^\%(\z1 \)\@!" contains=@hamlHtmlTop,hamlErbInterpolation
|
||||
syn region hamlRubyFilter matchgroup=hamlFilter start="^\z(\s*\):ruby\s*$" end="^\%(\z1 \)\@!" contains=@hamlRubyTop
|
||||
syn region hamlJavascriptFilter matchgroup=hamlFilter start="^\z(\s*\):javascript\s*$" end="^\%(\z1 \)\@!" contains=@htmlJavaScript,rubyInterpolation keepend
|
||||
syn region hamlSassFilter matchgroup=hamlFilter start="^\z(\s*\):sass\s*$" end="^\%(\z1 \)\@!" contains=@hamlSassTop
|
||||
|
||||
syn region hamlJavascriptBlock start="^\z(\s*\)%script" nextgroup=@hamlComponent,hamlError end="^\%(\z1 \)\@!" contains=@hamlTop,@htmlJavaScript keepend
|
||||
syn region hamlCssBlock start="^\z(\s*\)%style" nextgroup=@hamlComponent,hamlError end="^\%(\z1 \)\@!" contains=@hamlTop,@htmlCss keepend
|
||||
syn match hamlError "\$" contained
|
||||
|
||||
syn region hamlComment start="^\z(\s*\)-#" end="^\%(\z1 \)\@!" contains=rubyTodo
|
||||
syn region hamlHtmlComment start="^\z(\s*\)/" end="^\%(\z1 \)\@!" contains=@hamlTop,rubyTodo
|
||||
syn match hamlIEConditional "\%(^\s*/\)\@<=\[if\>[^]]*]" contained containedin=hamlHtmlComment
|
||||
|
||||
hi def link hamlSelfCloser Special
|
||||
hi def link hamlDespacer Special
|
||||
hi def link hamlClassChar Special
|
||||
hi def link hamlIdChar Special
|
||||
hi def link hamlTag Special
|
||||
hi def link hamlClass Type
|
||||
hi def link hamlId Identifier
|
||||
hi def link hamlPlainChar Special
|
||||
hi def link hamlInterpolatableChar hamlRubyChar
|
||||
hi def link hamlRubyOutputChar hamlRubyChar
|
||||
hi def link hamlRubyChar Special
|
||||
hi def link hamlInterpolationDelimiter Delimiter
|
||||
hi def link hamlDocType PreProc
|
||||
hi def link hamlFilter PreProc
|
||||
hi def link hamlAttributesDelimiter Delimiter
|
||||
hi def link hamlObjectDelimiter Delimiter
|
||||
hi def link hamlHelper Function
|
||||
hi def link hamlHtmlComment hamlComment
|
||||
hi def link hamlComment Comment
|
||||
hi def link hamlIEConditional SpecialComment
|
||||
hi def link hamlError Error
|
||||
|
||||
let b:current_syntax = "haml"
|
||||
|
||||
" vim:set sw=2:
|
@ -1,305 +0,0 @@
|
||||
" Vim syntax file
|
||||
" Language: LESS Cascading Style Sheets
|
||||
" Maintainer: Leaf Corcoran <leafot@gmail.com>
|
||||
" Modifier: Bryan J Swift <bryan@bryanjswift.com>
|
||||
" URL: http://leafo.net/lessphp/vim/less.vim
|
||||
" URL: http://gist.github.com/161047
|
||||
" Last Change: 2009 August 4
|
||||
" LESS by Leaf Corcoran
|
||||
" CSS2 by Nikolai Weibull
|
||||
" Full CSS2, HTML4 support by Yeti
|
||||
|
||||
" For version 5.x: Clear all syntax items
|
||||
" For version 6.x: Quit when a syntax file was already loaded
|
||||
if !exists("main_syntax")
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
let main_syntax = 'less'
|
||||
endif
|
||||
|
||||
syn case ignore
|
||||
|
||||
|
||||
|
||||
syn keyword cssTagName abbr acronym address applet area a b base
|
||||
syn keyword cssTagName basefont bdo big blockquote body br button
|
||||
syn keyword cssTagName caption center cite code col colgroup dd del
|
||||
syn keyword cssTagName dfn dir div dl dt em fieldset font form frame
|
||||
syn keyword cssTagName frameset h1 h2 h3 h4 h5 h6 head hr html img i
|
||||
syn keyword cssTagName iframe img input ins isindex kbd label legend li
|
||||
syn keyword cssTagName link map menu meta noframes noscript ol optgroup
|
||||
syn keyword cssTagName option p param pre q s samp script select small
|
||||
syn keyword cssTagName span strike strong style sub sup tbody td
|
||||
syn keyword cssTagName textarea tfoot th thead title tr tt ul u var
|
||||
syn match cssTagName "\<table\>"
|
||||
syn match cssTagName "\*"
|
||||
|
||||
syn match cssTagName "@page\>" nextgroup=cssDefinition
|
||||
|
||||
syn match cssSelectorOp "[+>.]"
|
||||
syn match cssSelectorOp2 "[~|]\?=" contained
|
||||
syn region cssAttributeSelector matchgroup=cssSelectorOp start="\[" end="]" transparent contains=cssUnicodeEscape,cssSelectorOp2,cssStringQ,cssStringQQ
|
||||
|
||||
try
|
||||
syn match cssIdentifier "#[A-Za-zУ<7A>-УП_@][A-Za-zУ<7A>-УП0-9_@-]*"
|
||||
catch /^.*/
|
||||
syn match cssIdentifier "#[A-Za-z_@][A-Za-z0-9_@-]*"
|
||||
endtry
|
||||
|
||||
syn match cssMedia "@media\>" nextgroup=cssMediaType skipwhite skipnl
|
||||
syn keyword cssMediaType contained screen print aural braile embosed handheld projection ty tv all nextgroup=cssMediaComma,cssMediaBlock skipwhite skipnl
|
||||
syn match cssMediaComma "," nextgroup=cssMediaType skipwhite skipnl
|
||||
syn region cssMediaBlock transparent matchgroup=cssBraces start='{' end='}' contains=cssTagName,cssError,cssComment,cssDefinition,cssURL,cssUnicodeEscape,cssIdentifier
|
||||
|
||||
syn match cssValueInteger "[-+]\=\d\+"
|
||||
syn match cssValueNumber "[-+]\=\d\+\(\.\d*\)\="
|
||||
syn match cssValueLength "[-+]\=\d\+\(\.\d*\)\=\(%\|mm\|cm\|in\|pt\|pc\|em\|ex\|px\)"
|
||||
|
||||
syn match cssValueAngle contained "[-+]\=\d\+\(\.\d*\)\=\(deg\|grad\|rad\)"
|
||||
syn match cssValueTime contained "+\=\d\+\(\.\d*\)\=\(ms\|s\)"
|
||||
syn match cssValueFrequency contained "+\=\d\+\(\.\d*\)\=\(Hz\|kHz\)"
|
||||
|
||||
syn match cssFontDescriptor "@font-face\>" nextgroup=cssFontDescriptorBlock skipwhite skipnl
|
||||
syn region cssFontDescriptorBlock contained transparent matchgroup=cssBraces start="{" end="}" contains=cssComment,cssError,cssUnicodeEscape,cssFontProp,cssFontAttr,cssCommonAttr,cssStringQ,cssStringQQ,cssFontDescriptorProp,cssValue.*,cssFontDescriptorFunction,cssUnicodeRange,cssFontDescriptorAttr
|
||||
syn match cssFontDescriptorProp contained "\<\(unicode-range\|unit-per-em\|panose-1\|cap-height\|x-height\|definition-src\)\>"
|
||||
syn keyword cssFontDescriptorProp contained src stemv stemh slope ascent descent widths bbox baseline centerline mathline topline
|
||||
syn keyword cssFontDescriptorAttr contained all
|
||||
syn region cssFontDescriptorFunction contained matchgroup=cssFunctionName start="\<\(uri\|url\|local\|format\)\s*(" end=")" contains=cssStringQ,cssStringQQ oneline keepend
|
||||
syn match cssUnicodeRange contained "U+[0-9A-Fa-f?]\+"
|
||||
syn match cssUnicodeRange contained "U+\x\+-\x\+"
|
||||
|
||||
syn keyword cssColor contained aqua black blue fuchsia gray green lime maroon navy olive purple red silver teal yellow
|
||||
" FIXME: These are actually case-insentivie too, but (a) specs recommend using
|
||||
" mixed-case (b) it's hard to highlight the word `Background' correctly in
|
||||
" all situations
|
||||
syn case match
|
||||
syn keyword cssColor contained ActiveBorder ActiveCaption AppWorkspace ButtonFace ButtonHighlight ButtonShadow ButtonText CaptionText GrayText Highlight HighlightText InactiveBorder InactiveCaption InactiveCaptionText InfoBackground InfoText Menu MenuText Scrollbar ThreeDDarkShadow ThreeDFace ThreeDHighlight ThreeDLightShadow ThreeDShadow Window WindowFrame WindowText Background
|
||||
syn case ignore
|
||||
syn match cssColor contained "\<transparent\>"
|
||||
syn match cssColor contained "\<white\>"
|
||||
syn match cssColor contained "#[0-9A-Fa-f]\{3\}\>"
|
||||
syn match cssColor contained "#[0-9A-Fa-f]\{6\}\>"
|
||||
"syn match cssColor contained "\<rgb\s*(\s*\d\+\(\.\d*\)\=%\=\s*,\s*\d\+\(\.\d*\)\=%\=\s*,\s*\d\+\(\.\d*\)\=%\=\s*)"
|
||||
syn region cssURL contained matchgroup=cssFunctionName start="\<url\s*(" end=")" oneline keepend
|
||||
syn region cssFunction contained matchgroup=cssFunctionName start="\<\(rgb\|clip\|attr\|counter\|rect\)\s*(" end=")" oneline keepend
|
||||
|
||||
syn match cssImportant contained "!\s*important\>"
|
||||
|
||||
syn keyword cssCommonAttr contained auto none inherit
|
||||
syn keyword cssCommonAttr contained top bottom
|
||||
syn keyword cssCommonAttr contained medium normal
|
||||
|
||||
syn match cssFontProp contained "\<font\>\(-\(family\|style\|variant\|weight\|size\(-adjust\)\=\|stretch\)\>\)\="
|
||||
syn match cssFontAttr contained "\<\(sans-\)\=\<serif\>"
|
||||
syn match cssFontAttr contained "\<small\>\(-\(caps\|caption\)\>\)\="
|
||||
syn match cssFontAttr contained "\<x\{1,2\}-\(large\|small\)\>"
|
||||
syn match cssFontAttr contained "\<message-box\>"
|
||||
syn match cssFontAttr contained "\<status-bar\>"
|
||||
syn match cssFontAttr contained "\<\(\(ultra\|extra\|semi\|status-bar\)-\)\=\(condensed\|expanded\)\>"
|
||||
syn keyword cssFontAttr contained cursive fantasy monospace italic oblique
|
||||
syn keyword cssFontAttr contained bold bolder lighter larger smaller
|
||||
syn keyword cssFontAttr contained icon menu
|
||||
syn match cssFontAttr contained "\<caption\>"
|
||||
syn keyword cssFontAttr contained large smaller larger
|
||||
syn keyword cssFontAttr contained narrower wider
|
||||
|
||||
syn keyword cssColorProp contained color
|
||||
syn match cssColorProp contained "\<background\(-\(color\|image\|attachment\|position\)\)\="
|
||||
syn keyword cssColorAttr contained center scroll fixed
|
||||
syn match cssColorAttr contained "\<repeat\(-[xy]\)\=\>"
|
||||
syn match cssColorAttr contained "\<no-repeat\>"
|
||||
|
||||
syn match cssTextProp "\<\(\(word\|letter\)-spacing\|text\(-\(decoration\|transform\|align\|index\|shadow\)\)\=\|vertical-align\|unicode-bidi\|line-height\)\>"
|
||||
syn match cssTextAttr contained "\<line-through\>"
|
||||
syn match cssTextAttr contained "\<text-indent\>"
|
||||
syn match cssTextAttr contained "\<\(text-\)\=\(top\|bottom\)\>"
|
||||
syn keyword cssTextAttr contained underline overline blink sub super middle
|
||||
syn keyword cssTextAttr contained capitalize uppercase lowercase center justify baseline sub super
|
||||
|
||||
syn match cssBoxProp contained "\<\(margin\|padding\|border\)\(-\(top\|right\|bottom\|left\)\)\=\>"
|
||||
syn match cssBoxProp contained "\<border-\(\(\(top\|right\|bottom\|left\)-\)\=\(width\|color\|style\)\)\=\>"
|
||||
syn match cssBoxProp contained "\<\(width\|z-index\)\>"
|
||||
syn match cssBoxProp contained "\<\(min\|max\)-\(width\|height\)\>"
|
||||
syn keyword cssBoxProp contained width height float clear overflow clip visibility
|
||||
syn keyword cssBoxAttr contained thin thick both
|
||||
syn keyword cssBoxAttr contained dotted dashed solid double groove ridge inset outset
|
||||
syn keyword cssBoxAttr contained hidden visible scroll collapse
|
||||
|
||||
syn keyword cssGeneratedContentProp contained content quotes
|
||||
syn match cssGeneratedContentProp contained "\<counter-\(reset\|increment\)\>"
|
||||
syn match cssGeneratedContentProp contained "\<list-style\(-\(type\|position\|image\)\)\=\>"
|
||||
syn match cssGeneratedContentAttr contained "\<\(no-\)\=\(open\|close\)-quote\>"
|
||||
syn match cssAuralAttr contained "\<lower\>"
|
||||
syn match cssGeneratedContentAttr contained "\<\(lower\|upper\)-\(roman\|alpha\|greek\|latin\)\>"
|
||||
syn match cssGeneratedContentAttr contained "\<\(hiragana\|katakana\)\(-iroha\)\=\>"
|
||||
syn match cssGeneratedContentAttr contained "\<\(decimal\(-leading-zero\)\=\|cjk-ideographic\)\>"
|
||||
syn keyword cssGeneratedContentAttr contained disc circle square hebrew armenian georgian
|
||||
syn keyword cssGeneratedContentAttr contained inside outside
|
||||
|
||||
syn match cssPagingProp contained "\<page\(-break-\(before\|after\|inside\)\)\=\>"
|
||||
syn keyword cssPagingProp contained size marks inside orphans widows
|
||||
syn keyword cssPagingAttr contained landscape portrait crop cross always avoid
|
||||
|
||||
syn keyword cssUIProp contained cursor
|
||||
syn match cssUIProp contained "\<outline\(-\(width\|style\|color\)\)\=\>"
|
||||
syn match cssUIAttr contained "\<[ns]\=[ew]\=-resize\>"
|
||||
syn keyword cssUIAttr contained default crosshair pointer move wait help
|
||||
syn keyword cssUIAttr contained thin thick
|
||||
syn keyword cssUIAttr contained dotted dashed solid double groove ridge inset outset
|
||||
syn keyword cssUIAttr contained invert
|
||||
|
||||
syn match cssRenderAttr contained "\<marker\>"
|
||||
syn match cssRenderProp contained "\<\(display\|marker-offset\|unicode-bidi\|white-space\|list-item\|run-in\|inline-table\)\>"
|
||||
syn keyword cssRenderProp contained position top bottom direction
|
||||
syn match cssRenderProp contained "\<\(left\|right\)\>"
|
||||
syn keyword cssRenderAttr contained block inline compact
|
||||
syn match cssRenderAttr contained "\<table\(-\(row-gorup\|\(header\|footer\)-group\|row\|column\(-group\)\=\|cell\|caption\)\)\=\>"
|
||||
syn keyword cssRenderAttr contained static relative absolute fixed
|
||||
syn keyword cssRenderAttr contained ltr rtl embed bidi-override pre nowrap
|
||||
syn match cssRenderAttr contained "\<bidi-override\>"
|
||||
|
||||
syn match cssAuralProp contained "\<\(pause\|cue\)\(-\(before\|after\)\)\=\>"
|
||||
syn match cssAuralProp contained "\<\(play-during\|speech-rate\|voice-family\|pitch\(-range\)\=\|speak\(-\(punctuation\|numerals\)\)\=\)\>"
|
||||
syn keyword cssAuralProp contained volume during azimuth elevation stress richness
|
||||
syn match cssAuralAttr contained "\<\(x-\)\=\(soft\|loud\)\>"
|
||||
syn keyword cssAuralAttr contained silent
|
||||
syn match cssAuralAttr contained "\<spell-out\>"
|
||||
syn keyword cssAuralAttr contained non mix
|
||||
syn match cssAuralAttr contained "\<\(left\|right\)-side\>"
|
||||
syn match cssAuralAttr contained "\<\(far\|center\)-\(left\|center\|right\)\>"
|
||||
syn keyword cssAuralAttr contained leftwards rightwards behind
|
||||
syn keyword cssAuralAttr contained below level above higher
|
||||
syn match cssAuralAttr contained "\<\(x-\)\=\(slow\|fast\)\>"
|
||||
syn keyword cssAuralAttr contained faster slower
|
||||
syn keyword cssAuralAttr contained male female child code digits continuous
|
||||
|
||||
syn match cssTableProp contained "\<\(caption-side\|table-layout\|border-collapse\|border-spacing\|empty-cells\|speak-header\)\>"
|
||||
syn keyword cssTableAttr contained fixed collapse separate show hide once always
|
||||
|
||||
|
||||
|
||||
syn match lessComment "//.*$" contains=@Spell
|
||||
syn match lessVariable "@[A-Za-z_-][A-Za-z0-9_-]*" contained
|
||||
syn region lessVariableDefinition start="^@" end=";" contains=css.*Attr,css.*Prop,cssComment,cssValue.*,cssColor,cssURL,cssImportant,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssDefinition,cssClassName,cssTagName,cssIdentifier,lessComment,lessVariable,lessFunction
|
||||
|
||||
" captures both the definition and the call
|
||||
syn region lessFunction matchgroup=lessFuncDef start="@[A-Za-z_-][A-Za-z0-9_-]*(" end=")" contains=css.*Attr,css.*Prop,cssComment,cssValue.*,cssColor,cssURL,cssImportant,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssDefinition,cssClassName,cssTagName,cssIdentifier,lessComment,lessVariable,lessFunction
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
" FIXME: This allows cssMediaBlock before the semicolon, which is wrong.
|
||||
syn region cssInclude start="@import" end=";" contains=cssComment,cssURL,cssUnicodeEscape,cssMediaType
|
||||
syn match cssBraces contained "[{}]"
|
||||
syn match cssError contained "{@<>"
|
||||
syn region cssDefinition transparent matchgroup=cssBraces start='{' end='}' contains=css.*Attr,css.*Prop,cssComment,cssValue.*,cssColor,cssURL,cssImportant,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssDefinition,cssClassName,cssTagName,cssIdentifier,lessComment,lessVariable,lessFunction
|
||||
" syn match cssBraceError "}"
|
||||
|
||||
syn match cssPseudoClass ":\S*" contains=cssPseudoClassId,cssUnicodeEscape
|
||||
syn keyword cssPseudoClassId contained link visited active hover focus before after left right
|
||||
syn match cssPseudoClassId contained "\<first\(-\(line\|letter\|child\)\)\=\>"
|
||||
syn region cssPseudoClassLang matchgroup=cssPseudoClassId start=":lang(" end=")" oneline
|
||||
|
||||
syn region cssComment start="/\*" end="\*/" contains=@Spell
|
||||
|
||||
syn match cssUnicodeEscape "\\\x\{1,6}\s\?"
|
||||
syn match cssSpecialCharQQ +\\"+ contained
|
||||
syn match cssSpecialCharQ +\\'+ contained
|
||||
syn region cssStringQQ start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=cssUnicodeEscape,cssSpecialCharQQ
|
||||
syn region cssStringQ start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=cssUnicodeEscape,cssSpecialCharQ
|
||||
syn match cssClassName "\.[A-Za-z][A-Za-z0-9_-]\+"
|
||||
|
||||
|
||||
|
||||
|
||||
if main_syntax == "css"
|
||||
syn sync minlines=10
|
||||
endif
|
||||
|
||||
" Define the default highlighting.
|
||||
" For version 5.7 and earlier: only when not done already
|
||||
" For version 5.8 and later: only when an item doesn't have highlighting yet
|
||||
if version >= 508 || !exists("did_less_syn_inits")
|
||||
if version < 508
|
||||
let did_less_syn_inits = 1
|
||||
command -nargs=+ HiLink hi link <args>
|
||||
else
|
||||
command -nargs=+ HiLink hi def link <args>
|
||||
endif
|
||||
|
||||
HiLink lessComment Comment
|
||||
HiLink lessVariable Special
|
||||
HiLink lessFuncDef Function
|
||||
HiLink cssComment Comment
|
||||
HiLink cssTagName Statement
|
||||
HiLink cssSelectorOp Special
|
||||
HiLink cssSelectorOp2 Special
|
||||
HiLink cssFontProp StorageClass
|
||||
HiLink cssColorProp storageClass
|
||||
HiLink cssTextProp StorageClass
|
||||
HiLink cssBoxProp StorageClass
|
||||
HiLink cssRenderProp StorageClass
|
||||
HiLink cssAuralProp StorageClass
|
||||
HiLink cssRenderProp StorageClass
|
||||
HiLink cssGeneratedContentProp StorageClass
|
||||
HiLink cssPagingProp StorageClass
|
||||
HiLink cssTableProp StorageClass
|
||||
HiLink cssUIProp StorageClass
|
||||
HiLink cssFontAttr Type
|
||||
HiLink cssColorAttr Type
|
||||
HiLink cssTextAttr Type
|
||||
HiLink cssBoxAttr Type
|
||||
HiLink cssRenderAttr Type
|
||||
HiLink cssAuralAttr Type
|
||||
HiLink cssGeneratedContentAttr Type
|
||||
HiLink cssPagingAttr Type
|
||||
HiLink cssTableAttr Type
|
||||
HiLink cssUIAttr Type
|
||||
HiLink cssCommonAttr Type
|
||||
HiLink cssPseudoClassId PreProc
|
||||
HiLink cssPseudoClassLang Constant
|
||||
HiLink cssValueLength Number
|
||||
HiLink cssValueInteger Number
|
||||
HiLink cssValueNumber Number
|
||||
HiLink cssValueAngle Number
|
||||
HiLink cssValueTime Number
|
||||
HiLink cssValueFrequency Number
|
||||
HiLink cssFunction Constant
|
||||
HiLink cssURL String
|
||||
HiLink cssFunctionName Function
|
||||
HiLink cssColor Constant
|
||||
HiLink cssIdentifier Function
|
||||
HiLink cssInclude Include
|
||||
HiLink cssImportant Special
|
||||
HiLink cssBraces SpecialChar
|
||||
HiLink cssBraceError Error
|
||||
HiLink cssError Error
|
||||
HiLink cssInclude Include
|
||||
HiLink cssUnicodeEscape Special
|
||||
HiLink cssStringQQ String
|
||||
HiLink cssStringQ String
|
||||
HiLink cssMedia Special
|
||||
HiLink cssMediaType Special
|
||||
HiLink cssMediaComma Normal
|
||||
HiLink cssFontDescriptor Special
|
||||
HiLink cssFontDescriptorFunction Constant
|
||||
HiLink cssFontDescriptorProp StorageClass
|
||||
HiLink cssFontDescriptorAttr Type
|
||||
HiLink cssUnicodeRange Constant
|
||||
HiLink cssClassName Function
|
||||
delcommand HiLink
|
||||
endif
|
||||
|
||||
let b:current_syntax = "less"
|
||||
|
||||
if main_syntax == 'less'
|
||||
unlet main_syntax
|
||||
endif
|
||||
|
||||
|
||||
" vim: ts=8
|
||||
|
@ -1,369 +0,0 @@
|
||||
" Vim syntax file
|
||||
" Language: Ruby
|
||||
" Maintainer: Doug Kearns <dougkearns@gmail.com>
|
||||
" URL: http://vim-ruby.rubyforge.org
|
||||
" Anon CVS: See above site
|
||||
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
|
||||
" ----------------------------------------------------------------------------
|
||||
"
|
||||
" Previous Maintainer: Mirko Nasato
|
||||
" Thanks to perl.vim authors, and to Reimer Behrends. :-) (MN)
|
||||
" ----------------------------------------------------------------------------
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
if has("folding") && exists("ruby_fold")
|
||||
setlocal foldmethod=syntax
|
||||
endif
|
||||
|
||||
syn cluster rubyNotTop contains=@rubyExtendedStringSpecial,@rubyRegexpSpecial,@rubyDeclaration,rubyConditional,rubyExceptional,rubyMethodExceptional,rubyTodo
|
||||
|
||||
if exists("ruby_space_errors")
|
||||
if !exists("ruby_no_trail_space_error")
|
||||
syn match rubySpaceError display excludenl "\s\+$"
|
||||
endif
|
||||
if !exists("ruby_no_tab_space_error")
|
||||
syn match rubySpaceError display " \+\t"me=e-1
|
||||
endif
|
||||
endif
|
||||
|
||||
" Operators
|
||||
if exists("ruby_operators")
|
||||
syn match rubyOperator "\%([~!^&|*/%+-]\|\%(class\s*\)\@<!<<\|<=>\|<=\|\%(<\|\<class\s\+\u\w*\s*\)\@<!<[^<]\@=\|===\|==\|=\~\|>>\|>=\|=\@<!>\|\*\*\|\.\.\.\|\.\.\|::\)"
|
||||
syn match rubyPseudoOperator "\%(-=\|/=\|\*\*=\|\*=\|&&=\|&=\|&&\|||=\||=\|||\|%=\|+=\|!\~\|!=\)"
|
||||
syn region rubyBracketOperator matchgroup=rubyOperator start="\%(\w[?!]\=\|[]})]\)\@<=\[\s*" end="\s*]" contains=ALLBUT,@rubyNotTop
|
||||
endif
|
||||
|
||||
" Expression Substitution and Backslash Notation
|
||||
syn match rubyStringEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display
|
||||
syn match rubyStringEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display
|
||||
syn match rubyQuoteEscape "\\[\\']" contained display
|
||||
|
||||
syn region rubyInterpolation matchgroup=rubyInterpolationDelimiter start="#{" end="}" contained contains=ALLBUT,@rubyNotTop
|
||||
syn match rubyInterpolation "#\%(\$\|@@\=\)\w\+" display contained contains=rubyInterpolationDelimiter,rubyInstanceVariable,rubyClassVariable,rubyGlobalVariable,rubyPredefinedVariable
|
||||
syn match rubyInterpolationDelimiter "#\ze\%(\$\|@@\=\)\w\+" display contained
|
||||
syn match rubyInterpolation "#\$\%(-\w\|\W\)" display contained contains=rubyInterpolationDelimiter,rubyPredefinedVariable,rubyInvalidVariable
|
||||
syn match rubyInterpolationDelimiter "#\ze\$\%(-\w\|\W\)" display contained
|
||||
syn region rubyNoInterpolation start="\\#{" end="}" contained
|
||||
syn match rubyNoInterpolation "\\#{" display contained
|
||||
syn match rubyNoInterpolation "\\#\%(\$\|@@\=\)\w\+" display contained
|
||||
syn match rubyNoInterpolation "\\#\$\W" display contained
|
||||
|
||||
syn match rubyDelimEscape "\\[(<{\[)>}\]]" transparent display contained contains=NONE
|
||||
|
||||
syn region rubyNestedParentheses start="(" skip="\\\\\|\\)" matchgroup=rubyString end=")" transparent contained
|
||||
syn region rubyNestedCurlyBraces start="{" skip="\\\\\|\\}" matchgroup=rubyString end="}" transparent contained
|
||||
syn region rubyNestedAngleBrackets start="<" skip="\\\\\|\\>" matchgroup=rubyString end=">" transparent contained
|
||||
syn region rubyNestedSquareBrackets start="\[" skip="\\\\\|\\\]" matchgroup=rubyString end="\]" transparent contained
|
||||
|
||||
" These are mostly Oniguruma ready
|
||||
syn region rubyRegexpComment matchgroup=rubyRegexpSpecial start="(?#" skip="\\)" end=")" contained
|
||||
syn region rubyRegexpParens matchgroup=rubyRegexpSpecial start="(\(?:\|?<\=[=!]\|?>\|?<[a-z_]\w*>\|?[imx]*-[imx]*:\=\|\%(?#\)\@!\)" skip="\\)" end=")" contained transparent contains=@rubyRegexpSpecial
|
||||
syn region rubyRegexpBrackets matchgroup=rubyRegexpCharClass start="\[\^\=" skip="\\\]" end="\]" contained transparent contains=rubyStringEscape,rubyRegexpEscape,rubyRegexpCharClass oneline
|
||||
syn match rubyRegexpCharClass "\\[DdHhSsWw]" contained display
|
||||
syn match rubyRegexpCharClass "\[:\^\=\%(alnum\|alpha\|ascii\|blank\|cntrl\|digit\|graph\|lower\|print\|punct\|space\|upper\|xdigit\):\]" contained
|
||||
syn match rubyRegexpEscape "\\[].*?+^$|\\/(){}[]" contained
|
||||
syn match rubyRegexpQuantifier "[*?+][?+]\=" contained display
|
||||
syn match rubyRegexpQuantifier "{\d\+\%(,\d*\)\=}?\=" contained display
|
||||
syn match rubyRegexpAnchor "[$^]\|\\[ABbGZz]" contained display
|
||||
syn match rubyRegexpDot "\." contained display
|
||||
syn match rubyRegexpSpecial "|" contained display
|
||||
syn match rubyRegexpSpecial "\\[1-9]\d\=\d\@!" contained display
|
||||
syn match rubyRegexpSpecial "\\k<\%([a-z_]\w*\|-\=\d\+\)\%([+-]\d\+\)\=>" contained display
|
||||
syn match rubyRegexpSpecial "\\k'\%([a-z_]\w*\|-\=\d\+\)\%([+-]\d\+\)\='" contained display
|
||||
syn match rubyRegexpSpecial "\\g<\%([a-z_]\w*\|-\=\d\+\)>" contained display
|
||||
syn match rubyRegexpSpecial "\\g'\%([a-z_]\w*\|-\=\d\+\)'" contained display
|
||||
|
||||
syn cluster rubyStringSpecial contains=rubyInterpolation,rubyNoInterpolation,rubyStringEscape
|
||||
syn cluster rubyExtendedStringSpecial contains=@rubyStringSpecial,rubyNestedParentheses,rubyNestedCurlyBraces,rubyNestedAngleBrackets,rubyNestedSquareBrackets
|
||||
syn cluster rubyRegexpSpecial contains=rubyInterpolation,rubyNoInterpolation,rubyStringEscape,rubyRegexpSpecial,rubyRegexpEscape,rubyRegexpBrackets,rubyRegexpCharClass,rubyRegexpDot,rubyRegexpQuantifier,rubyRegexpAnchor,rubyRegexpParens,rubyRegexpComment
|
||||
|
||||
" Numbers and ASCII Codes
|
||||
syn match rubyASCIICode "\%(\w\|[]})\"'/]\)\@<!\%(?\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\=\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)\)"
|
||||
syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[xX]\x\+\%(_\x\+\)*\>" display
|
||||
syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0[dD]\)\=\%(0\|[1-9]\d*\%(_\d\+\)*\)\>" display
|
||||
syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[oO]\=\o\+\%(_\o\+\)*\>" display
|
||||
syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[bB][01]\+\%(_[01]\+\)*\>" display
|
||||
syn match rubyFloat "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\.\d\+\%(_\d\+\)*\>" display
|
||||
syn match rubyFloat "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE][-+]\=\d\+\%(_\d\+\)*\)\>" display
|
||||
|
||||
" Identifiers
|
||||
syn match rubyLocalVariableOrMethod "\<[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent
|
||||
syn match rubyBlockArgument "&[_[:lower:]][_[:alnum:]]" contains=NONE display transparent
|
||||
|
||||
syn match rubyConstant "\%(\%([.@$]\@<!\.\)\@<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=\%(\s*(\)\@!"
|
||||
syn match rubyClassVariable "@@\h\w*" display
|
||||
syn match rubyInstanceVariable "@\h\w*" display
|
||||
syn match rubyGlobalVariable "$\%(\h\w*\|-.\)"
|
||||
syn match rubySymbol "[]})\"':]\@<!:\%(\^\|\~\|<<\|<=>\|<=\|<\|===\|==\|=\~\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)"
|
||||
syn match rubySymbol "[]})\"':]\@<!:\$\%(-.\|[`~<=>_,;:!?/.'"@$*\&+0]\)"
|
||||
syn match rubySymbol "[]})\"':]\@<!:\%(\$\|@@\=\)\=\h\w*"
|
||||
syn match rubySymbol "[]})\"':]\@<!:\h\w*\%([?!=]>\@!\)\="
|
||||
syn match rubySymbol "\%([{(,]\_s*\)\@<=\l\w*[!?]\=::\@!"he=e-1
|
||||
syn match rubySymbol "[]})\"':]\@<!\h\w*[!?]\=:\s\@="he=e-1
|
||||
syn region rubySymbol start="[]})\"':]\@<!:'" end="'" skip="\\\\\|\\'" contains=rubyQuoteEscape fold
|
||||
syn region rubySymbol start="[]})\"':]\@<!:\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial fold
|
||||
|
||||
syn match rubyBlockParameter "\h\w*" contained
|
||||
syn region rubyBlockParameterList start="\%(\%(\<do\>\|{\)\s*\)\@<=|" end="|" oneline display contains=rubyBlockParameter
|
||||
|
||||
syn match rubyInvalidVariable "$[^ A-Za-z_-]"
|
||||
syn match rubyPredefinedVariable #$[!$&"'*+,./0:;<=>?@\`~1-9]#
|
||||
syn match rubyPredefinedVariable "$_\>" display
|
||||
syn match rubyPredefinedVariable "$-[0FIKadilpvw]\>" display
|
||||
syn match rubyPredefinedVariable "$\%(deferr\|defout\|stderr\|stdin\|stdout\)\>" display
|
||||
syn match rubyPredefinedVariable "$\%(DEBUG\|FILENAME\|KCODE\|LOADED_FEATURES\|LOAD_PATH\|PROGRAM_NAME\|SAFE\|VERBOSE\)\>" display
|
||||
syn match rubyPredefinedConstant "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(MatchingData\|ARGF\|ARGV\|ENV\)\>\%(\s*(\)\@!"
|
||||
syn match rubyPredefinedConstant "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(DATA\|FALSE\|NIL\|RUBY_PLATFORM\|RUBY_RELEASE_DATE\)\>\%(\s*(\)\@!"
|
||||
syn match rubyPredefinedConstant "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(RUBY_VERSION\|STDERR\|STDIN\|STDOUT\|TOPLEVEL_BINDING\|TRUE\)\>\%(\s*(\)\@!"
|
||||
"Obsolete Global Constants
|
||||
"syn match rubyPredefinedConstant "\%(::\)\=\zs\%(PLATFORM\|RELEASE_DATE\|VERSION\)\>"
|
||||
"syn match rubyPredefinedConstant "\%(::\)\=\zs\%(NotImplementError\)\>"
|
||||
|
||||
" Normal Regular Expression
|
||||
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\|else\)\|[;\~=!|&(,[>]\)\s*\)\@<=/" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial keepend fold
|
||||
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/[ \t=]\@!" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial fold
|
||||
|
||||
" Generalized Regular Expression
|
||||
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1[iomxneus]*" skip="\\\\\|\\\z1" contains=@rubyRegexpSpecial fold
|
||||
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r{" end="}[iomxneus]*" skip="\\\\\|\\}" contains=@rubyRegexpSpecial fold
|
||||
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r<" end=">[iomxneus]*" skip="\\\\\|\\>" contains=@rubyRegexpSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold
|
||||
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\[" end="\][iomxneus]*" skip="\\\\\|\\\]" contains=@rubyRegexpSpecial fold
|
||||
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r(" end=")[iomxneus]*" skip="\\\\\|\\)" contains=@rubyRegexpSpecial fold
|
||||
|
||||
" Normal String and Shell Command Output
|
||||
syn region rubyString matchgroup=rubyStringDelimiter start="\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial fold
|
||||
syn region rubyString matchgroup=rubyStringDelimiter start="'" end="'" skip="\\\\\|\\'" contains=rubyQuoteEscape fold
|
||||
syn region rubyString matchgroup=rubyStringDelimiter start="`" end="`" skip="\\\\\|\\`" contains=@rubyStringSpecial fold
|
||||
|
||||
" Generalized Single Quoted String, Symbol and Array of Strings
|
||||
syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold
|
||||
syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]{" end="}" skip="\\\\\|\\}" fold contains=rubyNestedCurlyBraces,rubyDelimEscape
|
||||
syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]<" end=">" skip="\\\\\|\\>" fold contains=rubyNestedAngleBrackets,rubyDelimEscape
|
||||
syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]\[" end="\]" skip="\\\\\|\\\]" fold contains=rubyNestedSquareBrackets,rubyDelimEscape
|
||||
syn region rubyString matchgroup=rubyStringDelimiter start="%[qw](" end=")" skip="\\\\\|\\)" fold contains=rubyNestedParentheses,rubyDelimEscape
|
||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%[s]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold
|
||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%[s]{" end="}" skip="\\\\\|\\}" fold contains=rubyNestedCurlyBraces,rubyDelimEscape
|
||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%[s]<" end=">" skip="\\\\\|\\>" fold contains=rubyNestedAngleBrackets,rubyDelimEscape
|
||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%[s]\[" end="\]" skip="\\\\\|\\\]" fold contains=rubyNestedSquareBrackets,rubyDelimEscape
|
||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%[s](" end=")" skip="\\\\\|\\)" fold contains=rubyNestedParentheses,rubyDelimEscape
|
||||
|
||||
" Generalized Double Quoted String and Array of Strings and Shell Command Output
|
||||
" Note: %= is not matched here as the beginning of a double quoted string
|
||||
syn region rubyString matchgroup=rubyStringDelimiter start="%\z([~`!@#$%^&*_\-+|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold
|
||||
syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold
|
||||
syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\={" end="}" skip="\\\\\|\\}" contains=@rubyStringSpecial,rubyNestedCurlyBraces,rubyDelimEscape fold
|
||||
syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=<" end=">" skip="\\\\\|\\>" contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold
|
||||
syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\[" end="\]" skip="\\\\\|\\\]" contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimEscape fold
|
||||
syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=(" end=")" skip="\\\\\|\\)" contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimEscape fold
|
||||
|
||||
" Here Document
|
||||
syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs\%(\h\w*\)+ end=+$+ oneline contains=ALLBUT,@rubyNotTop
|
||||
syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs"\%([^"]*\)"+ end=+$+ oneline contains=ALLBUT,@rubyNotTop
|
||||
syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs'\%([^']*\)'+ end=+$+ oneline contains=ALLBUT,@rubyNotTop
|
||||
syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs`\%([^`]*\)`+ end=+$+ oneline contains=ALLBUT,@rubyNotTop
|
||||
|
||||
syn region rubyString start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<\z(\h\w*\)\ze+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend
|
||||
syn region rubyString start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<"\z([^"]*\)"\ze+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend
|
||||
syn region rubyString start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<'\z([^']*\)'\ze+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart fold keepend
|
||||
syn region rubyString start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<`\z([^`]*\)`\ze+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend
|
||||
|
||||
syn region rubyString start=+\%(\%(class\s*\|\%([]}).]\|::\)\)\_s*\|\w\)\@<!<<-\z(\h\w*\)\ze+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend
|
||||
syn region rubyString start=+\%(\%(class\s*\|\%([]}).]\|::\)\)\_s*\|\w\)\@<!<<-"\z([^"]*\)"\ze+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend
|
||||
syn region rubyString start=+\%(\%(class\s*\|\%([]}).]\|::\)\)\_s*\|\w\)\@<!<<-'\z([^']*\)'\ze+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart fold keepend
|
||||
syn region rubyString start=+\%(\%(class\s*\|\%([]}).]\|::\)\)\_s*\|\w\)\@<!<<-`\z([^`]*\)`\ze+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend
|
||||
|
||||
if exists('main_syntax') && main_syntax == 'eruby'
|
||||
let b:ruby_no_expensive = 1
|
||||
end
|
||||
|
||||
syn match rubyAliasDeclaration "[^[:space:];#.()]\+" contained contains=rubySymbol,rubyGlobalVariable,rubyPredefinedVariable nextgroup=rubyAliasDeclaration2 skipwhite
|
||||
syn match rubyAliasDeclaration2 "[^[:space:];#.()]\+" contained contains=rubySymbol,rubyGlobalVariable,rubyPredefinedVariable
|
||||
syn match rubyMethodDeclaration "[^[:space:];#(]\+" contained contains=rubyConstant,rubyBoolean,rubyPseudoVariable,rubyInstanceVariable,rubyClassVariable,rubyGlobalVariable
|
||||
syn match rubyClassDeclaration "[^[:space:];#<]\+" contained contains=rubyConstant,rubyOperator
|
||||
syn match rubyModuleDeclaration "[^[:space:];#<]\+" contained contains=rubyConstant,rubyOperator
|
||||
syn match rubyFunction "\<[_[:alpha:]][_[:alnum:]]*[?!=]\=[[:alnum:]_.:?!=]\@!" contained containedin=rubyMethodDeclaration
|
||||
syn match rubyFunction "\%(\s\|^\)\@<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2
|
||||
syn match rubyFunction "\%([[:space:].]\|^\)\@<=\%(\[\]=\=\|\*\*\|[+-]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|==\|=\~\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration
|
||||
|
||||
syn cluster rubyDeclaration contains=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration,rubyModuleDeclaration,rubyClassDeclaration,rubyFunction,rubyBlockParameter
|
||||
|
||||
" Keywords
|
||||
" Note: the following keywords have already been defined:
|
||||
" begin case class def do end for if module unless until while
|
||||
syn match rubyControl "\<\%(and\|break\|in\|next\|not\|or\|redo\|rescue\|retry\|return\)\>[?!]\@!"
|
||||
syn match rubyOperator "\<defined?" display
|
||||
syn match rubyKeyword "\<\%(super\|yield\)\>[?!]\@!"
|
||||
syn match rubyBoolean "\<\%(true\|false\)\>[?!]\@!"
|
||||
syn match rubyPseudoVariable "\<\%(nil\|self\|__FILE__\|__LINE__\)\>[?!]\@!"
|
||||
syn match rubyBeginEnd "\<\%(BEGIN\|END\)\>[?!]\@!"
|
||||
|
||||
" Expensive Mode - match 'end' with the appropriate opening keyword for syntax
|
||||
" based folding and special highlighting of module/class/method definitions
|
||||
if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive")
|
||||
syn match rubyDefine "\<alias\>" nextgroup=rubyAliasDeclaration skipwhite skipnl
|
||||
syn match rubyDefine "\<def\>" nextgroup=rubyMethodDeclaration skipwhite skipnl
|
||||
syn match rubyDefine "\<undef\>" nextgroup=rubyFunction skipwhite skipnl
|
||||
syn match rubyClass "\<class\>" nextgroup=rubyClassDeclaration skipwhite skipnl
|
||||
syn match rubyModule "\<module\>" nextgroup=rubyModuleDeclaration skipwhite skipnl
|
||||
|
||||
syn region rubyMethodBlock start="\<def\>" matchgroup=rubyDefine end="\%(\<def\_s\+\)\@<!\<end\>" contains=ALLBUT,@rubyNotTop fold
|
||||
syn region rubyBlock start="\<class\>" matchgroup=rubyClass end="\<end\>" contains=ALLBUT,@rubyNotTop fold
|
||||
syn region rubyBlock start="\<module\>" matchgroup=rubyModule end="\<end\>" contains=ALLBUT,@rubyNotTop fold
|
||||
|
||||
" modifiers
|
||||
syn match rubyConditionalModifier "\<\%(if\|unless\)\>" display
|
||||
syn match rubyRepeatModifier "\<\%(while\|until\)\>" display
|
||||
|
||||
syn region rubyDoBlock matchgroup=rubyControl start="\<do\>" end="\<end\>" contains=ALLBUT,@rubyNotTop fold
|
||||
" curly bracket block or hash literal
|
||||
syn region rubyCurlyBlock start="{" end="}" contains=ALLBUT,@rubyNotTop fold
|
||||
syn region rubyArrayLiteral matchgroup=rubyArrayDelimiter start="\%(\w\|[\]})]\)\@<!\[" end="]" contains=ALLBUT,@rubyNotTop fold
|
||||
|
||||
" statements without 'do'
|
||||
syn region rubyBlockExpression matchgroup=rubyControl start="\<begin\>" end="\<end\>" contains=ALLBUT,@rubyNotTop fold
|
||||
syn region rubyCaseExpression matchgroup=rubyConditional start="\<case\>" end="\<end\>" contains=ALLBUT,@rubyNotTop fold
|
||||
syn region rubyConditionalExpression matchgroup=rubyConditional start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+=-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![?!]\)\s*\)\@<=\%(if\|unless\)\>" end="\<end\>" contains=ALLBUT,@rubyNotTop fold
|
||||
|
||||
syn match rubyConditional "\<\%(then\|else\|when\)\>[?!]\@!" contained containedin=rubyCaseExpression
|
||||
syn match rubyConditional "\<\%(then\|else\|elsif\)\>[?!]\@!" contained containedin=rubyConditionalExpression
|
||||
|
||||
syn match rubyExceptional "\<\%(\%(\%(;\|^\)\s*\)\@<=rescue\|else\|ensure\)\>[?!]\@!" contained containedin=rubyBlockExpression
|
||||
syn match rubyMethodExceptional "\<\%(\%(\%(;\|^\)\s*\)\@<=rescue\|else\|ensure\)\>[?!]\@!" contained containedin=rubyMethodBlock
|
||||
|
||||
" statements with optional 'do'
|
||||
syn region rubyOptionalDoLine matchgroup=rubyRepeat start="\<for\>[?!]\@!" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=rubyOptionalDo end="\%(\<do\>\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@rubyNotTop
|
||||
syn region rubyRepeatExpression start="\<for\>[?!]\@!" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=rubyRepeat end="\<end\>" contains=ALLBUT,@rubyNotTop nextgroup=rubyOptionalDoLine fold
|
||||
|
||||
if !exists("ruby_minlines")
|
||||
let ruby_minlines = 50
|
||||
endif
|
||||
exec "syn sync minlines=" . ruby_minlines
|
||||
|
||||
else
|
||||
syn match rubyControl "\<def\>[?!]\@!" nextgroup=rubyMethodDeclaration skipwhite skipnl
|
||||
syn match rubyControl "\<class\>[?!]\@!" nextgroup=rubyClassDeclaration skipwhite skipnl
|
||||
syn match rubyControl "\<module\>[?!]\@!" nextgroup=rubyModuleDeclaration skipwhite skipnl
|
||||
syn match rubyControl "\<\%(case\|begin\|do\|for\|if\|unless\|while\|until\|else\|elsif\|ensure\|then\|when\|end\)\>[?!]\@!"
|
||||
syn match rubyKeyword "\<\%(alias\|undef\)\>[?!]\@!"
|
||||
endif
|
||||
|
||||
" Special Methods
|
||||
if !exists("ruby_no_special_methods")
|
||||
syn keyword rubyAccess public protected private module_function
|
||||
" attr is a common variable name
|
||||
syn match rubyAttribute "\%(\%(^\|;\)\s*\)\@<=attr\>\(\s*[.=]\)\@!"
|
||||
syn keyword rubyAttribute attr_accessor attr_reader attr_writer
|
||||
syn match rubyControl "\<\%(exit!\|\%(abort\|at_exit\|exit\|fork\|loop\|trap\)\>[?!]\@!\)"
|
||||
syn keyword rubyEval eval class_eval instance_eval module_eval
|
||||
syn keyword rubyException raise fail catch throw
|
||||
" false positive with 'include?'
|
||||
syn match rubyInclude "\<include\>[?!]\@!"
|
||||
syn keyword rubyInclude autoload extend load require
|
||||
syn keyword rubyKeyword callcc caller lambda proc
|
||||
endif
|
||||
|
||||
" Comments and Documentation
|
||||
syn match rubySharpBang "\%^#!.*" display
|
||||
syn keyword rubyTodo FIXME NOTE TODO OPTIMIZE XXX contained
|
||||
syn match rubyComment "#.*" contains=rubySharpBang,rubySpaceError,rubyTodo,@Spell
|
||||
if !exists("ruby_no_comment_fold")
|
||||
syn region rubyMultilineComment start="\%(\%(^\s*#.*\n\)\@<!\%(^\s*#.*\n\)\)\%(\(^\s*#.*\n\)\{1,}\)\@=" end="\%(^\s*#.*\n\)\@<=\%(^\s*#.*\n\)\%(^\s*#\)\@!" contains=rubyComment transparent fold keepend
|
||||
syn region rubyDocumentation start="^=begin\ze\%(\s.*\)\=$" end="^=end\s*$" contains=rubySpaceError,rubyTodo,@Spell fold
|
||||
else
|
||||
syn region rubyDocumentation start="^=begin\s*$" end="^=end\s*$" contains=rubySpaceError,rubyTodo,@Spell
|
||||
endif
|
||||
|
||||
" Note: this is a hack to prevent 'keywords' being highlighted as such when called as methods with an explicit receiver
|
||||
syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(alias\|and\|begin\|break\|case\|class\|def\|defined\|do\|else\)\>" transparent contains=NONE
|
||||
syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(elsif\|end\|ensure\|false\|for\|if\|in\|module\|next\|nil\)\>" transparent contains=NONE
|
||||
syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(not\|or\|redo\|rescue\|retry\|return\|self\|super\|then\|true\)\>" transparent contains=NONE
|
||||
syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(undef\|unless\|until\|when\|while\|yield\|BEGIN\|END\|__FILE__\|__LINE__\)\>" transparent contains=NONE
|
||||
|
||||
syn match rubyKeywordAsMethod "\<\%(alias\|begin\|case\|class\|def\|do\|end\)[?!]" transparent contains=NONE
|
||||
syn match rubyKeywordAsMethod "\<\%(if\|module\|undef\|unless\|until\|while\)[?!]" transparent contains=NONE
|
||||
|
||||
syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(abort\|at_exit\|attr\|attr_accessor\|attr_reader\)\>" transparent contains=NONE
|
||||
syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(attr_writer\|autoload\|callcc\|catch\|caller\)\>" transparent contains=NONE
|
||||
syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(eval\|class_eval\|instance_eval\|module_eval\|exit\)\>" transparent contains=NONE
|
||||
syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(extend\|fail\|fork\|include\|lambda\)\>" transparent contains=NONE
|
||||
syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(load\|loop\|private\|proc\|protected\)\>" transparent contains=NONE
|
||||
syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(public\|require\|raise\|throw\|trap\)\>" transparent contains=NONE
|
||||
|
||||
" __END__ Directive
|
||||
syn region rubyData matchgroup=rubyDataDirective start="^__END__$" end="\%$" fold
|
||||
|
||||
hi def link rubyClass rubyDefine
|
||||
hi def link rubyModule rubyDefine
|
||||
hi def link rubyMethodExceptional rubyDefine
|
||||
hi def link rubyDefine Define
|
||||
hi def link rubyFunction Function
|
||||
hi def link rubyConditional Conditional
|
||||
hi def link rubyConditionalModifier rubyConditional
|
||||
hi def link rubyExceptional rubyConditional
|
||||
hi def link rubyRepeat Repeat
|
||||
hi def link rubyRepeatModifier rubyRepeat
|
||||
hi def link rubyOptionalDo rubyRepeat
|
||||
hi def link rubyControl Statement
|
||||
hi def link rubyInclude Include
|
||||
hi def link rubyInteger Number
|
||||
hi def link rubyASCIICode Character
|
||||
hi def link rubyFloat Float
|
||||
hi def link rubyBoolean Boolean
|
||||
hi def link rubyException Exception
|
||||
if !exists("ruby_no_identifiers")
|
||||
hi def link rubyIdentifier Identifier
|
||||
else
|
||||
hi def link rubyIdentifier NONE
|
||||
endif
|
||||
hi def link rubyClassVariable rubyIdentifier
|
||||
hi def link rubyConstant Type
|
||||
hi def link rubyGlobalVariable rubyIdentifier
|
||||
hi def link rubyBlockParameter rubyIdentifier
|
||||
hi def link rubyInstanceVariable rubyIdentifier
|
||||
hi def link rubyPredefinedIdentifier rubyIdentifier
|
||||
hi def link rubyPredefinedConstant rubyPredefinedIdentifier
|
||||
hi def link rubyPredefinedVariable rubyPredefinedIdentifier
|
||||
hi def link rubySymbol Constant
|
||||
hi def link rubyKeyword Keyword
|
||||
hi def link rubyOperator Operator
|
||||
hi def link rubyPseudoOperator rubyOperator
|
||||
hi def link rubyBeginEnd Statement
|
||||
hi def link rubyAccess Statement
|
||||
hi def link rubyAttribute Statement
|
||||
hi def link rubyEval Statement
|
||||
hi def link rubyPseudoVariable Constant
|
||||
|
||||
hi def link rubyComment Comment
|
||||
hi def link rubyData Comment
|
||||
hi def link rubyDataDirective Delimiter
|
||||
hi def link rubyDocumentation Comment
|
||||
hi def link rubyTodo Todo
|
||||
|
||||
hi def link rubyQuoteEscape rubyStringEscape
|
||||
hi def link rubyStringEscape Special
|
||||
hi def link rubyInterpolationDelimiter Delimiter
|
||||
hi def link rubyNoInterpolation rubyString
|
||||
hi def link rubySharpBang PreProc
|
||||
hi def link rubyRegexpDelimiter rubyStringDelimiter
|
||||
hi def link rubySymbolDelimiter rubyStringDelimiter
|
||||
hi def link rubyStringDelimiter Delimiter
|
||||
hi def link rubyString String
|
||||
hi def link rubyRegexpEscape rubyRegexpSpecial
|
||||
hi def link rubyRegexpQuantifier rubyRegexpSpecial
|
||||
hi def link rubyRegexpAnchor rubyRegexpSpecial
|
||||
hi def link rubyRegexpDot rubyRegexpCharClass
|
||||
hi def link rubyRegexpCharClass rubyRegexpSpecial
|
||||
hi def link rubyRegexpSpecial Special
|
||||
hi def link rubyRegexpComment Comment
|
||||
hi def link rubyRegexp rubyString
|
||||
|
||||
hi def link rubyInvalidVariable Error
|
||||
hi def link rubyError Error
|
||||
hi def link rubySpaceError rubyError
|
||||
|
||||
let b:current_syntax = "ruby"
|
||||
|
||||
" vim: nowrap sw=2 sts=2 ts=8 noet:
|
@ -1,56 +0,0 @@
|
||||
" Vim syntax file
|
||||
" Language: Sass
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
|
||||
" Filenames: *.sass
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! syntax/css.vim
|
||||
|
||||
syn case ignore
|
||||
|
||||
syn cluster sassCssProperties contains=cssFontProp,cssFontDescriptorProp,cssColorProp,cssTextProp,cssBoxProp,cssGeneratedContentProp,cssPagingProp,cssUIProp,cssRenderProp,cssAuralProp,cssTableProp
|
||||
syn cluster sassCssAttributes contains=css.*Attr,cssComment,cssValue.*,cssColor,cssURL,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssRenderProp
|
||||
|
||||
syn match sassProperty "^\s*\zs\s\%([[:alnum:]-]\+:\|:[[:alnum:]-]\+\)"hs=s+1 contains=css.*Prop skipwhite nextgroup=sassCssAttribute
|
||||
syn match sassCssAttribute ".*$" contained contains=@sassCssAttributes,sassConstant
|
||||
syn match sassConstant "![[:alnum:]_-]\+"
|
||||
syn match sassConstantAssignment "\%(![[:alnum:]_]\+\s*\)\@<==" nextgroup=sassCssAttribute skipwhite
|
||||
syn match sassMixin "^=.*"
|
||||
syn match sassMixing "^\s\+\zs+.*"
|
||||
|
||||
syn match sassEscape "^\s*\zs\\"
|
||||
syn match sassIdChar "#[[:alnum:]_-]\@=" nextgroup=sassId
|
||||
syn match sassId "[[:alnum:]_-]\+" contained
|
||||
syn match sassClassChar "\.[[:alnum:]_-]\@=" nextgroup=sassClass
|
||||
syn match sassClass "[[:alnum:]_-]\+" contained
|
||||
syn match sassAmpersand "&"
|
||||
|
||||
" TODO: Attribute namespaces
|
||||
" TODO: Arithmetic (including strings and concatenation)
|
||||
|
||||
syn region sassInclude start="@import" end=";\|$" contains=cssComment,cssURL,cssUnicodeEscape,cssMediaType
|
||||
|
||||
syn keyword sassTodo FIXME NOTE TODO OPTIMIZE XXX contained
|
||||
syn region sassComment start="^\z(\s*\)//" end="^\%(\z1 \)\@!" contains=sassTodo
|
||||
syn region sassCssComment start="^\z(\s*\)/\*" end="^\%(\z1 \)\@!" contains=sassTodo
|
||||
|
||||
hi def link sassCssComment sassComment
|
||||
hi def link sassComment Comment
|
||||
hi def link sassConstant Identifier
|
||||
hi def link sassMixing PreProc
|
||||
hi def link sassMixin PreProc
|
||||
hi def link sassTodo Todo
|
||||
hi def link sassInclude Include
|
||||
hi def link sassEscape Special
|
||||
hi def link sassIdChar Special
|
||||
hi def link sassClassChar Special
|
||||
hi def link sassAmpersand Character
|
||||
hi def link sassId Identifier
|
||||
hi def link sassClass Type
|
||||
|
||||
let b:current_syntax = "sass"
|
||||
|
||||
" vim:set sw=2:
|
@ -1,119 +0,0 @@
|
||||
"============================================================================
|
||||
"File: c.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Gregor Uhlenheuer <kongo2002 at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
" In order to also check header files add this to your .vimrc:
|
||||
" (this usually creates a .gch file in your source directory)
|
||||
"
|
||||
" let g:syntastic_c_check_header = 1
|
||||
"
|
||||
" To disable the search of included header files after special
|
||||
" libraries like gtk and glib add this line to your .vimrc:
|
||||
"
|
||||
" let g:syntastic_c_no_include_search = 1
|
||||
"
|
||||
" To enable header files being re-checked on every file write add the
|
||||
" following line to your .vimrc. Otherwise the header files are checked only
|
||||
" one time on initially loading the file.
|
||||
" In order to force syntastic to refresh the header includes simply
|
||||
" unlet b:syntastic_c_includes. Then the header files are being re-checked on
|
||||
" the next file write.
|
||||
"
|
||||
" let g:syntastic_c_auto_refresh_includes = 1
|
||||
"
|
||||
" Alternatively you can set the buffer local variable b:syntastic_c_cflags.
|
||||
" If this variable is set for the current buffer no search for additional
|
||||
" libraries is done. I.e. set the variable like this:
|
||||
"
|
||||
" let b:syntastic_c_cflags = ' -I/usr/include/libsoup-2.4'
|
||||
"
|
||||
" In order to add some custom include directories that should be added to the
|
||||
" gcc command line you can add those to the global variable
|
||||
" g:syntastic_c_include_dirs. This list can be used like this:
|
||||
"
|
||||
" let g:syntastic_c_include_dirs = [ 'includes', 'headers' ]
|
||||
|
||||
" Moreover it is possible to add additional compiler options to the syntax
|
||||
" checking execution via the variable 'g:syntastic_c_compiler_options':
|
||||
"
|
||||
" let g:syntastic_c_compiler_options = ' -ansi'
|
||||
|
||||
if exists('loaded_c_syntax_checker')
|
||||
finish
|
||||
endif
|
||||
let loaded_c_syntax_checker = 1
|
||||
|
||||
if !executable('gcc')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let s:default_includes = [ '.', '..', 'include', 'includes',
|
||||
\ '../include', '../includes' ]
|
||||
|
||||
function! s:GetIncludeDirs()
|
||||
let include_dirs = s:default_includes
|
||||
|
||||
if exists('g:syntastic_c_include_dirs')
|
||||
" TODO: check for duplicates
|
||||
call extend(include_dirs, g:syntastic_c_include_dirs)
|
||||
endif
|
||||
|
||||
return join(map(copy(include_dirs), '"-I" . v:val'), ' ')
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_c_GetLocList()
|
||||
let makeprg = 'gcc -fsyntax-only '.shellescape(expand('%')).
|
||||
\ ' '.s:GetIncludeDirs()
|
||||
let errorformat = '%-G%f:%s:,%-G%f:%l: %#error: %#(Each undeclared '.
|
||||
\ 'identifier is reported only%.%#,%-G%f:%l: %#error: %#for '.
|
||||
\ 'each function it appears%.%#,%-GIn file included%.%#,'.
|
||||
\ '%-G %#from %f:%l\,,%f:%l:%c: %m,%f:%l: %trror: %m,%f:%l: %m'
|
||||
|
||||
if expand('%') =~? '.h$'
|
||||
if exists('g:syntastic_c_check_header')
|
||||
let makeprg = 'gcc -c '.shellescape(expand('%')).
|
||||
\ ' '.s:GetIncludeDirs()
|
||||
else
|
||||
return []
|
||||
endif
|
||||
endif
|
||||
|
||||
if exists('g:syntastic_c_compiler_options')
|
||||
let makeprg .= g:syntastic_c_compiler_options
|
||||
endif
|
||||
|
||||
if !exists('b:syntastic_c_cflags')
|
||||
if !exists('g:syntastic_c_no_include_search') ||
|
||||
\ g:syntastic_c_no_include_search != 1
|
||||
if exists('g:syntastic_c_auto_refresh_includes') &&
|
||||
\ g:syntastic_c_auto_refresh_includes != 0
|
||||
let makeprg .= syntastic#SearchHeaders()
|
||||
else
|
||||
if !exists('b:syntastic_c_includes')
|
||||
let b:syntastic_c_includes = syntastic#SearchHeaders()
|
||||
endif
|
||||
let makeprg .= b:syntastic_c_includes
|
||||
endif
|
||||
endif
|
||||
else
|
||||
let makeprg .= b:syntastic_c_cflags
|
||||
endif
|
||||
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
endfunction
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set et sts=4 sw=4:
|
@ -1,27 +0,0 @@
|
||||
"============================================================================
|
||||
"File: coffee.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Lincoln Stoll <l@lds.li>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
if exists("loaded_coffee_syntax_checker")
|
||||
finish
|
||||
endif
|
||||
let loaded_coffee_syntax_checker = 1
|
||||
|
||||
"bail if the user doesnt have coffee installed
|
||||
if !executable("coffee")
|
||||
finish
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_coffee_GetLocList()
|
||||
let makeprg = 'coffee -c -l -o /tmp %'
|
||||
let errorformat = '%EError: In %f\, Parse error on line %l: %m,%EError: In %f\, %m on line %l,%W%f(%l): lint warning: %m,%-Z%p^,%W%f(%l): warning: %m,%-Z%p^,%E%f(%l): SyntaxError: %m,%-Z%p^,%-G'
|
||||
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
endfunction
|
@ -1,94 +0,0 @@
|
||||
"============================================================================
|
||||
"File: cpp.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Gregor Uhlenheuer <kongo2002 at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
" in order to also check header files add this to your .vimrc:
|
||||
" (this usually creates a .gch file in your source directory)
|
||||
"
|
||||
" let g:syntastic_cpp_check_header = 1
|
||||
"
|
||||
" To disable the search of included header files after special
|
||||
" libraries like gtk and glib add this line to your .vimrc:
|
||||
"
|
||||
" let g:syntastic_cpp_no_include_search = 1
|
||||
"
|
||||
" To enable header files being re-checked on every file write add the
|
||||
" following line to your .vimrc. Otherwise the header files are checked only
|
||||
" one time on initially loading the file.
|
||||
" In order to force syntastic to refresh the header includes simply
|
||||
" unlet b:syntastic_cpp_includes. Then the header files are being re-checked
|
||||
" on the next file write.
|
||||
"
|
||||
" let g:syntastic_cpp_auto_refresh_includes = 1
|
||||
"
|
||||
" Alternatively you can set the buffer local variable b:syntastic_cpp_cflags.
|
||||
" If this variable is set for the current buffer no search for additional
|
||||
" libraries is done. I.e. set the variable like this:
|
||||
"
|
||||
" let b:syntastic_cpp_cflags = ' -I/usr/include/libsoup-2.4'
|
||||
"
|
||||
" Moreover it is possible to add additional compiler options to the syntax
|
||||
" checking execution via the variable 'g:syntastic_cpp_compiler_options':
|
||||
"
|
||||
" let g:syntastic_cpp_compiler_options = ' -std=c++0x'
|
||||
|
||||
if exists('loaded_cpp_syntax_checker')
|
||||
finish
|
||||
endif
|
||||
let loaded_cpp_syntax_checker = 1
|
||||
|
||||
if !executable('g++')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_cpp_GetLocList()
|
||||
let makeprg = 'g++ -fsyntax-only '.shellescape(expand('%'))
|
||||
let errorformat = '%-G%f:%s:,%f:%l:%c: %m,%f:%l: %m'
|
||||
|
||||
if expand('%') =~? '\%(.h\|.hpp\|.hh\)$'
|
||||
if exists('g:syntastic_cpp_check_header')
|
||||
let makeprg = 'g++ -c '.shellescape(expand('%'))
|
||||
else
|
||||
return []
|
||||
endif
|
||||
endif
|
||||
|
||||
if exists('g:syntastic_cpp_compiler_options')
|
||||
let makeprg .= g:syntastic_cpp_compiler_options
|
||||
endif
|
||||
|
||||
if !exists('b:syntastic_cpp_cflags')
|
||||
if !exists('g:syntastic_cpp_no_include_search') ||
|
||||
\ g:syntastic_cpp_no_include_search != 1
|
||||
if exists('g:syntastic_cpp_auto_refresh_includes') &&
|
||||
\ g:syntastic_cpp_auto_refresh_includes != 0
|
||||
let makeprg .= syntastic#SearchHeaders()
|
||||
else
|
||||
if !exists('b:syntastic_cpp_includes')
|
||||
let b:syntastic_cpp_includes = syntastic#SearchHeaders()
|
||||
endif
|
||||
let makeprg .= b:syntastic_cpp_includes
|
||||
endif
|
||||
endif
|
||||
else
|
||||
let makeprg .= b:syntastic_cpp_cflags
|
||||
endif
|
||||
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
endfunction
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set et sts=4 sw=4:
|
@ -1,34 +0,0 @@
|
||||
"============================================================================
|
||||
"File: css.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim using `csslint` CLI tool (http://csslint.net).
|
||||
"Maintainer: Ory Band <oryband at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"============================================================================
|
||||
if exists("loaded_css_syntax_checker")
|
||||
finish
|
||||
endif
|
||||
let loaded_css_syntax_checker = 1
|
||||
|
||||
" Bail if the user doesn't have `csslint` installed.
|
||||
if !executable("csslint")
|
||||
finish
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_css_GetLocList()
|
||||
let makeprg = 'csslint --format=compact '.shellescape(expand('%'))
|
||||
|
||||
" Print CSS Lint's error/warning messages from compact format. Ignores blank lines.
|
||||
let errorformat = '%-G,%-G%f: lint free!,%f: line %l\, col %c\, %trror - %m,%f: line %l\, col %c\, %tarning - %m,%f: line %l\, col %c\, %m,'
|
||||
|
||||
let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
|
||||
for i in loclist
|
||||
let i['bufnr'] = bufnr("")
|
||||
endfor
|
||||
|
||||
return loclist
|
||||
endfunction
|
@ -1,27 +0,0 @@
|
||||
"============================================================================
|
||||
"File: cucumber.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
if exists("loaded_cucumber_syntax_checker")
|
||||
finish
|
||||
endif
|
||||
let loaded_cucumber_syntax_checker = 1
|
||||
|
||||
"bail if the user doesnt have cucumber installed
|
||||
if !executable("cucumber")
|
||||
finish
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_cucumber_GetLocList()
|
||||
let makeprg = 'cucumber --dry-run --quiet --strict --format pretty '.shellescape(expand('%'))
|
||||
let errorformat = '%f:%l:%c:%m,%W %.%# (%m),%-Z%f:%l:%.%#,%-G%.%#'
|
||||
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
endfunction
|
@ -1,40 +0,0 @@
|
||||
"============================================================================
|
||||
"File: cuda.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"
|
||||
"Author: Hannes Schulz <schulz at ais dot uni-bonn dot de>
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
" in order to also check header files add this to your .vimrc:
|
||||
" (this creates an empty .syntastic_dummy.cu file in your source directory)
|
||||
"
|
||||
" let g:syntastic_cuda_check_header = 1
|
||||
|
||||
if exists('loaded_cuda_syntax_checker')
|
||||
finish
|
||||
endif
|
||||
let loaded_cuda_syntax_checker = 1
|
||||
|
||||
if !exists('g:syntastic_nvcc_binary')
|
||||
let g:syntastic_nvcc_binary = '/usr/local/cuda/bin/nvcc'
|
||||
endif
|
||||
if !executable('/usr/local/cuda/bin/nvcc')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_cuda_GetLocList()
|
||||
let makeprg = g:syntastic_nvcc_binary.' --cuda -O0 -I . -Xcompiler -fsyntax-only '.shellescape(expand('%')).' -o /dev/null'
|
||||
"let errorformat = '%-G%f:%s:,%f:%l:%c: %m,%f:%l: %m'
|
||||
let errorformat = '%*[^"]"%f"%*\D%l: %m,"%f"%*\D%l: %m,%-G%f:%l: (Each undeclared identifier is reported only once,%-G%f:%l: for each function it appears in.),%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,"%f"\, line %l%*\D%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,%f|%l| %m'
|
||||
|
||||
if expand('%') =~? '\%(.h\|.hpp\|.cuh\)$'
|
||||
if exists('g:syntastic_cuda_check_header')
|
||||
let makeprg = 'echo > .syntastic_dummy.cu ; '.g:syntastic_nvcc_binary.' --cuda -O0 -I . .syntastic_dummy.cu -Xcompiler -fsyntax-only -include '.shellescape(expand('%')).' -o /dev/null'
|
||||
else
|
||||
return []
|
||||
endif
|
||||
endif
|
||||
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
endfunction
|
@ -1,29 +0,0 @@
|
||||
"============================================================================
|
||||
"File: docbk.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
if exists("loaded_docbk_syntax_checker")
|
||||
finish
|
||||
endif
|
||||
let loaded_docbk_syntax_checker = 1
|
||||
|
||||
"bail if the user doesnt have tidy or grep installed
|
||||
if !executable("xmllint")
|
||||
finish
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_docbk_GetLocList()
|
||||
|
||||
let makeprg="xmllint --xinclude --noout --postvalid %"
|
||||
let errorformat='%E%f:%l: parser error : %m,%W%f:%l: parser warning : %m,%E%f:%l:%.%# validity error : %m,%W%f:%l:%.%# validity warning : %m,%-Z%p^,%-C%.%#,%-G%.%#'
|
||||
let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
|
||||
return loclist
|
||||
endfunction
|
@ -1,33 +0,0 @@
|
||||
"============================================================================
|
||||
"File: eruby.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
if exists("loaded_eruby_syntax_checker")
|
||||
finish
|
||||
endif
|
||||
let loaded_eruby_syntax_checker = 1
|
||||
|
||||
"bail if the user doesnt have ruby or cat installed
|
||||
if !executable("ruby") || !executable("cat")
|
||||
finish
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_eruby_GetLocList()
|
||||
let makeprg='sed "s/<\%=/<\%/g" '. shellescape(expand("%")) . ' \| RUBYOPT= ruby -e "require \"erb\"; puts ERB.new(ARGF.read, nil, \"-\").src" \| RUBYOPT= ruby -c'
|
||||
let errorformat='%-GSyntax OK,%E-:%l: syntax error\, %m,%Z%p^,%W-:%l: warning: %m,%Z%p^,%-C%.%#'
|
||||
let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
|
||||
"the file name isnt in the output so stick in the buf num manually
|
||||
for i in loclist
|
||||
let i['bufnr'] = bufnr("")
|
||||
endfor
|
||||
|
||||
return loclist
|
||||
endfunction
|
@ -1,27 +0,0 @@
|
||||
"============================================================================
|
||||
"File: go.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Sam Nguyen <samxnguyen@gmail.com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
if exists("loaded_go_syntax_checker")
|
||||
finish
|
||||
endif
|
||||
let loaded_go_syntax_checker = 1
|
||||
|
||||
"bail if the user doesnt have 6g installed
|
||||
if !executable("6g")
|
||||
finish
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_go_GetLocList()
|
||||
let makeprg = '6g -o /dev/null %'
|
||||
let errorformat = '%E%f:%l: %m'
|
||||
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
endfunction
|
@ -1,26 +0,0 @@
|
||||
"============================================================================
|
||||
"File: haml.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
if exists("loaded_haml_syntax_checker")
|
||||
finish
|
||||
endif
|
||||
let loaded_haml_syntax_checker = 1
|
||||
|
||||
"bail if the user doesnt have the haml binary installed
|
||||
if !executable("haml")
|
||||
finish
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_haml_GetLocList()
|
||||
let makeprg = "haml -c " . shellescape(expand("%"))
|
||||
let errorformat = 'Haml error on line %l: %m,Syntax error on line %l: %m,%-G%.%#'
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
endfunction
|
@ -1,34 +0,0 @@
|
||||
"============================================================================
|
||||
"File: haskell.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Anthony Carapetis <anthony.carapetis at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
if exists("loaded_haskell_syntax_checker")
|
||||
finish
|
||||
endif
|
||||
let loaded_haskell_syntax_checker = 1
|
||||
|
||||
"bail if the user doesnt have ghc-mod installed
|
||||
if !executable("ghc-mod")
|
||||
finish
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_haskell_GetLocList()
|
||||
let makeprg =
|
||||
\ 'ghc-mod check '. shellescape(expand('%')) .
|
||||
\ ' && ghc-mod lint ' . shellescape(expand('%'))
|
||||
let errorformat = '%-G\\s%#,%f:%l:%c:%m,%E%f:%l:%c:,%Z%m,'
|
||||
|
||||
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_lhaskell_GetLocList()
|
||||
return SyntaxCheckers_haskell_GetLocList()
|
||||
endfunction
|
@ -1,55 +0,0 @@
|
||||
"============================================================================
|
||||
"File: html.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
if exists("loaded_html_syntax_checker")
|
||||
finish
|
||||
endif
|
||||
let loaded_html_syntax_checker = 1
|
||||
|
||||
"bail if the user doesnt have tidy or grep installed
|
||||
if !executable("tidy") || !executable("grep")
|
||||
finish
|
||||
endif
|
||||
|
||||
" TODO: join this with xhtml.vim for DRY's sake?
|
||||
function! s:TidyEncOptByFenc()
|
||||
let tidy_opts = {
|
||||
\'utf-8' : '-utf8',
|
||||
\'ascii' : '-ascii',
|
||||
\'latin1' : '-latin1',
|
||||
\'iso-2022-jp' : '-iso-2022',
|
||||
\'cp1252' : '-win1252',
|
||||
\'macroman' : '-mac',
|
||||
\'utf-16le' : '-utf16le',
|
||||
\'utf-16' : '-utf16',
|
||||
\'big5' : '-big5',
|
||||
\'sjis' : '-shiftjis',
|
||||
\'cp850' : '-ibm858',
|
||||
\}
|
||||
return get(tidy_opts, &fileencoding, '-utf8')
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_html_GetLocList()
|
||||
|
||||
"grep out the '<table> lacks "summary" attribute' since it is almost
|
||||
"always present and almost always useless
|
||||
let encopt = s:TidyEncOptByFenc()
|
||||
let makeprg="tidy ".encopt." --new-blocklevel-tags 'section, article, aside, hgroup, header, footer, nav, figure, figcaption' --new-inline-tags 'video, audio, embed, mark, progress, meter, time, ruby, rt, rp, canvas, command, details, datalist' --new-empty-tags 'wbr, keygen' -e ".shellescape(expand('%'))." 2>&1 \\| grep -v '\<table\> lacks \"summary\" attribute' \\| grep -v 'not approved by W3C' \\| grep -v 'attribute \"placeholder\"'"
|
||||
let errorformat='%Wline %l column %c - Warning: %m,%Eline %l column %c - Error: %m,%-G%.%#,%-G%.%#'
|
||||
let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
|
||||
"the file name isnt in the output so stick in the buf num manually
|
||||
for i in loclist
|
||||
let i['bufnr'] = bufnr("")
|
||||
endfor
|
||||
|
||||
return loclist
|
||||
endfunction
|
@ -1,92 +0,0 @@
|
||||
"============================================================================
|
||||
"File: javascript.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim using jslin/jshint
|
||||
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
" Added changes from Matthew Kitt's javascript.vim to support jshint.
|
||||
" Will use jsl if it's found, if not it looks for jshint.
|
||||
"============================================================================
|
||||
if exists("loaded_javascript_syntax_checker")
|
||||
finish
|
||||
endif
|
||||
let loaded_javascript_syntax_checker = 1
|
||||
|
||||
" Use google's gjslint if the user has it installed
|
||||
if executable("gjslint")
|
||||
if !exists("g:syntastic_gjslint_conf")
|
||||
let g:syntastic_gjslint_conf = ""
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_javascript_GetLocList()
|
||||
if empty(g:syntastic_gjslint_conf)
|
||||
let gjslintconf = ""
|
||||
else
|
||||
let gjslintconf = g:syntastic_gjslint_conf
|
||||
endif
|
||||
let makeprg = "gjslint" . gjslintconf . " --nosummary --unix_mode --nodebug_indentation --nobeep " . shellescape(expand('%'))
|
||||
let errorformat="%f:%l:(New Error %n) %m,%f:%l:(%n) %m,%-G1 files checked, no errors found.,%-G%.%#"
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
endfunction
|
||||
" We're using google gjslint, finished.
|
||||
finish
|
||||
endif
|
||||
|
||||
" Use node jslint if the user has it installed
|
||||
if executable("jslint")
|
||||
if !exists("g:syntastic_jslint_conf")
|
||||
let g:syntastic_jslint_conf = ""
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_javascript_GetLocList()
|
||||
if empty(g:syntastic_jslint_conf)
|
||||
let jslintconf = ""
|
||||
else
|
||||
let jslintconf = g:syntastic_jslint_conf
|
||||
endif
|
||||
let makeprg = "jslint" . jslintconf . " " . shellescape(expand('%'))
|
||||
let errorformat='%-P%f,%*[ ]%n %l\,%c: %m,%-G%.%#'
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
endfunction
|
||||
" We're using node jslint, finished.
|
||||
finish
|
||||
endif
|
||||
|
||||
" Use jsl if the user has it installed
|
||||
if executable("jsl")
|
||||
if !exists("g:syntastic_jsl_conf")
|
||||
let g:syntastic_jsl_conf = ""
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_javascript_GetLocList()
|
||||
if empty(g:syntastic_jsl_conf)
|
||||
let jslconf = ""
|
||||
else
|
||||
let jslconf = " -conf " . g:syntastic_jsl_conf
|
||||
endif
|
||||
let makeprg = "jsl" . jslconf . " -nologo -nofilelisting -nosummary -nocontext -process ".shellescape(expand('%'))
|
||||
let errorformat='%W%f(%l): lint warning: %m,%-Z%p^,%W%f(%l): warning: %m,%-Z%p^,%E%f(%l): SyntaxError: %m,%-Z%p^,%-G'
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
endfunction
|
||||
" We're using jsl, finished.
|
||||
finish
|
||||
endif
|
||||
|
||||
" The user didn't have jsl, try with jshint instead
|
||||
if !executable('jshint')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_javascript_GetLocList()
|
||||
if exists('s:config')
|
||||
let makeprg = 'jshint ' . shellescape(expand("%")) . ' --config ' . s:config
|
||||
else
|
||||
let makeprg = 'jshint ' . shellescape(expand("%"))
|
||||
endif
|
||||
let errorformat = '%f: line %l\, col %c\, %m,%-G%.%#'
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
endfunction
|
@ -1,37 +0,0 @@
|
||||
"============================================================================
|
||||
"File: less.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Julien Blanchard <julien at sideburns dot eu>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
if exists("loaded_less_syntax_checker")
|
||||
finish
|
||||
endif
|
||||
let loaded_less_syntax_checker = 1
|
||||
|
||||
"bail if the user doesnt have the lessc binary installed
|
||||
if !executable("lessc")
|
||||
finish
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_less_GetLocList()
|
||||
let makeprg = 'lessc '. shellescape(expand('%')) . ' /dev/null'
|
||||
let errorformat = 'Syntax %trror on line %l,! Syntax %trror: on line %l: %m,%-G%.%#'
|
||||
let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
|
||||
for i in errors
|
||||
let i['bufnr'] = bufnr("")
|
||||
|
||||
if empty(i['text'])
|
||||
let i['text'] = "Syntax error"
|
||||
endif
|
||||
endfor
|
||||
|
||||
return errors
|
||||
endfunction
|
||||
|
@ -1,62 +0,0 @@
|
||||
"============================================================================
|
||||
"File: lua.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Gregor Uhlenheuer <kongo2002 at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
if exists('loaded_lua_syntax_checker')
|
||||
finish
|
||||
endif
|
||||
let loaded_lua_syntax_checker = 1
|
||||
|
||||
" check if the lua compiler is installed
|
||||
if !executable('luac')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_lua_Term(pos)
|
||||
let near = matchstr(a:pos['text'], "near '[^']\\+'")
|
||||
let result = ''
|
||||
if len(near) > 0
|
||||
let near = split(near, "'")[1]
|
||||
if near == '<eof>'
|
||||
let p = getpos('$')
|
||||
let a:pos['lnum'] = p[1]
|
||||
let a:pos['col'] = p[2]
|
||||
let result = '\%'.p[2].'c'
|
||||
else
|
||||
let result = '\V'.near
|
||||
endif
|
||||
let open = matchstr(a:pos['text'], "(to close '[^']\\+' at line [0-9]\\+)")
|
||||
if len(open) > 0
|
||||
let oline = split(open, "'")[1:2]
|
||||
let line = 0+strpart(oline[1], 9)
|
||||
call matchadd('SpellCap', '\%'.line.'l\V'.oline[0])
|
||||
endif
|
||||
endif
|
||||
return result
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_lua_GetLocList()
|
||||
let makeprg = 'luac -p ' . shellescape(expand('%'))
|
||||
let errorformat = 'luac: %#%f:%l: %m'
|
||||
|
||||
let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
|
||||
let bufn = bufnr('')
|
||||
for pos in loclist
|
||||
let pos['bufnr'] = bufn
|
||||
let pos['type'] = 'E'
|
||||
endfor
|
||||
|
||||
call syntastic#HighlightErrors(loclist, function("SyntaxCheckers_lua_Term"))
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
@ -1,34 +0,0 @@
|
||||
"============================================================================
|
||||
"File: matlab.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Jason Graham <jason at the-graham dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
if exists("loaded_matlab_syntax_checker")
|
||||
finish
|
||||
endif
|
||||
let loaded_matlab_syntax_checker = 1
|
||||
|
||||
"bail if the user doesn't have mlint installed
|
||||
if !executable("mlint")
|
||||
finish
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_matlab_GetLocList()
|
||||
let makeprg = 'mlint -id $* '.shellescape(expand('%'))
|
||||
let errorformat = 'L %l (C %c): %*[a-zA-Z0-9]: %m,L %l (C %c-%*[0-9]): %*[a-zA-Z0-9]: %m'
|
||||
let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
|
||||
for i in loclist
|
||||
let i['bufnr'] = bufnr("")
|
||||
endfor
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
@ -1,35 +0,0 @@
|
||||
"============================================================================
|
||||
"File: perl.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Anthony Carapetis <anthony.carapetis at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
" This checker requires efm_perl.pl, which is distributed with Vim version
|
||||
" seven and greater, as far as I know.
|
||||
|
||||
if exists("loaded_perl_syntax_checker")
|
||||
finish
|
||||
endif
|
||||
let loaded_perl_syntax_checker = 1
|
||||
|
||||
"bail if the user doesnt have perl installed
|
||||
if !executable("perl")
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists("g:syntastic_perl_efm_program")
|
||||
let g:syntastic_perl_efm_program = $VIMRUNTIME.'/tools/efm_perl.pl -c'
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_perl_GetLocList()
|
||||
let makeprg = g:syntastic_perl_efm_program . ' ' . shellescape(expand('%'))
|
||||
let errorformat = '%f:%l:%m'
|
||||
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
endfunction
|
@ -1,36 +0,0 @@
|
||||
"============================================================================
|
||||
"File: php.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
if exists("loaded_php_syntax_checker")
|
||||
finish
|
||||
endif
|
||||
let loaded_php_syntax_checker = 1
|
||||
|
||||
"bail if the user doesnt have php installed
|
||||
if !executable("php")
|
||||
finish
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_php_Term(item)
|
||||
let unexpected = matchstr(a:item['text'], "unexpected '[^']\\+'")
|
||||
if len(unexpected) < 1 | return '' | end
|
||||
return '\V'.split(unexpected, "'")[1]
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_php_GetLocList()
|
||||
let makeprg = "php -l ".shellescape(expand('%'))
|
||||
let errorformat='%-GNo syntax errors detected in%.%#,PHP Parse error: %#syntax %trror\, %m in %f on line %l,PHP Fatal %trror: %m in %f on line %l,%-GErrors parsing %.%#,%-G\s%#,Parse error: %#syntax %trror\, %m in %f on line %l,Fatal %trror: %m in %f on line %l'
|
||||
let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
|
||||
call syntastic#HighlightErrors(errors, function('SyntaxCheckers_php_Term'))
|
||||
|
||||
return errors
|
||||
endfunction
|
@ -1,38 +0,0 @@
|
||||
"============================================================================
|
||||
"File: puppet.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Eivind Uggedal <eivind at uggedal dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
if exists("loaded_puppet_syntax_checker")
|
||||
finish
|
||||
endif
|
||||
let loaded_puppet_syntax_checker = 1
|
||||
|
||||
"bail if the user doesnt have puppet installed
|
||||
if !executable("puppet")
|
||||
finish
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_puppet_GetLocList()
|
||||
let l:puppetVersion = system("puppet --version")
|
||||
let l:digits = split(l:puppetVersion, "\\.")
|
||||
"
|
||||
" If it is on the 2.7 series... use new executable
|
||||
if l:digits[0] == '2' && l:digits[1] == '7'
|
||||
let makeprg = 'puppet parser validate ' .
|
||||
\ shellescape(expand('%')) .
|
||||
\ ' --color=false'
|
||||
else
|
||||
let makeprg = 'puppet --color=false --parseonly '.shellescape(expand('%'))
|
||||
endif
|
||||
|
||||
let errorformat = 'err: Could not parse for environment %*[a-z]: %m at %f:%l'
|
||||
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
endfunction
|
@ -1,35 +0,0 @@
|
||||
if exists("loaded_python_syntax_checker")
|
||||
finish
|
||||
endif
|
||||
let loaded_python_syntax_checker = 1
|
||||
|
||||
"bail if the user doesnt have pyflakes installed
|
||||
if !executable("pyflakes")
|
||||
finish
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_python_Term(i)
|
||||
if a:i['type'] ==# 'E'
|
||||
let a:i['text'] = "Syntax error"
|
||||
endif
|
||||
if match(a:i['text'], 'is assigned to but never used') > -1
|
||||
\ || match(a:i['text'], 'imported but unused') > -1
|
||||
\ || match(a:i['text'], 'undefined name') > -1
|
||||
\ || match(a:i['text'], 'redefinition of unused') > -1
|
||||
|
||||
let term = split(a:i['text'], "'", 1)[1]
|
||||
return '\V'.term
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_python_GetLocList()
|
||||
let makeprg = 'pyflakes '.shellescape(expand('%'))
|
||||
let errorformat = '%E%f:%l: could not compile,%-Z%p^,%W%f:%l: %m,%-G%.%#'
|
||||
|
||||
let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
|
||||
call syntastic#HighlightErrors(errors, function('SyntaxCheckers_python_Term'))
|
||||
|
||||
return errors
|
||||
endfunction
|
@ -1,32 +0,0 @@
|
||||
"============================================================================
|
||||
"File: ruby.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
if exists("loaded_ruby_syntax_checker")
|
||||
finish
|
||||
endif
|
||||
let loaded_ruby_syntax_checker = 1
|
||||
|
||||
"bail if the user doesnt have ruby installed
|
||||
if !executable("ruby")
|
||||
finish
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_ruby_GetLocList()
|
||||
" we cannot set RUBYOPT on windows like that
|
||||
if has('win32') || has('win64')
|
||||
let makeprg = 'ruby -W1 -T1 -c '.shellescape(expand('%'))
|
||||
else
|
||||
let makeprg = 'RUBYOPT= ruby -W1 -c '.shellescape(expand('%'))
|
||||
endif
|
||||
let errorformat = '%-GSyntax OK,%E%f:%l: syntax error\, %m,%Z%p^,%W%f:%l: warning: %m,%Z%p^,%W%f:%l: %m,%-C%.%#'
|
||||
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
endfunction
|
@ -1,64 +0,0 @@
|
||||
"============================================================================
|
||||
"File: sass.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
if exists("loaded_sass_syntax_checker")
|
||||
finish
|
||||
endif
|
||||
let loaded_sass_syntax_checker = 1
|
||||
|
||||
"bail if the user doesnt have the sass binary installed
|
||||
if !executable("sass")
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:syntastic_sass_imports = 0
|
||||
|
||||
function! SyntaxCheckers_sass_GetLocList()
|
||||
"use compass imports if available
|
||||
if g:syntastic_sass_imports == 0 && executable("compass")
|
||||
let g:syntastic_sass_imports = "--compass"
|
||||
else
|
||||
let g:syntastic_sass_imports = ""
|
||||
endif
|
||||
|
||||
let makeprg='sass '.g:syntastic_sass_imports.' --check '.shellescape(expand('%'))
|
||||
let errorformat = '%ESyntax %trror:%m,%C on line %l of %f,%Z%m'
|
||||
let errorformat .= ',%Wwarning on line %l:,%Z%m,Syntax %trror on line %l: %m'
|
||||
let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
|
||||
let bn = bufnr("")
|
||||
for i in loclist
|
||||
let i['bufnr'] = bn
|
||||
endfor
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_scss_GetLocList()
|
||||
"use compass imports if available
|
||||
if g:syntastic_sass_imports == 0 && executable("compass")
|
||||
let g:syntastic_sass_imports = system("compass imports")
|
||||
else
|
||||
let g:syntastic_sass_imports = ""
|
||||
endif
|
||||
|
||||
let makeprg='sass '.g:syntastic_sass_imports.' --check '.shellescape(expand('%'))
|
||||
let errorformat = '%ESyntax %trror:%m,%C on line %l of %f,%Z%m'
|
||||
let errorformat .= ',%Wwarning on line %l:,%Z%m,Syntax %trror on line %l: %m'
|
||||
let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
|
||||
let bn = bufnr("")
|
||||
for i in loclist
|
||||
let i['bufnr'] = bn
|
||||
endfor
|
||||
|
||||
return loclist
|
||||
endfunction
|
@ -1,52 +0,0 @@
|
||||
"============================================================================
|
||||
"File: sh.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Gregor Uhlenheuer <kongo2002 at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
if exists('loaded_sh_syntax_checker')
|
||||
finish
|
||||
endif
|
||||
let loaded_sh_syntax_checker = 1
|
||||
|
||||
function! GetShell()
|
||||
let shebang = getbufline(bufnr('%'), 1)[0]
|
||||
if len(shebang) > 0
|
||||
if match(shebang, 'bash') >= 0
|
||||
return 'bash'
|
||||
elseif match(shebang, 'zsh') >= 0
|
||||
return 'zsh'
|
||||
elseif match(shebang, 'sh') >= 0
|
||||
return 'sh'
|
||||
endif
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_sh_GetLocList()
|
||||
if !exists('b:shell')
|
||||
let b:shell = GetShell()
|
||||
endif
|
||||
if len(b:shell) == 0 || !executable(b:shell)
|
||||
return []
|
||||
endif
|
||||
let output = split(system(b:shell.' -n '.shellescape(expand('%'))), '\n')
|
||||
if v:shell_error != 0
|
||||
let result = []
|
||||
for err_line in output
|
||||
let line = substitute(err_line, '^[^:]*:\D\{-}\(\d\+\):.*', '\1', '')
|
||||
let msg = substitute(err_line, '^[^:]*:\D\{-}\d\+: \(.*\)', '\1', '')
|
||||
call add(result, {'lnum' : line,
|
||||
\ 'text' : msg,
|
||||
\ 'bufnr': bufnr(''),
|
||||
\ 'type': 'E' })
|
||||
endfor
|
||||
return result
|
||||
endif
|
||||
return []
|
||||
endfunction
|
@ -1,28 +0,0 @@
|
||||
"============================================================================
|
||||
"File: tcl.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Eric Thomas <eric.l.m.thomas at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
if exists("loaded_tcl_syntax_checker")
|
||||
finish
|
||||
endif
|
||||
let loaded_tcl_syntax_checker = 1
|
||||
|
||||
"bail if the user doesnt have tclsh installed
|
||||
if !executable("tclsh")
|
||||
finish
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_tcl_GetLocList()
|
||||
let makeprg = 'tclsh '.shellescape(expand('%'))
|
||||
let errorformat = '%f:%l:%m'
|
||||
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
endfunction
|
@ -1,26 +0,0 @@
|
||||
"============================================================================
|
||||
"File: tex.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
if exists("loaded_tex_syntax_checker")
|
||||
finish
|
||||
endif
|
||||
let loaded_tex_syntax_checker = 1
|
||||
|
||||
"bail if the user doesnt have lacheck installed
|
||||
if !executable("lacheck")
|
||||
finish
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_tex_GetLocList()
|
||||
let makeprg = 'lacheck '.shellescape(expand('%'))
|
||||
let errorformat = '%-G** %f:,%E"%f"\, line %l: %m'
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
endfunction
|
@ -1,56 +0,0 @@
|
||||
"============================================================================
|
||||
"File: vala.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Konstantin Stepanov (me@kstep.me)
|
||||
"Notes: Add special comment line into your vala file starting with
|
||||
" "// modules: " and containing space delimited list of vala
|
||||
" modules, used by the file, so this script can build correct
|
||||
" --pkg arguments.
|
||||
" Valac compiler is not the fastest thing in the world, so you
|
||||
" may want to disable this plugin with
|
||||
" let g:syntastic_vala_check_disabled = 1 command in your .vimrc or
|
||||
" command line. Unlet this variable to set it to 0 to reenable
|
||||
" this checker.
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
if exists('loaded_vala_syntax_checker')
|
||||
finish
|
||||
endif
|
||||
let loaded_vala_syntax_checker = 1
|
||||
|
||||
if !executable('valac')
|
||||
finish
|
||||
endif
|
||||
|
||||
if exists('g:syntastic_vala_check_disabled') && g:syntastic_vala_check_disabled
|
||||
finish
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_vala_Term(pos)
|
||||
let strlength = strlen(matchstr(a:pos['text'], '\^\+$'))
|
||||
return '\%>'.(a:pos.col-1).'c.*\%<'.(a:pos.col+strlength+1).'c'
|
||||
endfunction
|
||||
|
||||
function! s:GetValaModules()
|
||||
let modules_line = search('^// modules: ', 'n')
|
||||
let modules_str = getline(modules_line)
|
||||
let modules = split(strpart(modules_str, 12), '\s\+')
|
||||
return modules
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_vala_GetLocList()
|
||||
let vala_pkg_args = join(map(s:GetValaModules(), '"--pkg ".v:val'), ' ')
|
||||
let makeprg = 'valac -C ' . vala_pkg_args . ' ' .shellescape(expand('%'))
|
||||
let errorformat = '%A%f:%l.%c-%\d%\+.%\d%\+: %t%[a-z]%\+: %m,%C%m,%Z%m'
|
||||
|
||||
let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
call syntastic#HighlightErrors(loclist, function("SyntaxCheckers_vala_Term"), 1)
|
||||
return loclist
|
||||
endfunction
|
||||
|
@ -1,53 +0,0 @@
|
||||
"============================================================================
|
||||
"File: xhtml.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
if exists("loaded_xhtml_syntax_checker")
|
||||
finish
|
||||
endif
|
||||
let loaded_xhtml_syntax_checker = 1
|
||||
|
||||
"bail if the user doesnt have tidy or grep installed
|
||||
if !executable("tidy")
|
||||
finish
|
||||
endif
|
||||
|
||||
" TODO: join this with html.vim DRY's sake?
|
||||
function! s:TidyEncOptByFenc()
|
||||
let tidy_opts = {
|
||||
\'utf-8' : '-utf8',
|
||||
\'ascii' : '-ascii',
|
||||
\'latin1' : '-latin1',
|
||||
\'iso-2022-jp' : '-iso-2022',
|
||||
\'cp1252' : '-win1252',
|
||||
\'macroman' : '-mac',
|
||||
\'utf-16le' : '-utf16le',
|
||||
\'utf-16' : '-utf16',
|
||||
\'big5' : '-big5',
|
||||
\'sjis' : '-shiftjis',
|
||||
\'cp850' : '-ibm858',
|
||||
\}
|
||||
return get(tidy_opts, &fileencoding, '-utf8')
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_xhtml_GetLocList()
|
||||
|
||||
let encopt = s:TidyEncOptByFenc()
|
||||
let makeprg="tidy ".encopt." -xml -e ".shellescape(expand('%'))
|
||||
let errorformat='%Wline %l column %c - Warning: %m,%Eline %l column %c - Error: %m,%-G%.%#,%-G%.%#'
|
||||
let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
|
||||
"the file name isnt in the output so stick in the buf num manually
|
||||
for i in loclist
|
||||
let i['bufnr'] = bufnr("")
|
||||
endfor
|
||||
|
||||
return loclist
|
||||
endfunction
|
@ -1,37 +0,0 @@
|
||||
"============================================================================
|
||||
"File: xml.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Sebastian Kusnier <sebastian at kusnier dot net>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
if exists("loaded_xml_syntax_checker")
|
||||
finish
|
||||
endif
|
||||
let loaded_xml_syntax_checker = 1
|
||||
|
||||
"bail if the user doesnt have tidy or grep installed
|
||||
if !executable("xmllint")
|
||||
finish
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_xml_GetLocList()
|
||||
|
||||
let makeprg="xmllint --xinclude --noout --postvalid %"
|
||||
let errorformat='%E%f:%l:\ error\ :\ %m,
|
||||
\%-G%f:%l:\ validity\ error\ :\ Validation\ failed:\ no\ DTD\ found\ %m,
|
||||
\%W%f:%l:\ warning\ :\ %m,
|
||||
\%W%f:%l:\ validity\ warning\ :\ %m,
|
||||
\%E%f:%l:\ validity\ error\ :\ %m,
|
||||
\%E%f:%l:\ parser\ error\ :\ %m,
|
||||
\%E%f:%l:\ %m,
|
||||
\%-Z%p^,
|
||||
\%-G%.%#'
|
||||
let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
|
||||
return loclist
|
||||
endfunction
|
@ -1,38 +0,0 @@
|
||||
"============================================================================
|
||||
"File: xslt.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Sebastian Kusnier <sebastian at kusnier dot net>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
if exists("loaded_xslt_syntax_checker")
|
||||
finish
|
||||
endif
|
||||
let loaded_xslt_syntax_checker = 1
|
||||
|
||||
"bail if the user doesnt have tidy or grep installed
|
||||
if !executable("xmllint")
|
||||
finish
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_xslt_GetLocList()
|
||||
|
||||
let makeprg="xmllint --xinclude --noout --postvalid %"
|
||||
let errorformat='%E%f:%l:\ error\ :\ %m,
|
||||
\%-G%f:%l:\ validity\ error\ :\ Validation\ failed:\ no\ DTD\ found\ %m,
|
||||
\%W%f:%l:\ warning\ :\ %m,
|
||||
\%W%f:%l:\ validity\ warning\ :\ %m,
|
||||
\%E%f:%l:\ validity\ error\ :\ %m,
|
||||
\%E%f:%l:\ parser\ error\ :\ %m,
|
||||
\%E%f:%l:\ namespace\ error\ :\ %m,
|
||||
\%E%f:%l:\ %m,
|
||||
\%-Z%p^,
|
||||
\%-G%.%#'
|
||||
let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
|
||||
return loclist
|
||||
endfunction
|
Loading…
Reference in New Issue
Block a user