summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2013-06-12 21:29:15 +0200
committerBram Moolenaar <Bram@vim.org>2013-06-12 21:29:15 +0200
commitec7944aaf2d5fd67b7bd59a69d6a393424b6c8f8 (patch)
treed578871973ba7c87e0337dbe90b61d75de667100 /runtime
parentcab465a6d7a7d158c99b04ddc81650b468d82227 (diff)
downloadvim-git-ec7944aaf2d5fd67b7bd59a69d6a393424b6c8f8.tar.gz
Update runtime files.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/autoload/rubycomplete.vim47
-rw-r--r--runtime/compiler/eruby.vim4
-rw-r--r--runtime/compiler/rake.vim35
-rw-r--r--runtime/compiler/rspec.vim22
-rw-r--r--runtime/compiler/ruby.vim27
-rw-r--r--runtime/compiler/rubyunit.vim4
-rw-r--r--runtime/compiler/xmllint.vim11
-rw-r--r--runtime/doc/eval.txt5
-rw-r--r--runtime/doc/gui.txt2
-rw-r--r--runtime/doc/indent.txt46
-rw-r--r--runtime/doc/insert.txt51
-rw-r--r--runtime/doc/map.txt15
-rw-r--r--runtime/doc/options.txt4
-rw-r--r--runtime/doc/starting.txt37
-rw-r--r--runtime/doc/tags17
-rw-r--r--runtime/doc/todo.txt126
-rw-r--r--runtime/filetype.vim8
-rw-r--r--runtime/ftplugin/eruby.vim11
-rw-r--r--runtime/ftplugin/falcon.vim6
-rw-r--r--runtime/ftplugin/gprof.vim14
-rw-r--r--runtime/ftplugin/ruby.vim221
-rw-r--r--runtime/indent/eruby.vim21
-rw-r--r--runtime/indent/falcon.vim455
-rw-r--r--runtime/indent/html.vim648
-rw-r--r--runtime/indent/ruby.vim321
-rw-r--r--runtime/syntax/eruby.vim13
-rw-r--r--runtime/syntax/gprof.vim4
-rw-r--r--runtime/syntax/javascript.vim3
-rw-r--r--runtime/syntax/objc.vim534
-rw-r--r--runtime/syntax/proto.vim74
-rw-r--r--runtime/syntax/ruby.vim137
-rw-r--r--runtime/syntax/xml.vim6
32 files changed, 2102 insertions, 827 deletions
diff --git a/runtime/autoload/rubycomplete.vim b/runtime/autoload/rubycomplete.vim
index f89be52e9..e1064c8a5 100644
--- a/runtime/autoload/rubycomplete.vim
+++ b/runtime/autoload/rubycomplete.vim
@@ -1,9 +1,7 @@
" Vim completion script
" Language: Ruby
" Maintainer: Mark Guzman <segfault@hasno.info>
-" Last Change: 2009 Sep 28
-" URL: http://vim-ruby.rubyforge.org
-" Anon CVS: See above site
+" URL: https://github.com/vim-ruby/vim-ruby
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
" Maintainer Version: 0.8.1
" ----------------------------------------------------------------------------
@@ -12,16 +10,23 @@
" ----------------------------------------------------------------------------
" {{{ requirement checks
+
+function! s:ErrMsg(msg)
+ echohl ErrorMsg
+ echo a:msg
+ echohl None
+endfunction
+
if !has('ruby')
- s:ErrMsg( "Error: Rubycomplete requires vim compiled with +ruby" )
- s:ErrMsg( "Error: falling back to syntax completion" )
+ call s:ErrMsg( "Error: Rubycomplete requires vim compiled with +ruby" )
+ call s:ErrMsg( "Error: falling back to syntax completion" )
" lets fall back to syntax completion
setlocal omnifunc=syntaxcomplete#Complete
finish
endif
if version < 700
- s:ErrMsg( "Error: Required vim >= 7.0" )
+ call s:ErrMsg( "Error: Required vim >= 7.0" )
finish
endif
" }}} requirement checks
@@ -51,12 +56,6 @@ endif
" {{{ 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
@@ -133,7 +132,7 @@ function! s:GetRubyVarType(v)
let stopline = 1
let vtp = ''
let pos = getpos('.')
- let sstr = '^\s*#\s*@var\s*'.a:v.'\>\s\+[^ \t]\+\s*$'
+ let sstr = '^\s*#\s*@var\s*'.escape(a:v, '*').'\>\s\+[^ \t]\+\s*$'
let [lnum,lcol] = searchpos(sstr,'nb',stopline)
if lnum != 0 && lcol != 0
call setpos('.',pos)
@@ -275,7 +274,7 @@ class VimRubyCompletion
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 )
+ mixre = /.*\n\s*(include|prepend)\s*(.*)\s*\n/.match( classdef )
load_buffer_module( $2 ) if mixre != nil && $2 != name # load mixins if needed
begin
@@ -364,6 +363,10 @@ class VimRubyCompletion
print txt if @@debug
end
+ def escape_vim_singlequote_string(str)
+ str.to_s.gsub(/'/,"\\'")
+ end
+
def get_buffer_entity_list( type )
# this will be a little expensive.
loading_allowed = VIM::evaluate("exists('g:rubycomplete_buffer_loading') && g:rubycomplete_buffer_loading")
@@ -526,9 +529,9 @@ class VimRubyCompletion
end
def clean_sel(sel, msg)
- sel.delete_if { |x| x == nil }
- sel.uniq!
- sel.grep(/^#{Regexp.quote(msg)}/) if msg != nil
+ ret = sel.reject{|x|x.nil?}.uniq
+ ret = ret.grep(/^#{Regexp.quote(msg)}/) if msg != nil
+ ret
end
def get_rails_view_methods
@@ -767,10 +770,10 @@ class 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 += methods.collect { |m| { :name => m.to_s, :type => 'm' } }
+ valid += variables.collect { |v| { :name => v.to_s, :type => 'v' } }
+ valid += classes.collect { |c| { :name => c.to_s, :type => 't' } }
+ valid += constants.collect { |d| { :name => d.to_s, :type => 'd' } }
valid.sort! { |x,y| x[:name] <=> y[:name] }
outp = ""
@@ -779,7 +782,7 @@ class VimRubyCompletion
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] ] }
+ valid[stpos..enpos].each { |c| outp += "{'word':'%s','item':'%s','kind':'%s'}," % [ c[:name], c[:name], c[:type] ].map{|x|escape_vim_singlequote_string(x)} }
outp.sub!(/,$/, '')
VIM::command("call extend(g:rubycomplete_completions, [%s])" % outp)
diff --git a/runtime/compiler/eruby.vim b/runtime/compiler/eruby.vim
index 614fc17f6..45ad5eead 100644
--- a/runtime/compiler/eruby.vim
+++ b/runtime/compiler/eruby.vim
@@ -1,9 +1,7 @@
" Vim compiler file
" Language: eRuby
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2008 Aug 1
-" URL: http://vim-ruby.rubyforge.org
-" Anon CVS: See above site
+" URL: https://github.com/vim-ruby/vim-ruby
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
if exists("current_compiler")
diff --git a/runtime/compiler/rake.vim b/runtime/compiler/rake.vim
new file mode 100644
index 000000000..3bd9da0da
--- /dev/null
+++ b/runtime/compiler/rake.vim
@@ -0,0 +1,35 @@
+" Vim compiler file
+" Language: Rake
+" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
+" URL: https://github.com/vim-ruby/vim-ruby
+" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
+
+if exists("current_compiler")
+ finish
+endif
+let current_compiler = "rake"
+
+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=rake
+
+CompilerSet errorformat=
+ \%D(in\ %f),
+ \%\\s%#from\ %f:%l:%m,
+ \%\\s%#from\ %f:%l:,
+ \%\\s%##\ %f:%l:%m,
+ \%\\s%##\ %f:%l,
+ \%\\s%#[%f:%l:\ %#%m,
+ \%\\s%#%f:%l:\ %#%m,
+ \%\\s%#%f:%l:,
+ \%m\ [%f:%l]:
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim: nowrap sw=2 sts=2 ts=8:
diff --git a/runtime/compiler/rspec.vim b/runtime/compiler/rspec.vim
index f46527ef1..7c340bab1 100644
--- a/runtime/compiler/rspec.vim
+++ b/runtime/compiler/rspec.vim
@@ -1,9 +1,7 @@
" Vim compiler file
" Language: RSpec
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
-" Last Change: 2009 Dec 22
-" URL: http://vim-ruby.rubyforge.org
-" Anon CVS: See above site
+" URL: https://github.com/vim-ruby/vim-ruby
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
if exists("current_compiler")
@@ -18,21 +16,15 @@ endif
let s:cpo_save = &cpo
set cpo-=C
-CompilerSet makeprg=spec
+CompilerSet makeprg=rspec
CompilerSet errorformat=
- \%+W'%.%#'\ FAILED,
- \%+I'%.%#'\ FIXED,
- \%-Cexpected:%.%#,
- \%-C\ \ \ \ \ got:%.%#,
+ \%f:%l:\ %tarning:\ %m,
\%E%.%#:in\ `load':\ %f:%l:%m,
- \%C%f:%l:,
- \%W%f:%l:\ warning:\ %m,
- \%E%f:%l:in\ %*[^:]:\ %m,
- \%E%f:%l:\ %m,
- \%-Z%\tfrom\ %f:%l,
- \%-Z%p^%.%#,
- \%-C%.%#,
+ \%E%f:%l:in\ `%*[^']':\ %m,
+ \%-Z\ \ \ \ \ \#\ %f:%l:%.%#,
+ \%E\ \ %\\d%\\+)%.%#,
+ \%C\ \ \ \ \ %m,
\%-G%.%#
let &cpo = s:cpo_save
diff --git a/runtime/compiler/ruby.vim b/runtime/compiler/ruby.vim
index 9499ce189..dcf7a4012 100644
--- a/runtime/compiler/ruby.vim
+++ b/runtime/compiler/ruby.vim
@@ -1,33 +1,10 @@
" Vim compiler file
" Language: Ruby
" Function: Syntax check and/or error reporting
-" Maintainer: Tim Hammerquist <timh at rubyforge.org>
-" Last Change: 2008 Aug 1
-" URL: http://vim-ruby.rubyforge.org
-" Anon CVS: See above site
+" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
+" URL: https://github.com/vim-ruby/vim-ruby
" 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
diff --git a/runtime/compiler/rubyunit.vim b/runtime/compiler/rubyunit.vim
index 524c205f8..93a0c8e65 100644
--- a/runtime/compiler/rubyunit.vim
+++ b/runtime/compiler/rubyunit.vim
@@ -1,9 +1,7 @@
" Vim compiler file
" Language: Test::Unit - Ruby Unit Testing Framework
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2008 Aug 1
-" URL: http://vim-ruby.rubyforge.org
-" Anon CVS: See above site
+" URL: https://github.com/vim-ruby/vim-ruby
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
if exists("current_compiler")
diff --git a/runtime/compiler/xmllint.vim b/runtime/compiler/xmllint.vim
index 8fde4e10f..ddd496048 100644
--- a/runtime/compiler/xmllint.vim
+++ b/runtime/compiler/xmllint.vim
@@ -1,8 +1,7 @@
" Vim compiler file
" Compiler: xmllint
-" Maintainer: Doug Kearns <djkea2@gus.gscit.monash.edu.au>
-" URL: http://gus.gscit.monash.edu.au/~djkea2/vim/compiler/xmllint.vim
-" Last Change: 2004 Nov 27
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Last Change: 2013 Jun 1
if exists("current_compiler")
finish
@@ -18,10 +17,8 @@ set cpo-=C
CompilerSet makeprg=xmllint\ --valid\ --noout\
-CompilerSet errorformat=%E%f:%l:\ error:\ %m,
- \%W%f:%l:\ warning:\ %m,
- \%E%f:%l:\ validity\ error:\ %m,
- \%W%f:%l:\ validity\ warning:\ %m,
+CompilerSet errorformat=%+E%f:%l:\ %.%#\ error\ :\ %m,
+ \%+W%f:%l:\ %.%#\ warning\ :\ %m,
\%-Z%p^,
\%-G%.%#
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 09eb22dbd..4dad26917 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1,4 +1,4 @@
-*eval.txt* For Vim version 7.3. Last change: 2013 May 21
+*eval.txt* For Vim version 7.3. Last change: 2013 Jun 11
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -2775,7 +2775,8 @@ expand({expr} [, {nosuf} [, {list}]]) *expand()*
file name contains a space]
If the expansion fails, the result is an empty string. A name
- for a non-existing file is not included.
+ for a non-existing file is not included, unless {expr} does
+ not start with '%', '#' or '<', see below.
When {expr} starts with '%', '#' or '<', the expansion is done
like for the |cmdline-special| variables with their associated
diff --git a/runtime/doc/gui.txt b/runtime/doc/gui.txt
index 6b46c9f02..70c1a68e5 100644
--- a/runtime/doc/gui.txt
+++ b/runtime/doc/gui.txt
@@ -1,4 +1,4 @@
-*gui.txt* For Vim version 7.3. Last change: 2011 Jul 22
+*gui.txt* For Vim version 7.3. Last change: 2013 Jun 12
VIM REFERENCE MANUAL by Bram Moolenaar
diff --git a/runtime/doc/indent.txt b/runtime/doc/indent.txt
index 0dd632b0c..7e89059b1 100644
--- a/runtime/doc/indent.txt
+++ b/runtime/doc/indent.txt
@@ -1,4 +1,4 @@
-*indent.txt* For Vim version 7.3. Last change: 2013 May 20
+*indent.txt* For Vim version 7.3. Last change: 2013 Jun 12
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -729,6 +729,50 @@ buffer-local variable as follows >
let b:fortran_indent_less=1
+HTML *ft-html-indent* *html-indent* *html-indenting*
+
+This is about variables you can set in your vimrc to customize HTML indenting.
+
+You can set the indent for the first line after <script> and <style>
+"blocktags" (default "zero"): >
+
+ :let g:html_indent_script1 = "inc"
+ :let g:html_indent_style1 = "inc"
+<
+ VALUE MEANING ~
+ "zero" zero indent
+ "auto" auto indent (same indent as the blocktag)
+ "inc" auto indent + one indent step
+
+Many tags increase the indent for what follows per default (see "Add Indent
+Tags" below in this script). You can add further tags with: >
+
+ :let g:html_indent_inctags = "html,body,head,tbody"
+
+You can also remove such tags with: >
+
+ :let g:html_indent_autotags = "th,td,tr,tfoot,thead"
+
+Default value is empty for both variables. Note: the initial "inctags" are
+only defined once per Vim session.
+
+User variables are only read when the script is sourced. To enable your
+changes during a session, without reloaind the html file, you can manually
+do: >
+
+ :call HtmlIndent_CheckUserSettings()
+
+Detail:
+ Calculation of indent inside "blocktags" with "alien" content:
+ BLOCKTAG INDENT EXPR WHEN APPLICABLE ~
+ <script> : {customizable} if first line of block
+ : cindent(v:lnum) if attributes empty or contain "java"
+ : -1 else (vbscript, tcl, ...)
+ <style> : {customizable} if first line of block
+ : GetCSSIndent() else
+ <!-- --> : -1
+
+
PHP *ft-php-indent* *php-indent* *php-indenting*
NOTE: PHP files will be indented correctly only if PHP |syntax| is active.
diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt
index 43fedbc89..fc0edb379 100644
--- a/runtime/doc/insert.txt
+++ b/runtime/doc/insert.txt
@@ -1468,9 +1468,9 @@ knows how to color highlight. It can be used for any filetype and provides a
minimal language-sensitive completion.
To enable syntax code completion you can run: >
- setlocal omnifunc=syntaxcomplete#Complete
+ setlocal omnifunc=syntaxcomplete#Complete
-You can automate this by placing the following in your vimrc (after any
+You can automate this by placing the following in your |.vimrc| (after any
":filetype" command): >
if has("autocmd") && exists("+omnifunc")
autocmd Filetype *
@@ -1487,7 +1487,7 @@ customize which syntax groups to include or exclude from the list. Let's have
a look at the PHP filetype to see how this works.
If you edit a file called, index.php, run the following command: >
- :syntax list
+ syntax list
The first thing you will notice is that there are many different syntax groups.
The PHP language can include elements from different languages like HTML,
@@ -1496,24 +1496,38 @@ that begin with the filetype, "php", in this case. For example these syntax
groups are included by default with the PHP: phpEnvVar, phpIntVar,
phpFunctions.
-The PHP language has an enormous number of items which it knows how to syntax
-highlight. This means these items will be available within the omni
-completion list. Some people may find this list unwieldy or are only
-interested in certain items.
+If you wish non-filetype syntax items to also be included, you can use a
+regular expression syntax (added in version 13.0 of autoload\syntaxcomplete.vim)
+to add items. Looking at the output from ":syntax list" while editing a PHP file
+I can see some of these entries: >
+ htmlArg,htmlTag,htmlTagName,javaScriptStatement,javaScriptGlobalObjects
+
+To pick up any JavaScript and HTML keyword syntax groups while editing a PHP
+file, you can use 3 different regexs, one for each language. Or you can
+simply restrict the include groups to a particular value, without using
+a regex string: >
+ let g:omni_syntax_group_include_php = 'php\w\+,javaScript\w\+,html\w\+'
+ let g:omni_syntax_group_include_php = 'phpFunctions,phpMethods'
+<
+The basic form of this variable is: >
+ let g:omni_syntax_group_include_{filetype} = 'regex,comma,separated'
-There are two ways to prune this list (if necessary). If you find certain
-syntax groups you do not wish displayed you can add the following to your
-vimrc: >
- let g:omni_syntax_group_exclude_php = 'phpCoreConstant,phpConstant'
+The PHP language has an enormous number of items which it knows how to syntax
+highlight. These these items will be available within the omni completion
+list.
+
+Some people may find this list unwieldy or are only interested in certain
+items. There are two ways to prune this list (if necessary). If you find
+certain syntax groups you do not wish displayed you can use two different
+methods to identify these groups. The first specifically lists the syntax
+groups by name. The second uses a regular expression to identify both
+syntax groups. Simply add one the following to your vimrc: >
+ let g:omni_syntax_group_exclude_php = 'phpCoreConstant,phpConstant'
+ let g:omni_syntax_group_exclude_php = 'php\w*Constant'
Add as many syntax groups to this list by comma separating them. The basic
form of this variable is: >
- let g:omni_syntax_group_exclude_{filetype} = 'comma,separated,list'
-
-For completeness the opposite is also true. Creating this variable in your
-vimrc will only include the items in the phpFunctions and phpMethods syntax
-groups: >
- let g:omni_syntax_group_include_php = 'phpFunctions,phpMethods'
+ let g:omni_syntax_group_exclude_{filetype} = 'regex,comma,separated'
You can create as many of these variables as you need, varying only the
filetype at the end of the variable name.
@@ -1554,6 +1568,9 @@ To retrieve only the syntax items for the sqlOperator syntax group: >
To retrieve all syntax items for both the sqlOperator and sqlType groups: >
echo OmniSyntaxList( ['sqlOperator', 'sqlType'] )
+A regular expression can also be used: >
+ echo OmniSyntaxList( ['sql\w\+'] )
+
From within a plugin, you would typically assign the output to a List: >
let myKeywords = []
let myKeywords = OmniSyntaxList( ['sqlKeyword'] )
diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt
index 0ae0cf3e5..e5e7720f7 100644
--- a/runtime/doc/map.txt
+++ b/runtime/doc/map.txt
@@ -1,4 +1,4 @@
-*map.txt* For Vim version 7.3. Last change: 2013 May 05
+*map.txt* For Vim version 7.3. Last change: 2013 Jun 12
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -175,6 +175,7 @@ The "<buffer>" argument can also be used to clear mappings: >
:mapclear <buffer>
Local mappings are also cleared when a buffer is deleted, but not when it is
unloaded. Just like local option values.
+Also see |map-precedence|.
*:map-<silent>* *:map-silent*
To define a mapping which will not be echoed on the command line, add
@@ -654,6 +655,18 @@ option). After that it assumes that the 'q' is to be interpreted as such. If
you type slowly, or your system is slow, reset the 'timeout' option. Then you
might want to set the 'ttimeout' option.
+ *map-precedence*
+Buffer-local mappings (defined using |:map-<buffer>|) take precedence over
+global mappings. When a buffer-local mapping is the same as a global mapping,
+Vim will use the buffer-local mapping. In addition, Vim will use a complete
+buffer-local mapping immediately, even if a longer global mapping has the
+buffer-local mapping as a prefix. For example, given the following two
+mappings: >
+ :map <buffer> \a :echo "Local \a"<CR>
+ :map \abc :echo "Global \abc"<CR>
+The buffer-local mapping \a will be used immediately. Vim will not wait for
+more characters to see if the user might be typing \abc.
+
*map-keys-fails*
There are situations where key codes might not be recognized:
- Vim can only read part of the key code. Mostly this is only the first
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index d7f9db011..93504a45f 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1,4 +1,4 @@
-*options.txt* For Vim version 7.3. Last change: 2013 Jun 04
+*options.txt* For Vim version 7.3. Last change: 2013 Jun 12
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -2243,7 +2243,7 @@ A jump table for the options with a short description can be found at |Q_op|.
Specifies whether to use quickfix window to show cscope results.
See |cscopequickfix|.
- *'cscoperelative'* *'csre'*
+ *'cscoperelative'* *'csre'* *'nocscoperelative'* *'nocsre'*
'cscoperelative' 'csre' boolean (default off)
global
{not available when compiled without the |+cscope|
diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt
index 41f6d8c95..d0b15c3e2 100644
--- a/runtime/doc/starting.txt
+++ b/runtime/doc/starting.txt
@@ -1,4 +1,4 @@
-*starting.txt* For Vim version 7.3. Last change: 2013 May 29
+*starting.txt* For Vim version 7.3. Last change: 2013 Jun 12
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -757,11 +757,21 @@ accordingly. Vim proceeds in this order:
file, but "exrc" is what Vi always used, "vimrc" is a Vim specific
name. Also see |vimrc-intro|.
- Recommended place for your personal initializations:
- Unix $HOME/.vimrc
- OS/2 $HOME/.vimrc or $VIM/.vimrc (or _vimrc)
- MS-DOS and Win32 $HOME/_vimrc or $VIM/_vimrc
- Amiga s:.vimrc or $VIM/.vimrc
+ Places for your personal initializations:
+ Unix $HOME/.vimrc or $HOME/.vim/vimrc
+ OS/2 $HOME/.vimrc, $HOME/vimfiles/vimrc
+ or $VIM/.vimrc (or _vimrc)
+ MS-Windows $HOME/_vimrc, $HOME/vimfiles/vimrc
+ or $VIM/_vimrc
+ Amiga s:.vimrc, home:.vimrc, home:vimfiles:vimrc
+ or $VIM/.vimrc
+
+ The files are searched in the order specified above and only the first
+ one that is found is read.
+
+ RECOMMENDATION: Put all your Vim configuration stuff in the
+ $HOME/.vim/ directory ($HOME/vimfiles/ for MS-Windows). That makes it
+ easy to copy it to another system.
If Vim was started with "-u filename", the file "filename" is used.
All following initializations until 4. are skipped.
@@ -791,12 +801,15 @@ accordingly. Vim proceeds in this order:
- The environment variable VIMINIT (see also |compatible-default|) (*)
The value of $VIMINIT is used as an Ex command line.
- The user vimrc file(s):
- "$HOME/.vimrc" (for Unix and OS/2) (*)
- "s:.vimrc" (for Amiga) (*)
- "home:.vimrc" (for Amiga) (*)
- "$VIM/.vimrc" (for OS/2 and Amiga) (*)
- "$HOME/_vimrc" (for MS-DOS and Win32) (*)
- "$VIM/_vimrc" (for MS-DOS and Win32) (*)
+ "$HOME/.vimrc" (for Unix and OS/2) (*)
+ "$HOME/.vim/vimrc" (for Unix and OS/2) (*)
+ "s:.vimrc" (for Amiga) (*)
+ "home:.vimrc" (for Amiga) (*)
+ "home:vimfiles:vimrc" (for Amiga) (*)
+ "$VIM/.vimrc" (for OS/2 and Amiga) (*)
+ "$HOME/_vimrc" (for MS-DOS and Win32) (*)
+ "$HOME/vimfiles/vimrc" (for MS-DOS and Win32) (*)
+ "$VIM/_vimrc" (for MS-DOS and Win32) (*)
Note: For Unix, OS/2 and Amiga, when ".vimrc" does not exist,
"_vimrc" is also tried, in case an MS-DOS compatible file
system is used. For MS-DOS and Win32 ".vimrc" is checked
diff --git a/runtime/doc/tags b/runtime/doc/tags
index 69ed5336d..f41f74d2c 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -496,8 +496,10 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
'nocopyindent' options.txt /*'nocopyindent'*
'nocp' options.txt /*'nocp'*
'nocrb' options.txt /*'nocrb'*
+'nocscoperelative' options.txt /*'nocscoperelative'*
'nocscopetag' options.txt /*'nocscopetag'*
'nocscopeverbose' options.txt /*'nocscopeverbose'*
+'nocsre' options.txt /*'nocsre'*
'nocst' options.txt /*'nocst'*
'nocsverb' options.txt /*'nocsverb'*
'nocuc' options.txt /*'nocuc'*
@@ -5716,6 +5718,7 @@ ft-gitcommit-plugin filetype.txt /*ft-gitcommit-plugin*
ft-groff-syntax syntax.txt /*ft-groff-syntax*
ft-gsp-syntax syntax.txt /*ft-gsp-syntax*
ft-haskell-syntax syntax.txt /*ft-haskell-syntax*
+ft-html-indent indent.txt /*ft-html-indent*
ft-html-omni insert.txt /*ft-html-omni*
ft-html-syntax syntax.txt /*ft-html-syntax*
ft-htmlos-syntax syntax.txt /*ft-htmlos-syntax*
@@ -6342,6 +6345,8 @@ howto.txt howto.txt /*howto.txt*
hpterm term.txt /*hpterm*
hpterm-color syntax.txt /*hpterm-color*
html-flavor insert.txt /*html-flavor*
+html-indent indent.txt /*html-indent*
+html-indenting indent.txt /*html-indenting*
html.vim syntax.txt /*html.vim*
htmlos.vim syntax.txt /*htmlos.vim*
http pi_netrw.txt /*http*
@@ -6708,6 +6713,7 @@ map-listing map.txt /*map-listing*
map-modes map.txt /*map-modes*
map-multibyte map.txt /*map-multibyte*
map-overview map.txt /*map-overview*
+map-precedence map.txt /*map-precedence*
map-self-destroy tips.txt /*map-self-destroy*
map-typing map.txt /*map-typing*
map-which-keys map.txt /*map-which-keys*
@@ -7352,6 +7358,8 @@ python-.locked if_pyth.txt /*python-.locked*
python-Dictionary if_pyth.txt /*python-Dictionary*
python-Function if_pyth.txt /*python-Function*
python-List if_pyth.txt /*python-List*
+python-VIM_SPECIAL_PATH if_pyth.txt /*python-VIM_SPECIAL_PATH*
+python-_get_paths if_pyth.txt /*python-_get_paths*
python-bindeval if_pyth.txt /*python-bindeval*
python-bindeval-objects if_pyth.txt /*python-bindeval-objects*
python-buffer if_pyth.txt /*python-buffer*
@@ -7365,11 +7373,15 @@ python-error if_pyth.txt /*python-error*
python-eval if_pyth.txt /*python-eval*
python-examples if_pyth.txt /*python-examples*
python-fchdir if_pyth.txt /*python-fchdir*
+python-find_module if_pyth.txt /*python-find_module*
+python-foreach_rtp if_pyth.txt /*python-foreach_rtp*
python-input if_pyth.txt /*python-input*
python-options if_pyth.txt /*python-options*
python-output if_pyth.txt /*python-output*
+python-path_hook if_pyth.txt /*python-path_hook*
python-pyeval if_pyth.txt /*python-pyeval*
python-range if_pyth.txt /*python-range*
+python-special-path if_pyth.txt /*python-special-path*
python-strwidth if_pyth.txt /*python-strwidth*
python-tabpage if_pyth.txt /*python-tabpage*
python-tabpages if_pyth.txt /*python-tabpages*
@@ -7379,7 +7391,10 @@ python-vvars if_pyth.txt /*python-vvars*
python-window if_pyth.txt /*python-window*
python-windows if_pyth.txt /*python-windows*
python.vim syntax.txt /*python.vim*
+python2-directory if_pyth.txt /*python2-directory*
python3 if_pyth.txt /*python3*
+python3-directory if_pyth.txt /*python3-directory*
+pythonx-directory if_pyth.txt /*pythonx-directory*
q repeat.txt /*q*
q/ cmdline.txt /*q\/*
q: cmdline.txt /*q:*
@@ -7550,6 +7565,8 @@ save-file editing.txt /*save-file*
save-settings starting.txt /*save-settings*
scheme.vim syntax.txt /*scheme.vim*
scp pi_netrw.txt /*scp*
+screenattr() eval.txt /*screenattr()*
+screenchar() eval.txt /*screenchar()*
screencol() eval.txt /*screencol()*
screenrow() eval.txt /*screenrow()*
script usr_41.txt /*script*
diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt
index 5f0160323..f5ac22d69 100644
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1,4 +1,4 @@
-*todo.txt* For Vim version 7.3. Last change: 2013 Jun 06
+*todo.txt* For Vim version 7.3. Last change: 2013 Jun 12
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -34,18 +34,11 @@ not be repeated below, unless there is extra information.
*known-bugs*
-------------------- Known bugs and current work -----------------------
-Make it possible to test the status line: add screenchar(col, row).
-Use screen_getbytes().
-Could also add screenattr(col, row), but value is unpredictable.
-Functions to read the actual contents of the screen, so that things like
-conceal can be tested. (Nazri Ramliy, 2013 Feb 18)
-
-function() does not work like before. (lilydjwg, 2013 Jun 4)
-I guess this is caused by patch 7.3.1058:
-"Call of funcref does not succeed in other script."
-
--- Python interface
+Test 87 fails.
+Test 86 fails on some systems.
+
Python: ":py raw_input('prompt')" doesn't work. (Manu Hack)
Win32: The Python interface only works with one version of Python, selected at
@@ -59,62 +52,6 @@ Python SystemExit exception is not handled properly. Patch to catch the
exception and give an error. (Yasuhiro Matsumoto)
Does not work, tests fail.
-Python: crash in test 86 because of int/size_t mixup? (Jun Takimoto, 2013 Jun
-6)
-
-Add a $VIMRUNTIME/python and $VIMRUNTIME/python3 directories?
-
---- runtime files
-
-Alternate html indent file by Andy Wokula, script 2075.
-
-Syntax file for protocol buffers. (Feng Xiao, 2013 May 9)
-Has an ugly copyright notice.
-Add statement that it does not conflict with Vim license.
-
-Patch for JavaScript syntax. (Kevin Locke, 2013 May 9)
-Claudio didn't respond yet.
-
-upstream_dat, usserver_log et al. syntax files. (Rob Owens, 2013 Jun 5)
-
---- New regexp engine
-
-Does not work (yet) with NFA:
-- \%u, \%x, \%o, \%d followed by a composing character
-
-Don't call nfa_regmatch() recursively if the "out" state is not going to be
-added anyway. In run log:
- > Not adding state 6 to list 4. char -971: NFA_SKIP
-
-Profiling:
- ./vim -s ~/vim/test/alsa.vim
- ./vim -s ~/vim/test/todo.vim
- ./vim -s ~/vim/test/loop.vim
- ./vim -s ~/vim/test/xml.vim
-
-More test files from the src/pkg/regexp/testdata directory in the Go repo.
-
-It's very slow compared to the old engine...
-Performance tests:
-- ~/vim/text/FeiqCfg.xml (file from Netjune)
-- ~/vim/text/edl.svg (also XML)
-- glts has five tests. (May 25)
-- ~/vim/test/veryslow.js display last line (file from Daniel Fetchinson)
-- ~/vim/test/slowsearch
-- ~/vim/test/rgb.vim
-- search for a.*e*exn in the vim executable. Go to last line to use
- 'hlsearch'.
-- Slow combination of folding and PHP syntax highlighting. Script to
- reproduce it. Caused by "syntax sync fromstart" in combination with patch
- 7.2.274. (Christian Brabandt, 2010 May 27) Generally, folding with
- 'foldmethod' set to "syntax" is slow. Do profiling to find out why.
-- It does not use any of the optimizations, such as required start pattern.
-- When lists are empty in nfa_regmatch() and match is true, it keeps looping
- without doing anything.
-
-BT engine: After \@> match and failing submatches are not cleared.
-See test64.
-
--- bug fixes
:wviminfo does not write old history entries. (Roland Eggner, 2013 Jun 5)
@@ -157,6 +94,8 @@ Patch for IME problems. Remove hacking code for old IM. (Yukihiro Nakadaira,
Patch to fix finding toolbar bitmaps. Issue 129.
+Suggestion to remove __QNXNTO__ in gui.c. (Sean Boudreau, 2013 Jun 7)
+
Combining characters are not used when executing a register with :@w.
(William Fugh, 2013 Apr 5, more info from Ben Fritz)
Patch by Christian Brabandt, 2013 Apr 6. Second one.
@@ -174,6 +113,8 @@ Patch by Christian Brabandt, 2013 May 22.
Patch to fix "gn" on single character matches. (Christian Brabandt, 2013 Jun
2)
+Patch for cscope connection (Narendran, 2013 Jun 10)
+
'cursorline' is drawn incorrectly in diff mode. Patch by Christian Brabandt,
2012 Apr 2.
@@ -192,24 +133,11 @@ Patch by Christian Wellenbrock, 2013 Jun 2. Update Jun 3 (second one).
Patch to fix glob() and globpath() with escaped special characters.
(Adnan Zafar, 2013 Jun 2, tests Jun 3)
---- slightly incompatible changes
-
-Patch to load ~/.vim/vimrc when ~/.vimrc isn't found. (Lech Lorens, 2013 Apr
-13)
-
-It's probably a good idea to make a negative value for 'sts' use the value of
-'sw'. Patch by So8res, Oct 3 2012
-
-When a buffer-local mapping is used, but a global mapping starts with the same
-characters, Vim currently waits for the next typed character to find out if
-the global mapping matches. It is probably better to let the local mapping
-win and not wait. (discussion with Andy Wokula, 2013 Jan 30)
-Patch by Michael Henry, 2013 Jan 30, update Feb 15.
-
-Patch to store absolute path for cscope. (Christian Brabandt, 2013 May 31)
-
---- Fixes to be included before 7.4 above, less important stuff below ----
+Patch to make has() check for Vim version and patch at the same time.
+(Marc Weber, 2013 Jun 7)
+
Several syntax file match "^\s*" which may get underlined if that's in the
highlight group. Add a "\zs" after it?
@@ -219,6 +147,9 @@ Discussion about canonicalization of Hebrew. (Ron Aaron, 2011 April 10)
Checking runtime scripts: Thilo Six, 2012 Jun 6.
+Fold can't be opened after ":move". (Ein Brown)
+Patch from Christian Brabandt doesn't fix it completely.
+
GTK: problem with 'L' in 'guioptions' changing the window width.
(Aaron Cornelius, 2012 Feb 6)
@@ -539,6 +470,9 @@ Using ":break" or something else that stops executing commands inside a
Vim using lots of memory when joining lines. (John Little, 2010 Dec 3)
+BT regexp engine: After trying a \@> match and failing, submatches are not
+cleared. See test64.
+
Changes to manpage plugin. (Elias Toivanen, 2011 Jul 25)
Patch to make "z=" work when 'spell' is off. Does this have nasty side
@@ -679,6 +613,32 @@ the command line. (Ingo Karkat, 2011 Jan 25)
Since patch 7.2.46 Yankring plugin has become very slow, eventually make Vim
crash? (Raiwil, 2010 Nov 17)
+Does not work with NFA regexp engine:
+- \%u, \%x, \%o, \%d followed by a composing character
+
+Regexp engine performance:
+- Profiling:
+ ./vim -u NONE -s ~/vim/test/ruby.vim
+ ./vim -u NONE -s ~/vim/test/loop.vim
+ ./vim -u NONE -s ~/vim/test/alsa.vim
+ ./vim -s ~/vim/test/todo.vim
+ ./vim -s ~/vim/test/xml.vim
+ Dominique Pelle: xmlSyncDT is particularly slow (Jun 7)
+- More test files from the src/pkg/regexp/testdata directory in the Go repo.
+- Performance tests:
+ - Using asciidoc syntax. (Marek Schimara, 2013 Jun 6)
+ - ~/vim/text/FeiqCfg.xml (file from Netjune)
+ - ~/vim/text/edl.svg (also XML)
+ - glts has five tests. (May 25)
+ - ~/vim/test/slowsearch
+ - ~/vim/test/rgb.vim
+ - search for a.*e*exn in the vim executable. Go to last line to use
+ 'hlsearch'.
+ - Slow combination of folding and PHP syntax highlighting. Script to
+ reproduce it. Caused by "syntax sync fromstart" in combination with patch
+ 7.2.274. (Christian Brabandt, 2010 May 27) Generally, folding with
+ 'foldmethod' set to "syntax" is slow. Do profiling to find out why.
+
Patch to add 'systemencoding', convert between 'encoding' and this for file
names, shell commands and the like. (Kikuchan, 2010 Oct 14)
Assume the system converts between the actual encoding of the filesystem to
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index d5d85fdfb..ab10a5023 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -1,7 +1,7 @@
" Vim support file to detect file types
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2013 Jun 01
+" Last Change: 2013 Jun 12
" Listen very carefully, I will say this only once
if exists("did_load_filetypes")
@@ -870,6 +870,9 @@ au BufNewFile,BufRead */etc/hosts.allow,*/etc/hosts.deny setf hostsaccess
" Hyper Builder
au BufNewFile,BufRead *.hb setf hb
+" Httest
+au BufNewFile,BufRead *.htt,*.htb setf httest
+
" Icon
au BufNewFile,BufRead *.icn setf icon
@@ -1548,6 +1551,9 @@ au BufNewFile,BufRead *.pdb setf prolog
" Promela
au BufNewFile,BufRead *.pml setf promela
+" Google protocol buffers
+au BufNewFile,BufRead *.proto setf proto
+
" Protocols
au BufNewFile,BufRead */etc/protocols setf protocols
diff --git a/runtime/ftplugin/eruby.vim b/runtime/ftplugin/eruby.vim
index 870f45e07..9bb8e86ff 100644
--- a/runtime/ftplugin/eruby.vim
+++ b/runtime/ftplugin/eruby.vim
@@ -1,9 +1,7 @@
" Vim filetype plugin
" Language: eRuby
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
-" Last Change: 2012 Mar 11
-" URL: http://vim-ruby.rubyforge.org
-" Anon CVS: See above site
+" URL: https://github.com/vim-ruby/vim-ruby
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
" Only do this when not done yet for this buffer
@@ -23,13 +21,12 @@ if !exists("g:eruby_default_subtype")
let g:eruby_default_subtype = "html"
endif
-if !exists("b:eruby_subtype")
+if &filetype =~ '^eruby\.'
+ let b:eruby_subtype = matchstr(&filetype,'^eruby\.\zs\w\+')
+elseif !exists("b:eruby_subtype")
let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$")
let b:eruby_subtype = matchstr(s:lines,'eruby_subtype=\zs\w\+')
if b:eruby_subtype == ''
- let b:eruby_subtype = matchstr(&filetype,'^eruby\.\zs\w\+')
- endif
- if b:eruby_subtype == ''
let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\|\.erubis\)\+$','',''),'\.\zs\w\+$')
endif
if b:eruby_subtype == 'rhtml'
diff --git a/runtime/ftplugin/falcon.vim b/runtime/ftplugin/falcon.vim
index 2e1e7fafb..4fc135b4a 100644
--- a/runtime/ftplugin/falcon.vim
+++ b/runtime/ftplugin/falcon.vim
@@ -1,10 +1,9 @@
" Vim filetype plugin file
" Language: Falcon
" Author: Steven Oliver <oliver.steven@gmail.com>
-" Copyright: Copyright (c) 2009, 2010, 2011, 2012 Steven Oliver
+" Copyright: Copyright (c) 2009-2013 Steven Oliver
" License: You may redistribute this under the same terms as Vim itself
" --------------------------------------------------------------------------
-" GetLatestVimScripts: 2762 1 :AutoInstall: falcon.vim
" Only do this when not done yet for this buffer
if (exists("b:did_ftplugin"))
@@ -15,7 +14,7 @@ let b:did_ftplugin = 1
let s:cpo_save = &cpo
set cpo&vim
-setlocal tabstop=4 shiftwidth=4 expandtab fileencoding=utf-8
+setlocal softtabstop=4 shiftwidth=4 fileencoding=utf-8
setlocal suffixesadd=.fal,.ftd
" Matchit support
@@ -31,7 +30,6 @@ if exists("loaded_matchit") && !exists("b:match_words")
\ ',{:},\[:\],(:)'
endif
-" Set comments to include dashed lines
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
" Windows allows you to filter the open file dialog
diff --git a/runtime/ftplugin/gprof.vim b/runtime/ftplugin/gprof.vim
index f76dd31ae..750751c37 100644
--- a/runtime/ftplugin/gprof.vim
+++ b/runtime/ftplugin/gprof.vim
@@ -1,6 +1,6 @@
" Language: gprof
" Maintainer: Dominique Pelle <dominique.pelle@gmail.com>
-" Last Change: 2012 May 20
+" Last Change: 2013 Jun 09
" When cursor is on one line of the gprof call graph,
" calling this function jumps to this function in the call graph.
@@ -13,20 +13,20 @@ fun! <SID>GprofJumpToFunctionIndex()
let l:line = getline('.')
if l:line =~ '[\d\+\]$'
" We're in a line in the call graph.
- norm $y%
+ norm! $y%
call search('^' . escape(@", '[]'), 'sw')
- norm zz
+ norm! zz
elseif l:line =~ '^\(\s\+[0-9\.]\+\)\{3}\s\+'
" We're in line in the flat profile.
- norm 55|y$
- call search('^\[\d\+\].*\d\s\+' . escape(@", '[]*.'), 'sW')
- norm zz
+ norm! 55|eby$
+ call search('^\[\d\+\].*\d\s\+' . escape(@", '[]*.') . '\>', 'sW')
+ norm! zz
endif
endfun
" Pressing <C-]> on a line in the gprof flat profile or in
" the call graph, jumps to the corresponding function inside
" the flat profile.
-map <silent> <C-]> :call <SID>GprofJumpToFunctionIndex()<CR>
+map <buffer> <silent> <C-]> :call <SID>GprofJumpToFunctionIndex()<CR>
" vim:sw=2 fdm=indent
diff --git a/runtime/ftplugin/ruby.vim b/runtime/ftplugin/ruby.vim
index 6b9363e48..9630a940a 100644
--- a/runtime/ftplugin/ruby.vim
+++ b/runtime/ftplugin/ruby.vim
@@ -1,17 +1,10 @@
" Vim filetype plugin
" Language: Ruby
-" Maintainer: Gavin Sinclair <gsinclair at gmail.com>
-" Last Change: 2010 Mar 15
-" URL: http://vim-ruby.rubyforge.org
-" Anon CVS: See above site
+" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
+" URL: https://github.com/vim-ruby/vim-ruby
" 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
@@ -21,7 +14,7 @@ let s:cpo_save = &cpo
set cpo&vim
if has("gui_running") && !has("gui_win32")
- setlocal keywordprg=ri\ -T
+ setlocal keywordprg=ri\ -T\ -f\ bs
else
setlocal keywordprg=ri
endif
@@ -49,7 +42,7 @@ endif
setlocal formatoptions-=t formatoptions+=croql
-setlocal include=^\\s*\\<\\(load\\\|\w*require\\)\\>
+setlocal include=^\\s*\\<\\(load\\>\\\|require\\>\\\|autoload\\s*:\\=[\"']\\=\\h\\w*[\"']\\=,\\)
setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'$','.rb','')
setlocal suffixesadd=.rb
@@ -69,41 +62,90 @@ endif
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 . '"')
+if !exists('g:ruby_version_paths')
+ let g:ruby_version_paths = {}
+endif
+
+function! s:query_path(root)
+ let code = "print $:.join %q{,}"
+ if &shell =~# 'sh' && $PATH !~# '\s'
+ let prefix = 'env PATH='.$PATH.' '
+ else
+ let prefix = ''
+ endif
+ if &shellxquote == "'"
+ let path_check = prefix.'ruby -e "' . code . '"'
+ else
+ let path_check = prefix."ruby -e '" . code . "'"
+ endif
+
+ let cd = haslocaldir() ? 'lcd' : 'cd'
+ let cwd = getcwd()
+ try
+ exe cd fnameescape(a:root)
+ let path = split(system(path_check),',')
+ exe cd fnameescape(cwd)
+ return path
+ finally
+ exe cd fnameescape(cwd)
+ endtry
+endfunction
+
+function! s:build_path(path)
+ let path = join(map(copy(a:path), 'v:val ==# "." ? "" : v:val'), ',')
+ if &g:path !~# '\v^\.%(,/%(usr|emx)/include)=,,$'
+ let path = substitute(&g:path,',,$',',','') . ',' . path
+ endif
+ return path
+endfunction
+
+if !exists('b:ruby_version') && !exists('g:ruby_path') && isdirectory(expand('%:p:h'))
+ let s:version_file = findfile('.ruby-version', '.;')
+ if !empty(s:version_file)
+ let b:ruby_version = get(readfile(s:version_file, '', 1), '')
+ if !has_key(g:ruby_version_paths, b:ruby_version)
+ let g:ruby_version_paths[b:ruby_version] = s:query_path(fnamemodify(s:version_file, ':p:h'))
+ endif
+ endif
+endif
+
+if exists("g:ruby_path")
+ let s:ruby_path = type(g:ruby_path) == type([]) ? join(g:ruby_path, ',') : g:ruby_path
+elseif has_key(g:ruby_version_paths, get(b:, 'ruby_version', ''))
+ let s:ruby_paths = g:ruby_version_paths[b:ruby_version]
+ let s:ruby_path = s:build_path(s:ruby_paths)
+else
+ if !exists('g:ruby_default_path')
+ if has("ruby") && has("win32")
+ ruby ::VIM::command( 'let g:ruby_default_path = split("%s",",")' % $:.join(%q{,}) )
+ elseif executable('ruby')
+ let g:ruby_default_path = s:query_path($HOME)
else
- let s:ruby_path = system("ruby -e '" . s:code . "'")
+ let g:ruby_default_path = map(split($RUBYLIB,':'), 'v:val ==# "." ? "" : v:val')
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
+ let s:ruby_paths = g:ruby_default_path
+ let s:ruby_path = s:build_path(s:ruby_paths)
endif
-let &l:path = s:ruby_path
+if stridx(&l:path, s:ruby_path) == -1
+ let &l:path = s:ruby_path
+endif
+if exists('s:ruby_paths') && stridx(&l:tags, join(map(copy(s:ruby_paths),'v:val."/tags"'),',')) == -1
+ let &l:tags = &tags . ',' . join(map(copy(s:ruby_paths),'v:val."/tags"'),',')
+endif
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<"
+let b:undo_ftplugin = "setl fo< inc< inex< sua< def< com< cms< path< tags< 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")
-
nnoremap <silent> <buffer> [m :<C-U>call <SID>searchsyn('\<def\>','rubyDefine','b','n')<CR>
nnoremap <silent> <buffer> ]m :<C-U>call <SID>searchsyn('\<def\>','rubyDefine','','n')<CR>
nnoremap <silent> <buffer> [M :<C-U>call <SID>searchsyn('\<end\>','rubyDefine','b','n')<CR>
@@ -126,6 +168,26 @@ if !exists("g:no_plugin_maps") && !exists("g:no_ruby_maps")
\."| 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('im','n') == ''
+ onoremap <silent> <buffer> im :<C-U>call <SID>wrap_i('[m',']M')<CR>
+ onoremap <silent> <buffer> am :<C-U>call <SID>wrap_a('[m',']M')<CR>
+ xnoremap <silent> <buffer> im :<C-U>call <SID>wrap_i('[m',']M')<CR>
+ xnoremap <silent> <buffer> am :<C-U>call <SID>wrap_a('[m',']M')<CR>
+ let b:undo_ftplugin = b:undo_ftplugin
+ \."| sil! exe 'ounmap <buffer> im' | sil! exe 'ounmap <buffer> am'"
+ \."| sil! exe 'xunmap <buffer> im' | sil! exe 'xunmap <buffer> am'"
+ endif
+
+ if maparg('iM','n') == ''
+ onoremap <silent> <buffer> iM :<C-U>call <SID>wrap_i('[[','][')<CR>
+ onoremap <silent> <buffer> aM :<C-U>call <SID>wrap_a('[[','][')<CR>
+ xnoremap <silent> <buffer> iM :<C-U>call <SID>wrap_i('[[','][')<CR>
+ xnoremap <silent> <buffer> aM :<C-U>call <SID>wrap_a('[[','][')<CR>
+ let b:undo_ftplugin = b:undo_ftplugin
+ \."| sil! exe 'ounmap <buffer> iM' | sil! exe 'ounmap <buffer> aM'"
+ \."| sil! exe 'xunmap <buffer> iM' | sil! exe 'xunmap <buffer> aM'"
+ endif
+
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>
@@ -142,6 +204,17 @@ if !exists("g:no_plugin_maps") && !exists("g:no_ruby_maps")
\."| 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
+
+ if maparg("gf",'n') == ''
+ " By using findfile() rather than gf's normal behavior, we prevent
+ " erroneously editing a directory.
+ nnoremap <silent> <buffer> gf :<C-U>exe <SID>gf(v:count1,"gf",'edit')<CR>
+ nnoremap <silent> <buffer> <C-W>f :<C-U>exe <SID>gf(v:count1,"\<Lt>C-W>f",'split')<CR>
+ nnoremap <silent> <buffer> <C-W><C-F> :<C-U>exe <SID>gf(v:count1,"\<Lt>C-W>\<Lt>C-F>",'split')<CR>
+ nnoremap <silent> <buffer> <C-W>gf :<C-U>exe <SID>gf(v:count1,"\<Lt>C-W>gf",'tabedit')<CR>
+ let b:undo_ftplugin = b:undo_ftplugin
+ \."| sil! exe 'nunmap <buffer> gf' | sil! exe 'nunmap <buffer> <C-W>f' | sil! exe 'nunmap <buffer> <C-W><C-F>' | sil! exe 'nunmap <buffer> <C-W>gf'"
+ endif
endif
let &cpo = s:cpo_save
@@ -191,7 +264,7 @@ function! RubyBalloonexpr()
if str !~ '^\w'
return ''
endif
- silent! let res = substitute(system("ri -f simple -T \"".str.'"'),'\n$','','')
+ silent! let res = substitute(system("ri -f rdoc -T \"".str.'"'),'\n$','','')
if res =~ '^Nothing known about' || res =~ '^Bad argument:' || res =~ '^More than one method'
return ''
endif
@@ -202,29 +275,57 @@ function! RubyBalloonexpr()
endfunction
function! s:searchsyn(pattern,syn,flags,mode)
- norm! m'
- if a:mode ==# 'v'
- norm! gv
- endif
- 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
+ norm! m'
+ if a:mode ==# 'v'
+ norm! gv
+ endif
+ 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')
+ return synIDattr(synID(line('.'),col('.'),0),'name')
+endfunction
+
+function! s:wrap_i(back,forward)
+ execute 'norm k'.a:forward
+ let line = line('.')
+ execute 'norm '.a:back
+ if line('.') == line - 1
+ return s:wrap_a(a:back,a:forward)
+ endif
+ execute 'norm jV'.a:forward.'k'
+endfunction
+
+function! s:wrap_a(back,forward)
+ execute 'norm '.a:forward
+ if line('.') < line('$') && getline(line('.')+1) ==# ''
+ let after = 1
+ endif
+ execute 'norm '.a:back
+ while getline(line('.')-1) =~# '^\s*#' && line('.')
+ -
+ endwhile
+ if exists('after')
+ execute 'norm V'.a:forward.'j'
+ elseif line('.') > 1 && getline(line('.')-1) =~# '^\s*$'
+ execute 'norm kV'.a:forward
+ else
+ execute 'norm V'.a:forward
+ endif
endfunction
function! RubyCursorIdentifier()
@@ -241,6 +342,26 @@ function! RubyCursorIdentifier()
return stripped == '' ? expand("<cword>") : stripped
endfunction
+function! s:gf(count,map,edit) abort
+ if getline('.') =~# '^\s*require_relative\s*\(["'']\).*\1\s*$'
+ let target = matchstr(getline('.'),'\(["'']\)\zs.\{-\}\ze\1')
+ return a:edit.' %:h/'.target.'.rb'
+ elseif getline('.') =~# '^\s*\%(require[( ]\|load[( ]\|autoload[( ]:\w\+,\)\s*\s*\%(::\)\=File\.expand_path(\(["'']\)\.\./.*\1,\s*__FILE__)\s*$'
+ let target = matchstr(getline('.'),'\(["'']\)\.\./\zs.\{-\}\ze\1')
+ return a:edit.' %:h/'.target.'.rb'
+ elseif getline('.') =~# '^\s*\%(require \|load \|autoload :\w\+,\)\s*\(["'']\).*\1\s*$'
+ let target = matchstr(getline('.'),'\(["'']\)\zs.\{-\}\ze\1')
+ else
+ let target = expand('<cfile>')
+ endif
+ let found = findfile(target, &path, a:count)
+ if found ==# ''
+ return 'norm! '.a:count.a:map
+ else
+ return a:edit.' '.fnameescape(found)
+ endif
+endfunction
+
"
" Instructions for enabling "matchit" support:
"
diff --git a/runtime/indent/eruby.vim b/runtime/indent/eruby.vim
index a4de118cc..80cab7000 100644
--- a/runtime/indent/eruby.vim
+++ b/runtime/indent/eruby.vim
@@ -1,9 +1,7 @@
" Vim indent file
" Language: eRuby
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
-" Last Change: 2010 May 28
-" URL: http://vim-ruby.rubyforge.org
-" Anon CVS: See above site
+" URL: https://github.com/vim-ruby/vim-ruby
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
if exists("b:did_indent")
@@ -50,29 +48,32 @@ function! GetErubyIndent(...)
call cursor(v:lnum,1)
let inruby = searchpair('<%','','%>','W')
call cursor(v:lnum,vcol)
- if inruby && getline(v:lnum) !~ '^<%\|^\s*-\=%>'
- let ind = GetRubyIndent()
+ if inruby && getline(v:lnum) !~ '^<%\|^\s*[-=]\=%>'
+ let ind = GetRubyIndent(v:lnum)
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*\%(-\=%>\|$\)'
+ if cline =~# '^\s*<%[-=]\=\s*\%(}\|end\|else\|\%(ensure\|rescue\|elsif\|when\).\{-\}\)\s*\%([-=]\=%>\|$\)'
let ind = ind - &sw
endif
- if line =~# '\S\s*<%-\=\s*\%(}\|end\).\{-\}\s*\%(-\=%>\|$\)'
+ if line =~# '\S\s*<%[-=]\=\s*\%(}\|end\).\{-\}\s*\%([-=]\=%>\|$\)'
let ind = ind - &sw
endif
- if line =~# '\%({\|\<do\)\%(\s*|[^|]*|\)\=\s*-\=%>'
+ 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\)\>.*%>'
+ 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*$'
+ if line !~# '^\s*<%' && line =~# '%>\s*$'
+ let ind = ind - &sw
+ endif
+ if cline =~# '^\s*[-=]\=%>\s*$'
let ind = ind - &sw
endif
return ind
diff --git a/runtime/indent/falcon.vim b/runtime/indent/falcon.vim
index 46a228e8b..84b16d55f 100644
--- a/runtime/indent/falcon.vim
+++ b/runtime/indent/falcon.vim
@@ -2,13 +2,10 @@
" Language: Falcon
" Maintainer: Steven Oliver <oliver.steven@gmail.com>
" Website: https://steveno@github.com/steveno/falconpl-vim.git
-" Credits: Thanks to the ruby.vim authors, I borrow a lot!
-" Previous Maintainer: Brent A. Fulgham <bfulgham@debian.org>
-" -----------------------------------------------------------
+" Credits: This is, to a great extent, a copy n' paste of ruby.vim.
-"======================================
-" SETUP
-"======================================
+" 1. Setup {{{1
+" ============
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -19,7 +16,7 @@ let b:did_indent = 1
setlocal nosmartindent
" Setup indent function and when to use it
-setlocal indentexpr=FalconGetIndent()
+setlocal indentexpr=FalconGetIndent(v:lnum)
setlocal indentkeys=0{,0},0),0],!^F,o,O,e
setlocal indentkeys+==~case,=~catch,=~default,=~elif,=~else,=~end,=~\"
@@ -31,9 +28,8 @@ endif
let s:cpo_save = &cpo
set cpo&vim
-"======================================
-" VARIABLES
-"======================================
+" 2. Variables {{{1
+" ============
" Regex of syntax group names that are strings AND comments
let s:syng_strcom = '\<falcon\%(String\|StringEscape\|Comment\)\>'
@@ -41,6 +37,31 @@ let s:syng_strcom = '\<falcon\%(String\|StringEscape\|Comment\)\>'
" Regex of syntax group names that are strings
let s:syng_string = '\<falcon\%(String\|StringEscape\)\>'
+" Regex that defines blocks.
+"
+" Note that there's a slight problem with this regex and s:continuation_regex.
+" Code like this will be matched by both:
+"
+" method_call do |(a, b)|
+"
+" The reason is that the pipe matches a hanging "|" operator.
+"
+let s:block_regex =
+ \ '\%(\<do:\@!\>\|%\@<!{\)\s*\%(|\s*(*\s*\%([*@&]\=\h\w*,\=\s*\)\%(,\s*(*\s*[*@&]\=\h\w*\s*)*\s*\)*|\)\=\s*\%(#.*\)\=$'
+
+let s:block_continuation_regex = '^\s*[^])}\t ].*'.s:block_regex
+
+" Regex that defines continuation lines.
+" TODO: this needs to deal with if ...: and so on
+let s:continuation_regex =
+ \ '\%(%\@<![({[\\.,:*/%+]\|\<and\|\<or\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\)\s*\%(#.*\)\=$'
+
+" Regex that defines bracket continuations
+let s:bracket_continuation_regex = '%\@<!\%([({[]\)\s*\%(#.*\)\=$'
+
+" Regex that defines continuation lines, not including (, {, or [.
+let s:non_bracket_continuation_regex = '\%([\\.,:*/%+]\|\<and\|\<or\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\)\s*\%(#.*\)\=$'
+
" Keywords to indent on
let s:falcon_indent_keywords = '^\s*\(case\|catch\|class\|enum\|default\|elif\|else' .
\ '\|for\|function\|if.*"[^"]*:.*"\|if \(\(:\)\@!.\)*$\|loop\|object\|select' .
@@ -49,109 +70,381 @@ let s:falcon_indent_keywords = '^\s*\(case\|catch\|class\|enum\|default\|elif\|e
" Keywords to deindent on
let s:falcon_deindent_keywords = '^\s*\(case\|catch\|default\|elif\|else\|end\)'
-"======================================
-" FUNCTIONS
-"======================================
+" 3. Functions {{{1
+" ============
-" Check if the character at lnum:col is inside a string
+" Check if the character at lnum:col is inside a string, comment, or is ascii.
function s:IsInStringOrComment(lnum, col)
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_strcom
endfunction
-"======================================
-" INDENT ROUTINE
-"======================================
+" Check if the character at lnum:col is inside a string.
+function s:IsInString(lnum, col)
+ return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_string
+endfunction
-function FalconGetIndent()
- " Get the line to be indented
- let cline = getline(v:lnum)
+" Check if the character at lnum:col is inside a string delimiter
+function s:IsInStringDelimiter(lnum, col)
+ return synIDattr(synID(a:lnum, a:col, 1), 'name') == 'falconStringDelimiter'
+endfunction
- " Don't reindent comments on first column
- if cline =~ '^\/\/'
- return 0
- endif
+" Find line above 'lnum' that isn't empty, in a comment, or in a string.
+function s:PrevNonBlankNonString(lnum)
+ let in_block = 0
+ let lnum = prevnonblank(a:lnum)
+ while lnum > 0
+ " Go in and out of blocks comments as necessary.
+ " If the line isn't empty (with opt. comment) or in a string, end search.
+ let line = getline(lnum)
+ if line =~ '^=begin'
+ if in_block
+ let in_block = 0
+ else
+ break
+ endif
+ elseif !in_block && line =~ '^=end'
+ let in_block = 1
+ elseif !in_block && line !~ '^\s*#.*$' && !(s:IsInStringOrComment(lnum, 1)
+ \ && s:IsInStringOrComment(lnum, strlen(line)))
+ break
+ endif
+ let lnum = prevnonblank(lnum - 1)
+ endwhile
+ return lnum
+endfunction
+
+" Find line above 'lnum' that started the continuation 'lnum' may be part of.
+function s:GetMSL(lnum)
+ " Start on the line we're at and use its indent.
+ let msl = a:lnum
+ let msl_body = getline(msl)
+ let lnum = s:PrevNonBlankNonString(a:lnum - 1)
+ while lnum > 0
+ " If we have a continuation line, or we're in a string, use line as MSL.
+ " Otherwise, terminate search as we have found our MSL already.
+ let line = getline(lnum)
+
+ if s:Match(line, s:non_bracket_continuation_regex) &&
+ \ s:Match(msl, s:non_bracket_continuation_regex)
+ " If the current line is a non-bracket continuation and so is the
+ " previous one, keep its indent and continue looking for an MSL.
+ "
+ " Example:
+ " method_call one,
+ " two,
+ " three
+ "
+ let msl = lnum
+ elseif s:Match(lnum, s:non_bracket_continuation_regex) &&
+ \ (s:Match(msl, s:bracket_continuation_regex) || s:Match(msl, s:block_continuation_regex))
+ " If the current line is a bracket continuation or a block-starter, but
+ " the previous is a non-bracket one, respect the previous' indentation,
+ " and stop here.
+ "
+ " Example:
+ " method_call one,
+ " two {
+ " three
+ "
+ return lnum
+ elseif s:Match(lnum, s:bracket_continuation_regex) &&
+ \ (s:Match(msl, s:bracket_continuation_regex) || s:Match(msl, s:block_continuation_regex))
+ " If both lines are bracket continuations (the current may also be a
+ " block-starter), use the current one's and stop here
+ "
+ " Example:
+ " method_call(
+ " other_method_call(
+ " foo
+ return msl
+ elseif s:Match(lnum, s:block_regex) &&
+ \ !s:Match(msl, s:continuation_regex) &&
+ \ !s:Match(msl, s:block_continuation_regex)
+ " If the previous line is a block-starter and the current one is
+ " mostly ordinary, use the current one as the MSL.
+ "
+ " Example:
+ " method_call do
+ " something
+ " something_else
+ return msl
+ else
+ let col = match(line, s:continuation_regex) + 1
+ if (col > 0 && !s:IsInStringOrComment(lnum, col))
+ \ || s:IsInString(lnum, strlen(line))
+ let msl = lnum
+ else
+ break
+ endif
+ endif
+
+ let msl_body = getline(msl)
+ let lnum = s:PrevNonBlankNonString(lnum - 1)
+ endwhile
+ return msl
+endfunction
+
+" Check if line 'lnum' has more opening brackets than closing ones.
+function s:ExtraBrackets(lnum)
+ let opening = {'parentheses': [], 'braces': [], 'brackets': []}
+ let closing = {'parentheses': [], 'braces': [], 'brackets': []}
+
+ let line = getline(a:lnum)
+ let pos = match(line, '[][(){}]', 0)
+
+ " Save any encountered opening brackets, and remove them once a matching
+ " closing one has been found. If a closing bracket shows up that doesn't
+ " close anything, save it for later.
+ while pos != -1
+ if !s:IsInStringOrComment(a:lnum, pos + 1)
+ if line[pos] == '('
+ call add(opening.parentheses, {'type': '(', 'pos': pos})
+ elseif line[pos] == ')'
+ if empty(opening.parentheses)
+ call add(closing.parentheses, {'type': ')', 'pos': pos})
+ else
+ let opening.parentheses = opening.parentheses[0:-2]
+ endif
+ elseif line[pos] == '{'
+ call add(opening.braces, {'type': '{', 'pos': pos})
+ elseif line[pos] == '}'
+ if empty(opening.braces)
+ call add(closing.braces, {'type': '}', 'pos': pos})
+ else
+ let opening.braces = opening.braces[0:-2]
+ endif
+ elseif line[pos] == '['
+ call add(opening.brackets, {'type': '[', 'pos': pos})
+ elseif line[pos] == ']'
+ if empty(opening.brackets)
+ call add(closing.brackets, {'type': ']', 'pos': pos})
+ else
+ let opening.brackets = opening.brackets[0:-2]
+ endif
+ endif
+ endif
+
+ let pos = match(line, '[][(){}]', pos + 1)
+ endwhile
+
+ " Find the rightmost brackets, since they're the ones that are important in
+ " both opening and closing cases
+ let rightmost_opening = {'type': '(', 'pos': -1}
+ let rightmost_closing = {'type': ')', 'pos': -1}
+
+ for opening in opening.parentheses + opening.braces + opening.brackets
+ if opening.pos > rightmost_opening.pos
+ let rightmost_opening = opening
+ endif
+ endfor
+
+ for closing in closing.parentheses + closing.braces + closing.brackets
+ if closing.pos > rightmost_closing.pos
+ let rightmost_closing = closing
+ endif
+ endfor
+
+ return [rightmost_opening, rightmost_closing]
+endfunction
+
+function s:Match(lnum, regex)
+ let col = match(getline(a:lnum), '\C'.a:regex) + 1
+ return col > 0 && !s:IsInStringOrComment(a:lnum, col) ? col : 0
+endfunction
- " Find the previous non-blank line
- let lnum = prevnonblank(v:lnum - 1)
+function s:MatchLast(lnum, regex)
+ let line = getline(a:lnum)
+ let col = match(line, '.*\zs' . a:regex)
+ while col != -1 && s:IsInStringOrComment(a:lnum, col)
+ let line = strpart(line, 0, col)
+ let col = match(line, '.*' . a:regex)
+ endwhile
+ return col + 1
+endfunction
+
+" 4. FalconGetIndent Routine {{{1
+" ============
+
+function FalconGetIndent(...)
+ " For the current line, use the first argument if given, else v:lnum
+ let clnum = a:0 ? a:1 : v:lnum
" Use zero indent at the top of the file
- if lnum == 0
+ if clnum == 0
return 0
endif
- let prevline=getline(lnum)
- let ind = indent(lnum)
- let chg = 0
+ let line = getline(clnum)
+ let ind = -1
+
+ " If we got a closing bracket on an empty line, find its match and indent
+ " according to it. For parentheses we indent to its column - 1, for the
+ " others we indent to the containing line's MSL's level. Return -1 if fail.
+ let col = matchend(line, '^\s*[]})]')
+ if col > 0 && !s:IsInStringOrComment(clnum, col)
+ call cursor(clnum, col)
+ let bs = strpart('(){}[]', stridx(')}]', line[col - 1]) * 2, 2)
+ if searchpair(escape(bs[0], '\['), '', bs[1], 'bW', s:skip_expr) > 0
+ if line[col-1]==')' && col('.') != col('$') - 1
+ let ind = virtcol('.') - 1
+ else
+ let ind = indent(s:GetMSL(line('.')))
+ endif
+ endif
+ return ind
+ endif
+
+ " If we have a deindenting keyword, find its match and indent to its level.
+ " TODO: this is messy
+ if s:Match(clnum, s:falcon_deindent_keywords)
+ call cursor(clnum, 1)
+ if searchpair(s:end_start_regex, s:end_middle_regex, s:end_end_regex, 'bW',
+ \ s:end_skip_expr) > 0
+ let msl = s:GetMSL(line('.'))
+ let line = getline(line('.'))
+
+ if strpart(line, 0, col('.') - 1) =~ '=\s*$' &&
+ \ strpart(line, col('.') - 1, 2) !~ 'do'
+ let ind = virtcol('.') - 1
+ elseif getline(msl) =~ '=\s*\(#.*\)\=$'
+ let ind = indent(line('.'))
+ else
+ let ind = indent(msl)
+ endif
+ endif
+ return ind
+ endif
+
+ " If we are in a multi-line string or line-comment, don't do anything to it.
+ if s:IsInString(clnum, matchend(line, '^\s*') + 1)
+ return indent('.')
+ endif
+
+ " Find a non-blank, non-multi-line string line above the current line.
+ let lnum = s:PrevNonBlankNonString(clnum - 1)
- " If we are in a multi-line string or line-comment, don't do anything
- if s:IsInStringOrComment(v:lnum, matchend(cline, '^\s*') + 1 )
- return indent('.')
+ " If the line is empty and inside a string, use the previous line.
+ if line =~ '^\s*$' && lnum != prevnonblank(clnum - 1)
+ return indent(prevnonblank(clnum))
endif
- " If the start of the line equals a double quote, then indent to the
- " previous lines first double quote
- if cline =~? '^\s*"'
- let chg = chg + &sw
+ " At the start of the file use zero indent.
+ if lnum == 0
+ return 0
endif
- " If previous line started with a double quote and this one
- " doesn't, unindent
- if prevline =~? '^\s*"' && cline =~? '^\s*'
- let chg = chg - &sw
+ " Set up variables for the previous line.
+ let line = getline(lnum)
+ let ind = indent(lnum)
+
+ " If the previous line ended with a block opening, add a level of indent.
+ if s:Match(lnum, s:block_regex)
+ return indent(s:GetMSL(lnum)) + &sw
endif
- " Indent if proper keyword
- if prevline =~? s:falcon_indent_keywords
- let chg = &sw
- " If previous line opened a parenthesis, and did not close it, indent
- elseif prevline =~ '^.*(\s*[^)]*\((.*)\)*[^)]*$'
- " Make sure this isn't just a function split between two lines
- if prevline =~ ',\s*$'
- return indent(prevnonblank(v:lnum - 1)) + &sw
- else
- return match(prevline, '(.*\((.*)\|[^)]\)*.*$') + 1
- endif
- elseif prevline =~ '^[^(]*)\s*$'
- " This line closes a parenthesis. Finds opening.
- let curr_line = prevnonblank(lnum - 1)
- while curr_line >= 0
- let str = getline(curr_line)
- if str !~ '^.*(\s*[^)]*\((.*)\)*[^)]*$'
- let curr_line = prevnonblank(curr_line - 1)
- else
- break
- endif
- endwhile
- if curr_line < 0
- return -1
- endif
- let ind = indent(curr_line)
+ " If it contained hanging closing brackets, find the rightmost one, find its
+ " match and indent according to that.
+ if line =~ '[[({]' || line =~ '[])}]\s*\%(#.*\)\=$'
+ let [opening, closing] = s:ExtraBrackets(lnum)
+
+ if opening.pos != -1
+ if opening.type == '(' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0
+ if col('.') + 1 == col('$')
+ return ind + &sw
+ else
+ return virtcol('.')
+ endif
+ else
+ let nonspace = matchend(line, '\S', opening.pos + 1) - 1
+ return nonspace > 0 ? nonspace : ind + &sw
+ endif
+ elseif closing.pos != -1
+ call cursor(lnum, closing.pos + 1)
+ normal! %
+
+ if s:Match(line('.'), s:falcon_indent_keywords)
+ return indent('.') + &sw
+ else
+ return indent('.')
+ endif
+ else
+ call cursor(clnum, vcol)
+ end
endif
- " If previous line ends in a semi-colon reset indent to previous
- " lines setting
- if prevline =~? ';\s*$' && prevnonblank(prevline) =~? ',\s*$'
- let chg = chg - (2 * &sw)
+ " If the previous line ended with an "end", match that "end"s beginning's
+ " indent.
+ let col = s:Match(lnum, '\%(^\|[^.:@$]\)\<end\>\s*\%(#.*\)\=$')
+ if col > 0
+ call cursor(lnum, col)
+ if searchpair(s:end_start_regex, '', s:end_end_regex, 'bW',
+ \ s:end_skip_expr) > 0
+ let n = line('.')
+ let ind = indent('.')
+ let msl = s:GetMSL(n)
+ if msl != n
+ let ind = indent(msl)
+ end
+ return ind
+ endif
+ end
+
+ let col = s:Match(lnum, s:falcon_indent_keywords)
+ if col > 0
+ call cursor(lnum, col)
+ let ind = virtcol('.') - 1 + &sw
+ " TODO: make this better (we need to count them) (or, if a searchpair
+ " fails, we know that something is lacking an end and thus we indent a
+ " level
+ if s:Match(lnum, s:end_end_regex)
+ let ind = indent('.')
+ endif
+ return ind
endif
- " If previous line ended in a comma, indent again
- if prevline =~? ',\s*$'
- let chg = chg + &sw
+ " Set up variables to use and search for MSL to the previous line.
+ let p_lnum = lnum
+ let lnum = s:GetMSL(lnum)
+
+ " If the previous line wasn't a MSL and is continuation return its indent.
+ " TODO: the || s:IsInString() thing worries me a bit.
+ if p_lnum != lnum
+ if s:Match(p_lnum, s:non_bracket_continuation_regex) || s:IsInString(p_lnum,strlen(line))
+ return ind
+ endif
endif
- " If previous line ended in a =>, indent again
- if prevline =~? '=>\s*$'
- let chg = chg + &sw
+ " Set up more variables, now that we know we wasn't continuation bound.
+ let line = getline(lnum)
+ let msl_ind = indent(lnum)
+
+ " If the MSL line had an indenting keyword in it, add a level of indent.
+ " TODO: this does not take into account contrived things such as
+ " module Foo; class Bar; end
+ if s:Match(lnum, s:falcon_indent_keywords)
+ let ind = msl_ind + &sw
+ if s:Match(lnum, s:end_end_regex)
+ let ind = ind - &sw
+ endif
+ return ind
endif
- " Deindent on proper keywords
- if cline =~? s:falcon_deindent_keywords
- let chg = chg - &sw
+ " If the previous line ended with [*+/.,-=], but wasn't a block ending or a
+ " closing bracket, indent one extra level.
+ if s:Match(lnum, s:non_bracket_continuation_regex) && !s:Match(lnum, '^\s*\([\])}]\|end\)')
+ if lnum == p_lnum
+ let ind = msl_ind + &sw
+ else
+ let ind = msl_ind
+ endif
+ return ind
endif
- return ind + chg
+ return ind
endfunction
+" }}}1
+
let &cpo = s:cpo_save
unlet s:cpo_save
diff --git a/runtime/indent/html.vim b/runtime/indent/html.vim
index 6f016ad16..d9a3d4f51 100644
--- a/runtime/indent/html.vim
+++ b/runtime/indent/html.vim
@@ -1,242 +1,492 @@
-" Description: html indenter
-" Author: Johannes Zellner <johannes@zellner.org>
-" Last Change: Mo, 05 Jun 2006 22:32:41 CEST
-" Restoring 'cpo' and 'ic' added by Bram 2006 May 5
-" Globals: g:html_indent_tags -- indenting tags
-" g:html_indent_strict -- inhibit 'O O' elements
-" g:html_indent_strict_table -- inhibit 'O -' elements
-
-" Only load this indent file when no other was loaded.
+" Vim indent script for HTML
+" General: "{{{
+" File: html.vim (Vimscript #2075)
+" Author: Andy Wokula <anwoku@yahoo.de>
+" Last Change: 2013 Jun 12
+" Rev Days: 9
+" Version: 0.8
+" Vim Version: Vim7
+" Description:
+" Improved version of the distributed html indent script, faster on a
+" range of lines.
+"
+" Credits:
+" indent/html.vim (2006 Jun 05) from J. Zellner
+" indent/css.vim (2006 Dec 20) from N. Weibull
+"
+" History:
+" 2011 Sep 09 added HTML5 tags (thx to J. Zuckerman)
+" }}}
+
+" Init Folklore, check user settings (2nd time ++) "{{{
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
+setlocal indentexpr=HtmlIndent()
+setlocal indentkeys=o,O,<Return>,<>>,{,},!^F
-" [-- local settings (must come before aborting the script) --]
-setlocal indentexpr=HtmlIndentGet(v:lnum)
-setlocal indentkeys=o,O,*<Return>,<>>,{,}
-
+let b:indent = {"lnum": -1}
+let b:undo_indent = "set inde< indk<| unlet b:indent"
-if exists('g:html_indent_tags')
- unlet g:html_indent_tags
+" Load Once:
+if exists("*HtmlIndent")
+ call HtmlIndent_CheckUserSettings()
+ finish
endif
-" [-- helper function to assemble tag list --]
-fun! <SID>HtmlIndentPush(tag)
- if exists('g:html_indent_tags')
- let g:html_indent_tags = g:html_indent_tags.'\|'.a:tag
+let s:cpo_save = &cpo
+set cpo-=C
+"}}}
+
+func! HtmlIndent_CheckUserSettings() "{{{
+ if exists("g:html_indent_inctags")
+ call s:AddITags(split(g:html_indent_inctags, ","))
+ endif
+ if exists("g:html_indent_autotags")
+ call s:RemoveITags(split(g:html_indent_autotags, ","))
+ endif
+
+ let indone = {"zero": 0
+ \,"auto": "indent(prevnonblank(v:lnum-1))"
+ \,"inc": "b:indent.blocktagind + &shiftwidth"}
+ if exists("g:html_indent_script1")
+ let s:js1indent = get(indone, g:html_indent_script1, indone.zero)
+ endif
+ if exists("g:html_indent_style1")
+ let s:css1indent = get(indone, g:html_indent_style1, indone.zero)
+ endif
+endfunc "}}}
+
+" Init Script Vars "{{{
+let s:usestate = 1
+let s:css1indent = 0
+let s:js1indent = 0
+" not to be changed:
+let s:endtags = [0,0,0,0,0,0,0,0] " some places unused
+let s:newstate = {}
+let s:countonly = 0
+ "}}}
+func! s:AddITags(taglist) "{{{
+ for itag in a:taglist
+ let s:indent_tags[itag] = 1
+ let s:indent_tags['/'.itag] = -1
+ endfor
+endfunc "}}}
+func! s:AddBlockTag(tag, id, ...) "{{{
+ if !(a:id >= 2 && a:id < 2+len(s:endtags))
+ return
+ endif
+ let s:indent_tags[a:tag] = a:id
+ if a:0 == 0
+ let s:indent_tags['/'.a:tag] = -a:id
+ let s:endtags[a:id-2] = "</".a:tag.">"
else
- let g:html_indent_tags = a:tag
- endif
-endfun
-
-
-" [-- <ELEMENT ? - - ...> --]
-call <SID>HtmlIndentPush('a')
-call <SID>HtmlIndentPush('abbr')
-call <SID>HtmlIndentPush('acronym')
-call <SID>HtmlIndentPush('address')
-call <SID>HtmlIndentPush('b')
-call <SID>HtmlIndentPush('bdo')
-call <SID>HtmlIndentPush('big')
-call <SID>HtmlIndentPush('blockquote')
-call <SID>HtmlIndentPush('button')
-call <SID>HtmlIndentPush('caption')
-call <SID>HtmlIndentPush('center')
-call <SID>HtmlIndentPush('cite')
-call <SID>HtmlIndentPush('code')
-call <SID>HtmlIndentPush('colgroup')
-call <SID>HtmlIndentPush('del')
-call <SID>HtmlIndentPush('dfn')
-call <SID>HtmlIndentPush('dir')
-call <SID>HtmlIndentPush('div')
-call <SID>HtmlIndentPush('dl')
-call <SID>HtmlIndentPush('em')
-call <SID>HtmlIndentPush('fieldset')
-call <SID>HtmlIndentPush('font')
-call <SID>HtmlIndentPush('form')
-call <SID>HtmlIndentPush('frameset')
-call <SID>HtmlIndentPush('h1')
-call <SID>HtmlIndentPush('h2')
-call <SID>HtmlIndentPush('h3')
-call <SID>HtmlIndentPush('h4')
-call <SID>HtmlIndentPush('h5')
-call <SID>HtmlIndentPush('h6')
-call <SID>HtmlIndentPush('i')
-call <SID>HtmlIndentPush('iframe')
-call <SID>HtmlIndentPush('ins')
-call <SID>HtmlIndentPush('kbd')
-call <SID>HtmlIndentPush('label')
-call <SID>HtmlIndentPush('legend')
-call <SID>HtmlIndentPush('map')
-call <SID>HtmlIndentPush('menu')
-call <SID>HtmlIndentPush('noframes')
-call <SID>HtmlIndentPush('noscript')
-call <SID>HtmlIndentPush('object')
-call <SID>HtmlIndentPush('ol')
-call <SID>HtmlIndentPush('optgroup')
-" call <SID>HtmlIndentPush('pre')
-call <SID>HtmlIndentPush('q')
-call <SID>HtmlIndentPush('s')
-call <SID>HtmlIndentPush('samp')
-call <SID>HtmlIndentPush('script')
-call <SID>HtmlIndentPush('select')
-call <SID>HtmlIndentPush('small')
-call <SID>HtmlIndentPush('span')
-call <SID>HtmlIndentPush('strong')
-call <SID>HtmlIndentPush('style')
-call <SID>HtmlIndentPush('sub')
-call <SID>HtmlIndentPush('sup')
-call <SID>HtmlIndentPush('table')
-call <SID>HtmlIndentPush('textarea')
-call <SID>HtmlIndentPush('title')
-call <SID>HtmlIndentPush('tt')
-call <SID>HtmlIndentPush('u')
-call <SID>HtmlIndentPush('ul')
-call <SID>HtmlIndentPush('var')
-
-
-" [-- <ELEMENT ? O O ...> --]
-if !exists('g:html_indent_strict')
- call <SID>HtmlIndentPush('body')
- call <SID>HtmlIndentPush('head')
- call <SID>HtmlIndentPush('html')
- call <SID>HtmlIndentPush('tbody')
+ let s:indent_tags[a:1] = -a:id
+ let s:endtags[a:id-2] = a:1
+ endif
+endfunc "}}}
+func! s:RemoveITags(taglist) "{{{
+ " remove itags (protect blocktags from being removed)
+ for itag in a:taglist
+ if !has_key(s:indent_tags, itag) || s:indent_tags[itag] != 1
+ continue
+ endif
+ unlet s:indent_tags[itag]
+ if itag =~ '^\w\+$'
+ unlet s:indent_tags["/".itag]
+ endif
+ endfor
+endfunc "}}}
+" Add Indent Tags: {{{
+if !exists("s:indent_tags")
+ let s:indent_tags = {}
endif
+" old tags:
+call s:AddITags(['a', 'abbr', 'acronym', 'address', 'b', 'bdo', 'big',
+ \ 'blockquote', 'button', 'caption', 'center', 'cite', 'code', 'colgroup',
+ \ 'del', 'dfn', 'dir', 'div', 'dl', 'em', 'fieldset', 'font', 'form',
+ \ 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'i', 'iframe', 'ins', 'kbd',
+ \ 'label', 'legend', 'map', 'menu', 'noframes', 'noscript', 'object', 'ol',
+ \ 'optgroup', 'q', 's', 'samp', 'select', 'small', 'span', 'strong', 'sub',
+ \ 'sup', 'table', 'textarea', 'title', 'tt', 'u', 'ul', 'var', 'th', 'td',
+ \ 'tr', 'tfoot', 'thead'])
-" [-- <ELEMENT ? O - ...> --]
-if !exists('g:html_indent_strict_table')
- call <SID>HtmlIndentPush('th')
- call <SID>HtmlIndentPush('td')
- call <SID>HtmlIndentPush('tr')
- call <SID>HtmlIndentPush('tfoot')
- call <SID>HtmlIndentPush('thead')
-endif
+" tags added 2011 Sep 09 (especially HTML5 tags):
+call s:AddITags(['area', 'article', 'aside', 'audio', 'bdi', 'canvas',
+ \ 'command', 'datalist', 'details', 'embed', 'figure', 'footer',
+ \ 'header', 'group', 'keygen', 'mark', 'math', 'meter', 'nav', 'output',
+ \ 'progress', 'ruby', 'section', 'svg', 'texture', 'time', 'video',
+ \ 'wbr', 'text'])
-delfun <SID>HtmlIndentPush
+"}}}
+" Add Block Tags: contain alien content "{{{
+call s:AddBlockTag('pre', 2)
+call s:AddBlockTag('script', 3)
+call s:AddBlockTag('style', 4)
+call s:AddBlockTag('<!--', 5, '-->')
+"}}}
-let s:cpo_save = &cpo
-set cpo-=C
+func! s:CountITags(...) "{{{
-" [-- count indent-increasing tags of line a:lnum --]
-fun! <SID>HtmlIndentOpen(lnum, pattern)
- let s = substitute('x'.getline(a:lnum),
- \ '.\{-}\(\(<\)\('.a:pattern.'\)\>\)', "\1", 'g')
- let s = substitute(s, "[^\1].*$", '', '')
- return strlen(s)
-endfun
-
-" [-- count indent-decreasing tags of line a:lnum --]
-fun! <SID>HtmlIndentClose(lnum, pattern)
- let s = substitute('x'.getline(a:lnum),
- \ '.\{-}\(\(<\)/\('.a:pattern.'\)\>>\)', "\1", 'g')
- let s = substitute(s, "[^\1].*$", '', '')
- return strlen(s)
-endfun
-
-" [-- count indent-increasing '{' of (java|css) line a:lnum --]
-fun! <SID>HtmlIndentOpenAlt(lnum)
- return strlen(substitute(getline(a:lnum), '[^{]\+', '', 'g'))
-endfun
-
-" [-- count indent-decreasing '}' of (java|css) line a:lnum --]
-fun! <SID>HtmlIndentCloseAlt(lnum)
- return strlen(substitute(getline(a:lnum), '[^}]\+', '', 'g'))
-endfun
-
-" [-- return the sum of indents respecting the syntax of a:lnum --]
-fun! <SID>HtmlIndentSum(lnum, style)
- if a:style == match(getline(a:lnum), '^\s*</')
- if a:style == match(getline(a:lnum), '^\s*</\<\('.g:html_indent_tags.'\)\>')
- let open = <SID>HtmlIndentOpen(a:lnum, g:html_indent_tags)
- let close = <SID>HtmlIndentClose(a:lnum, g:html_indent_tags)
- if 0 != open || 0 != close
- return open - close
- endif
+ " relative indent steps for current line [unit &sw]:
+ let s:curind = 0
+ " relative indent steps for next line [unit &sw]:
+ let s:nextrel = 0
+
+ if a:0==0
+ let s:block = s:newstate.block
+ let tmpline = substitute(s:curline, '<\zs\/\=\w\+\>\|<!--\|-->', '\=s:CheckTag(submatch(0))', 'g')
+ if s:block == 3
+ let s:newstate.scripttype = s:GetScriptType(matchstr(tmpline, '\C.*<SCRIPT\>\zs[^>]*'))
endif
+ let s:newstate.block = s:block
+ else
+ let s:block = 0 " assume starting outside of a block
+ let s:countonly = 1 " don't change state
+ let tmpline = substitute(s:altline, '<\zs\/\=\w\+\>\|<!--\|-->', '\=s:CheckTag(submatch(0))', 'g')
+ let s:countonly = 0
endif
- if '' != &syntax &&
- \ synIDattr(synID(a:lnum, 1, 1), 'name') =~ '\(css\|java\).*' &&
- \ synIDattr(synID(a:lnum, strlen(getline(a:lnum)), 1), 'name')
- \ =~ '\(css\|java\).*'
- if a:style == match(getline(a:lnum), '^\s*}')
- return <SID>HtmlIndentOpenAlt(a:lnum) - <SID>HtmlIndentCloseAlt(a:lnum)
+endfunc "}}}
+func! s:CheckTag(itag) "{{{
+ " "tag" or "/tag" or "<!--" or "-->"
+ let ind = get(s:indent_tags, a:itag)
+ if ind == -1
+ " closing tag
+ if s:block != 0
+ " ignore itag within a block
+ return "foo"
+ endif
+ if s:nextrel == 0
+ let s:curind -= 1
+ else
+ let s:nextrel -= 1
endif
+ " if s:curind >= 1
+ " let s:curind -= 1
+ " else
+ " let s:nextrel -= 1
+ " endif
+ elseif ind == 1
+ " opening tag
+ if s:block != 0
+ return "foo"
+ endif
+ let s:nextrel += 1
+ elseif ind != 0
+ " block-tag (opening or closing)
+ return s:Blocktag(a:itag, ind)
+ endif
+ " else ind==0 (other tag found): keep indent
+ return "foo" " no matter
+endfunc "}}}
+func! s:Blocktag(blocktag, ind) "{{{
+ if a:ind > 0
+ " a block starts here
+ if s:block != 0
+ " already in a block (nesting) - ignore
+ " especially ignore comments after other blocktags
+ return "foo"
+ endif
+ let s:block = a:ind " block type
+ if s:countonly
+ return "foo"
+ endif
+ let s:newstate.blocklnr = v:lnum
+ " save allover indent for the endtag
+ let s:newstate.blocktagind = b:indent.baseindent + (s:nextrel + s:curind) * &shiftwidth
+ if a:ind == 3
+ return "SCRIPT" " all except this must be lowercase
+ " line is to be checked again for the type attribute
+ endif
+ else
+ let s:block = 0
+ " we get here if starting and closing block-tag on same line
+ endif
+ return "foo"
+endfunc "}}}
+func! s:GetScriptType(str) "{{{
+ if a:str == "" || a:str =~ "java"
+ return "javascript"
+ else
+ return ""
+ endif
+endfunc "}}}
+
+func! s:FreshState(lnum) "{{{
+ " Look back in the file (lines 1 to a:lnum-1) to calc a state for line
+ " a:lnum. A state is to know ALL relevant details about the lines
+ " 1..a:lnum-1, initial calculating (here!) can be slow, but updating is
+ " fast (incremental).
+ " State:
+ " lnum last indented line == prevnonblank(a:lnum - 1)
+ " block = 0 a:lnum located within special tag: 0:none, 2:<pre>,
+ " 3:<script>, 4:<style>, 5:<!--
+ " baseindent use this indent for line a:lnum as a start - kind of
+ " autoindent (if block==0)
+ " scripttype = '' type attribute of a script tag (if block==3)
+ " blocktagind indent for current opening (get) and closing (set)
+ " blocktag (if block!=0)
+ " blocklnr lnum of starting blocktag (if block!=0)
+ " inattr line {lnum} starts with attributes of a tag
+ let state = {}
+ let state.lnum = prevnonblank(a:lnum - 1)
+ let state.scripttype = ""
+ let state.blocktagind = -1
+ let state.block = 0
+ let state.baseindent = 0
+ let state.blocklnr = 0
+ let state.inattr = 0
+
+ if state.lnum == 0
+ return state
endif
- return 0
-endfun
-fun! HtmlIndentGet(lnum)
- " Find a non-empty line above the current line.
- let lnum = prevnonblank(a:lnum - 1)
+ " Heuristic:
+ " remember startline state.lnum
+ " look back for <pre, </pre, <script, </script, <style, </style tags
+ " remember stopline
+ " if opening tag found,
+ " assume a:lnum within block
+ " else
+ " look back in result range (stopline, startline) for comment
+ " \ delimiters (<!--, -->)
+ " if comment opener found,
+ " assume a:lnum within comment
+ " else
+ " assume usual html for a:lnum
+ " if a:lnum-1 has a closing comment
+ " look back to get indent of comment opener
+ " FI
- " Hit the start of the file, use zero indent.
- if lnum == 0
- return 0
+ " look back for blocktag
+ call cursor(a:lnum, 1)
+ let [stopline, stopcol] = searchpos('\c<\zs\/\=\%(pre\>\|script\>\|style\>\)', "bW")
+ " fugly ... why isn't there searchstr()
+ let tagline = tolower(getline(stopline))
+ let blocktag = matchstr(tagline, '\/\=\%(pre\>\|script\>\|style\>\)', stopcol-1)
+ if stopline > 0 && blocktag[0] != "/"
+ " opening tag found, assume a:lnum within block
+ let state.block = s:indent_tags[blocktag]
+ if state.block == 3
+ let state.scripttype = s:GetScriptType(matchstr(tagline, '\>[^>]*', stopcol))
+ endif
+ let state.blocklnr = stopline
+ " check preceding tags in the line:
+ let s:altline = tagline[: stopcol-2]
+ call s:CountITags(1)
+ let state.blocktagind = indent(stopline) + (s:curind + s:nextrel) * &shiftwidth
+ return state
+ elseif stopline == state.lnum
+ " handle special case: previous line (= state.lnum) contains a
+ " closing blocktag which is preceded by line-noise;
+ " blocktag == "/..."
+ let swendtag = match(tagline, '^\s*</') >= 0
+ if !swendtag
+ let [bline, bcol] = searchpos('<'.blocktag[1:].'\>', "bW")
+ let s:altline = tolower(getline(bline)[: bcol-2])
+ call s:CountITags(1)
+ let state.baseindent = indent(bline) + (s:nextrel+s:curline) * &shiftwidth
+ return state
+ endif
endif
- let restore_ic = &ic
- setlocal ic " ignore case
+ " else look back for comment
+ call cursor(a:lnum, 1)
+ let [comline, comcol, found] = searchpos('\(<!--\)\|-->', 'bpW', stopline)
+ if found == 2
+ " comment opener found, assume a:lnum within comment
+ let state.block = 5
+ let state.blocklnr = comline
+ " check preceding tags in the line:
+ let s:altline = tolower(getline(comline)[: comcol-2])
+ call s:CountITags(1)
+ let state.blocktagind = indent(comline) + (s:curind + s:nextrel) * &shiftwidth
+ return state
+ endif
- " [-- special handling for <pre>: no indenting --]
- if getline(a:lnum) =~ '\c</pre>'
- \ || 0 < searchpair('\c<pre>', '', '\c</pre>', 'nWb')
- \ || 0 < searchpair('\c<pre>', '', '\c</pre>', 'nW')
- " we're in a line with </pre> or inside <pre> ... </pre>
- if restore_ic == 0
- setlocal noic
+ " else within usual html
+ let s:altline = tolower(getline(state.lnum))
+ " check a:lnum-1 for closing comment (we need indent from the opening line)
+ let comcol = stridx(s:altline, '-->')
+ if comcol >= 0
+ call cursor(state.lnum, comcol+1)
+ let [comline, comcol] = searchpos('<!--', 'bW')
+ if comline == state.lnum
+ let s:altline = s:altline[: comcol-2]
+ else
+ let s:altline = tolower(getline(comline)[: comcol-2])
endif
+ call s:CountITags(1)
+ let state.baseindent = indent(comline) + (s:nextrel+s:curline) * &shiftwidth
+ return state
+ " TODO check tags that follow "-->"
+ endif
+
+ " else no comments
+ call s:CountITags(1)
+ let state.baseindent = indent(state.lnum) + s:nextrel * &shiftwidth
+ " line starts with end tag
+ let swendtag = match(s:altline, '^\s*</') >= 0
+ if !swendtag
+ let state.baseindent += s:curind * &shiftwidth
+ endif
+ return state
+endfunc "}}}
+
+func! s:Alien2() "{{{
+ " <pre> block
+ return -1
+endfunc "}}}
+func! s:Alien3() "{{{
+ " <script> javascript
+ if prevnonblank(v:lnum-1) == b:indent.blocklnr
+ " indent for the first line after <script>
+ return eval(s:js1indent)
+ endif
+ if b:indent.scripttype == "javascript"
+ return cindent(v:lnum)
+ else
return -1
endif
+endfunc "}}}
+func! s:Alien4() "{{{
+ " <style>
+ if prevnonblank(v:lnum-1) == b:indent.blocklnr
+ " indent for first content line
+ return eval(s:css1indent)
+ endif
+ return s:CSSIndent()
+endfunc
- " [-- special handling for <javascript>: use cindent --]
- let js = '<script.*type\s*=\s*.*java'
-
- """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
- " by Tye Zdrojewski <zdro@yahoo.com>, 05 Jun 2006
- " ZDR: This needs to be an AND (we are 'after the start of the pair' AND
- " we are 'before the end of the pair'). Otherwise, indentation
- " before the start of the script block will be affected; the end of
- " the pair will still match if we are before the beginning of the
- " pair.
- "
- if 0 < searchpair(js, '', '</script>', 'nWb')
- \ && 0 < searchpair(js, '', '</script>', 'nW')
- " we're inside javascript
- if getline(lnum) !~ js && getline(a:lnum) != '</script>'
- if restore_ic == 0
- setlocal noic
+func! s:CSSIndent() "{{{
+ " adopted $VIMRUNTIME/indent/css.vim
+ if getline(v:lnum) =~ '^\s*[*}]'
+ return cindent(v:lnum)
+ endif
+ let minline = b:indent.blocklnr
+ let pnum = s:css_prevnoncomment(v:lnum - 1, minline)
+ if pnum <= minline
+ " < is to catch errors
+ " indent for first content line after comments
+ return eval(s:css1indent)
+ endif
+ let ind = indent(pnum) + s:css_countbraces(pnum, 1) * &sw
+ let pline = getline(pnum)
+ if pline =~ '}\s*$'
+ let ind -= (s:css_countbraces(pnum, 0) - (pline =~ '^\s*}')) * &sw
+ endif
+ return ind
+endfunc "}}}
+func! s:css_prevnoncomment(lnum, stopline) "{{{
+ " caller starts from a line a:lnum-1 that is not a comment
+ let lnum = prevnonblank(a:lnum)
+ let ccol = match(getline(lnum), '\*/')
+ if ccol < 0
+ return lnum
+ endif
+ call cursor(lnum, ccol+1)
+ let lnum = search('/\*', 'bW', a:stopline)
+ if indent(".") == virtcol(".")-1
+ return prevnonblank(lnum-1)
+ else
+ return lnum
+ endif
+endfunc "}}}
+func! s:css_countbraces(lnum, count_open) "{{{
+ let brs = substitute(getline(a:lnum),'[''"].\{-}[''"]\|/\*.\{-}\*/\|/\*.*$\|[^{}]','','g')
+ let n_open = 0
+ let n_close = 0
+ for brace in split(brs, '\zs')
+ if brace == "{"
+ let n_open += 1
+ elseif brace == "}"
+ if n_open > 0
+ let n_open -= 1
+ else
+ let n_close += 1
endif
- return cindent(a:lnum)
endif
+ endfor
+ return a:count_open ? n_open : n_close
+endfunc "}}}
+
+"}}}
+func! s:Alien5() "{{{
+ " <!-- -->
+ return -1
+endfunc "}}}
+
+func! HtmlIndent() "{{{
+ let s:curline = tolower(getline(v:lnum))
+
+ let s:newstate = {}
+ let s:newstate.lnum = v:lnum
+
+ " is the first non-blank in the line the start of a tag?
+ let swendtag = match(s:curline, '^\s*</') >= 0
+
+ if prevnonblank(v:lnum-1) == b:indent.lnum && s:usestate
+ " use state (continue from previous line)
+ else
+ " start over (know nothing)
+ let b:indent = s:FreshState(v:lnum)
endif
- if getline(lnum) =~ '\c</pre>'
- " line before the current line a:lnum contains
- " a closing </pre>. --> search for line before
- " starting <pre> to restore the indent.
- let preline = prevnonblank(search('\c<pre>', 'bW') - 1)
- if preline > 0
- if restore_ic == 0
- setlocal noic
+ if b:indent.block >= 2
+ " within block
+ let endtag = s:endtags[b:indent.block-2]
+ let blockend = stridx(s:curline, endtag)
+ if blockend >= 0
+ " block ends here
+ let s:newstate.block = 0
+ " calc indent for REST OF LINE (may start more blocks):
+ let s:curline = strpart(s:curline, blockend+strlen(endtag))
+ call s:CountITags()
+ if swendtag && b:indent.block != 5
+ let indent = b:indent.blocktagind + s:curind * &shiftwidth
+ let s:newstate.baseindent = indent + s:nextrel * &shiftwidth
+ else
+ let indent = s:Alien{b:indent.block}()
+ let s:newstate.baseindent = b:indent.blocktagind + s:nextrel * &shiftwidth
endif
- return indent(preline)
+ call extend(b:indent, s:newstate, "force")
+ return indent
+ else
+ " block continues
+ " indent this line with alien method
+ let indent = s:Alien{b:indent.block}()
+ call extend(b:indent, s:newstate, "force")
+ return indent
endif
+ else
+ " not within a block - within usual html
+ " if < 2 then always 0
+ let s:newstate.block = b:indent.block
+ call s:CountITags()
+ if swendtag
+ let indent = b:indent.baseindent + s:curind * &shiftwidth
+ let s:newstate.baseindent = indent + s:nextrel * &shiftwidth
+ else
+ let indent = b:indent.baseindent
+ let s:newstate.baseindent = indent + (s:curind + s:nextrel) * &shiftwidth
+ endif
+ call extend(b:indent, s:newstate, "force")
+ return indent
endif
- let ind = <SID>HtmlIndentSum(lnum, -1)
- let ind = ind + <SID>HtmlIndentSum(a:lnum, 0)
+endfunc "}}}
- if restore_ic == 0
- setlocal noic
- endif
+" check user settings (first time), clear cpo, Modeline: {{{1
+
+" DEBUG:
+com! -nargs=* IndHtmlLocal <args>
- return indent(lnum) + (&sw * ind)
-endfun
+call HtmlIndent_CheckUserSettings()
let &cpo = s:cpo_save
unlet s:cpo_save
-" [-- EOF <runtime>/indent/html.vim --]
+" vim:set fdm=marker ts=8:
diff --git a/runtime/indent/ruby.vim b/runtime/indent/ruby.vim
index 04d130104..095b3a43c 100644
--- a/runtime/indent/ruby.vim
+++ b/runtime/indent/ruby.vim
@@ -1,9 +1,7 @@
" Vim indent file
" Language: Ruby
" Maintainer: Nikolai Weibull <now at bitwi.se>
-" Last Change: 2009 Dec 17
-" URL: http://vim-ruby.rubyforge.org
-" Anon CVS: See above site
+" URL: https://github.com/vim-ruby/vim-ruby
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
" 0. Initialization {{{1
@@ -18,9 +16,9 @@ let b:did_indent = 1
setlocal nosmartindent
" Now, set up our indentation expression and keys that trigger it.
-setlocal indentexpr=GetRubyIndent()
+setlocal indentexpr=GetRubyIndent(v:lnum)
setlocal indentkeys=0{,0},0),0],!^F,o,O,e
-setlocal indentkeys+==end,=elsif,=when,=ensure,=rescue,==begin,==end
+setlocal indentkeys+==end,=else,=elsif,=when,=ensure,=rescue,==begin,==end
" Only define the function once.
if exists("*GetRubyIndent")
@@ -33,8 +31,9 @@ set cpo&vim
" 1. Variables {{{1
" ============
-" Regex of syntax group names that are or delimit string or are comments.
-let s:syng_strcom = '\<ruby\%(String\|StringEscape\|ASCIICode' .
+" Regex of syntax group names that are or delimit strings/symbols or are comments.
+let s:syng_strcom = '\<ruby\%(Regexp\|RegexpDelimiter\|RegexpEscape' .
+ \ '\|Symbol\|String\|StringDelimiter\|StringEscape\|ASCIICode' .
\ '\|Interpolation\|NoInterpolation\|Comment\|Documentation\)\>'
" Regex of syntax group names that are strings.
@@ -43,7 +42,7 @@ let s:syng_string =
" Regex of syntax group names that are strings or documentation.
let s:syng_stringdoc =
- \'\<ruby\%(String\|Interpolation\|NoInterpolation\|StringEscape\|Documentation\)\>'
+ \'\<ruby\%(String\|Interpolation\|NoInterpolation\|StringEscape\|Documentation\)\>'
" Expression used to check whether we should skip a match with searchpair().
let s:skip_expr =
@@ -52,45 +51,60 @@ let s:skip_expr =
" Regex used for words that, at the start of a line, add a level of indent.
let s:ruby_indent_keywords = '^\s*\zs\<\%(module\|class\|def\|if\|for' .
\ '\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure' .
- \ '\|rescue\)\>' .
- \ '\|\%([*+/,=-]\|<<\|>>\|:\s\)\s*\zs' .
- \ '\<\%(if\|for\|while\|until\|case\|unless\|begin\)\>'
+ \ '\|rescue\):\@!\>' .
+ \ '\|\%([=,*/%+-]\|<<\|>>\|:\s\)\s*\zs' .
+ \ '\<\%(if\|for\|while\|until\|case\|unless\|begin\):\@!\>'
" Regex used for words that, at the start of a line, remove a level of indent.
let s:ruby_deindent_keywords =
- \ '^\s*\zs\<\%(ensure\|else\|rescue\|elsif\|when\|end\)\>'
+ \ '^\s*\zs\<\%(ensure\|else\|rescue\|elsif\|when\|end\):\@!\>'
" Regex that defines the start-match for the 'end' keyword.
"let s:end_start_regex = '\%(^\|[^.]\)\<\%(module\|class\|def\|if\|for\|while\|until\|case\|unless\|begin\|do\)\>'
" TODO: the do here should be restricted somewhat (only at end of line)?
-let s:end_start_regex = '^\s*\zs\<\%(module\|class\|def\|if\|for' .
- \ '\|while\|until\|case\|unless\|begin\)\>' .
- \ '\|\%([*+/,=-]\|<<\|>>\|:\s\)\s*\zs' .
- \ '\<\%(if\|for\|while\|until\|case\|unless\|begin\)\>' .
- \ '\|\<do\>'
+let s:end_start_regex =
+ \ '\C\%(^\s*\|[=,*/%+\-|;{]\|<<\|>>\|:\s\)\s*\zs' .
+ \ '\<\%(module\|class\|def\|if\|for\|while\|until\|case\|unless\|begin\):\@!\>' .
+ \ '\|\%(^\|[^.:@$]\)\@<=\<do:\@!\>'
" Regex that defines the middle-match for the 'end' keyword.
-let s:end_middle_regex = '\<\%(ensure\|else\|\%(\%(^\|;\)\s*\)\@<=\<rescue\>\|when\|elsif\)\>'
+let s:end_middle_regex = '\<\%(ensure\|else\|\%(\%(^\|;\)\s*\)\@<=\<rescue:\@!\>\|when\|elsif\):\@!\>'
" Regex that defines the end-match for the 'end' keyword.
-let s:end_end_regex = '\%(^\|[^.:@$]\)\@<=\<end\>'
+let s:end_end_regex = '\%(^\|[^.:@$]\)\@<=\<end:\@!\>'
" Expression used for searchpair() call for finding match for 'end' keyword.
let s:end_skip_expr = s:skip_expr .
\ ' || (expand("<cword>") == "do"' .
- \ ' && getline(".") =~ "^\\s*\\<\\(while\\|until\\|for\\)\\>")'
+ \ ' && getline(".") =~ "^\\s*\\<\\(while\\|until\\|for\\):\\@!\\>")'
" Regex that defines continuation lines, not including (, {, or [.
-let s:continuation_regex = '\%([\\*+/.,:]\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\)\s*\%(#.*\)\=$'
+let s:non_bracket_continuation_regex = '\%([\\.,:*/%+]\|\<and\|\<or\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\)\s*\%(#.*\)\=$'
" Regex that defines continuation lines.
" TODO: this needs to deal with if ...: and so on
-let s:continuation_regex2 =
- \ '\%([\\*+/.,:({[]\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\)\s*\%(#.*\)\=$'
+let s:continuation_regex =
+ \ '\%(%\@<![({[\\.,:*/%+]\|\<and\|\<or\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\)\s*\%(#.*\)\=$'
+
+" Regex that defines bracket continuations
+let s:bracket_continuation_regex = '%\@<!\%([({[]\)\s*\%(#.*\)\=$'
+
+" Regex that defines the first part of a splat pattern
+let s:splat_regex = '[[,(]\s*\*\s*\%(#.*\)\=$'
" Regex that defines blocks.
+"
+" Note that there's a slight problem with this regex and s:continuation_regex.
+" Code like this will be matched by both:
+"
+" method_call do |(a, b)|
+"
+" The reason is that the pipe matches a hanging "|" operator.
+"
let s:block_regex =
- \ '\%(\<do\>\|{\)\s*\%(|\%([*@]\=\h\w*,\=\s*\)\%(,\s*[*@]\=\h\w*\)*|\)\=\s*\%(#.*\)\=$'
+ \ '\%(\<do:\@!\>\|%\@<!{\)\s*\%(|\s*(*\s*\%([*@&]\=\h\w*,\=\s*\)\%(,\s*(*\s*[*@&]\=\h\w*\s*)*\s*\)*|\)\=\s*\%(#.*\)\=$'
+
+let s:block_continuation_regex = '^\s*[^])}\t ].*'.s:block_regex
" 2. Auxiliary Functions {{{1
" ======================
@@ -110,6 +124,11 @@ function s:IsInStringOrDocumentation(lnum, col)
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_stringdoc
endfunction
+" Check if the character at lnum:col is inside a string delimiter
+function s:IsInStringDelimiter(lnum, col)
+ return synIDattr(synID(a:lnum, a:col, 1), 'name') == 'rubyStringDelimiter'
+endfunction
+
" Find line above 'lnum' that isn't empty, in a comment, or in a string.
function s:PrevNonBlankNonString(lnum)
let in_block = 0
@@ -118,16 +137,16 @@ function s:PrevNonBlankNonString(lnum)
" Go in and out of blocks comments as necessary.
" If the line isn't empty (with opt. comment) or in a string, end search.
let line = getline(lnum)
- if line =~ '^=begin$'
+ if line =~ '^=begin'
if in_block
- let in_block = 0
+ let in_block = 0
else
- break
+ break
endif
- elseif !in_block && line =~ '^=end$'
+ elseif !in_block && line =~ '^=end'
let in_block = 1
elseif !in_block && line !~ '^\s*#.*$' && !(s:IsInStringOrComment(lnum, 1)
- \ && s:IsInStringOrComment(lnum, strlen(line)))
+ \ && s:IsInStringOrComment(lnum, strlen(line)))
break
endif
let lnum = prevnonblank(lnum - 1)
@@ -139,42 +158,144 @@ endfunction
function s:GetMSL(lnum)
" Start on the line we're at and use its indent.
let msl = a:lnum
+ let msl_body = getline(msl)
let lnum = s:PrevNonBlankNonString(a:lnum - 1)
while lnum > 0
" If we have a continuation line, or we're in a string, use line as MSL.
" Otherwise, terminate search as we have found our MSL already.
let line = getline(lnum)
- let col = match(line, s:continuation_regex2) + 1
- if (col > 0 && !s:IsInStringOrComment(lnum, col))
- \ || s:IsInString(lnum, strlen(line))
+
+ if s:Match(lnum, s:splat_regex)
+ " If the above line looks like the "*" of a splat, use the current one's
+ " indentation.
+ "
+ " Example:
+ " Hash[*
+ " method_call do
+ " something
+ "
+ return msl
+ elseif s:Match(line, s:non_bracket_continuation_regex) &&
+ \ s:Match(msl, s:non_bracket_continuation_regex)
+ " If the current line is a non-bracket continuation and so is the
+ " previous one, keep its indent and continue looking for an MSL.
+ "
+ " Example:
+ " method_call one,
+ " two,
+ " three
+ "
let msl = lnum
+ elseif s:Match(lnum, s:non_bracket_continuation_regex) &&
+ \ (s:Match(msl, s:bracket_continuation_regex) || s:Match(msl, s:block_continuation_regex))
+ " If the current line is a bracket continuation or a block-starter, but
+ " the previous is a non-bracket one, respect the previous' indentation,
+ " and stop here.
+ "
+ " Example:
+ " method_call one,
+ " two {
+ " three
+ "
+ return lnum
+ elseif s:Match(lnum, s:bracket_continuation_regex) &&
+ \ (s:Match(msl, s:bracket_continuation_regex) || s:Match(msl, s:block_continuation_regex))
+ " If both lines are bracket continuations (the current may also be a
+ " block-starter), use the current one's and stop here
+ "
+ " Example:
+ " method_call(
+ " other_method_call(
+ " foo
+ return msl
+ elseif s:Match(lnum, s:block_regex) &&
+ \ !s:Match(msl, s:continuation_regex) &&
+ \ !s:Match(msl, s:block_continuation_regex)
+ " If the previous line is a block-starter and the current one is
+ " mostly ordinary, use the current one as the MSL.
+ "
+ " Example:
+ " method_call do
+ " something
+ " something_else
+ return msl
else
- break
+ let col = match(line, s:continuation_regex) + 1
+ if (col > 0 && !s:IsInStringOrComment(lnum, col))
+ \ || s:IsInString(lnum, strlen(line))
+ let msl = lnum
+ else
+ break
+ endif
endif
+
+ let msl_body = getline(msl)
let lnum = s:PrevNonBlankNonString(lnum - 1)
endwhile
return msl
endfunction
" Check if line 'lnum' has more opening brackets than closing ones.
-function s:LineHasOpeningBrackets(lnum)
- let open_0 = 0
- let open_2 = 0
- let open_4 = 0
+function s:ExtraBrackets(lnum)
+ let opening = {'parentheses': [], 'braces': [], 'brackets': []}
+ let closing = {'parentheses': [], 'braces': [], 'brackets': []}
+
let line = getline(a:lnum)
- let pos = match(line, '[][(){}]', 0)
+ let pos = match(line, '[][(){}]', 0)
+
+ " Save any encountered opening brackets, and remove them once a matching
+ " closing one has been found. If a closing bracket shows up that doesn't
+ " close anything, save it for later.
while pos != -1
if !s:IsInStringOrComment(a:lnum, pos + 1)
- let idx = stridx('(){}[]', line[pos])
- if idx % 2 == 0
- let open_{idx} = open_{idx} + 1
- else
- let open_{idx - 1} = open_{idx - 1} - 1
+ if line[pos] == '('
+ call add(opening.parentheses, {'type': '(', 'pos': pos})
+ elseif line[pos] == ')'
+ if empty(opening.parentheses)
+ call add(closing.parentheses, {'type': ')', 'pos': pos})
+ else
+ let opening.parentheses = opening.parentheses[0:-2]
+ endif
+ elseif line[pos] == '{'
+ call add(opening.braces, {'type': '{', 'pos': pos})
+ elseif line[pos] == '}'
+ if empty(opening.braces)
+ call add(closing.braces, {'type': '}', 'pos': pos})
+ else
+ let opening.braces = opening.braces[0:-2]
+ endif
+ elseif line[pos] == '['
+ call add(opening.brackets, {'type': '[', 'pos': pos})
+ elseif line[pos] == ']'
+ if empty(opening.brackets)
+ call add(closing.brackets, {'type': ']', 'pos': pos})
+ else
+ let opening.brackets = opening.brackets[0:-2]
+ endif
endif
endif
+
let pos = match(line, '[][(){}]', pos + 1)
endwhile
- return (open_0 > 0) . (open_2 > 0) . (open_4 > 0)
+
+ " Find the rightmost brackets, since they're the ones that are important in
+ " both opening and closing cases
+ let rightmost_opening = {'type': '(', 'pos': -1}
+ let rightmost_closing = {'type': ')', 'pos': -1}
+
+ for opening in opening.parentheses + opening.braces + opening.brackets
+ if opening.pos > rightmost_opening.pos
+ let rightmost_opening = opening
+ endif
+ endfor
+
+ for closing in closing.parentheses + closing.braces + closing.brackets
+ if closing.pos > rightmost_closing.pos
+ let rightmost_closing = closing
+ endif
+ endfor
+
+ return [rightmost_opening, rightmost_closing]
endfunction
function s:Match(lnum, regex)
@@ -195,32 +316,35 @@ endfunction
" 3. GetRubyIndent Function {{{1
" =========================
-function GetRubyIndent()
+function GetRubyIndent(...)
" 3.1. Setup {{{2
" ----------
- " Set up variables for restoring position in file. Could use v:lnum here.
+ " For the current line, use the first argument if given, else v:lnum
+ let clnum = a:0 ? a:1 : v:lnum
+
+ " Set up variables for restoring position in file. Could use clnum here.
let vcol = col('.')
" 3.2. Work on the current line {{{2
" -----------------------------
" Get the current line.
- let line = getline(v:lnum)
+ let line = getline(clnum)
let ind = -1
" If we got a closing bracket on an empty line, find its match and indent
" according to it. For parentheses we indent to its column - 1, for the
" others we indent to the containing line's MSL's level. Return -1 if fail.
let col = matchend(line, '^\s*[]})]')
- if col > 0 && !s:IsInStringOrComment(v:lnum, col)
- call cursor(v:lnum, col)
+ if col > 0 && !s:IsInStringOrComment(clnum, col)
+ call cursor(clnum, col)
let bs = strpart('(){}[]', stridx(')}]', line[col - 1]) * 2, 2)
if searchpair(escape(bs[0], '\['), '', bs[1], 'bW', s:skip_expr) > 0
if line[col-1]==')' && col('.') != col('$') - 1
- let ind = virtcol('.')-1
+ let ind = virtcol('.') - 1
else
- let ind = indent(s:GetMSL(line('.')))
+ let ind = indent(s:GetMSL(line('.')))
endif
endif
return ind
@@ -233,35 +357,47 @@ function GetRubyIndent()
" If we have a deindenting keyword, find its match and indent to its level.
" TODO: this is messy
- if s:Match(v:lnum, s:ruby_deindent_keywords)
- call cursor(v:lnum, 1)
+ if s:Match(clnum, s:ruby_deindent_keywords)
+ call cursor(clnum, 1)
if searchpair(s:end_start_regex, s:end_middle_regex, s:end_end_regex, 'bW',
- \ s:end_skip_expr) > 0
- let line = getline('.')
+ \ s:end_skip_expr) > 0
+ let msl = s:GetMSL(line('.'))
+ let line = getline(line('.'))
+
if strpart(line, 0, col('.') - 1) =~ '=\s*$' &&
- \ strpart(line, col('.') - 1, 2) !~ 'do'
- let ind = virtcol('.') - 1
+ \ strpart(line, col('.') - 1, 2) !~ 'do'
+ let ind = virtcol('.') - 1
+ elseif getline(msl) =~ '=\s*\(#.*\)\=$'
+ let ind = indent(line('.'))
else
- let ind = indent('.')
+ let ind = indent(msl)
endif
endif
return ind
endif
" If we are in a multi-line string or line-comment, don't do anything to it.
- if s:IsInStringOrDocumentation(v:lnum, matchend(line, '^\s*') + 1)
+ if s:IsInStringOrDocumentation(clnum, matchend(line, '^\s*') + 1)
return indent('.')
endif
+ " If we are at the closing delimiter of a "<<" heredoc-style string, set the
+ " indent to 0.
+ if line =~ '^\k\+\s*$'
+ \ && s:IsInStringDelimiter(clnum, 1)
+ \ && search('\V<<'.line, 'nbW') > 0
+ return 0
+ endif
+
" 3.3. Work on the previous line. {{{2
" -------------------------------
" Find a non-blank, non-multi-line string line above the current line.
- let lnum = s:PrevNonBlankNonString(v:lnum - 1)
+ let lnum = s:PrevNonBlankNonString(clnum - 1)
" If the line is empty and inside a string, use the previous line.
- if line =~ '^\s*$' && lnum != prevnonblank(v:lnum - 1)
- return indent(prevnonblank(v:lnum))
+ if line =~ '^\s*$' && lnum != prevnonblank(clnum - 1)
+ return indent(prevnonblank(clnum))
endif
" At the start of the file use zero indent.
@@ -269,7 +405,7 @@ function GetRubyIndent()
return 0
endif
- " Set up variables for current line.
+ " Set up variables for the previous line.
let line = getline(lnum)
let ind = indent(lnum)
@@ -278,20 +414,42 @@ function GetRubyIndent()
return indent(s:GetMSL(lnum)) + &sw
endif
- " If the previous line contained an opening bracket, and we are still in it,
- " add indent depending on the bracket type.
- if line =~ '[[({]'
- let counts = s:LineHasOpeningBrackets(lnum)
- if counts[0] == '1' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0
- if col('.') + 1 == col('$')
- return ind + &sw
+ " If the previous line ended with the "*" of a splat, add a level of indent
+ if line =~ s:splat_regex
+ return indent(lnum) + &sw
+ endif
+
+ " If the previous line contained unclosed opening brackets and we are still
+ " in them, find the rightmost one and add indent depending on the bracket
+ " type.
+ "
+ " If it contained hanging closing brackets, find the rightmost one, find its
+ " match and indent according to that.
+ if line =~ '[[({]' || line =~ '[])}]\s*\%(#.*\)\=$'
+ let [opening, closing] = s:ExtraBrackets(lnum)
+
+ if opening.pos != -1
+ if opening.type == '(' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0
+ if col('.') + 1 == col('$')
+ return ind + &sw
+ else
+ return virtcol('.')
+ endif
else
- return virtcol('.')
+ let nonspace = matchend(line, '\S', opening.pos + 1) - 1
+ return nonspace > 0 ? nonspace : ind + &sw
+ endif
+ elseif closing.pos != -1
+ call cursor(lnum, closing.pos + 1)
+ normal! %
+
+ if s:Match(line('.'), s:ruby_indent_keywords)
+ return indent('.') + &sw
+ else
+ return indent('.')
endif
- elseif counts[1] == '1' || counts[2] == '1'
- return ind + &sw
else
- call cursor(v:lnum, vcol)
+ call cursor(clnum, vcol)
end
endif
@@ -301,12 +459,12 @@ function GetRubyIndent()
if col > 0
call cursor(lnum, col)
if searchpair(s:end_start_regex, '', s:end_end_regex, 'bW',
- \ s:end_skip_expr) > 0
+ \ s:end_skip_expr) > 0
let n = line('.')
let ind = indent('.')
let msl = s:GetMSL(n)
if msl != n
- let ind = indent(msl)
+ let ind = indent(msl)
end
return ind
endif
@@ -316,7 +474,6 @@ function GetRubyIndent()
if col > 0
call cursor(lnum, col)
let ind = virtcol('.') - 1 + &sw
-" let ind = indent(lnum) + &sw
" TODO: make this better (we need to count them) (or, if a searchpair
" fails, we know that something is lacking an end and thus we indent a
" level
@@ -336,7 +493,7 @@ function GetRubyIndent()
" If the previous line wasn't a MSL and is continuation return its indent.
" TODO: the || s:IsInString() thing worries me a bit.
if p_lnum != lnum
- if s:Match(p_lnum,s:continuation_regex)||s:IsInString(p_lnum,strlen(line))
+ if s:Match(p_lnum, s:non_bracket_continuation_regex) || s:IsInString(p_lnum,strlen(line))
return ind
endif
endif
@@ -356,13 +513,15 @@ function GetRubyIndent()
return ind
endif
- " If the previous line ended with [*+/.-=], indent one extra level.
- if s:Match(lnum, s:continuation_regex)
+ " If the previous line ended with [*+/.,-=], but wasn't a block ending or a
+ " closing bracket, indent one extra level.
+ if s:Match(lnum, s:non_bracket_continuation_regex) && !s:Match(lnum, '^\s*\([\])}]\|end\)')
if lnum == p_lnum
let ind = msl_ind + &sw
else
let ind = msl_ind
endif
+ return ind
endif
" }}}2
@@ -375,4 +534,4 @@ endfunction
let &cpo = s:cpo_save
unlet s:cpo_save
-" vim:set sw=2 sts=2 ts=8 noet:
+" vim:set sw=2 sts=2 ts=8 et:
diff --git a/runtime/syntax/eruby.vim b/runtime/syntax/eruby.vim
index 42c8b5106..c20b086ba 100644
--- a/runtime/syntax/eruby.vim
+++ b/runtime/syntax/eruby.vim
@@ -1,9 +1,7 @@
" Vim syntax file
" Language: eRuby
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
-" Last Change: 2010 Apr 15
-" URL: http://vim-ruby.rubyforge.org
-" Anon CVS: See above site
+" URL: https://github.com/vim-ruby/vim-ruby
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
if exists("b:current_syntax")
@@ -18,13 +16,12 @@ if !exists("g:eruby_default_subtype")
let g:eruby_default_subtype = "html"
endif
-if !exists("b:eruby_subtype") && main_syntax == 'eruby'
+if &filetype =~ '^eruby\.'
+ let b:eruby_subtype = matchstr(&filetype,'^eruby\.\zs\w\+')
+elseif !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\|\.erubis\)\+$','',''),'\.\zs\w\+$')
endif
if b:eruby_subtype == 'rhtml'
@@ -61,7 +58,7 @@ syn cluster erubyRegions contains=erubyOneLiner,erubyBlock,erubyExpression,eruby
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'
+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.
diff --git a/runtime/syntax/gprof.vim b/runtime/syntax/gprof.vim
index 342af056f..381a3c63b 100644
--- a/runtime/syntax/gprof.vim
+++ b/runtime/syntax/gprof.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: Syntax for Gprof Output
" Maintainer: Dominique Pelle <dominique.pelle@gmail.com>
-" Last Change: 2012 May 20
+" Last Change: 2013 Jun 09
" Quit when a syntax file was already loaded
if exists("b:current_syntax")
@@ -32,7 +32,7 @@ syn match gprofCallGraphFunction "\s\+\(\d\+\.\d\+\s\+\)\{3}\([0-9+]\+\)\?\s\+[a
syn match gprofCallGraphSeparator "^-\+$"
syn region gprofCallGraphTrailer
\ start="This table describes the call tree of the program"
- \ end="^\s*the cycle.$"
+ \ end="^\s*the cycle\.$"
" Index
syn region gprofIndex
diff --git a/runtime/syntax/javascript.vim b/runtime/syntax/javascript.vim
index 8bf677bf5..ba906664b 100644
--- a/runtime/syntax/javascript.vim
+++ b/runtime/syntax/javascript.vim
@@ -8,6 +8,7 @@
" (ss) fixed regex parsing issue with multiple qualifiers [gi]
" (ss) additional factoring of keywords, globals, and members
" Last Change: 2012 Oct 05
+" 2013 Jun 12: adjusted javaScriptRegexpString (Kevin Locke)
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
@@ -42,7 +43,7 @@ syn region javaScriptStringS start=+'+ skip=+\\\\\|\\'+ end=+'\|$+ con
syn match javaScriptSpecialCharacter "'\\.'"
syn match javaScriptNumber "-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>"
-syn region javaScriptRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gi]\{0,2\}\s*$+ end=+/[gi]\{0,2\}\s*[;.,)\]}]+me=e-1 contains=@htmlPreproc oneline
+syn region javaScriptRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gim]\{0,2\}\s*$+ end=+/[gim]\{0,2\}\s*[;.,)\]}]+me=e-1 contains=@htmlPreproc oneline
syn keyword javaScriptConditional if else switch
syn keyword javaScriptRepeat while for do in
diff --git a/runtime/syntax/objc.vim b/runtime/syntax/objc.vim
index 665a47a27..8891ebed6 100644
--- a/runtime/syntax/objc.vim
+++ b/runtime/syntax/objc.vim
@@ -1,123 +1,435 @@
" Vim syntax file
-" Language: Objective C
-" Maintainer: Kazunobu Kuriyama <kazunobu.kuriyama@nifty.com>
-" Ex-maintainer: Anthony Hodsdon <ahodsdon@fastmail.fm>
-" First Author: Valentino Kyriakides <1kyriaki@informatik.uni-hamburg.de>
-" Last Change: 2013 Feb 20
-"
-" 2013 Feb 19 Revised based on a patch sent to the maintainer by
-" Christos Kontas <xakon@yahoo.com> on 2012 Dec 12.
-
-" For version 5.x: Clear all syntax items
-" For version 6.x: Quit when a syntax file was already loaded
-if version < 600
- syntax clear
-elseif exists("b:current_syntax")
+" Language: Objective-C
+" Maintainer: Kazunobu Kuriyama <kazunobu.kuriyama@nifty.com>
+" Last Change: 2013 Jun 12
+" Remark: Modern Objective-C Edition
+
+""" Preparation for loading ObjC stuff
+if exists("b:current_syntax")
finish
endif
-let s:keepcpo= &cpo
-set cpo&vim
-
if &filetype != 'objcpp'
- " Read the C syntax to start with
- if version < 600
- source <sfile>:p:h/c.vim
- else
- runtime! syntax/c.vim
- endif
+ syn clear
+ runtime! syntax/c.vim
endif
+let s:cpo_save = &cpo
+set cpo&vim
+
+""" ObjC proper stuff follows...
+
+syn keyword objcPreProcMacro __OBJC__ __OBJC2__ __clang__
+
+" Defined Types
+syn keyword objcPrincipalType id Class SEL IMP BOOL
+syn keyword objcUsefulTerm nil Nil NO YES
-" Objective C extentions follow below
-"
-" NOTE: Objective C is abbreviated to ObjC/objc
-" and uses *.h, *.m as file extensions!
-
-
-" ObjC keywords, types, type qualifiers etc.
-syn keyword objcStatement self super _cmd
-syn keyword objcType id Class SEL IMP BOOL
-syn keyword objcTypeModifier bycopy in out inout oneway
-syn keyword objcConstant nil Nil
-
-" Match the ObjC #import directive (like C's #include)
-syn region objcImported display contained start=+"+ skip=+\\\\\|\\"+ end=+"+
-syn match objcImported display contained "<[-_0-9a-zA-Z.\/]*>"
-syn match objcImport display "^\s*\(%:\|#\)\s*import\>\s*["<]" contains=objcImported
-
-" Match the important ObjC directives
-syn match objcScopeDecl "@public\|@private\|@protected"
-syn match objcDirective "@interface\|@implementation"
-syn match objcDirective "@class\|@end\|@defs"
-syn match objcDirective "@encode\|@protocol\|@selector"
-syn match objcDirective "@try\|@catch\|@finally\|@throw\|@synchronized"
-
- " New directives introduced with Objc-2.0
-syn match objcDirective "@property\|@synthesize\|@dynamic"
-syn match objcDirective "@optional\|@required"
-syn match objcDirective "@autoreleasepool"
-
-" Match the ObjC method types
-"
-" NOTE: here I match only the indicators, this looks
-" much nicer and reduces cluttering color highlightings.
-" However, if you prefer full method declaration matching
-" append .* at the end of the next two patterns!
-"
-syn match objcInstMethod "^\s*-\s*"
-syn match objcFactMethod "^\s*+\s*"
-
-" To distinguish from a header inclusion from a protocol list.
-syn match objcProtocol display "<[_a-zA-Z][_a-zA-Z0-9]*>" contains=objcType,cType,Type
-
-
-" To distinguish labels from the keyword for a method's parameter.
-syn region objcKeyForMethodParam display
- \ start="^\s*[_a-zA-Z][_a-zA-Z0-9]*\s*:\s*("
- \ end=")\s*[_a-zA-Z][_a-zA-Z0-9]*"
- \ contains=objcType,objcTypeModifier,cType,cStructure,cStorageClass,Type
-
-" Objective-C Constant Strings
-syn match objcSpecial display "%@" contained
+" Preprocessor Directives
+syn region objcImported display contained start=+"+ skip=+\\\\\|\\"+ end=+"+
+syn match objcImported display contained "<[^>]*>"
+syn match objcImport display "^\s*\(%:\|#\)\s*import\>\s*["<]" contains=objcImported
+
+" ObjC Compiler Directives
+syn match objcObjDef display /@interface\>\|@implementation\>\|@end\>\|@class\>/
+syn match objcProtocol display /@protocol\>\|@optional\>\|@required\>/
+syn match objcProperty display /@property\>\|@synthesize\>\|@dynamic\>/
+syn match objcIvarScope display /@private\>\|@protected\>\|@public\>/
+syn match objcInternalRep display /@selector\>\|@encode\>/
+syn match objcException display /@try\>\|@throw\>\|@catch\|@finally\>/
+syn match objcThread display /@synchronized\>/
+syn match objcPool display /@autoreleasepool\>/
+
+" ObjC Constant Strings
+syn match objcSpecial display contained "%@"
syn region objcString start=+\(@"\|"\)+ skip=+\\\\\|\\"+ end=+"+ contains=cFormat,cSpecial,objcSpecial
+" ObjC Hidden Arguments
+syn keyword objcHiddenArgument self _cmd super
+
+" ObjC Type Qualifiers for Blocks
+syn keyword objcBlocksQualifier __block
+" ObjC Type Qualifiers for Object Lifetime
+syn keyword objcObjectLifetimeQualifier __strong __weak __unsafe_unretained __autoreleasing
+" ObjC Type Qualifiers for Toll-Free Bridge
+syn keyword objcTollFreeBridgeQualifier __bridge __bridge_retained __bridge_transfer
+
+" ObjC Type Qualifiers for Remote Messaging
+syn match objcRemoteMessagingQualifier display contained /\((\s*oneway\s\+\|(\s*in\s\+\|(\s*out\s\+\|(\s*inout\s\+\|(\s*bycopy\s\+\(in\(out\)\?\|out\)\?\|(\s*byref\s\+\(in\(out\)\?\|out\)\?\)/hs=s+1
+
+" shorthand
+syn cluster objcTypeQualifier contains=objcBlocksQualifier,objcObjectLifetimeQualifier,objcTollFreeBridgeQualifier,objcRemoteMessagingQualifier
+
+" ObjC Fast Enumeration
+syn match objcFastEnumKeyword display /\sin\(\s\|$\)/
+
+" ObjC Literal Syntax
+syn match objcLiteralSyntaxNumber display /@\(YES\>\|NO\>\|\d\|-\|+\)/ contains=cNumber,cFloat,cOctal
+syn match objcLiteralSyntaxSpecialChar display /@'/ contains=cSpecialCharacter
+syn match objcLiteralSyntaxChar display /@'[^\\]'/
+syn match objcLiteralSyntaxOp display /@\((\|\[\|{\)/me=e-1,he=e-1
+
+" ObjC Declared Property Attributes
+syn match objDeclPropAccessorNameAssign display /\s*=\s*/ contained
+syn region objcDeclPropAccessorName display start=/\(getter\|setter\)/ end=/\h\w*/ contains=objDeclPropAccessorNameAssign
+syn keyword objcDeclPropAccessorType readonly readwrite contained
+syn keyword objcDeclPropAssignSemantics assign retain copy contained
+syn keyword objcDeclPropAtomicity nonatomic contained
+syn keyword objcDeclPropARC strong weak contained
+syn region objcDeclProp display transparent keepend start=/@property\s*(/ end=/)/ contains=objcProperty,objcDeclPropAccessorName,objcDeclPropAccessorType,objcDeclPropAssignSemantics,objcDeclPropAtomicity,objcDeclPropARC
+
+" To distinguish colons in methods and dictionaries from those in C's labels.
+syn match objcColon display /^\s*\h\w*\s*\:\(\s\|.\)/me=e-1,he=e-1
+
+" To distinguish a protocol list from system header files
+syn match objcProtocolList display /<\h\w*\(\s*,\s*\h\w*\)*>/ contains=objcPrincipalType,cType,Type
+
+" shorthand
+syn cluster objcCEntities contains=cType,cStructure,cStorageClass,cString,cCharacter,cSpecialCharacter,cNumbers,cConstant,cOperator,cComment,cCommentL,cStatement,cLabel,cConditional,cRepeat
+syn cluster objcObjCEntities contains=objcHiddenArgument,objcPrincipalType,objcString,objcUsefulTerm,objcProtocol,objcInternalRep,objcException,objcThread,objcPool,@objcTypeQualifier,objcLiteralSyntaxNumber,objcLiteralSyntaxOp,objcLiteralSyntaxChar,objcLiteralSyntaxSpecialChar,objcProtocolList,objcColon,objcFastEnumKeyword,objcType,objcClass,objcMacro,objcEnum,objcEnumValue,objcExceptionValue,objcNotificationValue,objcConstVar,objcPreProcMacro
+
" Objective-C Message Expressions
-syn region objcMessage display start="\[" end="\]" contains=objcMessage,objcStatement,objcType,objcTypeModifier,objcString,objcConstant,objcDirective,cType,cStructure,cStorageClass,cString,cCharacter,cSpecialCharacter,cNumbers,cConstant,cOperator,cComment,cCommentL,Type
-
-syn cluster cParenGroup add=objcMessage
-syn cluster cPreProcGroup add=objcMessage
-
-" 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_objc_syntax_inits")
- if version < 508
- let did_objc_syntax_inits = 1
- command -nargs=+ HiLink hi link <args>
- else
- command -nargs=+ HiLink hi def link <args>
- endif
-
- HiLink objcImport Include
- HiLink objcImported cString
- HiLink objcTypeModifier objcType
- HiLink objcType Type
- HiLink objcScopeDecl Statement
- HiLink objcInstMethod Function
- HiLink objcFactMethod Function
- HiLink objcStatement Statement
- HiLink objcDirective Statement
- HiLink objcKeyForMethodParam None
- HiLink objcString cString
- HiLink objcSpecial Special
- HiLink objcProtocol None
- HiLink objcConstant cConstant
-
- delcommand HiLink
-endif
+syn region objcMethodCall start=/\[/ end=/\]/ contains=objcMethodCall,objcBlocks,@objcObjCEntities,@objcCEntities
-let b:current_syntax = "objc"
+" To distinguish class method and instance method
+syn match objcInstanceMethod display /^s*-\s*/
+syn match objcClassMethod display /^s*+\s*/
-let &cpo = s:keepcpo
-unlet s:keepcpo
+" ObjC Blocks
+syn region objcBlocks start=/\(\^\s*([^)]\+)\s*{\|\^\s*{\)/ end=/}/ contains=objcBlocks,objcMethodCall,@objcObjCEntities,@objcCEntities
+
+syn cluster cParenGroup add=objcMethodCall
+syn cluster cPreProcGroup add=objcMethodCall
+
+""" Foundation Framework
+syn match objcClass /Protocol\s*\*/me=s+8,he=s+8
+
+"""""""""""""""""
+" NSObjCRuntime.h
+syn keyword objcType NSInteger NSUInteger NSComparator
+syn keyword objcEnum NSComparisonResult
+syn keyword objcEnumValue NSOrderedAscending NSOrderedSame NSOrderedDescending
+syn keyword objcEnum NSEnumerationOptions
+syn keyword objcEnumValue NSEnumerationConcurrent NSEnumerationReverse
+syn keyword objcEnum NSSortOptions
+syn keyword objcEnumValue NSSortConcurrent NSSortStable
+syn keyword objcEnumValue NSNotFound
+syn keyword objcMacro NSIntegerMax NSIntegerMin NSUIntegerMax
+" NSRange.h
+syn keyword objcType NSRange NSRangePointer
+" NSGeometry.h
+syn keyword objcType NSPoint NSPointPointer NSPointArray NSSize NSSizePointer NSSizeArray NSRect NSRectPointer NSRectArray
+syn keyword objcEnum NSRectEdge
+syn keyword objcEnumValue NSMinXEdge NSMinYEdge NSMaxXEdge NSMaxYEdge
+syn keyword objcConstVar NSZeroPoint NSZeroSize NSZeroRect
+syn keyword cType CGFloat CGPoint CGSize CGRect
+syn keyword objcEnum NSAlignmentOptions
+syn keyword objcEnumValue NSAlignMinXInward NSAlignMinYInward NSAlignMaxXInward NSAlignMaxYInward NSAlignWidthInward NSAlignHeightInward NSAlignMinXOutward NSAlignMinYOutward NSAlignMaxXOutward NSAlignMaxYOutward NSAlignWidthOutward NSAlignHeightOutward NSAlignMinXNearest NSAlignMinYNearest NSAlignMaxXNearest NSAlignMaxYNearest NSAlignWidthNearest NSAlignHeightNearest NSAlignRectFlipped NSAlignAllEdgesInward NSAlignAllEdgesOutward NSAlignAllEdgesNearest
+" NSDecimal.h
+syn keyword objcType NSDecimal
+syn keyword objcEnum NSRoundingMode
+syn keyword objcEnumValue NSRoundPlain NSRoundDown NSRoundUp NSRoundBankers
+syn keyword objcEnum NSCalculationError
+syn keyword objcEnumValue NSCalculationNoError NSCalculationLossOfPrecision NSCalculationUnderflow NSCalculationOverflow NSCalculationDivideByZero
+" NSDate.h
+syn match objcClass /NSDate\s*\*/me=s+6,he=s+6
+syn keyword objcType NSTimeInterval
+syn keyword objcNotificationValue NSSystemClockDidChangeNotification
+syn keyword objcMacro NSTimeIntervalSince1970
+" NSZone.h
+syn match objcType /NSZone\s*\*/me=s+6,he=s+6
+" NSError.h
+syn match objcClass /NSError\s*\*/me=s+7,he=s+7
+syn keyword objcConstVar NSCocoaErrorDomain NSPOSIXErrorDomain NSOSStatusErrorDomain NSMachErrorDomain NSUnderlyingErrorKey NSLocalizedDescriptionKey NSLocalizedFailureReasonErrorKey NSLocalizedRecoverySuggestionErrorKey NSLocalizedRecoveryOptionsErrorKey NSRecoveryAttempterErrorKey NSHelpAnchorErrorKey NSStringEncodingErrorKey NSURLErrorKey NSFilePathErrorKey
+" NSException.h
+syn match objcClass /NSException\s*\*/me=s+11,he=s+11
+syn keyword objcType NSUncaughtExceptionHandler
+syn keyword objcConstVar NSGenericException NSRangeException NSInvalidArgumentException NSInternalInconsistencyException NSMallocException NSObjectInaccessibleException NSObjectNotAvailableException NSDestinationInvalidException NSPortTimeoutException NSInvalidSendPortException NSInvalidReceivePortException NSPortSendException NSPortReceiveException NSOldStyleException
+" NSNotification.h
+syn match objcClass /NSNotification\s*\*/me=s+14,he=s+14
+syn match objcClass /NSNotificationCenter\s*\*/me=s+20,he=s+20
+" NSDistributedNotificationCenter.h
+syn match objcClass /NSDistributedNotificationCenter\s*\*/me=s+31,he=s+31
+syn keyword objcConstVar NSLocalNotificationCenterType
+syn keyword objcEnum NSNotificationSuspensionBehavior
+syn keyword objcEnumValue NSNotificationSuspensionBehaviorDrop NSNotificationSuspensionBehaviorCoalesce NSNotificationSuspensionBehaviorHold NSNotificationSuspensionBehaviorHold NSNotificationSuspensionBehaviorDeliverImmediately
+syn keyword objcEnumValue NSNotificationDeliverImmediately NSNotificationPostToAllSessions
+" NSNotificationQueue.h
+syn match objcClass /NSNotificationQueue\s*\*/me=s+19,he=s+19
+syn keyword objcEnum NSPostingStyle
+syn keyword objcEnumValue NSPostWhenIdle NSPostASAP NSPostNow
+syn keyword objcEnum NSNotificationCoalescing
+syn keyword objcEnumValue NSNotificationNoCoalescing NSNotificationCoalescingOnName NSNotificationCoalescingOnSender
+" NSEnumerator.h
+syn match objcClass /NSEnumerator\s*\*/me=s+12,he=s+12
+" NSIndexSet.h
+syn match objcClass /NSIndexSet\s*\*/me=s+10,he=s+10
+syn match objcClass /NSMutableIndexSet\s*\*/me=s+17,he=s+17
+" NSCharecterSet.h
+syn match objcClass /NSCharacterSet\s*\*/me=s+14,he=s+14
+" NSURL.h
+syn match objcClass /NSURL\s*\*/me=s+5,he=s+5
+syn keyword objcEnum NSURLBookmarkCreationOptions
+syn keyword objcEnumValue NSURLBookmarkCreationPreferFileIDResolution NSURLBookmarkCreationMinimalBookmark NSURLBookmarkCreationSuitableForBookmarkFile NSURLBookmarkCreationWithSecurityScope NSURLBookmarkCreationSecurityScopeAllowOnlyReadAccess
+syn keyword objcEnum NSURLBookmarkResolutionOptions
+syn keyword objcEnumValue NSURLBookmarkResolutionWithoutUI NSURLBookmarkResolutionWithoutMounting NSURLBookmarkResolutionWithSecurityScope
+syn keyword objcType NSURLBookmarkFileCreationOptions
+syn keyword objcConstVar NSURLFileScheme NSURLKeysOfUnsetValuesKey
+syn keyword objcConstVar NSURLNameKey NSURLLocalizedNameKey NSURLIsRegularFileKey NSURLIsDirectoryKey NSURLIsSymbolicLinkKey NSURLIsVolumeKey NSURLIsPackageKey NSURLIsSystemImmutableKey NSURLIsUserImmutableKey NSURLIsHiddenKey NSURLHasHiddenExtensionKey NSURLCreationDateKey NSURLContentAccessDateKey NSURLContentModificationDateKey NSURLAttributeModificationDateKey NSURLLinkCountKey NSURLParentDirectoryURLKey NSURLVolumeURLKey NSURLTypeIdentifierKey NSURLLocalizedTypeDescriptionKey NSURLLabelNumberKey NSURLLabelColorKey NSURLLocalizedLabelKey NSURLEffectiveIconKey NSURLCustomIconKey NSURLFileResourceIdentifierKey NSURLVolumeIdentifierKey NSURLPreferredIOBlockSizeKey NSURLIsReadableKey NSURLIsWritableKey NSURLIsExecutableKey NSURLFileSecurityKey NSURLIsExcludedFromBackupKey NSURLPathKey NSURLIsMountTriggerKey NSURLFileResourceTypeKey
+syn keyword objcConstVar NSURLFileResourceTypeNamedPipe NSURLFileResourceTypeCharacterSpecial NSURLFileResourceTypeDirectory NSURLFileResourceTypeBlockSpecial NSURLFileResourceTypeRegular NSURLFileResourceTypeSymbolicLink NSURLFileResourceTypeSocket NSURLFileResourceTypeUnknown
+syn keyword objcConstVar NSURLFileSizeKey NSURLFileAllocatedSizeKey NSURLTotalFileSizeKey NSURLTotalFileAllocatedSizeKey NSURLIsAliasFileKey
+syn keyword objcConstVar NSURLVolumeLocalizedFormatDescriptionKey NSURLVolumeTotalCapacityKey NSURLVolumeAvailableCapacityKey NSURLVolumeResourceCountKey NSURLVolumeSupportsPersistentIDsKey NSURLVolumeSupportsSymbolicLinksKey NSURLVolumeSupportsHardLinksKey NSURLVolumeSupportsJournalingKey NSURLVolumeIsJournalingKey NSURLVolumeSupportsSparseFilesKey NSURLVolumeSupportsZeroRunsKey NSURLVolumeSupportsCaseSensitiveNamesKey NSURLVolumeSupportsCasePreservedNamesKey NSURLVolumeSupportsRootDirectoryDatesKey NSURLVolumeSupportsVolumeSizesKey NSURLVolumeSupportsRenamingKey NSURLVolumeSupportsAdvisoryFileLockingKey NSURLVolumeSupportsExtendedSecurityKey NSURLVolumeIsBrowsableKey NSURLVolumeMaximumFileSizeKey NSURLVolumeIsEjectableKey NSURLVolumeIsRemovableKey NSURLVolumeIsInternalKey NSURLVolumeIsAutomountedKey NSURLVolumeIsLocalKey NSURLVolumeIsReadOnlyKey NSURLVolumeCreationDateKey NSURLVolumeURLForRemountingKey NSURLVolumeUUIDStringKey NSURLVolumeNameKey NSURLVolumeLocalizedNameKey
+syn keyword objcConstVar NSURLIsUbiquitousItemKey NSURLUbiquitousItemHasUnresolvedConflictsKey NSURLUbiquitousItemIsDownloadedKey NSURLUbiquitousItemIsDownloadingKey NSURLUbiquitousItemIsUploadedKey NSURLUbiquitousItemIsUploadingKey NSURLUbiquitousItemPercentDownloadedKey NSURLUbiquitousItemPercentUploadedKey
+""""""""""""
+" NSString.h
+syn match objcClass /NSString\s*\*/me=s+8,he=s+8
+syn match objcClass /NSMutableString\s*\*/me=s+15,he=s+15
+syn keyword objcType unichar
+syn keyword objcExceptionValue NSParseErrorException NSCharacterConversionException
+syn keyword objcMacro NSMaximumStringLength
+syn keyword objcEnum NSStringCompareOptions
+syn keyword objcEnumValue NSCaseInsensitiveSearch NSLiteralSearch NSBackwardsSearch NSAnchoredSearch NSNumericSearch NSDiacriticInsensitiveSearch NSWidthInsensitiveSearch NSForcedOrderingSearch NSRegularExpressionSearch
+syn keyword objcEnum NSStringEncoding
+syn keyword objcEnumValue NSASCIIStringEncoding NSNEXTSTEPStringEncoding NSJapaneseEUCStringEncoding NSUTF8StringEncoding NSISOLatin1StringEncoding NSSymbolStringEncoding NSNonLossyASCIIStringEncoding NSShiftJISStringEncoding NSISOLatin2StringEncoding NSUnicodeStringEncoding NSWindowsCP1251StringEncoding NSWindowsCP1252StringEncoding NSWindowsCP1253StringEncoding NSWindowsCP1254StringEncoding NSWindowsCP1250StringEncoding NSISO2022JPStringEncoding NSMacOSRomanStringEncoding NSUTF16StringEncoding NSUTF16BigEndianStringEncoding NSUTF16LittleEndianStringEncoding NSUTF32StringEncoding NSUTF32BigEndianStringEncoding NSUTF32LittleEndianStringEncoding
+syn keyword objcEnum NSStringEncodingConversionOptions
+syn keyword objcEnumValue NSStringEncodingConversionAllowLossy NSStringEncodingConversionExternalRepresentation
+syn keyword objcEnum NSStringEnumerationOptions
+syn keyword objcEnumValue NSStringEnumerationByLines NSStringEnumerationByParagraphs NSStringEnumerationByComposedCharacterSequences NSStringEnumerationByWords NSStringEnumerationBySentences NSStringEnumerationReverse NSStringEnumerationSubstringNotRequired NSStringEnumerationLocalized
+" NSAttributedString.h
+syn match objcClass /NSAttributedString\s*\*/me=s+18,he=s+18
+syn match objcClass /NSMutableAttributedString\s*\*/me=s+25,he=s+25
+syn keyword objcEnum NSAttributedStringEnumerationOptions
+syn keyword objcEnumValue NSAttributedStringEnumerationReverse NSAttributedStringEnumerationLongestEffectiveRangeNotRequired
+" NSValue.h
+syn match objcClass /NSValue\s*\*/me=s+7,he=s+7
+syn match objcClass /NSNumber\s*\*/me=s+8,he=s+8
+" NSDecimalNumber.h
+syn match objcClass /NSDecimalNumber\s*\*/me=s+15,he=s+15
+syn match objcClass /NSDecimalNumberHandler\s*\*/me=s+22,he=s+22
+syn keyword objcExceptionValue NSDecimalNumberExactnessException NSDecimalNumberOverflowException NSDecimalNumberUnderflowException NSDecimalNumberDivideByZeroException
+" NSData.h
+syn match objcClass /NSData\s*\*/me=s+6,he=s+6
+syn match objcClass /NSMutableData\s*\*/me=s+13,he=s+13
+syn keyword objcEnum NSDataReadingOptions
+syn keyword objcEnumValue NSDataReadingMappedIfSafe NSDataReadingUncached NSDataReadingMappedAlways NSDataReadingMapped NSMappedRead NSUncachedRead
+syn keyword objcEnum NSDataWritingOptions
+syn keyword objcEnumValue NSDataWritingAtomic NSDataWritingWithoutOverwriting NSDataWritingFileProtectionNone NSDataWritingFileProtectionComplete NSDataWritingFileProtectionCompleteUnlessOpen NSDataWritingFileProtectionCompleteUntilFirstUserAuthentication NSDataWritingFileProtectionMask NSAtomicWrite
+syn keyword objcEnum NSDataSearchOptions
+syn keyword objcEnumValue NSDataSearchBackwards NSDataSearchAnchored
+" NSArray.h
+syn match objcClass /NSArray\s*\*/me=s+7,he=s+7
+syn match objcClass /NSMutableArray\s*\*/me=s+14,he=s+14
+syn keyword objcEnum NSBinarySearchingOptions
+syn keyword objcEnumValue NSBinarySearchingFirstEqual NSBinarySearchingLastEqual NSBinarySearchingInsertionIndex
+" NSDictionary.h
+syn match objcClass /NSDictionary\s*\*/me=s+12,he=s+12
+syn match objcClass /NSMutableDictionary\s*\*/me=s+19,he=s+19
+" NSSet.h
+syn match objcClass /NSSet\s*\*/me=s+5,me=s+5
+syn match objcClass /NSMutableSet\s*\*/me=s+12,me=s+12
+syn match objcClass /NSCountedSet\s*\*/me=s+12,me=s+12
+" NSOrderedSet.h
+syn match objcClass /NSOrderedSet\s*\*/me=s+12,me=s+12
+syn match objcClass /NSMutableOrderedSet\s*\*/me=s+19,me=s+19
+"""""""""""""""""""
+" NSPathUtilities.h
+syn keyword objcEnum NSSearchPathDirectory
+syn keyword objcEnumValue NSApplicationDirectory NSDemoApplicationDirectory NSDeveloperApplicationDirectory NSAdminApplicationDirectory NSLibraryDirectory NSDeveloperDirectory NSUserDirectory NSDocumentationDirectory NSDocumentDirectory NSCoreServiceDirectory NSAutosavedInformationDirectory NSDesktopDirectory NSCachesDirectory NSApplicationSupportDirectory NSDownloadsDirectory NSInputMethodsDirectory NSMoviesDirectory NSMusicDirectory NSPicturesDirectory NSPrinterDescriptionDirectory NSSharedPublicDirectory NSPreferencePanesDirectory NSApplicationScriptsDirectory NSItemReplacementDirectory NSAllApplicationsDirectory NSAllLibrariesDirectory NSTrashDirectory
+syn keyword objcEnum NSSearchPathDomainMask
+syn keyword objcEnumValue NSUserDomainMask NSLocalDomainMask NSNetworkDomainMask NSSystemDomainMask NSAllDomainsMask
+" NSFileManger.h
+syn match objcClass /NSFileManager\s*\*/me=s+13,he=s+13
+syn match objcClass /NSDirectoryEnumerator\s*\*/me=s+21,he=s+21
+syn keyword objcEnum NSVolumeEnumerationOptions
+syn keyword objcEnumValue NSVolumeEnumerationSkipHiddenVolumes NSVolumeEnumerationProduceFileReferenceURLs
+syn keyword objcEnum NSDirectoryEnumerationOptions
+syn keyword objcEnumValue NSDirectoryEnumerationSkipsSubdirectoryDescendants NSDirectoryEnumerationSkipsPackageDescendants NSDirectoryEnumerationSkipsHiddenFiles
+syn keyword objcEnum NSFileManagerItemReplacementOptions
+syn keyword objcEnumValue NSFileManagerItemReplacementUsingNewMetadataOnly NSFileManagerItemReplacementWithoutDeletingBackupItem
+syn keyword objcNotificationValue NSUbiquityIdentityDidChangeNotification
+syn keyword objcConstVar NSFileType NSFileTypeDirectory NSFileTypeRegular NSFileTypeSymbolicLink NSFileTypeSocket NSFileTypeCharacterSpecial NSFileTypeBlockSpecial NSFileTypeUnknown NSFileSize NSFileModificationDate NSFileReferenceCount NSFileDeviceIdentifier NSFileOwnerAccountName NSFileGroupOwnerAccountName NSFilePosixPermissions NSFileSystemNumber NSFileSystemFileNumber NSFileExtensionHidden NSFileHFSCreatorCode NSFileHFSTypeCode NSFileImmutable NSFileAppendOnly NSFileCreationDate NSFileOwnerAccountID NSFileGroupOwnerAccountID NSFileBusy NSFileProtectionKey NSFileProtectionNone NSFileProtectionComplete NSFileProtectionCompleteUnlessOpen NSFileProtectionCompleteUntilFirstUserAuthentication NSFileSystemSize NSFileSystemFreeSize NSFileSystemNodes NSFileSystemFreeNodes
+" NSFileHandle.h
+syn match objcClass /NSFileHandle\s*\*/me=s+12,he=s+12
+syn keyword objcExceptionValue NSFileHandleOperationException
+syn keyword objcNotificationValue NSFileHandleReadCompletionNotification NSFileHandleReadToEndOfFileCompletionNotification NSFileHandleConnectionAcceptedNotification NSFileHandleDataAvailableNotification NSFileHandleNotificationDataItem NSFileHandleNotificationFileHandleItem NSFileHandleNotificationMonitorModes
+syn match objcClass /NSPipe\s*\*/me=s+6,he=s+6
+""""""""""""
+" NSLocale.h
+syn match objcClass /NSLocale\s*\*/me=s+8,he=s+8
+syn keyword objcEnum NSLocaleLanguageDirection
+syn keyword objcEnumValue NSLocaleLanguageDirectionUnknown NSLocaleLanguageDirectionLeftToRight NSLocaleLanguageDirectionRightToLeft NSLocaleLanguageDirectionTopToBottom NSLocaleLanguageDirectionBottomToTop
+syn keyword objcNotificationValue NSCurrentLocaleDidChangeNotification
+syn keyword objcConstVar NSLocaleIdentifier NSLocaleLanguageCode NSLocaleCountryCode NSLocaleScriptCode NSLocaleVariantCode NSLocaleExemplarCharacterSet NSLocaleCalendar NSLocaleCollationIdentifier NSLocaleUsesMetricSystem NSLocaleMeasurementSystem NSLocaleDecimalSeparator NSLocaleGroupingSeparator NSLocaleCurrencySymbol NSLocaleCurrencyCode NSLocaleCollatorIdentifier NSLocaleQuotationBeginDelimiterKey NSLocaleQuotationEndDelimiterKey NSLocaleAlternateQuotationBeginDelimiterKey NSLocaleAlternateQuotationEndDelimiterKey NSGregorianCalendar NSBuddhistCalendar NSChineseCalendar NSHebrewCalendar NSIslamicCalendar NSIslamicCivilCalendar NSJapaneseCalendar NSRepublicOfChinaCalendar NSPersianCalendar NSIndianCalendar NSISO8601Calendar
+" NSFormatter.h
+syn match objcClass /NSFormatter\s*\*/me=s+11,he=s+11
+" NSNumberFormatter.h
+syn match objcClass /NSNumberFormatter\s*\*/me=s+17,he=s+17
+syn keyword objcEnum NSNumberFormatterStyle
+syn keyword objcEnumValue NSNumberFormatterNoStyle NSNumberFormatterDecimalStyle NSNumberFormatterCurrencyStyle NSNumberFormatterPercentStyle NSNumberFormatterScientificStyle NSNumberFormatterSpellOutStyle
+syn keyword objcEnum NSNumberFormatterBehavior
+syn keyword objcEnumValue NSNumberFormatterBehaviorDefault NSNumberFormatterBehavior10_0 NSNumberFormatterBehavior10_4
+syn keyword objcEnum NSNumberFormatterPadPosition
+syn keyword objcEnumValue NSNumberFormatterPadBeforePrefix NSNumberFormatterPadAfterPrefix NSNumberFormatterPadBeforeSuffix NSNumberFormatterPadAfterSuffix
+syn keyword objcEnum NSNumberFormatterRoundingMode
+syn keyword objcEnumValue NSNumberFormatterRoundCeiling NSNumberFormatterRoundFloor NSNumberFormatterRoundDown NSNumberFormatterRoundUp NSNumberFormatterRoundHalfEven NSNumberFormatterRoundHalfDown NSNumberFormatterRoundHalfUp
+" NSDateFormatter.h
+syn match objcClass /NSDateFormatter\s*\*/me=s+15,he=s+15
+syn keyword objcEnum NSDateFormatterStyle
+syn keyword objcEnumValue NSDateFormatterNoStyle NSDateFormatterShortStyle NSDateFormatterMediumStyle NSDateFormatterLongStyle NSDateFormatterFullStyle
+syn keyword objcEnum NSDateFormatterBehavior
+syn keyword objcEnumValue NSDateFormatterBehaviorDefault NSDateFormatterBehavior10_0 NSDateFormatterBehavior10_4
+" NSCalendar.h
+syn match objcClass /NSCalendar\s*\*/me=s+10,he=s+10
+syn keyword objcEnum NSCalendarUnit
+syn keyword objcEnumValue NSEraCalendarUnit NSYearCalendarUnit NSMonthCalendarUnit NSDayCalendarUnit NSHourCalendarUnit NSMinuteCalendarUnit NSSecondCalendarUnit NSWeekCalendarUnit NSWeekdayCalendarUnit NSWeekdayOrdinalCalendarUnit NSQuarterCalendarUnit NSWeekOfMonthCalendarUnit NSWeekOfYearCalendarUnit NSYearForWeekOfYearCalendarUnit NSCalendarCalendarUnit NSTimeZoneCalendarUnit
+syn keyword objcEnumValue NSWrapCalendarComponents NSUndefinedDateComponent
+syn match objcClass /NSDateComponents\s*\*/me=s+16,he=s+16
+" NSTimeZone.h
+syn match objcClass /NSTimeZone\s*\*/me=s+10,he=s+10
+syn keyword objcEnum NSTimeZoneNameStyle
+syn keyword objcEnumValue NSTimeZoneNameStyleStandard NSTimeZoneNameStyleShortStandard NSTimeZoneNameStyleDaylightSaving NSTimeZoneNameStyleShortDaylightSaving NSTimeZoneNameStyleGeneric NSTimeZoneNameStyleShortGeneric
+syn keyword objcNotificationValue NSSystemTimeZoneDidChangeNotification
+"""""""""""
+" NSCoder.h
+syn match objcClass /NSCoder\s*\*/me=s+7,he=s+7
+" NSArchiver.h
+syn match objcClass /NSArchiver\s*\*/me=s+10,he=s+10
+syn match objcClass /NSUnarchiver\s*\*/me=s+12,he=s+12
+syn keyword objcExceptionValue NSInconsistentArchiveException
+" NSKeyedArchiver.h
+syn match objcClass /NSKeyedArchiver\s*\*/me=s+15,he=s+15
+syn match objcClass /NSKeyedUnarchiver\s*\*/me=s+17,he=s+17
+syn keyword objcExceptionValue NSInvalidArchiveOperationException NSInvalidUnarchiveOperationException
+""""""""""""""""""
+" NSPropertyList.h
+syn keyword objcEnum NSPropertyListMutabilityOptions
+syn keyword objcEnumValue NSPropertyListImmutable NSPropertyListMutableContainers NSPropertyListMutableContainersAndLeaves
+syn keyword objcEnum NSPropertyListFormat
+syn keyword objcEnumValue NSPropertyListOpenStepFormat NSPropertyListXMLFormat_v1_0 NSPropertyListBinaryFormat_v1_0
+syn keyword objcType NSPropertyListReadOptions NSPropertyListWriteOptions
+" NSUserDefaults.h
+syn match objcClass /NSUserDefaults\s*\*/me=s+14,he=s+14
+syn keyword objcConstVar NSGlobalDomain NSArgumentDomain NSRegistrationDomain
+syn keyword objcNotificationValue NSUserDefaultsDidChangeNotification
+" NSBundle.h
+syn match objcClass /NSBundle\s*\*/me=s+8,he=s+8
+syn keyword objcEnumValue NSBundleExecutableArchitectureI386 NSBundleExecutableArchitecturePPC NSBundleExecutableArchitectureX86_64 NSBundleExecutableArchitecturePPC64
+syn keyword objcNotificationValue NSBundleDidLoadNotification NSLoadedClasses
+"""""""""""""""""
+" NSProcessInfo.h
+syn match objcClass /NSProcessInfo\s*\*/me=s+13,he=s+13
+syn keyword objcEnumValue NSWindowsNTOperatingSystem NSWindows95OperatingSystem NSSolarisOperatingSystem NSHPUXOperatingSystem NSMACHOperatingSystem NSSunOSOperatingSystem NSOSF1OperatingSystem
+" NSTask.h
+syn match objcClass /NSTask\s*\*/me=s+6,he=s+6
+syn keyword objcEnum NSTaskTerminationReason
+syn keyword objcEnumValue NSTaskTerminationReasonExit NSTaskTerminationReasonUncaughtSignal
+syn keyword objcNotificationValue NSTaskDidTerminateNotification
+" NSThread.h
+syn match objcClass /NSThread\s*\*/me=s+8,he=s+8
+syn keyword objcNotificationValue NSWillBecomeMultiThreadedNotification NSDidBecomeSingleThreadedNotification NSThreadWillExitNotification
+" NSLock.h
+syn match objcClass /NSLock\s*\*/me=s+6,he=s+6
+syn match objcClass /NSConditionLock\s*\*/me=s+15,he=s+15
+syn match objcClass /NSRecursiveLock\s*\*/me=s+15,he=s+15
+" NSDictributedLock
+syn match objcClass /NSDistributedLock\s*\*/me=s+17,he=s+17
+" NSOperation.h
+""""""""""""""""
+syn match objcClass /NSOperation\s*\*/me=s+11,he=s+11
+syn keyword objcEnum NSOperationQueuePriority
+syn keyword objcEnumValue NSOperationQueuePriorityVeryLow NSOperationQueuePriorityLow NSOperationQueuePriorityNormal NSOperationQueuePriorityHigh NSOperationQueuePriorityVeryHigh
+syn match objcClass /NSBlockOperation\s*\*/me=s+16,he=s+16
+syn match objcClass /NSInvocationOperation\s*\*/me=s+21,he=s+21
+syn keyword objcExceptionValue NSInvocationOperationVoidResultException NSInvocationOperationCancelledException
+syn match objcClass /NSOperationQueue\s*\*/me=s+16,he=s+16
+syn keyword objcEnumValue NSOperationQueueDefaultMaxConcurrentOperationCount
+" NSConnection.h
+syn match objcClass /NSConnection\s*\*/me=s+12,he=s+12
+syn keyword objcConstVar NSConnectionReplyMode
+syn keyword objcNotificationValue NSConnectionDidDieNotification NSConnectionDidInitializeNotification
+syn keyword objcExceptionValue NSFailedAuthenticationException
+" NSPort.h
+syn match objcClass /NSPort\s*\*/me=s+6,he=s+6
+syn keyword objcType NSSocketNativeHandle
+syn keyword objcNotificationValue NSPortDidBecomeInvalidNotification
+syn match objcClass /NSMachPort\s*\*/me=s+10,he=s+10
+syn keyword objcEnumValue NSMachPortDeallocateNone NSMachPortDeallocateSendRight NSMachPortDeallocateReceiveRight
+syn match objcClass /NSMessagePort\s*\*/me=s+13,he=s+13
+syn match objcClass /NSSocketPort\s*\*/me=s+12,he=s+12
+" NSPortMessage.h
+syn match objcClass /NSPortMessage\s*\*/me=s+13,he=s+13
+" NSDistantObject.h
+syn match objcClass /NSDistantObject\s*\*/me=s+15,he=s+15
+" NSPortNameServer.h
+syn match objcClass /NSPortNameServer\s*\*/me=s+16,he=s+16
+syn match objcClass /NSMessagePortNameServer\s*\*/me=s+23,he=s+23
+syn match objcClass /NSSocketPortNameServer\s*\*/me=s+22,he=s+22
+" NSHost.h
+syn match objcClass /NSHost\s*\*/me=s+6,he=s+6
+" NSInvocation.h
+syn match objcClass /NSInvocation\s*\*/me=s+12,he=s+12
+" NSMethodSignature.h
+syn match objcClass /NSMethodSignature\s*\*/me=s+17,he=s+17
+"""""
+" NSScanner.h
+syn match objcClass /NSScanner\s*\*/me=s+9,he=s+9
+" NSTimer.h
+syn match objcClass /NSTimer\s*\*/me=s+7,he=s+7
+" NSAutoreleasePool.h
+syn match objcClass /NSAutoreleasePool\s*\*/me=s+17,he=s+17
+" NSRunLoop.h
+syn match objcClass /NSRunLoop\s*\*/me=s+9,he=s+9
+syn keyword objcConstVar NSDefaultRunLoopMode NSRunLoopCommonModes
+" NSNull.h
+syn match objcClass /NSNull\s*\*/me=s+6,he=s+6
+" NSProxy.h
+syn match objcClass /NSProxy\s*\*/me=s+7,he=s+7
+" NSObject.h
+syn match objcClass /NSObject\s*\*/me=s+8,he=s+8
+
+""" Default Highlighting
+hi def link objcPreProcMacro cConstant
+hi def link objcPrincipalType cType
+hi def link objcUsefulTerm cConstant
+hi def link objcImport cInclude
+hi def link objcImported cString
+hi def link objcObjDef cOperator
+hi def link objcProtocol cOperator
+hi def link objcProperty cOperator
+hi def link objcIvarScope cOperator
+hi def link objcInternalRep cOperator
+hi def link objcException cOperator
+hi def link objcThread cOperator
+hi def link objcPool cOperator
+hi def link objcSpecial cSpecial
+hi def link objcString cString
+hi def link objcHiddenArgument cStatement
+hi def link objcBlocksQualifier cStorageClass
+hi def link objcObjectLifetimeQualifier cStorageClass
+hi def link objcTollFreeBridgeQualifier cStorageClass
+hi def link objcRemoteMessagingQualifier cStorageClass
+hi def link objcFastEnumKeyword cStatement
+hi def link objcLiteralSyntaxNumber cNumber
+hi def link objcLiteralSyntaxChar cCharacter
+hi def link objcLiteralSyntaxSpecialChar cCharacter
+hi def link objcLiteralSyntaxOp cOperator
+hi def link objcDeclPropAccessorName cConstant
+hi def link objcDeclPropAccessorType cConstant
+hi def link objcDeclPropAssignSemantics cConstant
+hi def link objcDeclPropAtomicity cConstant
+hi def link objcDeclPropARC cConstant
+hi def link objcInstanceMethod Function
+hi def link objcClassMethod Function
+hi def link objcType cType
+hi def link objcClass cType
+hi def link objcMacro cConstant
+hi def link objcEnum cType
+hi def link objcEnumValue cConstant
+hi def link objcExceptionValue cConstant
+hi def link objcNotificationValue cConstant
+hi def link objcConstVar cConstant
+
+""" Final step
+let b:current_syntax = "objc"
+let &cpo = s:cpo_save
+unlet s:cpo_save
-" vim: ts=8
+" vim: ts=8 sw=2 sts=2
diff --git a/runtime/syntax/proto.vim b/runtime/syntax/proto.vim
new file mode 100644
index 000000000..4d6a77e84
--- /dev/null
+++ b/runtime/syntax/proto.vim
@@ -0,0 +1,74 @@
+" syntax file for Protocol Buffers - Google's data interchange format
+"
+" Copyright 2008 Google Inc. All rights reserved.
+"
+" 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.
+"
+" http://code.google.com/p/protobuf/
+
+if version < 600
+ syntax clear
+elseif exists("b:current_syntax")
+ finish
+endif
+
+syn case match
+
+syn keyword protoTodo contained TODO FIXME XXX
+syn cluster protoCommentGrp contains=protoTodo
+
+syn keyword protoSyntax syntax import option
+syn keyword protoStructure package message group
+syn keyword protoRepeat optional required repeated
+syn keyword protoDefault default
+syn keyword protoExtend extend extensions to max
+syn keyword protoRPC service rpc returns
+
+syn keyword protoType int32 int64 uint32 uint64 sint32 sint64
+syn keyword protoType fixed32 fixed64 sfixed32 sfixed64
+syn keyword protoType float double bool string bytes
+syn keyword protoTypedef enum
+syn keyword protoBool true false
+
+syn match protoInt /-\?\<\d\+\>/
+syn match protoInt /\<0[xX]\x+\>/
+syn match protoFloat /\<-\?\d*\(\.\d*\)\?/
+syn region protoComment start="\/\*" end="\*\/" contains=@protoCommentGrp
+syn region protoComment start="//" skip="\\$" end="$" keepend contains=@protoCommentGrp
+syn region protoString start=/"/ skip=/\\./ end=/"/
+syn region protoString start=/'/ skip=/\\./ end=/'/
+
+hi def link protoTodo Todo
+
+hi def link protoSyntax Include
+hi def link protoStructure Structure
+hi def link protoRepeat Repeat
+hi def link protoDefault Keyword
+hi def link protoExtend Keyword
+hi def link protoRPC Keyword
+hi def link protoType Type
+hi def link protoTypedef Typedef
+hi def link protoBool Boolean
+
+hi def link protoInt Number
+hi def link protoFloat Float
+hi def link protoComment Comment
+hi def link protoString String
+
+let b:current_syntax = "proto"
diff --git a/runtime/syntax/ruby.vim b/runtime/syntax/ruby.vim
index e3aee1200..28f553dec 100644
--- a/runtime/syntax/ruby.vim
+++ b/runtime/syntax/ruby.vim
@@ -1,9 +1,7 @@
" Vim syntax file
" Language: Ruby
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2009 Dec 2
-" URL: http://vim-ruby.rubyforge.org
-" Anon CVS: See above site
+" URL: https://github.com/vim-ruby/vim-ruby
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
" ----------------------------------------------------------------------------
"
@@ -32,8 +30,8 @@ endif
" Operators
if exists("ruby_operators")
- syn match rubyOperator "\%([~!^&|*/%+-]\|\%(class\s*\)\@<!<<\|<=>\|<=\|\%(<\|\<class\s\+\u\w*\s*\)\@<!<[^<]\@=\|===\|==\|=\~\|>>\|>=\|=\@<!>\|\*\*\|\.\.\.\|\.\.\|::\)"
- syn match rubyPseudoOperator "\%(-=\|/=\|\*\*=\|\*=\|&&=\|&=\|&&\|||=\||=\|||\|%=\|+=\|!\~\|!=\)"
+ syn match rubyOperator "[~!^&|*/%+-]\|\%(class\s*\)\@<!<<\|<=>\|<=\|\%(<\|\<class\s\+\u\w*\s*\)\@<!<[^<]\@=\|===\|==\|=\~\|>>\|>=\|=\@<!>\|\*\*\|\.\.\.\|\.\.\|::"
+ syn match rubyOperator "->\|-=\|/=\|\*\*=\|\*=\|&&=\|&=\|&&\|||=\||=\|||\|%=\|+=\|!\~\|!="
syn region rubyBracketOperator matchgroup=rubyOperator start="\%(\w[?!]\=\|[]})]\)\@<=\[\s*" end="\s*]" contains=ALLBUT,@rubyNotTop
endif
@@ -95,86 +93,89 @@ syn match rubyLocalVariableOrMethod "\<[_[:lower:]][_[:alnum:]]*[?!=]\=" contain
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 rubyClassVariable "@@\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" display
+syn match rubyInstanceVariable "@\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" display
+syn match rubyGlobalVariable "$\%(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\|-.\)"
+syn match rubySymbol "[]})\"':]\@<!:\%(\^\|\~\|<<\|<=>\|<=\|<\|===\|[=!]=\|[=!]\~\|!\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)"
syn match rubySymbol "[]})\"':]\@<!:\$\%(-.\|[`~<=>_,;:!?/.'"@$*\&+0]\)"
-syn match rubySymbol "[]})\"':]\@<!:\%(\$\|@@\=\)\=\h\w*"
-syn match rubySymbol "[]})\"':]\@<!:\h\w*\%([?!=]>\@!\)\="
+syn match rubySymbol "[]})\"':]\@<!:\%(\$\|@@\=\)\=\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*"
+syn match rubySymbol "[]})\"':]\@<!:\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\%([?!=]>\@!\)\="
syn match rubySymbol "\%([{(,]\_s*\)\@<=\l\w*[!?]\=::\@!"he=e-1
-syn match rubySymbol "[]})\"':]\@<!\h\w*[!?]\=:\s\@="he=e-1
+syn match rubySymbol "[]})\"':]\@<!\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:\s\@="he=e-1
+syn match rubySymbol "\%([{(,]\_s*\)\@<=[[:space:],{]\l\w*[!?]\=::\@!"hs=s+1,he=e-1
+syn match rubySymbol "[[:space:],{]\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:\s\@="hs=s+1,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 match rubyBlockParameter "\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" 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 #$[!$&"'*+,./0:;<=>?@\`~]#
+syn match rubyPredefinedVariable "$\d\+" display
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\)\>"
+syn match rubyPredefinedConstant "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(DATA\|FALSE\|NIL\)\>\%(\s*(\)\@!"
+syn match rubyPredefinedConstant "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(STDERR\|STDIN\|STDOUT\|TOPLEVEL_BINDING\|TRUE\)\>\%(\s*(\)\@!"
+syn match rubyPredefinedConstant "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(RUBY_\%(VERSION\|RELEASE_DATE\|PLATFORM\|PATCHLEVEL\|REVISION\|DESCRIPTION\|COPYRIGHT\|ENGINE\)\)\>\%(\s*(\)\@!"
" 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="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\|else\)\|[;\~=!|&(,[<>?:*+-]\)\s*\)\@<=/" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial 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
+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,@Spell fold
+syn region rubyString matchgroup=rubyStringDelimiter start="'" end="'" skip="\\\\\|\\'" contains=rubyQuoteEscape,@Spell 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
+syn region rubyString matchgroup=rubyStringDelimiter start="%[qwi]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold
+syn region rubyString matchgroup=rubyStringDelimiter start="%[qwi]{" end="}" skip="\\\\\|\\}" fold contains=rubyNestedCurlyBraces,rubyDelimEscape
+syn region rubyString matchgroup=rubyStringDelimiter start="%[qwi]<" end=">" skip="\\\\\|\\>" fold contains=rubyNestedAngleBrackets,rubyDelimEscape
+syn region rubyString matchgroup=rubyStringDelimiter start="%[qwi]\[" end="\]" skip="\\\\\|\\\]" fold contains=rubyNestedSquareBrackets,rubyDelimEscape
+syn region rubyString matchgroup=rubyStringDelimiter start="%[qwi](" end=")" skip="\\\\\|\\)" fold contains=rubyNestedParentheses,rubyDelimEscape
+syn region rubyString matchgroup=rubyStringDelimiter start="%q " end=" " skip="\\\\\|\\)" fold
+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
+syn region rubyString matchgroup=rubyStringDelimiter start="%[QWIx]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold
+syn region rubyString matchgroup=rubyStringDelimiter start="%[QWIx]\={" end="}" skip="\\\\\|\\}" contains=@rubyStringSpecial,rubyNestedCurlyBraces,rubyDelimEscape fold
+syn region rubyString matchgroup=rubyStringDelimiter start="%[QWIx]\=<" end=">" skip="\\\\\|\\>" contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold
+syn region rubyString matchgroup=rubyStringDelimiter start="%[QWIx]\=\[" end="\]" skip="\\\\\|\\\]" contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimEscape fold
+syn region rubyString matchgroup=rubyStringDelimiter start="%[QWIx]\=(" end=")" skip="\\\\\|\\)" contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimEscape fold
+syn region rubyString matchgroup=rubyStringDelimiter start="%[Qx] " end=" " skip="\\\\\|\\)" contains=@rubyStringSpecial 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\%(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)+ 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\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@rubyStringSpecial fold keepend
+syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<"\z([^"]*\)"\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@rubyStringSpecial fold keepend
+syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<'\z([^']*\)'\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc fold keepend
+syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<`\z([^`]*\)`\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@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
+syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<-\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend
+syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<-"\z([^"]*\)"\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend
+syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<-'\z([^']*\)'\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart fold keepend
+syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<-`\z([^`]*\)`\ze\%(.*<<-\=['`"]\=\h\)\@!+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
@@ -187,7 +188,7 @@ syn match rubyClassDeclaration "[^[:space:];#<]\+" contained contains=rubyC
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 match rubyFunction "\%([[:space:].]\|^\)\@<=\%(\[\]=\=\|\*\*\|[+-]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|[=!]=\|[=!]\~\|!\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration
syn cluster rubyDeclaration contains=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration,rubyModuleDeclaration,rubyClassDeclaration,rubyFunction,rubyBlockParameter
@@ -198,7 +199,7 @@ syn match rubyControl "\<\%(and\|break\|in\|next\|not\|or\|redo\|rescue
syn match rubyOperator "\<defined?" display
syn match rubyKeyword "\<\%(super\|yield\)\>[?!]\@!"
syn match rubyBoolean "\<\%(true\|false\)\>[?!]\@!"
-syn match rubyPseudoVariable "\<\%(nil\|self\|__FILE__\|__LINE__\)\>[?!]\@!"
+syn match rubyPseudoVariable "\<\%(nil\|self\|__ENCODING__\|__FILE__\|__LINE__\|__callee__\|__method__\)\>[?!]\@!" " TODO: reorganise
syn match rubyBeginEnd "\<\%(BEGIN\|END\)\>[?!]\@!"
" Expensive Mode - match 'end' with the appropriate opening keyword for syntax
@@ -220,13 +221,13 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive")
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
+ syn region rubyCurlyBlock matchgroup=rubyCurlyBlockDelimiter 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 region rubyConditionalExpression matchgroup=rubyConditional start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+=-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![?!]\)\s*\)\@<=\%(if\|unless\)\>" end="\%(\%(\%(\.\@<!\.\)\|::\)\s*\)\@<!\<end\>" contains=ALLBUT,@rubyNotTop fold
syn match rubyConditional "\<\%(then\|else\|when\)\>[?!]\@!" contained containedin=rubyCaseExpression
syn match rubyConditional "\<\%(then\|else\|elsif\)\>[?!]\@!" contained containedin=rubyConditionalExpression
@@ -239,7 +240,7 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive")
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
+ let ruby_minlines = 500
endif
exec "syn sync minlines=" . ruby_minlines
@@ -253,7 +254,7 @@ endif
" Special Methods
if !exists("ruby_no_special_methods")
- syn keyword rubyAccess public protected private module_function
+ syn keyword rubyAccess public protected private public_class_method private_class_method public_constant private_constant module_function
" attr is a common variable name
syn match rubyAttribute "\%(\%(^\|;\)\s*\)\@<=attr\>\(\s*[.=]\)\@!"
syn keyword rubyAttribute attr_accessor attr_reader attr_writer
@@ -262,17 +263,17 @@ if !exists("ruby_no_special_methods")
syn keyword rubyException raise fail catch throw
" false positive with 'include?'
syn match rubyInclude "\<include\>[?!]\@!"
- syn keyword rubyInclude autoload extend load require
+ syn keyword rubyInclude autoload extend load prepend require require_relative
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 keyword rubyTodo FIXME NOTE TODO OPTIMIZE XXX todo 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
+ 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
@@ -286,12 +287,12 @@ syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(undef\|unless\|until
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
+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\|prepend\|private\|proc\|protected\)\>" transparent contains=NONE
+syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(public\|require\|require_relative\|raise\|throw\|trap\)\>" transparent contains=NONE
" __END__ Directive
syn region rubyData matchgroup=rubyDataDirective start="^__END__$" end="\%$" fold
@@ -330,7 +331,6 @@ 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
@@ -351,6 +351,7 @@ hi def link rubySharpBang PreProc
hi def link rubyRegexpDelimiter rubyStringDelimiter
hi def link rubySymbolDelimiter rubyStringDelimiter
hi def link rubyStringDelimiter Delimiter
+hi def link rubyHeredoc rubyString
hi def link rubyString String
hi def link rubyRegexpEscape rubyRegexpSpecial
hi def link rubyRegexpQuantifier rubyRegexpSpecial
diff --git a/runtime/syntax/xml.vim b/runtime/syntax/xml.vim
index 2d4170a04..7b503abf4 100644
--- a/runtime/syntax/xml.vim
+++ b/runtime/syntax/xml.vim
@@ -3,7 +3,7 @@
" Maintainer: Johannes Zellner <johannes@zellner.org>
" Author and previous maintainer:
" Paul Siegmann <pauls@euronet.nl>
-" Last Change: 2013 May 29
+" Last Change: 2013 Jun 07
" Filenames: *.xml
" $Id: xml.vim,v 1.3 2006/04/11 21:32:00 vimboss Exp $
@@ -81,7 +81,7 @@ syn match xmlEqual +=+ display
" ^^^^^^^^^^^^^
"
syn match xmlAttrib
- \ +[-'"<]\@2<!\<[a-zA-Z:_][-.0-9a-zA-Z0-9:_]*\>\(['">]\@!\|$\)+
+ \ +[-'"<]\@1<!\<[a-zA-Z:_][-.0-9a-zA-Z:_]*\>\%(['">]\@!\|$\)+
\ contained
\ contains=xmlAttribPunct,@xmlAttribHook
\ display
@@ -122,7 +122,7 @@ endif
" ^^^
"
syn match xmlTagName
- \ +[<]\@2<=[^ /!?<>"']\++
+ \ +<\@1<=[^ /!?<>"']\++
\ contained
\ contains=xmlNamespace,xmlAttribPunct,@xmlTagHook
\ display