From 6fed5051008ec464316e6045cb7a900a329929d3 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 29 Jul 2019 03:03:53 +0200 Subject: vim-patch:d09091d4955c Update runtime files. https://github.com/vim/vim/commit/d09091d4955c5f41de69928f2db85611ed54ed23 --- runtime/autoload/rubycomplete.vim | 57 ++- runtime/compiler/eruby.vim | 5 +- runtime/compiler/rake.vim | 13 +- runtime/compiler/rspec.vim | 4 +- runtime/compiler/ruby.vim | 10 +- runtime/compiler/rubyunit.vim | 1 + runtime/doc/autocmd.txt | 6 +- runtime/doc/eval.txt | 6 +- runtime/doc/index.txt | 5 +- runtime/doc/options.txt | 5 +- runtime/doc/quickfix.txt | 21 +- runtime/doc/sign.txt | 7 +- runtime/doc/spell.txt | 2 +- runtime/ftplugin/bash.vim | 31 ++ runtime/ftplugin/eruby.vim | 34 +- runtime/ftplugin/ruby.vim | 100 +++-- runtime/ftplugin/text.vim | 7 +- runtime/indent/eruby.vim | 10 +- runtime/indent/ruby.vim | 886 ++++++++++++++++++++++++-------------- runtime/syntax/eruby.vim | 19 +- runtime/syntax/ruby.vim | 71 +-- 21 files changed, 842 insertions(+), 458 deletions(-) create mode 100644 runtime/ftplugin/bash.vim diff --git a/runtime/autoload/rubycomplete.vim b/runtime/autoload/rubycomplete.vim index 40b87f4cbe..ea18470232 100644 --- a/runtime/autoload/rubycomplete.vim +++ b/runtime/autoload/rubycomplete.vim @@ -1,9 +1,9 @@ " Vim completion script -" Language: Ruby -" Maintainer: Mark Guzman -" URL: https://github.com/vim-ruby/vim-ruby -" Release Coordinator: Doug Kearns -" Maintainer Version: 0.8.1 +" Language: Ruby +" Maintainer: Mark Guzman +" URL: https://github.com/vim-ruby/vim-ruby +" Release Coordinator: Doug Kearns +" Last Change: 2019 Jan 06 " ---------------------------------------------------------------------------- " " Ruby IRB/Complete author: Keiju ISHITSUKA(keiju@ishitsuka.com) @@ -103,7 +103,7 @@ function! s:GetBufferRubyEntity( name, type, ... ) endif let curpos = getpos(".") - let [enum,ecol] = searchpairpos( crex, '', '\(end\|}\)', 'wr' ) + let [enum,ecol] = searchpairpos( crex, '', '\(end\|}\)', 'W' ) call cursor(lastpos[1], lastpos[2]) if lnum > enum @@ -253,15 +253,27 @@ class VimRubyCompletion # {{{ buffer analysis magic def load_requires + + custom_paths = VIM::evaluate("get(g:, 'rubycomplete_load_paths', [])") + + if !custom_paths.empty? + $LOAD_PATH.concat(custom_paths).uniq! + end + buf = VIM::Buffer.current enum = buf.line_number nums = Range.new( 1, enum ) nums.each do |x| + ln = buf[x] begin - eval( "require %s" % $1 ) if /.*require\s*(.*)$/.match( ln ) - rescue Exception - #ignore? + if /.*require_relative\s*(.*)$/.match( ln ) + eval( "require %s" % File.expand_path($1) ) + elsif /.*require\s*(["'].*?["'])/.match( ln ) + eval( "require %s" % $1 ) + end + rescue Exception => e + dprint e.inspect end end end @@ -344,8 +356,13 @@ class VimRubyCompletion if x != cur_line next if x == 0 ln = buf[x] - if /^\s*(module|class|def|include)\s+/.match(ln) - clscnt += 1 if $1 == "class" + is_const = false + if /^\s*(module|class|def|include)\s+/.match(ln) || is_const = /^\s*?[A-Z]([A-z]|[1-9])*\s*?[|]{0,2}=\s*?.+\s*?/.match(ln) + clscnt += 1 if /class|module/.match($1) + # We must make sure to load each constant only once to avoid errors + if is_const + ln.gsub!(/\s*?[|]{0,2}=\s*?/, '||=') + end #dprint "\$1$1 classdef += "%s\n" % ln classdef += "end\n" if /def\s+/.match(ln) @@ -423,7 +440,6 @@ class VimRubyCompletion return get_buffer_entity_list( "class" ) end - def load_rails allow_rails = VIM::evaluate("exists('g:rubycomplete_rails') && g:rubycomplete_rails") return if allow_rails.to_i.zero? @@ -529,7 +545,6 @@ class VimRubyCompletion ret += ActiveRecord::ConnectionAdapters::SchemaStatements.methods end - return ret end @@ -587,11 +602,13 @@ class VimRubyCompletion # {{{ main completion code def self.preload_rails a = VimRubyCompletion.new - require 'Thread' - Thread.new(a) do |b| - begin - b.load_rails - rescue + if VIM::evaluate("has('nvim')") == 0 + require 'thread' + Thread.new(a) do |b| + begin + b.load_rails + rescue + end end end a.load_rails @@ -612,7 +629,6 @@ class VimRubyCompletion want_gems = VIM::evaluate("get(g:, 'rubycomplete_load_gemfile')") load_gems unless want_gems.to_i.zero? - input = VIM::Buffer.current.line cpos = VIM::Window.current.cursor[1] - 1 @@ -666,6 +682,7 @@ class VimRubyCompletion message = Regexp.quote($4) dprint "const or cls 2 [recv: \'%s\', msg: \'%s\']" % [ receiver, message ] load_buffer_class( receiver ) + load_buffer_module( receiver ) begin classes = eval("#{receiver}.constants") #methods = eval("#{receiver}.methods") @@ -786,7 +803,6 @@ class VimRubyCompletion methods += Kernel.public_methods end - include_object = VIM::evaluate("exists('g:rubycomplete_include_object') && g:rubycomplete_include_object") methods = clean_sel( methods, message ) methods = (methods-Object.instance_methods) if include_object == "0" @@ -829,5 +845,4 @@ let s:rubycomplete_rails_loaded = 0 call s:DefRuby() "}}} ruby-side code - " vim:tw=78:sw=4:ts=8:et:fdm=marker:ft=vim:norl: diff --git a/runtime/compiler/eruby.vim b/runtime/compiler/eruby.vim index 45ad5eeadf..a81a3f3b77 100644 --- a/runtime/compiler/eruby.vim +++ b/runtime/compiler/eruby.vim @@ -3,6 +3,7 @@ " Maintainer: Doug Kearns " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns +" Last Change: 2018 Jan 25 if exists("current_compiler") finish @@ -28,8 +29,8 @@ CompilerSet errorformat= \%W%f:%l:\ warning:\ %m, \%E%f:%l:in\ %*[^:]:\ %m, \%E%f:%l:\ %m, - \%-C%\tfrom\ %f:%l:in\ %.%#, - \%-Z%\tfrom\ %f:%l, + \%-C%\t%\\d%#:%#\ %#from\ %f:%l:in\ %.%#, + \%-Z%\t%\\d%#:%#\ %#from\ %f:%l, \%-Z%p^, \%-G%.%# diff --git a/runtime/compiler/rake.vim b/runtime/compiler/rake.vim index 8490f2a9e9..3d11a31f89 100644 --- a/runtime/compiler/rake.vim +++ b/runtime/compiler/rake.vim @@ -3,6 +3,7 @@ " Maintainer: Tim Pope " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns +" Last Change: 2018 Mar 02 if exists("current_compiler") finish @@ -20,12 +21,12 @@ 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%#%\\d%#:%#\ %#from\ %f:%l:%m, + \%\\s%#%\\d%#:%#\ %#from\ %f:%l:, + \%\\s%##\ %f:%l:%m%\\&%.%#%\\D:%\\d%\\+:%.%#, + \%\\s%##\ %f:%l%\\&%.%#%\\D:%\\d%\\+, + \%\\s%#[%f:%l:\ %#%m%\\&%.%#%\\D:%\\d%\\+:%.%#, + \%\\s%#%f:%l:\ %#%m%\\&%.%#%\\D:%\\d%\\+:%.%#, \%\\s%#%f:%l:, \%m\ [%f:%l]:, \%+Erake\ aborted!, diff --git a/runtime/compiler/rspec.vim b/runtime/compiler/rspec.vim index c77bd70da7..0cfce04572 100644 --- a/runtime/compiler/rspec.vim +++ b/runtime/compiler/rspec.vim @@ -3,6 +3,7 @@ " Maintainer: Tim Pope " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns +" Last Change: 2018 Aug 07 if exists("current_compiler") finish @@ -23,7 +24,8 @@ CompilerSet errorformat= \%E%.%#:in\ `load':\ %f:%l:%m, \%E%f:%l:in\ `%*[^']':\ %m, \%-Z\ \ \ \ \ %\\+\#\ %f:%l:%.%#, - \%E\ \ %\\d%\\+)%.%#, + \%E\ \ \ \ \ Failure/Error:\ %m, + \%E\ \ \ \ \ Failure/Error:, \%C\ \ \ \ \ %m, \%C%\\s%#, \%-G%.%# diff --git a/runtime/compiler/ruby.vim b/runtime/compiler/ruby.vim index dcf7a40129..82d4d1c876 100644 --- a/runtime/compiler/ruby.vim +++ b/runtime/compiler/ruby.vim @@ -4,7 +4,7 @@ " Maintainer: Tim Pope " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns -" ---------------------------------------------------------------------------- +" Last Change: 2019 Jan 06 if exists("current_compiler") finish @@ -21,21 +21,21 @@ set cpo-=C " default settings runs script normally " add '-c' switch to run syntax check only: " -" CompilerSet makeprg=ruby\ -wc\ $* +" CompilerSet makeprg=ruby\ -c " " or add '-c' at :make command line: " " :make -c % " -CompilerSet makeprg=ruby\ -w\ $* +CompilerSet makeprg=ruby CompilerSet errorformat= \%+E%f:%l:\ parse\ error, \%W%f:%l:\ warning:\ %m, \%E%f:%l:in\ %*[^:]:\ %m, \%E%f:%l:\ %m, - \%-C%\tfrom\ %f:%l:in\ %.%#, - \%-Z%\tfrom\ %f:%l, + \%-C%\t%\\d%#:%#\ %#from\ %f:%l:in\ %.%#, + \%-Z%\t%\\d%#:%#\ %#from\ %f:%l, \%-Z%p^, \%-G%.%# diff --git a/runtime/compiler/rubyunit.vim b/runtime/compiler/rubyunit.vim index ed0639b581..48e8fa41ab 100644 --- a/runtime/compiler/rubyunit.vim +++ b/runtime/compiler/rubyunit.vim @@ -3,6 +3,7 @@ " Maintainer: Doug Kearns " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns +" Last Change: 2014 Mar 23 if exists("current_compiler") finish diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index a4e42d61be..859b31a170 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -1043,8 +1043,10 @@ TermResponse After the response to t_RV is received from anything else that takes time is involved). *TextChanged* TextChanged After a change was made to the text in the - current buffer in Normal mode. That is when - |b:changedtick| has changed. + current buffer in Normal mode. That is after + |b:changedtick| has changed (also when that + happened before the TextChanged autocommand + was defined). Not triggered when there is typeahead or when an operator is pending. Careful: This is triggered very often, don't diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 5ec649cf40..c73bd40cb6 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -69,7 +69,7 @@ To force conversion from String to Number, add zero to it: > To avoid a leading zero to cause octal conversion, or for using a different base, use |str2nr()|. - *TRUE* *FALSE* + *TRUE* *FALSE* *Boolean* For boolean operators Numbers are used. Zero is FALSE, non-zero is TRUE. You can also use |v:false| and |v:true|. When TRUE is returned from a function it is the Number one, FALSE is the number zero. @@ -92,7 +92,8 @@ Note that " " and "0" are also non-empty strings, thus considered to be TRUE. A List, Dictionary or Float is not a Number or String, thus evaluate to FALSE. *E745* *E728* *E703* *E729* *E730* *E731* -List, Dictionary and Funcref types are not automatically converted. +|List|, |Dictionary|, |Funcref|, and |Blob| types are not automatically +converted. *E805* *E806* *E808* When mixing Number and Float the Number is converted to Float. Otherwise @@ -5419,6 +5420,7 @@ len({expr}) The result is a Number, which is the length of the argument. used, as with |strlen()|. When {expr} is a |List| the number of items in the |List| is returned. + When {expr} is a |Blob| the number of bytes is returned. When {expr} is a |Dictionary| the number of entries in the |Dictionary| is returned. Otherwise an error is given. diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index 765f8ce3a1..03523042c6 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -1429,8 +1429,9 @@ tag command action ~ |:recover| :rec[over] recover a file from a swap file |:redo| :red[o] redo one undone change |:redir| :redi[r] redirect messages to a file or register -|:redraw| :redr[aw] force a redraw of the display -|:redrawstatus| :redraws[tatus] force a redraw of the status line(s) +|:redraw| :redr[aw] force a redraw of the display +|:redrawstatus| :redraws[tatus] force a redraw of the status line(s) +|:redrawtabline| :redrawt[abline] force a redraw of the tabline |:registers| :reg[isters] display the contents of registers |:resize| :res[ize] change current window height |:retab| :ret[ab] change tab size diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index cb396eea38..f27edef412 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1661,7 +1661,10 @@ A jump table for the options with a short description can be found at |Q_op|. deleted only once. Also when repeating "R" with "." and a count. *cpo-y* - y A yank command can be redone with ".". + y A yank command can be redone with ".". Think twice if + you really want to use this, it may break some + plugins, since most people expect "." to only repeat a + change. *cpo-Z* Z When using "w!" while the 'readonly' option is set, don't reset 'readonly'. diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index 3e90a5cfd0..ca836fea67 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -97,14 +97,14 @@ processing a quickfix or location list command, it will be aborted. :[count]lne[xt][!] Same as ":cnext", except the location list for the current window is used instead of the quickfix list. -:[count]cN[ext][!] *:cp* *:cprevious* *:cN* *:cNext* +:[count]cN[ext][!] *:cp* *:cprevious* *:cprev* *:cN* *:cNext* :[count]cp[revious][!] Display the [count] previous error in the list that includes a file name. If there are no file names at all, go to the [count] previous error. See |:cc| for [!] and 'switchbuf'. -:[count]lN[ext][!] *:lp* *:lprevious* *:lN* *:lNext* +:[count]lN[ext][!] *:lp* *:lprevious* *:lprev* *:lN* *:lNext* :[count]lp[revious][!] Same as ":cNext" and ":cprevious", except the location list for the current window is used instead of the quickfix list. @@ -354,6 +354,23 @@ modify the title of a quickfix and location list respectively. Examples: > echo getqflist({'title' : 1}) call setloclist(3, [], 'a', {'title' : 'Cmd output'}) echo getloclist(3, {'title' : 1}) +< + *quickfix-index* +When you jump to a quickfix/location list entry using any of the quickfix +commands (e.g. |:cc|, |:cnext|, |:cprev|, etc.), that entry becomes the +currently selected entry. The index of the currently selected entry in a +quickfix/location list can be obtained using the getqflist()/getloclist() +functions. Examples: > + echo getqflist({'idx' : 0}).idx + echo getqflist({'id' : qfid, 'idx' : 0}).idx + echo getloclist(2, {'idx' : 0}).idx +< +For a new quickfix list, the first entry is selected and the index is 1. Any +entry in any quickfix/location list can be set as the currently selected entry +using the setqflist() function. Examples: > + call setqflist([], 'a', {'idx' : 12}) + call setqflist([], 'a', {'id' : qfid, 'idx' : 7}) + call setloclist(1, [], 'a', {'idx' : 7}) < *quickfix-size* You can get the number of entries (size) in a quickfix and a location list diff --git a/runtime/doc/sign.txt b/runtime/doc/sign.txt index bbf877bf04..4e0d91dae0 100644 --- a/runtime/doc/sign.txt +++ b/runtime/doc/sign.txt @@ -37,6 +37,7 @@ There are two steps in using signs: displayed. A defined sign can be placed several times in different lines and files. + *sign-column* When signs are defined for a file, Vim will automatically add a column of two characters to display them in. When the last sign is unplaced the column disappears again. This behavior can be changed with the 'signcolumn' option. @@ -49,7 +50,7 @@ Example to set the color: > *sign-identifier* Each placed sign is identified by a number called the sign identifier. This identifier is used to jump to the sign or to remove the sign. The identifier -is assigned when placing the sign using the |sign-place| command or the +is assigned when placing the sign using the |:sign-place| command or the |sign_place()| function. Each sign identifier should be a unique number. If multiple placed signs use the same identifier, then jumping to or removing a sign becomes unpredictable. To avoid overlapping identifiers, sign groups can @@ -70,6 +71,10 @@ on the same line, the attributes of the sign with the highest priority is used independent of the sign group. The default priority for a sign is 10. The priority is assigned at the time of placing a sign. +When the line on which the sign is placed is deleted, the sign is moved to the +next line (or the last line of the buffer, if there is no next line). When +the delete is undone the sign does not move back. + ============================================================================== 2. Commands *sign-commands* *:sig* *:sign* diff --git a/runtime/doc/spell.txt b/runtime/doc/spell.txt index 875f3f2c08..7ea6021d5a 100644 --- a/runtime/doc/spell.txt +++ b/runtime/doc/spell.txt @@ -558,7 +558,7 @@ When the Myspell files are updated you can merge the differences: nvim -d xx_YY.orig.dic xx_YY.new.dic 3. Take over the changes you like in xx_YY.dic. You may also need to change xx_YY.aff. -4. Rename xx_YY.new.dic to xx_YY.orig.dic and xx_YY.new.aff to xx_YY.new.aff. +4. Rename xx_YY.new.dic to xx_YY.orig.dic and xx_YY.new.aff to xx_YY.orig.aff. SPELL FILE VERSIONS *E770* *E771* *E772* diff --git a/runtime/ftplugin/bash.vim b/runtime/ftplugin/bash.vim new file mode 100644 index 0000000000..a3d01fc2ad --- /dev/null +++ b/runtime/ftplugin/bash.vim @@ -0,0 +1,31 @@ +" Vim filetype plugin file +" Language: bash +" Maintainer: Bram Moolenaar +" Last Changed: 2019 Jan 12 +" +" This is not a real filetype plugin. It allows for someone to set 'filetype' +" to "bash" in the modeline, and gets the effect of filetype "sh" with +" b:is_bash set. Idea from Mahmode Al-Qudsi. + +if exists("b:did_ftplugin") + finish +endif + +let b:is_bash = 1 +if exists("b:is_sh") + unlet b:is_sh +endif +if exists("b:is_kornshell") + unlet b:is_kornshell +endif + +" Setting 'filetype' here directly won't work, since we are being invoked +" through an autocommand. Do it later, on the BufWinEnter event. +augroup bash_filetype + au BufWinEnter * call SetBashFt() +augroup END + +func SetBashFt() + au! bash_filetype + set ft=sh +endfunc diff --git a/runtime/ftplugin/eruby.vim b/runtime/ftplugin/eruby.vim index 32f3fb868f..3c18bada78 100644 --- a/runtime/ftplugin/eruby.vim +++ b/runtime/ftplugin/eruby.vim @@ -3,6 +3,7 @@ " Maintainer: Tim Pope " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns +" Last Change: 2019 Jan 06 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -27,7 +28,7 @@ elseif !exists("b:eruby_subtype") let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$") let b:eruby_subtype = matchstr(s:lines,'eruby_subtype=\zs\w\+') if b:eruby_subtype == '' - let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\|\.erubis\)\+$','',''),'\.\zs\w\+\%(\ze+\w\+\)\=$') + let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\|\.erubis\|\.example\)\+$','',''),'\.\zs\w\+\%(\ze+\w\+\)\=$') endif if b:eruby_subtype == 'rhtml' let b:eruby_subtype = 'html' @@ -45,7 +46,7 @@ elseif !exists("b:eruby_subtype") endif endif -if exists("b:eruby_subtype") && b:eruby_subtype != '' +if exists("b:eruby_subtype") && b:eruby_subtype != '' && b:eruby_subtype !=? 'eruby' exe "runtime! ftplugin/".b:eruby_subtype.".vim ftplugin/".b:eruby_subtype."_*.vim ftplugin/".b:eruby_subtype."/*.vim" else runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim @@ -66,6 +67,21 @@ if exists("b:match_words") unlet b:match_words endif +let s:cfilemap = v:version >= 704 ? maparg('', 'c', 0, 1) : {} +if !get(s:cfilemap, 'buffer') || !s:cfilemap.expr || s:cfilemap.rhs =~# 'ErubyAtCursor()' + let s:cfilemap = {} +endif +if !has_key(s:cfilemap, 'rhs') + let s:cfilemap.rhs = "substitute(&l:inex =~# '\\' && len(expand('')) ? eval(substitute(&l:inex, '\\', '\\=string(expand(\"\"))', 'g')) : '', '^$', \"\\022\\006\",'')" +endif +let s:ctagmap = v:version >= 704 ? maparg('', 'c', 0, 1) : {} +if !get(s:ctagmap, 'buffer') || !s:ctagmap.expr || s:ctagmap.rhs =~# 'ErubyAtCursor()' + let s:ctagmap = {} +endif +let s:include = &l:include +let s:path = &l:path +let s:suffixesadd = &l:suffixesadd + runtime! ftplugin/ruby.vim ftplugin/ruby_*.vim ftplugin/ruby/*.vim let b:did_ftplugin = 1 @@ -80,6 +96,15 @@ if exists("b:match_words") let s:match_words = b:match_words . ',' . s:match_words endif +if len(s:include) + let &l:include = s:include +endif +let &l:path = s:path . (s:path =~# ',$\|^$' ? '' : ',') . &l:path +let &l:suffixesadd = s:suffixesadd . (s:suffixesadd =~# ',$\|^$' ? '' : ',') . &l:suffixesadd +exe 'cmap