# HG changeset patch # User Bram Moolenaar # Date 1371065355 -7200 # Node ID a5352e73dc008133d066b81da581e2a2562ddb47 # Parent f2f15e432db6130ebf54b934ee888f4c3dae4c22 Update runtime files. diff --git a/runtime/autoload/rubycomplete.vim b/runtime/autoload/rubycomplete.vim --- a/runtime/autoload/rubycomplete.vim +++ b/runtime/autoload/rubycomplete.vim @@ -1,9 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" 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 " 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 --- a/runtime/compiler/eruby.vim +++ b/runtime/compiler/eruby.vim @@ -1,9 +1,7 @@ " Vim compiler file " Language: eRuby " Maintainer: Doug Kearns -" 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 if exists("current_compiler") diff --git a/runtime/compiler/rake.vim b/runtime/compiler/rake.vim new file mode 100644 --- /dev/null +++ b/runtime/compiler/rake.vim @@ -0,0 +1,35 @@ +" Vim compiler file +" Language: Rake +" Maintainer: Tim Pope +" URL: https://github.com/vim-ruby/vim-ruby +" Release Coordinator: Doug Kearns + +if exists("current_compiler") + finish +endif +let current_compiler = "rake" + +if exists(":CompilerSet") != 2 " older Vim always used :setlocal + command -nargs=* CompilerSet setlocal +endif + +let s:cpo_save = &cpo +set cpo-=C + +CompilerSet makeprg=rake + +CompilerSet errorformat= + \%D(in\ %f), + \%\\s%#from\ %f:%l:%m, + \%\\s%#from\ %f:%l:, + \%\\s%##\ %f:%l:%m, + \%\\s%##\ %f:%l, + \%\\s%#[%f:%l:\ %#%m, + \%\\s%#%f:%l:\ %#%m, + \%\\s%#%f:%l:, + \%m\ [%f:%l]: + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: nowrap sw=2 sts=2 ts=8: diff --git a/runtime/compiler/rspec.vim b/runtime/compiler/rspec.vim --- a/runtime/compiler/rspec.vim +++ b/runtime/compiler/rspec.vim @@ -1,9 +1,7 @@ " Vim compiler file " Language: RSpec " Maintainer: Tim Pope -" 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 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 --- 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 -" Last Change: 2008 Aug 1 -" URL: http://vim-ruby.rubyforge.org -" Anon CVS: See above site +" Maintainer: Tim Pope +" URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns " ---------------------------------------------------------------------------- -" -" Changelog: -" 0.2: script saves and restores 'cpoptions' value to prevent problems with -" line continuations -" 0.1: initial release -" -" Contributors: -" Hugh Sasse -" Doug Kearns -" -" 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 --- 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 -" 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 if exists("current_compiler") diff --git a/runtime/compiler/xmllint.vim b/runtime/compiler/xmllint.vim --- a/runtime/compiler/xmllint.vim +++ b/runtime/compiler/xmllint.vim @@ -1,8 +1,7 @@ " Vim compiler file " Compiler: xmllint -" Maintainer: Doug Kearns -" URL: http://gus.gscit.monash.edu.au/~djkea2/vim/compiler/xmllint.vim -" Last Change: 2004 Nov 27 +" Maintainer: Doug Kearns +" 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 --- 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}]]) 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 --- 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 --- 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 ', 'nWb') - \ && 0 < searchpair(js, '', '', 'nW') - " we're inside javascript - if getline(lnum) !~ js && getline(a:lnum) != '' - if restore_ic == 0 - setlocal noic - endif - return cindent(a:lnum) + " 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 - if getline(lnum) =~ '\c' - " line before the current line a:lnum contains - " a closing . --> search for line before - " starting
 to restore the indent.
-	let preline = prevnonblank(search('\c
', 'bW') - 1)
-	if preline > 0
-	    if restore_ic == 0
-	      setlocal noic
-	    endif
-	    return indent(preline)
+    " 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
+
+    " 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('"
     endif
 
-    let ind = HtmlIndentSum(lnum, -1)
-    let ind = ind + HtmlIndentSum(a:lnum, 0)
+    " 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() "{{{
+    " 
 block
+    return -1
+endfunc "}}}
+func! s:Alien3() "{{{
+    "