diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-01-17 16:07:22 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-01-17 16:07:22 +0100 |
commit | d09091d4955c5f41de69928f2db85611ed54ed23 (patch) | |
tree | 9ae3f6b6c693334f58138064918222640c049ff5 /runtime | |
parent | bb1969b6ab28120c93b77817e7b6075e1aecf663 (diff) | |
download | vim-git-d09091d4955c5f41de69928f2db85611ed54ed23.tar.gz |
Update runtime files.
Diffstat (limited to 'runtime')
32 files changed, 1009 insertions, 595 deletions
diff --git a/runtime/autoload/rubycomplete.vim b/runtime/autoload/rubycomplete.vim index 40b87f4cb..ea1847023 100644 --- a/runtime/autoload/rubycomplete.vim +++ b/runtime/autoload/rubycomplete.vim @@ -1,9 +1,9 @@ " Vim completion script -" Language: Ruby -" Maintainer: Mark Guzman <segfault@hasno.info> -" URL: https://github.com/vim-ruby/vim-ruby -" Release Coordinator: Doug Kearns <dougkearns@gmail.com> -" Maintainer Version: 0.8.1 +" Language: Ruby +" Maintainer: Mark Guzman <segfault@hasno.info> +" URL: https://github.com/vim-ruby/vim-ruby +" Release Coordinator: Doug Kearns <dougkearns@gmail.com> +" 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 45ad5eead..a81a3f3b7 100644 --- a/runtime/compiler/eruby.vim +++ b/runtime/compiler/eruby.vim @@ -3,6 +3,7 @@ " Maintainer: Doug Kearns <dougkearns@gmail.com> " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns <dougkearns@gmail.com> +" 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 8490f2a9e..3d11a31f8 100644 --- a/runtime/compiler/rake.vim +++ b/runtime/compiler/rake.vim @@ -3,6 +3,7 @@ " Maintainer: Tim Pope <vimNOSPAM@tpope.org> " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns <dougkearns@gmail.com> +" 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 c77bd70da..0cfce0457 100644 --- a/runtime/compiler/rspec.vim +++ b/runtime/compiler/rspec.vim @@ -3,6 +3,7 @@ " Maintainer: Tim Pope <vimNOSPAM@tpope.org> " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns <dougkearns@gmail.com> +" 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 dcf7a4012..82d4d1c87 100644 --- a/runtime/compiler/ruby.vim +++ b/runtime/compiler/ruby.vim @@ -4,7 +4,7 @@ " Maintainer: Tim Pope <vimNOSPAM@tpope.org> " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns <dougkearns@gmail.com> -" ---------------------------------------------------------------------------- +" 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 %<CR> " -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 ed0639b58..48e8fa41a 100644 --- a/runtime/compiler/rubyunit.vim +++ b/runtime/compiler/rubyunit.vim @@ -3,6 +3,7 @@ " Maintainer: Doug Kearns <dougkearns@gmail.com> " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns <dougkearns@gmail.com> +" Last Change: 2014 Mar 23 if exists("current_compiler") finish diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index b3790d5d5..b78cddfef 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -1,4 +1,4 @@ -*autocmd.txt* For Vim version 8.1. Last change: 2018 Dec 28 +*autocmd.txt* For Vim version 8.1. Last change: 2019 Jan 11 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1017,8 +1017,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 6e9ff7ca0..93958d174 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 8.1. Last change: 2019 Jan 15 +*eval.txt* For Vim version 8.1. Last change: 2019 Jan 17 VIM REFERENCE MANUAL by Bram Moolenaar @@ -107,7 +107,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. @@ -131,8 +131,8 @@ A List, Dictionary or Float is not a Number or String, thus evaluate to FALSE. *E745* *E728* *E703* *E729* *E730* *E731* *E908* *E910* *E913* *E974* *E975* *E976* -List, Dictionary, Funcref, Job, Channel and Blob types are not automatically -converted. +|List|, |Dictionary|, |Funcref|, |Job|, |Channel| and |Blob| types are not +automatically converted. *E805* *E806* *E808* When mixing Number and Float the Number is converted to Float. Otherwise @@ -673,6 +673,7 @@ Part of a blob ~ A part of the Blob can be obtained by specifying the first and last index, separated by a colon in square brackets: > :let myblob = 0z00112233 + :let shortblob = myblob[1:2] " get 0z1122 :let shortblob = myblob[2:-1] " get 0z2233 Omitting the first index is similar to zero. Omitting the last index is @@ -681,7 +682,7 @@ similar to -1. > :let shortblob = myblob[2:2] " Blob with one byte: 0z22 :let otherblob = myblob[:] " make a copy of the Blob -If the first index is beyond the last byte of the Blob or the second byte is +If the first index is beyond the last byte of the Blob or the second index is before the first byte, the result is an empty list. There is no error message. @@ -700,12 +701,12 @@ higher index is an error. To change a sequence of bytes the [:] notation can be used: > let blob[1:3] = 0z445566 -The length of the replaced bytes much be exactly the same as the value +The length of the replaced bytes must be exactly the same as the value provided. *E972* To change part of a blob you can specify the first and last byte to be -modified. The value must at least have the number of bytes in the range: > - :let blob[3:5] = [3, 4, 5] +modified. The value must have the same number of bytes in the range: > + :let blob[3:5] = 0z334455 You can also use the functions |add()|, |remove()| and |insert()|. @@ -734,7 +735,7 @@ identity is different: > :echo blob is blob3 < 0 -Making a copy of a list is done with the |copy()| function. Using [:] also +Making a copy of a Blob is done with the |copy()| function. Using [:] also works, as explained above. @@ -793,7 +794,7 @@ Expression syntax summary, from least to most significant: expr5 isnot expr5 different |List| instance |expr5| expr6 - expr6 + expr6 .. number addition or list concatenation + expr6 + expr6 .. number addition, list or blob concatenation expr6 - expr6 .. number subtraction expr6 . expr6 .. string concatenation @@ -1143,7 +1144,7 @@ If expr8 is a |Blob| this results in a new |Blob| with the bytes in the indexes expr1a and expr1b, inclusive. Examples: > :let b = 0zDEADBEEF :let bs = b[1:2] " 0zADBE - :let bs = b[] " copy ov 0zDEADBEEF + :let bs = b[:] " copy of 0zDEADBEEF Using expr8[expr1] or expr8[expr1a : expr1b] on a |Funcref| results in an error. @@ -1871,7 +1872,7 @@ v:mouse_col Column number for a mouse click obtained with |getchar()|. This is the screen column number, like with |virtcol()|. The value is zero when there was no mouse button click. - *v:none* *none-variable* + *v:none* *none-variable* *None* v:none An empty String. Used to put an empty item in JSON. See |json_encode()|. When used as a number this evaluates to zero. @@ -2028,27 +2029,27 @@ v:swapcommand Normal mode command to be executed after a file has been For ":edit +cmd file" the value is ":cmd\r". *v:t_TYPE* *v:t_bool* *t_bool-variable* -v:t_bool Value of Boolean type. Read-only. See: |type()| +v:t_bool Value of |Boolean| type. Read-only. See: |type()| *v:t_channel* *t_channel-variable* -v:t_channel Value of Channel type. Read-only. See: |type()| +v:t_channel Value of |Channel| type. Read-only. See: |type()| *v:t_dict* *t_dict-variable* -v:t_dict Value of Dictionary type. Read-only. See: |type()| +v:t_dict Value of |Dictionary| type. Read-only. See: |type()| *v:t_float* *t_float-variable* -v:t_float Value of Float type. Read-only. See: |type()| +v:t_float Value of |Float| type. Read-only. See: |type()| *v:t_func* *t_func-variable* -v:t_func Value of Funcref type. Read-only. See: |type()| +v:t_func Value of |Funcref| type. Read-only. See: |type()| *v:t_job* *t_job-variable* -v:t_job Value of Job type. Read-only. See: |type()| +v:t_job Value of |Job| type. Read-only. See: |type()| *v:t_list* *t_list-variable* -v:t_list Value of List type. Read-only. See: |type()| +v:t_list Value of |List| type. Read-only. See: |type()| *v:t_none* *t_none-variable* -v:t_none Value of None type. Read-only. See: |type()| +v:t_none Value of |None| type. Read-only. See: |type()| *v:t_number* *t_number-variable* -v:t_number Value of Number type. Read-only. See: |type()| +v:t_number Value of |Number| type. Read-only. See: |type()| *v:t_string* *t_string-variable* -v:t_string Value of String type. Read-only. See: |type()| +v:t_string Value of |String| type. Read-only. See: |type()| *v:t_blob* *t_blob-variable* -v:t_blob Value of Blob type. Read-only. See: |type()| +v:t_blob Value of |Blob| type. Read-only. See: |type()| *v:termresponse* *termresponse-variable* v:termresponse The escape sequence returned by the terminal for the |t_RV| @@ -3342,7 +3343,7 @@ ch_read({handle} [, {options}]) *ch_read()* {only available when compiled with the |+channel| feature} ch_readblob({handle} [, {options}]) *ch_readblob()* - Like ch_read() but reads binary data and returns a Blob. + Like ch_read() but reads binary data and returns a |Blob|. See |channel-more|. {only available when compiled with the |+channel| feature} @@ -3363,7 +3364,7 @@ ch_sendexpr({handle}, {expr} [, {options}]) *ch_sendexpr()* {only available when compiled with the |+channel| feature} ch_sendraw({handle}, {expr} [, {options}]) *ch_sendraw()* - Send string or Blob {expr} over {handle}. + Send |String| or |Blob| {expr} over {handle}. Works like |ch_sendexpr()|, but does not encode the request or decode the response. The caller is responsible for the correct contents. Also does not add a newline for a channel @@ -3788,7 +3789,7 @@ empty({expr}) *empty()* - |v:false|, |v:none| and |v:null| are empty, |v:true| is not. - A |Job| is empty when it failed to start. - A |Channel| is empty when it is closed. - - A Blob is empty when its length is zero. + - A |Blob| is empty when its length is zero. For a long |List| this is much faster than comparing the length with zero. @@ -5883,6 +5884,8 @@ json_decode({string}) *json_decode()* The decoding is permissive: - A trailing comma in an array and object is ignored, e.g. "[1, 2, ]" is the same as "[1, 2]". + - Integer keys are accepted in objects, e.g. {1:2} is the + same as {'1':2}. - More floating point numbers are recognized, e.g. "1." for "1.0", or "001.2" for "1.2". Special floating point values "Infinity", "-Infinity" and "NaN" (capitalization ignored) @@ -5911,18 +5914,18 @@ json_encode({expr}) *json_encode()* The encoding is specified in: https://tools.ietf.org/html/rfc7159.html Vim values are converted as follows: - Number decimal number - Float floating point number + |Number| decimal number + |Float| floating point number Float nan "NaN" Float inf "Infinity" Float -inf "-Infinity" - String in double quotes (possibly null) - Funcref not possible, error - List as an array (possibly null); when + |String| in double quotes (possibly null) + |Funcref| not possible, error + |List| as an array (possibly null); when used recursively: [] - Dict as an object (possibly null); when + |Dict| as an object (possibly null); when used recursively: {} - Blob as an array of the individual bytes + |Blob| as an array of the individual bytes v:false "false" v:true "true" v:none "null" @@ -5941,6 +5944,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. @@ -10247,7 +10251,7 @@ spell Compiled with spell checking support |spell|. startuptime Compiled with |--startuptime| support. statusline Compiled with support for 'statusline', 'rulerformat' and special formats of 'titlestring' and 'iconstring'. -sun_workshop Compiled with support for Sun |workshop|. +sun_workshop Support for Sun |workshop| has been removed. syntax Compiled with syntax highlighting support |syntax|. syntax_items There are active syntax highlighting items for the current buffer. diff --git a/runtime/doc/help.txt b/runtime/doc/help.txt index 4c6567b16..c8ff75aec 100644 --- a/runtime/doc/help.txt +++ b/runtime/doc/help.txt @@ -1,4 +1,4 @@ -*help.txt* For Vim version 8.1. Last change: 2019 Jan 01 +*help.txt* For Vim version 8.1. Last change: 2019 Jan 17 VIM - main help file k diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index 4abd25aa0..296a4e371 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -1,4 +1,4 @@ -*index.txt* For Vim version 8.1. Last change: 2018 Apr 19 +*index.txt* For Vim version 8.1. Last change: 2019 Jan 17 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1457,8 +1457,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 @@ -1643,7 +1644,6 @@ tag command action ~ argument list |:wq| :wq write to a file and quit window or Vim |:wqall| :wqa[ll] write all changed buffers and quit Vim -|:wsverb| :ws[verb] pass the verb to workshop over IPC |:wundo| :wu[ndo] write undo information to a file |:wviminfo| :wv[iminfo] write to viminfo file |:xit| :x[it] write if buffer changed and quit window or Vim diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index e01eac932..0431043c2 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -1,4 +1,4 @@ -*insert.txt* For Vim version 8.1. Last change: 2018 Feb 10 +*insert.txt* For Vim version 8.1. Last change: 2019 Jan 11 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/intro.txt b/runtime/doc/intro.txt index 5f051e74d..106245b83 100644 --- a/runtime/doc/intro.txt +++ b/runtime/doc/intro.txt @@ -1,4 +1,4 @@ -*intro.txt* For Vim version 8.1. Last change: 2019 Jan 01 +*intro.txt* For Vim version 8.1. Last change: 2019 Jan 07 VIM REFERENCE MANUAL by Bram Moolenaar @@ -268,9 +268,9 @@ In this documentation there are several references to other versions of Vi: Vi "the original". Without further remarks this is the version of Vi that appeared in Sun OS 4.x. ":version" returns "Version 3.7, 6/7/85". Sometimes other versions are referred - to. Only runs under Unix. Source code only available with a - license. More information on Vi can be found through: - http://vi-editor.org [doesn't currently work...] + to. Only runs under Unix. Source code is now available under a + BSD-style license. More information on Vi can be found through: + http://ex-vi.sourceforge.net/ *Posix* Posix From the IEEE standard 1003.2, Part 2: Shell and utilities. Generally known as "Posix". This is a textual description of @@ -285,11 +285,10 @@ Nvi The "New" Vi. The version of Vi that comes with BSD 4.4 and FreeBSD. Source code is freely available. *Elvis* Elvis Another Vi clone, made by Steve Kirkendall. Very compact but isn't - as flexible as Vim. - The version used is 2.1. It is still being developed. Source code is - freely available. - *NeoVim* -NeoVim A Vim clone. Forked the Vim source in 2014 and went a different way. + as flexible as Vim. Development has stalled, Elvis has left the + building! Source code is freely available. + *Neovim* +Neovim A Vim clone. Forked the Vim source in 2014 and went a different way. Very much bound to github and has many more dependencies, making development more complex and limiting portability. Code has been refactored, resulting in patches not being exchangeable with Vim. diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index be53e9f56..128b34cba 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 8.1. Last change: 2018 Dec 27 +*options.txt* For Vim version 8.1. Last change: 2019 Jan 16 VIM REFERENCE MANUAL by Bram Moolenaar @@ -2273,7 +2273,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 18372dda0..5589df988 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -1,4 +1,4 @@ -*quickfix.txt* For Vim version 8.1. Last change: 2019 Jan 09 +*quickfix.txt* For Vim version 8.1. Last change: 2019 Jan 13 VIM REFERENCE MANUAL by Bram Moolenaar @@ -111,14 +111,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. @@ -367,8 +367,8 @@ modify the title of a quickfix and location list respectively. Examples: > < *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 +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 diff --git a/runtime/doc/sign.txt b/runtime/doc/sign.txt index 7b33a2da3..4886f7407 100644 --- a/runtime/doc/sign.txt +++ b/runtime/doc/sign.txt @@ -1,4 +1,4 @@ -*sign.txt* For Vim version 8.1. Last change: 2019 Jan 06 +*sign.txt* For Vim version 8.1. Last change: 2019 Jan 17 VIM REFERENCE MANUAL by Gordon Prieur @@ -31,7 +31,7 @@ terminal emulator. Signs and highlights are not useful just for debuggers. Sun's Visual WorkShop uses signs and highlights to mark build errors and SourceBrowser hits. Additionally, the debugger supports 8 to 10 different signs and -highlight colors. |workshop| Same for Netbeans |netbeans|. +highlight colors, see |NetBeans|. There are two steps in using signs: @@ -43,6 +43,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. @@ -55,7 +56,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 @@ -76,6 +77,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 2b096e3be..18db324b8 100644 --- a/runtime/doc/spell.txt +++ b/runtime/doc/spell.txt @@ -1,4 +1,4 @@ -*spell.txt* For Vim version 8.1. Last change: 2018 Mar 29 +*spell.txt* For Vim version 8.1. Last change: 2019 Jan 09 VIM REFERENCE MANUAL by Bram Moolenaar @@ -577,7 +577,7 @@ When the Myspell files are updated you can merge the differences: vimdiff 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/doc/tags b/runtime/doc/tags index e2028575c..a090a2423 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -2238,6 +2238,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX* :cp quickfix.txt /*:cp* :cpf quickfix.txt /*:cpf* :cpfile quickfix.txt /*:cpfile* +:cprev quickfix.txt /*:cprev* :cprevious quickfix.txt /*:cprevious* :cq quickfix.txt /*:cq* :cquit quickfix.txt /*:cquit* @@ -2584,6 +2585,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX* :lp quickfix.txt /*:lp* :lpf quickfix.txt /*:lpf* :lpfile quickfix.txt /*:lpfile* +:lprev quickfix.txt /*:lprev* :lprevious quickfix.txt /*:lprevious* :lr quickfix.txt /*:lr* :lrewind quickfix.txt /*:lrewind* @@ -2838,6 +2840,8 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX* :redraw various.txt /*:redraw* :redraws various.txt /*:redraws* :redrawstatus various.txt /*:redrawstatus* +:redrawt various.txt /*:redrawt* +:redrawtabline various.txt /*:redrawtabline* :reg change.txt /*:reg* :registers change.txt /*:registers* :res windows.txt /*:res* @@ -3315,8 +3319,6 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX* :write_a editing.txt /*:write_a* :write_c editing.txt /*:write_c* :write_f editing.txt /*:write_f* -:ws workshop.txt /*:ws* -:wsverb workshop.txt /*:wsverb* :wundo undo.txt /*:wundo* :wv starting.txt /*:wv* :wviminfo starting.txt /*:wviminfo* @@ -3576,6 +3578,9 @@ Athena gui_x11.txt /*Athena* B motion.txt /*B* BeBox os_beos.txt /*BeBox* BeOS os_beos.txt /*BeOS* +Blob eval.txt /*Blob* +Blobs eval.txt /*Blobs* +Boolean eval.txt /*Boolean* Bram intro.txt /*Bram* BufAdd autocmd.txt /*BufAdd* BufCreate autocmd.txt /*BufCreate* @@ -3748,6 +3753,7 @@ D change.txt /*D* DOS os_dos.txt /*DOS* DOS-format editing.txt /*DOS-format* DOS-format-write editing.txt /*DOS-format-write* +Dict eval.txt /*Dict* Dictionaries eval.txt /*Dictionaries* Dictionary eval.txt /*Dictionary* Dictionary-function eval.txt /*Dictionary-function* @@ -4665,6 +4671,14 @@ E969 eval.txt /*E969* E97 diff.txt /*E97* E970 eval.txt /*E970* E971 textprop.txt /*E971* +E972 eval.txt /*E972* +E973 eval.txt /*E973* +E974 eval.txt /*E974* +E975 eval.txt /*E975* +E976 eval.txt /*E976* +E977 eval.txt /*E977* +E978 eval.txt /*E978* +E979 eval.txt /*E979* E98 diff.txt /*E98* E99 diff.txt /*E99* EX intro.txt /*EX* @@ -4769,9 +4783,11 @@ N: cmdline.txt /*N:* N<Del> various.txt /*N<Del>* NFA pattern.txt /*NFA* NL-used-for-Nul pattern.txt /*NL-used-for-Nul* -NeoVim intro.txt /*NeoVim* +Neovim intro.txt /*Neovim* NetBSD-backspace options.txt /*NetBSD-backspace* +NetBeans netbeans.txt /*NetBeans* NetUserPass() pi_netrw.txt /*NetUserPass()* +None eval.txt /*None* Normal intro.txt /*Normal* Normal-mode intro.txt /*Normal-mode* Number eval.txt /*Number* @@ -4879,6 +4895,7 @@ SessionLoadPost autocmd.txt /*SessionLoadPost* ShellCmdPost autocmd.txt /*ShellCmdPost* ShellFilterPost autocmd.txt /*ShellFilterPost* SourceCmd autocmd.txt /*SourceCmd* +SourcePost autocmd.txt /*SourcePost* SourcePre autocmd.txt /*SourcePre* Special eval.txt /*Special* SpellFileMissing autocmd.txt /*SpellFileMissing* @@ -5281,6 +5298,11 @@ beval_winid-variable eval.txt /*beval_winid-variable* beval_winnr-variable eval.txt /*beval_winnr-variable* binary-number eval.txt /*binary-number* bitwise-function usr_41.txt /*bitwise-function* +blob eval.txt /*blob* +blob-identity eval.txt /*blob-identity* +blob-index eval.txt /*blob-index* +blob-literal eval.txt /*blob-literal* +blob-modification eval.txt /*blob-modification* blockwise-examples visual.txt /*blockwise-examples* blockwise-operators visual.txt /*blockwise-operators* blockwise-register change.txt /*blockwise-register* @@ -5461,6 +5483,7 @@ ch_log() eval.txt /*ch_log()* ch_logfile() eval.txt /*ch_logfile()* ch_open() eval.txt /*ch_open()* ch_read() eval.txt /*ch_read()* +ch_readblob() eval.txt /*ch_readblob()* ch_readraw() eval.txt /*ch_readraw()* ch_sendexpr() eval.txt /*ch_sendexpr()* ch_sendraw() eval.txt /*ch_sendraw()* @@ -7341,6 +7364,7 @@ locale mbyte.txt /*locale* locale-name mbyte.txt /*locale-name* localtime() eval.txt /*localtime()* location-list quickfix.txt /*location-list* +location-list-file-window quickfix.txt /*location-list-file-window* location-list-window quickfix.txt /*location-list-window* log() eval.txt /*log()* log10() eval.txt /*log10()* @@ -7586,6 +7610,7 @@ netbeans-protocol netbeans.txt /*netbeans-protocol* netbeans-run netbeans.txt /*netbeans-run* netbeans-setup netbeans.txt /*netbeans-setup* netbeans-support netbeans.txt /*netbeans-support* +netbeans-xpm netbeans.txt /*netbeans-xpm* netbeans.txt netbeans.txt /*netbeans.txt* netreadfixup pi_netrw.txt /*netreadfixup* netrw pi_netrw.txt /*netrw* @@ -8019,6 +8044,7 @@ peace intro.txt /*peace* penc-option print.txt /*penc-option* perl if_perl.txt /*perl* perl-Append if_perl.txt /*perl-Append* +perl-Blob if_perl.txt /*perl-Blob* perl-Buffer if_perl.txt /*perl-Buffer* perl-Buffers if_perl.txt /*perl-Buffers* perl-Count if_perl.txt /*perl-Count* @@ -8213,6 +8239,7 @@ quickfix-directory-stack quickfix.txt /*quickfix-directory-stack* quickfix-error-lists quickfix.txt /*quickfix-error-lists* quickfix-functions usr_41.txt /*quickfix-functions* quickfix-gcc quickfix.txt /*quickfix-gcc* +quickfix-index quickfix.txt /*quickfix-index* quickfix-manx quickfix.txt /*quickfix-manx* quickfix-parse quickfix.txt /*quickfix-parse* quickfix-perl quickfix.txt /*quickfix-perl* @@ -8332,6 +8359,7 @@ rrst.vim syntax.txt /*rrst.vim* rst.vim syntax.txt /*rst.vim* rsync pi_netrw.txt /*rsync* ruby if_ruby.txt /*ruby* +ruby-blob if_ruby.txt /*ruby-blob* ruby-buffer if_ruby.txt /*ruby-buffer* ruby-command if_ruby.txt /*ruby-command* ruby-commands if_ruby.txt /*ruby-commands* @@ -8482,9 +8510,11 @@ shift-left-right change.txt /*shift-left-right* shiftwidth() eval.txt /*shiftwidth()* short-name-changed version4.txt /*short-name-changed* showing-menus gui.txt /*showing-menus* +sign-column sign.txt /*sign-column* sign-commands sign.txt /*sign-commands* sign-functions usr_41.txt /*sign-functions* sign-group sign.txt /*sign-group* +sign-identifier sign.txt /*sign-identifier* sign-intro sign.txt /*sign-intro* sign-priority sign.txt /*sign-priority* sign-support sign.txt /*sign-support* @@ -8492,6 +8522,7 @@ sign.txt sign.txt /*sign.txt* sign_define() eval.txt /*sign_define()* sign_getdefined() eval.txt /*sign_getdefined()* sign_getplaced() eval.txt /*sign_getplaced()* +sign_jump() eval.txt /*sign_jump()* sign_place() eval.txt /*sign_place()* sign_undefine() eval.txt /*sign_undefine()* sign_unplace() eval.txt /*sign_unplace()* @@ -8843,6 +8874,7 @@ t_ZH term.txt /*t_ZH* t_ZR term.txt /*t_ZR* t_al term.txt /*t_al* t_bc term.txt /*t_bc* +t_blob-variable eval.txt /*t_blob-variable* t_bool-variable eval.txt /*t_bool-variable* t_cd term.txt /*t_cd* t_cdl version4.txt /*t_cdl* @@ -9134,6 +9166,7 @@ test_autochdir() eval.txt /*test_autochdir()* test_feedinput() eval.txt /*test_feedinput()* test_garbagecollect_now() eval.txt /*test_garbagecollect_now()* test_ignore_error() eval.txt /*test_ignore_error()* +test_null_blob() eval.txt /*test_null_blob()* test_null_channel() eval.txt /*test_null_channel()* test_null_dict() eval.txt /*test_null_dict()* test_null_job() eval.txt /*test_null_job()* @@ -9166,6 +9199,7 @@ tex.vim syntax.txt /*tex.vim* text-functions usr_41.txt /*text-functions* text-objects motion.txt /*text-objects* text-objects-changed version5.txt /*text-objects-changed* +text-prop-changes textprop.txt /*text-prop-changes* text-prop-functions textprop.txt /*text-prop-functions* text-prop-intro textprop.txt /*text-prop-intro* text-properties textprop.txt /*text-properties* @@ -9356,6 +9390,7 @@ v:swapchoice eval.txt /*v:swapchoice* v:swapcommand eval.txt /*v:swapcommand* v:swapname eval.txt /*v:swapname* v:t_TYPE eval.txt /*v:t_TYPE* +v:t_blob eval.txt /*v:t_blob* v:t_bool eval.txt /*v:t_bool* v:t_channel eval.txt /*v:t_channel* v:t_dict eval.txt /*v:t_dict* @@ -9726,12 +9761,7 @@ word-motions motion.txt /*word-motions* wordcount() eval.txt /*wordcount()* workbench starting.txt /*workbench* workshop workshop.txt /*workshop* -workshop-commands workshop.txt /*workshop-commands* -workshop-compiling workshop.txt /*workshop-compiling* -workshop-configure workshop.txt /*workshop-configure* -workshop-intro workshop.txt /*workshop-intro* workshop-support workshop.txt /*workshop-support* -workshop-xpm workshop.txt /*workshop-xpm* workshop.txt workshop.txt /*workshop.txt* wrap-off intro.txt /*wrap-off* write-compiler-plugin usr_41.txt /*write-compiler-plugin* diff --git a/runtime/doc/textprop.txt b/runtime/doc/textprop.txt index b4aeaf7c8..375255134 100644 --- a/runtime/doc/textprop.txt +++ b/runtime/doc/textprop.txt @@ -1,4 +1,4 @@ -*textprop.txt* For Vim version 8.1. Last change: 2018 Dec 30 +*textprop.txt* For Vim version 8.1. Last change: 2019 Jan 08 VIM REFERENCE MANUAL by Bram Moolenaar @@ -17,6 +17,7 @@ What is not working yet: 1. Introduction |text-prop-intro| 2. Functions |text-prop-functions| +3. When text changes |text-prop-changes| {Vi does not have text properties} @@ -113,5 +114,25 @@ prop_list({lnum} [, {props}) text properties in {lnum} prop_remove({props} [, {lnum} [, {lnum-end}]]) remove a text property +============================================================================== +3. When text changes *text-prop-changes* + +Vim will do its best to keep the text properties on the text where it was +attached. When inserting or deleting text the properties after the change +will move accordingly. + +When text is deleted and a text property no longer includes any text, it is +deleted. However, a text property that was defined as zero-width will remain, +unless the whole line is deleted. + +When using replace mode, the text properties stay on the same character +positions, even though the characters themselves change. + + +When text property columns are not updated ~ + +- When setting the line with |setline()| or through an interface, such as Lua, + Tcl or Python. + vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 20eb894d7..543729888 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 8.1. Last change: 2019 Jan 01 +*todo.txt* For Vim version 8.1. Last change: 2019 Jan 17 VIM REFERENCE MANUAL by Bram Moolenaar @@ -38,12 +38,13 @@ browser use: https://github.com/vim/vim/issues/1234 *known-bugs* -------------------- Known bugs and current work ----------------------- -Valgrind error in old regexp engine when using TOhtml. -(Dominique, 2018 Dec 31, #3749) +Blob: the string form can't be parsed back. Use 0z00112233.44556677 ? -Possible errors reported from fuzzer. Shadowblade #3716 -a) using get_regline() without checking for NULL -b) using getcell() in libvterm without checking for NULL +Make msg() and msg_attr() also use "char *" intead of "char_u *"? + +Feature to possibly graduate: FEAT_MBYTE + Integrate EBCDIC feature, use 'encoding' == "ebcdic" ? + Or drop EBCDIC? 'incsearch' with :s: (#3321) - :s/foo using CTRL-G moves to another line, should not happen, or use the @@ -76,8 +77,11 @@ Terminal debugger: with another Vim instance. Terminal emulator window: +- When Vim runs in the terminal and changes the title, the statusline needs to + be redrawn. - GUI: When using ":set go+=!" a system() call causes the hit-enter prompt. (#3327) +- Terminal API: Add more functionality? (Ozaki Kiichi 2018 May 13, #2907) - GUI: hang until key typed. (#3530) - When the job in the terminal doesn't use mouse events, let the scroll wheel scroll the scrollback, like a terminal does at the shell prompt. #2490 @@ -96,7 +100,6 @@ Terminal emulator window: - Win32: Redirecting output works but includes escape sequences. - Win32: Make terminal used for :!cmd in the GUI work better. Allow for redirection. -- Terminal API: Add more functionality? (Ozaki Kiichi 2018 May 13, #2907) - When the job only outputs lines, we could handle resizing the terminal better: store lines separated by line breaks, instead of screen lines, then when the window is resized redraw those lines. @@ -106,8 +109,7 @@ Terminal emulator window: - When 'encoding' is not utf-8, or the job is using another encoding, setup conversions. -":function" can now silently overwrite the function from the same script. -Do the same for ":command" ? +Patch with updates for VMS. (Zoltan Arpadffy, 2019 Jan 14) Update for German spell files: https://github.com/chrisbra/vim/compare/5e021c990f8817a50d3264782a5...3b27c92f297540761ebbd92d04fb3 (Christian Brabandt, 2018 Nov 4) @@ -116,35 +118,44 @@ Problem with Visual yank when 'linebreak' and 'showbreak' are set. Patch with tests, but it's not clear how it is supposed to work. (tommm, 2018 Nov 17) Asked about this, Dec 22. Christian will have a look. +Patch to deal with signs at the end of the buffer when lines are deleted. +(Yegappan Lakshmanan, #3798) + Key mapping times out when using a timer in Gvim. (Michael Henry, 2018 Sep 9, #3417) - -Add v:motion_force. (Kana Natsuno, 2008 Dec 6) -Maybe call it v:motiontype. Update in #3490. -Alternative: add the force flag to mode(), after "no". -Patch ready to include? +Another report, with reproduction steps. (#3799) +Is this fixed by 8.1.0761? Does not build with MinGW out of the box: - _stat64 is not defined, need to use "struct stat" in vim.h - WINVER conflict, should use 0x0600 by default? +Patch to remove flicker from popup menu. (Yasuhiro Matsumoto, 2013 Aug 15) +When redrawing for updating the popup menu, don't redraw the part when the new +popup menu will be displayed? + +js_decode() does not handle infinity properly. (Dominique Pelle, 2019 Jan 10, +#3788) + Signs: +- screen not redrawn correctly. (Dominique Pelle, 2019 Jan 14, #3803) - Use a sign group in the Termdebug plugin. - Avoid that "sign unplace id" does a redraw right away, esp. when there is a sequence of these commands. (Andy Stewart, 2018 Mar 16) -- Patch to right-align signs. (James Kolb (email james), 2013 Sep 23) -- Patch from Christian Brabandt to make the "buffer" argument for ":sign - place" optional. (2013 Jul 12) Crash when mixing matchadd and substitute()? (Max Christian Pohle, 2018 May 13, #2910) Can't reproduce? -Patch to add blob type support. (Yasuhiro Matsumoto, 2018 Nov 26, #3638) -Should be ready to include. +Merge checking for 'cursorline' and 'concealcursor', see neovim #9492. + +Patch to not call setActiveWindow. Yasuhiro Matsumoto, 2019 Jan 8, #3778) Errors found with random data: heap-buffer-overflow in alist_add (#2472) +Patch for xxd to make it work with 64 bit numbers. (Christer Jense, 2019 Jan +11, #3791) + Win32 key codes are messy. Mike Williams tried to fix that, but now old mappings no longer work. Create a new terminal for the better solution? @@ -152,9 +163,6 @@ Improve fallback for menu translations, to avoid having to create lots of files that source the actual file. E.g. menu_da_de -> menu_da Include part of #3242? -Patch to add 'p' flag to 'formatoptions'. (Tom Ryder, 2018 Dec 28) -Wait a few days for feedback. - When a terminal exit_cb closes the window, a following typed key is lost, if it's in a mapping. (2018 Oct 6, #2302, #3522) @@ -169,6 +177,10 @@ Williams, 2018 Oct 30) Problem with :tlmenu: Detach item added with all modes? Issue #3563. +When using a timer callback vgetc_busy is reset, allowing for using input(). +But in a channel callback this does not happen. We need to do something +similar to check_due_timer(). Also see #3809. + C syntax: {} inside () causes following {} to be highlighted as error. (Michalis Giannakidis, 2006 Jun 1) @@ -178,10 +190,27 @@ Patch on #3690 to fix that "wincmd p" does not always behave properly. Patch: When using %v in 'errorformat', assume the number is the screen column not bytes, also handle multi-byte charactes. (Yegappan Lakshmanan, #3700) +Make balloon_show() work outside of 'balloonexpr'? Users expect it to work: +#2948. (related to #1512?) +On Win32 it stops showing, because showState is already ShS_SHOWING. +balloon_show() does not work properly in the terminal. (Ben Jackson, 2017 Dec +20, #2481) +Also see #2352, want better control over balloon, perhaps set the position. +Should also be possible to add highlighting, like in the status line? +balloonexpr() on MS-Windows GUI doesn't handle accented chars? (nivaemail, +2018 Sep 14) +Another request: #3811. + Patch to add FOR_ALL_FRAMES. (Yegappan, 2018 Dec 11, #3686) Patch for MinGW build with static libraries. (Ken Takata, 2018 Dec 16) +Patch to add new regexp classes :ident:, :keyword:, :fname:. +(ichizok, 2016 Jan 12, #1373) + +Patch to add "termsig" - signal that caused job to end. (Ozaki Kiichi, 2019 +Jan 10, #3786) + More warnings from static analysis: https://lgtm.com/projects/g/vim/vim/alerts/?mode=list @@ -191,7 +220,8 @@ Patch for this: (Aron Widforss, 2018 Oct 13, #3539) quickfix window, for example. (Gary Holloway) Also do 'sidescrolloff'. -Patch for ConPTY support, #3474: What is the status? +Patch for ConPTY support, new one: #3794 Does this work now? +(Nobuhiro Takasaki) Issue #3649: Retrying the X server connection once may be insufficient. Since patch 8.1.0615 we try reconnecting five times. Does it work? @@ -229,9 +259,6 @@ When 'sidescrolloff' is set, using "zl" to go to the end of the line, suddenly scrolls back. Should allow for this scrolling, like 'scrolloff' does when using CTRL-E. (Yee Cheng Chin, #3721) -We have a SourcePre autocommand event, but not SourcePost. Useful for doing -some thing after a plugin was loaded. (#3739) - Invalid memory access with old regexp engine. (Dominique Pelle, 2018 Sep 3, #3405) Introduced by 8.0.1517, which was fixing another memory access error. (Sep 8) @@ -244,9 +271,6 @@ Patch to implement 'diffref' option. (#3535) Patch to fix that bracketed paste remains after Vim exits. (2018 Oct 30, #3579) -Patch to add support for changing the current quickfix/location list indes. -(Yegappan Lakshmanan, 2018 Dec 18, #3701) - Make ":interactive !cmd" stop termcap mode, also when used in an autocommand. (#3692) @@ -296,6 +320,9 @@ Adjust windows installer explanation of behavior. (scootergrisen, #3310) Set g:actual_curbuf when evaluating 'statusline', not just with an expression. (Daniel Hahler, 2018 Aug 8, #3299) +Update for xim-input-style help (Tony Mechelynck, 2019 Jan 10). +Feedback from someone who uses this? + ml_get error. (Dominique Pelle, 2018 Sep 14, #3434) Patch to use forward slash for completion even when 'shellslash' is set. @@ -379,16 +406,6 @@ Update Sep 7. Update by Christian Brabandt, 2015 Sep 8, 2016 Feb 1. Patch to be able to disable default digraphs (incomplete) (Eric Pruitt, 2018 Nov 22). -Make balloon_show() work outside of 'balloonexpr'? Users expect it to work: -#2948. (related to #1512?) -On Win32 it stops showing, because showState is already ShS_SHOWING. -balloon_show() does not work properly in the terminal. (Ben Jackson, 2017 Dec -20, #2481) -Also see #2352, want better control over balloon, perhaps set the position. -Should also be possible to add highlighting, like in the status line? -balloonexpr() on MS-Windows GUI doesn't handle accented chars? (nivaemail, -2018 Sep 14) - Try out background make plugin: https://github.com/AndrewVos/vim-make-background or asyncmake: @@ -444,19 +461,6 @@ deleting autocmds, not when adding them. Quickfix window height is not kept with a vertical split. (Lifepillar, 2018 Jun 10, #2998) -Improve the installer for MS-Windows. There are a few alternatives: -- mui2 installer improved by Ken Takata (2018 Sep 29) -- Installer from Cream (Steve Hall). -- Modern UI 2.0 for the Nsis installer. (Guopeng Wen) - https://github.com/gpwen/vim-installer-mui2 -- make it possible to do a silent install, see - http://nsis.sourceforge.net/Docs/Chapter4.html#4.12 - Version from Guopeng Wen does this. -- MSI installer: https://github.com/petrkle/vim-msi/ -- The one on Issue 279. -Problem: they all work slightly different (e.g. don't install vimrun.exe). -How to test that it works well for all Vim users? - Alternative manpager.vim. (Enno, 2018 Jan 5, #2529) Delete all the specific stuff for the Borland compiler? (#3374) @@ -538,7 +542,7 @@ option_save({list}) *option_save()* Alternatively: save and restore ALL options. Implementation needs to use copy-on-write. Return an ID from option_save(), when option_restore(ID) is called give an error if another option_save() - was called in the mean time, they must be balanced. + was called in the meantime, they must be balanced. "gvim --remote" from a directory with non-word characters changes the current directory (Paulo Marcel Coelho Arabic, 2017 Oct 30, #2266) @@ -562,8 +566,6 @@ Add script number to profile? (#3330 breaks tests). A function defined locally and lambda's are not easily recognized. Mention where they were defined somewhere. -CTRL-X on zero gets stuck on 0xfffffffffffffffe. (Hengyang Zhao, #2746) - Invalid range error when using BufWinLeave for closing terminal. (Gabriel Barta, 2017 Nov 15, #2339) @@ -590,9 +592,6 @@ In an optional package the "after" directory is not scanned? Patch for Neovim concerning restoring when closing help window. (glacambre neovim #7431) -Default install on MS-Windows should source defaults.vim. -Ask whether to use Windows or Vim key behavior? - Patch for improving detecting Ruby on Mac in configure. (Ilya Mikhaltsou, 2017 Nov 21) @@ -1570,9 +1569,6 @@ Updated spec ftplugin. (Matěj Cepl, 2013 Oct 16) Patch to handle integer overflow. (Aaron Burrow, 2013 Dec 12) -Patch to add "ntab" item in 'listchars' to repeat first character. (Nathaniel -Braun, pragm, 2013 Oct 13) A better solution 2014 Mar 5. - 7 Windows XP: When using "ClearType" for text smoothing, a column of yellow pixels remains when typing spaces in front of a "D" ('guifont' set to "lucida_console:h8"). @@ -1659,8 +1655,6 @@ Or use expand('<sid>')? Patch to make confirm() display colors. (Christian Brabandt, 2012 Nov 9) -Patch to remove flicker from popup menu. (Yasuhiro Matsumoto, 2013 Aug 15) - Problem with refresh:always in completion. (Tyler Wade, 2013 Mar 17) b:undo_ftplugin cannot call a script-local function. (Boris Danilov, 2013 Jan @@ -1679,9 +1673,6 @@ Patch for :tabcloseleft, after closing a tab go to left tab. (William Bowers, Patch to improve equivalence classes in regexp patterns. (Christian Brabandt, 2013 Jan 16, update Jan 17) -Patch to add new regexp classes :ident:, :keyword:, :fname:. -(ichizok, 2016 Jan 12, #1373) - Patch with suggestions for starting.txt. (Tony Mechelynck, 2012 Oct 24) But use Gnome instead of GTK? diff --git a/runtime/doc/undo.txt b/runtime/doc/undo.txt index 2ada2a6f4..b6c9809c2 100644 --- a/runtime/doc/undo.txt +++ b/runtime/doc/undo.txt @@ -1,4 +1,4 @@ -*undo.txt* For Vim version 8.1. Last change: 2014 May 24 +*undo.txt* For Vim version 8.1. Last change: 2019 Jan 04 VIM REFERENCE MANUAL by Bram Moolenaar @@ -259,6 +259,12 @@ changed with the 'undodir' option. When the file is encrypted, the text in the undo file is also crypted. The same key and method is used. |encryption| +Note that text properties are not stored in the undo file. You can restore +text properties so long as a buffer is loaded, but you cannot restore them +from an undo file. Rationale: It would require the associated text property +types to be defined in exactly the same was as before, which cannot be +guaranteed. + You can also save and restore undo histories by using ":wundo" and ":rundo" respectively: *:wundo* *:rundo* diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index c7bfffdc5..dd0583b60 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -1,4 +1,4 @@ -*usr_41.txt* For Vim version 8.1. Last change: 2018 Dec 18 +*usr_41.txt* For Vim version 8.1. Last change: 2019 Jan 12 VIM USER MANUAL - by Bram Moolenaar @@ -958,6 +958,7 @@ Inter-process communication: *channel-functions* ch_close() close a channel ch_close_in() close the in part of a channel ch_read() read a message from a channel + ch_readblob() read a Blob from a channel ch_readraw() read a raw message from a channel ch_sendexpr() send a JSON message over a channel ch_sendraw() send a raw message over a channel diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index 8473fca5a..2a9c9cfcb 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -1,4 +1,4 @@ -*various.txt* For Vim version 8.1. Last change: 2019 Jan 08 +*various.txt* For Vim version 8.1. Last change: 2019 Jan 17 VIM REFERENCE MANUAL by Bram Moolenaar @@ -440,7 +440,7 @@ N *+smartindent* |'smartindent'| N *+startuptime* |--startuptime| argument N *+statusline* Options 'statusline', 'rulerformat' and special formats of 'titlestring' and 'iconstring' -m *+sun_workshop* |workshop| +m *+sun_workshop* |workshop|; no longer supported N *+syntax* Syntax highlighting |syntax| *+system()* Unix only: opposite of |+fork| T *+tag_binary* binary searching in tags file |tag-binary-search| diff --git a/runtime/doc/version6.txt b/runtime/doc/version6.txt index a2e5474f4..126601430 100644 --- a/runtime/doc/version6.txt +++ b/runtime/doc/version6.txt @@ -1,4 +1,4 @@ -*version6.txt* For Vim version 8.1. Last change: 2018 Mar 18 +*version6.txt* For Vim version 8.1. Last change: 2019 Jan 17 VIM REFERENCE MANUAL by Bram Moolenaar @@ -943,7 +943,7 @@ Added the ":sign" command to define and place signs. They can be displayed with two ASCII characters or an icon. The line after it can be highlighted. Useful to display breakpoints and the current PC position. -Added the |:wsverb| command to execute debugger commands. +Added the :wsverb command to execute debugger commands. Added balloon stuff: 'balloondelay' and 'ballooneval' options. diff --git a/runtime/doc/visual.txt b/runtime/doc/visual.txt index c48c1b526..0b8ca99cd 100644 --- a/runtime/doc/visual.txt +++ b/runtime/doc/visual.txt @@ -1,4 +1,4 @@ -*visual.txt* For Vim version 8.1. Last change: 2017 Sep 02 +*visual.txt* For Vim version 8.1. Last change: 2019 Jan 11 VIM REFERENCE MANUAL by Bram Moolenaar @@ -305,8 +305,6 @@ mode. ============================================================================== 5. Blockwise operators *blockwise-operators* -{not available when compiled without the |+visualextra| feature} - Reminder: Use 'virtualedit' to be able to select blocks that start or end after the end of a line or halfway a tab. diff --git a/runtime/ftplugin/bash.vim b/runtime/ftplugin/bash.vim new file mode 100644 index 000000000..a3d01fc2a --- /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 32f3fb868..3c18bada7 100644 --- a/runtime/ftplugin/eruby.vim +++ b/runtime/ftplugin/eruby.vim @@ -3,6 +3,7 @@ " Maintainer: Tim Pope <vimNOSPAM@tpope.org> " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns <dougkearns@gmail.com> +" 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('<Plug><cfile>', '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 =~# '\\<v:fname\\>' && len(expand('<cfile>')) ? eval(substitute(&l:inex, '\\<v:fname\\>', '\\=string(expand(\"<cfile>\"))', 'g')) : '', '^$', \"\\022\\006\",'')" +endif +let s:ctagmap = v:version >= 704 ? maparg('<Plug><ctag>', '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 <buffer><script><expr> <Plug><cfile> ErubyAtCursor() ? ' . maparg('<Plug><cfile>', 'c') . ' : ' . s:cfilemap.rhs +exe 'cmap <buffer><script><expr> <Plug><ctag> ErubyAtCursor() ? ' . maparg('<Plug><ctag>', 'c') . ' : ' . get(s:ctagmap, 'rhs', '"\022\027"') +unlet s:cfilemap s:ctagmap s:include s:path s:suffixesadd + " Change the browse dialog on Win32 to show mainly eRuby-related files if has("gui_win32") let b:browsefilter="eRuby Files (*.erb, *.rhtml)\t*.erb;*.rhtml\n" . s:browsefilter @@ -99,4 +124,9 @@ let b:undo_ftplugin = "setl cms< " let &cpo = s:save_cpo unlet s:save_cpo +function! ErubyAtCursor() abort + let groups = map(['erubyBlock', 'erubyComment', 'erubyExpression', 'erubyOneLiner'], 'hlID(v:val)') + return !empty(filter(synstack(line('.'), col('.')), 'index(groups, v:val) >= 0')) +endfunction + " vim: nowrap sw=2 sts=2 ts=8: diff --git a/runtime/ftplugin/ruby.vim b/runtime/ftplugin/ruby.vim index 84fb9930a..054c35e5f 100644 --- a/runtime/ftplugin/ruby.vim +++ b/runtime/ftplugin/ruby.vim @@ -2,8 +2,8 @@ " Language: Ruby " Maintainer: Tim Pope <vimNOSPAM@tpope.org> " URL: https://github.com/vim-ruby/vim-ruby -" Release Coordinator: Doug Kearns <dougkearns@gmail.com> -" ---------------------------------------------------------------------------- +" Release Coordinator: Doug Kearns <dougkearns@gmail.com> +" Last Change: 2019 Jan 06 if (exists("b:did_ftplugin")) finish @@ -44,19 +44,12 @@ endif setlocal formatoptions-=t formatoptions+=croql setlocal include=^\\s*\\<\\(load\\>\\\|require\\>\\\|autoload\\s*:\\=[\"']\\=\\h\\w*[\"']\\=,\\) -setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'\%(\.rb\)\=$','.rb','') setlocal suffixesadd=.rb if exists("&ofu") && has("ruby") setlocal omnifunc=rubycomplete#Complete endif -" To activate, :set ballooneval -if has('balloon_eval') && exists('+balloonexpr') - setlocal balloonexpr=RubyBalloonexpr() -endif - - " TODO: "setlocal define=^\\s*def @@ -69,7 +62,7 @@ endif function! s:query_path(root) abort let code = "print $:.join %q{,}" - if &shell =~# 'sh' + if &shell =~# 'sh' && empty(&shellxquote) let prefix = 'env PATH='.shellescape($PATH).' ' else let prefix = '' @@ -141,44 +134,54 @@ if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") \ "All Files (*.*)\t*.*\n" endif -let b:undo_ftplugin = "setl fo< inc< inex< sua< def< com< cms< path< tags< kp<" +let b:undo_ftplugin = "setl inc= sua= path= tags= fo< com< cms< 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 get(g:, 'ruby_recommended_style', 1) + setlocal shiftwidth=2 softtabstop=2 expandtab + let b:undo_ftplugin .= ' | setl sw< sts< et<' +endif + +" To activate, :set ballooneval +if exists('+balloonexpr') && get(g:, 'ruby_balloonexpr') + setlocal balloonexpr=RubyBalloonexpr() + let b:undo_ftplugin .= "| setl bexpr=" +endif function! s:map(mode, flags, map) abort let from = matchstr(a:map, '\S\+') if empty(mapcheck(from, a:mode)) - exe a:mode.'map' '<buffer>'.(a:0 ? a:1 : '') a:map + exe a:mode.'map' '<buffer>' a:map let b:undo_ftplugin .= '|sil! '.a:mode.'unmap <buffer> '.from endif endfunction -cmap <buffer><script><expr> <Plug><cword> substitute(RubyCursorIdentifier(),'^$',"\022\027",'') +cmap <buffer><script><expr> <Plug><ctag> substitute(RubyCursorTag(),'^$',"\022\027",'') cmap <buffer><script><expr> <Plug><cfile> substitute(RubyCursorFile(),'^$',"\022\006",'') -let b:undo_ftplugin .= "| sil! cunmap <buffer> <Plug><cword>| sil! cunmap <buffer> <Plug><cfile>" +let b:undo_ftplugin .= "| sil! cunmap <buffer> <Plug><ctag>| sil! cunmap <buffer> <Plug><cfile>" if !exists("g:no_plugin_maps") && !exists("g:no_ruby_maps") nmap <buffer><script> <SID>: :<C-U> nmap <buffer><script> <SID>c: :<C-U><C-R>=v:count ? v:count : ''<CR> - 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> - nnoremap <silent> <buffer> ]M :<C-U>call <SID>searchsyn('\<end\>','rubyDefine','','n')<CR> - xnoremap <silent> <buffer> [m :<C-U>call <SID>searchsyn('\<def\>','rubyDefine','b','v')<CR> - xnoremap <silent> <buffer> ]m :<C-U>call <SID>searchsyn('\<def\>','rubyDefine','','v')<CR> - xnoremap <silent> <buffer> [M :<C-U>call <SID>searchsyn('\<end\>','rubyDefine','b','v')<CR> - xnoremap <silent> <buffer> ]M :<C-U>call <SID>searchsyn('\<end\>','rubyDefine','','v')<CR> - - nnoremap <silent> <buffer> [[ :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>','rubyModule\<Bar>rubyClass','b','n')<CR> - nnoremap <silent> <buffer> ]] :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>','rubyModule\<Bar>rubyClass','','n')<CR> - nnoremap <silent> <buffer> [] :<C-U>call <SID>searchsyn('\<end\>','rubyModule\<Bar>rubyClass','b','n')<CR> - nnoremap <silent> <buffer> ][ :<C-U>call <SID>searchsyn('\<end\>','rubyModule\<Bar>rubyClass','','n')<CR> - xnoremap <silent> <buffer> [[ :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>','rubyModule\<Bar>rubyClass','b','v')<CR> - xnoremap <silent> <buffer> ]] :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>','rubyModule\<Bar>rubyClass','','v')<CR> - xnoremap <silent> <buffer> [] :<C-U>call <SID>searchsyn('\<end\>','rubyModule\<Bar>rubyClass','b','v')<CR> - xnoremap <silent> <buffer> ][ :<C-U>call <SID>searchsyn('\<end\>','rubyModule\<Bar>rubyClass','','v')<CR> + 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> + nnoremap <silent> <buffer> ]M :<C-U>call <SID>searchsyn('\<end\>',['rubyDefine'],'','n')<CR> + xnoremap <silent> <buffer> [m :<C-U>call <SID>searchsyn('\<def\>',['rubyDefine'],'b','v')<CR> + xnoremap <silent> <buffer> ]m :<C-U>call <SID>searchsyn('\<def\>',['rubyDefine'],'','v')<CR> + xnoremap <silent> <buffer> [M :<C-U>call <SID>searchsyn('\<end\>',['rubyDefine'],'b','v')<CR> + xnoremap <silent> <buffer> ]M :<C-U>call <SID>searchsyn('\<end\>',['rubyDefine'],'','v')<CR> + + nnoremap <silent> <buffer> [[ :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>',['rubyModule','rubyClass'],'b','n')<CR> + nnoremap <silent> <buffer> ]] :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>',['rubyModule','rubyClass'],'','n')<CR> + nnoremap <silent> <buffer> [] :<C-U>call <SID>searchsyn('\<end\>',['rubyModule','rubyClass'],'b','n')<CR> + nnoremap <silent> <buffer> ][ :<C-U>call <SID>searchsyn('\<end\>',['rubyModule','rubyClass'],'','n')<CR> + xnoremap <silent> <buffer> [[ :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>',['rubyModule','rubyClass'],'b','v')<CR> + xnoremap <silent> <buffer> ]] :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>',['rubyModule','rubyClass'],'','v')<CR> + xnoremap <silent> <buffer> [] :<C-U>call <SID>searchsyn('\<end\>',['rubyModule','rubyClass'],'b','v')<CR> + xnoremap <silent> <buffer> ][ :<C-U>call <SID>searchsyn('\<end\>',['rubyModule','rubyClass'],'','v')<CR> let b:undo_ftplugin = b:undo_ftplugin \."| sil! exe 'unmap <buffer> [[' | sil! exe 'unmap <buffer> ]]' | sil! exe 'unmap <buffer> []' | sil! exe 'unmap <buffer> ]['" @@ -204,19 +207,18 @@ if !exists("g:no_plugin_maps") && !exists("g:no_ruby_maps") \."| sil! exe 'xunmap <buffer> iM' | sil! exe 'xunmap <buffer> aM'" endif - call s:map('c', '', '<C-R><C-W> <Plug><cword>') call s:map('c', '', '<C-R><C-F> <Plug><cfile>') cmap <buffer><script><expr> <SID>tagzv &foldopen =~# 'tag' ? '<Bar>norm! zv' : '' - call s:map('n', '<silent>', '<C-]> <SID>:exe v:count1."tag <Plug><cword>"<SID>tagzv<CR>') - call s:map('n', '<silent>', 'g<C-]> <SID>:exe "tjump <Plug><cword>"<SID>tagzv<CR>') - call s:map('n', '<silent>', 'g] <SID>:exe "tselect <Plug><cword>"<SID>tagzv<CR>') - call s:map('n', '<silent>', '<C-W>] <SID>:exe v:count1."stag <Plug><cword>"<SID>tagzv<CR>') - call s:map('n', '<silent>', '<C-W><C-]> <SID>:exe v:count1."stag <Plug><cword>"<SID>tagzv<CR>') - call s:map('n', '<silent>', '<C-W>g<C-]> <SID>:exe "stjump <Plug><cword>"<SID>tagzv<CR>') - call s:map('n', '<silent>', '<C-W>g] <SID>:exe "stselect <Plug><cword>"<SID>tagzv<CR>') - call s:map('n', '<silent>', '<C-W>} <SID>:exe v:count1."ptag <Plug><cword>"<CR>') - call s:map('n', '<silent>', '<C-W>g} <SID>:exe "ptjump <Plug><cword>"<CR>') + call s:map('n', '<silent>', '<C-]> <SID>:exe v:count1."tag <Plug><ctag>"<SID>tagzv<CR>') + call s:map('n', '<silent>', 'g<C-]> <SID>:exe "tjump <Plug><ctag>"<SID>tagzv<CR>') + call s:map('n', '<silent>', 'g] <SID>:exe "tselect <Plug><ctag>"<SID>tagzv<CR>') + call s:map('n', '<silent>', '<C-W>] <SID>:exe v:count1."stag <Plug><ctag>"<SID>tagzv<CR>') + call s:map('n', '<silent>', '<C-W><C-]> <SID>:exe v:count1."stag <Plug><ctag>"<SID>tagzv<CR>') + call s:map('n', '<silent>', '<C-W>g<C-]> <SID>:exe "stjump <Plug><ctag>"<SID>tagzv<CR>') + call s:map('n', '<silent>', '<C-W>g] <SID>:exe "stselect <Plug><ctag>"<SID>tagzv<CR>') + call s:map('n', '<silent>', '<C-W>} <SID>:exe v:count1."ptag <Plug><ctag>"<CR>') + call s:map('n', '<silent>', '<C-W>g} <SID>:exe "ptjump <Plug><ctag>"<CR>') call s:map('n', '<silent>', 'gf <SID>c:find <Plug><cfile><CR>') call s:map('n', '<silent>', '<C-W>f <SID>c:sfind <Plug><cfile><CR>') @@ -288,12 +290,13 @@ function! s:searchsyn(pattern, syn, flags, mode) abort norm! gv endif let i = 0 + call map(a:syn, 'hlID(v:val)') 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 + while pos != 0 && index(a:syn, s:synid()) < 0 let pos = search(a:pattern,'W'.a:flags) endwhile if pos == 0 @@ -303,8 +306,8 @@ function! s:searchsyn(pattern, syn, flags, mode) abort endwhile endfunction -function! s:synname() abort - return synIDattr(synID(line('.'),col('.'),0),'name') +function! s:synid() abort + return synID(line('.'),col('.'),0) endfunction function! s:wrap_i(back,forward) abort @@ -349,6 +352,10 @@ function! RubyCursorIdentifier() abort return stripped == '' ? expand("<cword>") : stripped endfunction +function! RubyCursorTag() abort + return substitute(RubyCursorIdentifier(), '^[$@]*', '', '') +endfunction + function! RubyCursorFile() abort let isfname = &isfname try @@ -360,8 +367,9 @@ function! RubyCursorFile() abort let pre = matchstr(strpart(getline('.'), 0, col('.')-1), '.*\f\@<!') let post = matchstr(strpart(getline('.'), col('.')), '\f\@!.*') let ext = getline('.') =~# '^\s*\%(require\%(_relative\)\=\|autoload\)\>' && cfile !~# '\.rb$' ? '.rb' : '' - if s:synname() ==# 'rubyConstant' + if s:synid() ==# hlID('rubyConstant') let cfile = substitute(cfile,'\.\w\+[?!=]\=$','','') + let cfile = substitute(cfile,'^::','','') let cfile = substitute(cfile,'::','/','g') let cfile = substitute(cfile,'\(\u\+\)\(\u\l\)','\1_\2', 'g') let cfile = substitute(cfile,'\(\l\|\d\)\(\u\)','\1_\2', 'g') diff --git a/runtime/ftplugin/text.vim b/runtime/ftplugin/text.vim index ec84ac6f7..c4cbcb54c 100644 --- a/runtime/ftplugin/text.vim +++ b/runtime/ftplugin/text.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Text " Maintainer: David Barnett <daviebdawg+vim@gmail.com> -" Last Change: 2014 Jul 09 +" Last Change: 2019 Jan 10 if exists('b:did_ftplugin') finish @@ -12,6 +12,7 @@ let b:undo_ftplugin = 'setlocal comments< commentstring<' " We intentionally don't set formatoptions-=t since text should wrap as text. -" Pseudo comment leaders to indent bulleted lists. -setlocal comments=fb:-,fb:* +" Pseudo comment leaders to indent bulleted lists with '-' and '*'. And allow +" for Mail quoted text with '>'. +setlocal comments=fb:-,fb:*,n:> setlocal commentstring= diff --git a/runtime/indent/eruby.vim b/runtime/indent/eruby.vim index 505832549..6ff15ab95 100644 --- a/runtime/indent/eruby.vim +++ b/runtime/indent/eruby.vim @@ -3,6 +3,7 @@ " Maintainer: Tim Pope <vimNOSPAM@tpope.org> " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns <dougkearns@gmail.com> +" Last Change: 2019 Jan 06 if exists("b:did_indent") finish @@ -12,7 +13,7 @@ runtime! indent/ruby.vim unlet! b:did_indent setlocal indentexpr= -if exists("b:eruby_subtype") +if exists("b:eruby_subtype") && b:eruby_subtype != '' && b:eruby_subtype !=# 'eruby' exe "runtime! indent/".b:eruby_subtype.".vim" else runtime! indent/html.vim @@ -47,7 +48,11 @@ set cpo&vim function! GetErubyIndent(...) " The value of a single shift-width - let sw = shiftwidth() + if exists('*shiftwidth') + let sw = shiftwidth() + else + let sw = &sw + endif if a:0 && a:1 == '.' let v:lnum = line('.') @@ -91,6 +96,7 @@ function! GetErubyIndent(...) let ind = ind + sw endif if line !~# '^\s*<%' && line =~# '%>\s*$' && line !~# '^\s*end\>' + \ && synID(v:lnum, match(cline, '\S') + 1, 1) != hlID('htmlEndTag') let ind = ind - sw endif if cline =~# '^\s*[-=]\=%>\s*$' diff --git a/runtime/indent/ruby.vim b/runtime/indent/ruby.vim index d8733db30..5c420d754 100644 --- a/runtime/indent/ruby.vim +++ b/runtime/indent/ruby.vim @@ -1,8 +1,10 @@ " Vim indent file " Language: Ruby -" Maintainer: Nikolai Weibull <now at bitwi.se> +" Maintainer: Andrew Radev <andrey.radev@gmail.com> +" Previous Maintainer: Nikolai Weibull <now at bitwi.se> " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns <dougkearns@gmail.com> +" Last Change: 2019 Jan 06 " 0. Initialization {{{1 " ================= @@ -18,6 +20,11 @@ if !exists('g:ruby_indent_access_modifier_style') let g:ruby_indent_access_modifier_style = 'normal' endif +if !exists('g:ruby_indent_assignment_style') + " Possible values: "variable", "hanging" + let g:ruby_indent_assignment_style = 'hanging' +endif + if !exists('g:ruby_indent_block_style') " Possible values: "expression", "do" let g:ruby_indent_block_style = 'expression' @@ -42,28 +49,27 @@ set cpo&vim " 1. Variables {{{1 " ============ -" 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\|InterpolationDelimiter\|NoInterpolation\|Comment\|Documentation\)\>' - -" Regex of syntax group names that are strings. +" Syntax group names that are strings. let s:syng_string = - \ '\<ruby\%(String\|Interpolation\|NoInterpolation\|StringEscape\)\>' + \ ['String', 'Interpolation', 'InterpolationDelimiter', 'NoInterpolation', 'StringEscape'] + +" Syntax group names that are strings or documentation. +let s:syng_stringdoc = s:syng_string + ['Documentation'] -" Regex of syntax group names that are strings or documentation. -let s:syng_stringdoc = - \'\<ruby\%(String\|Interpolation\|NoInterpolation\|StringEscape\|Documentation\)\>' +" Syntax group names that are or delimit strings/symbols/regexes or are comments. +let s:syng_strcom = s:syng_stringdoc + + \ ['Regexp', 'RegexpDelimiter', 'RegexpEscape', + \ 'Symbol', 'StringDelimiter', 'ASCIICode', 'Comment'] " Expression used to check whether we should skip a match with searchpair(). let s:skip_expr = - \ "synIDattr(synID(line('.'),col('.'),1),'name') =~ '".s:syng_strcom."'" + \ 'index(map('.string(s:syng_strcom).',"hlID(''ruby''.v:val)"), synID(line("."),col("."),1)) >= 0' " 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\|if\|for' . \ '\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure\|rescue' . - \ '\|\%(public\|protected\|private\)\=\s*def\):\@!\>' . + \ '\|\%(\K\k*[!?]\?\)\=\s*def\):\@!\>' . \ '\|\%([=,*/%+-]\|<<\|>>\|:\s\)\s*\zs' . \ '\<\%(if\|for\|while\|until\|case\|unless\|begin\):\@!\>' @@ -77,7 +83,7 @@ let s:ruby_deindent_keywords = let s:end_start_regex = \ '\C\%(^\s*\|[=,*/%+\-|;{]\|<<\|>>\|:\s\)\s*\zs' . \ '\<\%(module\|class\|if\|for\|while\|until\|case\|unless\|begin' . - \ '\|\%(public\|protected\|private\)\=\s*def\):\@!\>' . + \ '\|\%(\K\k*[!?]\?\)\=\s*def\):\@!\>' . \ '\|\%(^\|[^.:@$]\)\@<=\<do:\@!\>' " Regex that defines the middle-match for the 'end' keyword. @@ -142,31 +148,562 @@ let s:block_continuation_regex = '^\s*[^])}\t ].*'.s:block_regex " Regex that describes a leading operator (only a method call's dot for now) let s:leading_operator_regex = '^\s*[.]' -" 2. Auxiliary Functions {{{1 +" 2. GetRubyIndent Function {{{1 +" ========================= + +function! GetRubyIndent(...) abort + " 2.1. Setup {{{2 + " ---------- + + let indent_info = {} + + " The value of a single shift-width + if exists('*shiftwidth') + let indent_info.sw = shiftwidth() + else + let indent_info.sw = &sw + endif + + " For the current line, use the first argument if given, else v:lnum + let indent_info.clnum = a:0 ? a:1 : v:lnum + let indent_info.cline = getline(indent_info.clnum) + + " Set up variables for restoring position in file. Could use clnum here. + let indent_info.col = col('.') + + " 2.2. Work on the current line {{{2 + " ----------------------------- + let indent_callback_names = [ + \ 's:AccessModifier', + \ 's:ClosingBracketOnEmptyLine', + \ 's:BlockComment', + \ 's:DeindentingKeyword', + \ 's:MultilineStringOrLineComment', + \ 's:ClosingHeredocDelimiter', + \ 's:LeadingOperator', + \ ] + + for callback_name in indent_callback_names +" Decho "Running: ".callback_name + let indent = call(function(callback_name), [indent_info]) + + if indent >= 0 +" Decho "Match: ".callback_name." indent=".indent." info=".string(indent_info) + return indent + endif + endfor + + " 2.3. Work on the previous line. {{{2 + " ------------------------------- + + " Special case: we don't need the real s:PrevNonBlankNonString for an empty + " line inside a string. And that call can be quite expensive in that + " particular situation. + let indent_callback_names = [ + \ 's:EmptyInsideString', + \ ] + + for callback_name in indent_callback_names +" Decho "Running: ".callback_name + let indent = call(function(callback_name), [indent_info]) + + if indent >= 0 +" Decho "Match: ".callback_name." indent=".indent." info=".string(indent_info) + return indent + endif + endfor + + " Previous line number + let indent_info.plnum = s:PrevNonBlankNonString(indent_info.clnum - 1) + let indent_info.pline = getline(indent_info.plnum) + + let indent_callback_names = [ + \ 's:StartOfFile', + \ 's:AfterAccessModifier', + \ 's:ContinuedLine', + \ 's:AfterBlockOpening', + \ 's:AfterHangingSplat', + \ 's:AfterUnbalancedBracket', + \ 's:AfterLeadingOperator', + \ 's:AfterEndKeyword', + \ 's:AfterIndentKeyword', + \ ] + + for callback_name in indent_callback_names +" Decho "Running: ".callback_name + let indent = call(function(callback_name), [indent_info]) + + if indent >= 0 +" Decho "Match: ".callback_name." indent=".indent." info=".string(indent_info) + return indent + endif + endfor + + " 2.4. Work on the MSL line. {{{2 + " -------------------------- + let indent_callback_names = [ + \ 's:PreviousNotMSL', + \ 's:IndentingKeywordInMSL', + \ 's:ContinuedHangingOperator', + \ ] + + " Most Significant line based on the previous one -- in case it's a + " contination of something above + let indent_info.plnum_msl = s:GetMSL(indent_info.plnum) + + for callback_name in indent_callback_names +" Decho "Running: ".callback_name + let indent = call(function(callback_name), [indent_info]) + + if indent >= 0 +" Decho "Match: ".callback_name." indent=".indent." info=".string(indent_info) + return indent + endif + endfor + + " }}}2 + + " By default, just return the previous line's indent +" Decho "Default case matched" + return indent(indent_info.plnum) +endfunction + +" 3. Indenting Logic Callbacks {{{1 +" ============================ + +function! s:AccessModifier(cline_info) abort + let info = a:cline_info + + " If this line is an access modifier keyword, align according to the closest + " class declaration. + if g:ruby_indent_access_modifier_style == 'indent' + if s:Match(info.clnum, s:access_modifier_regex) + let class_lnum = s:FindContainingClass() + if class_lnum > 0 + return indent(class_lnum) + info.sw + endif + endif + elseif g:ruby_indent_access_modifier_style == 'outdent' + if s:Match(info.clnum, s:access_modifier_regex) + let class_lnum = s:FindContainingClass() + if class_lnum > 0 + return indent(class_lnum) + endif + endif + endif + + return -1 +endfunction + +function! s:ClosingBracketOnEmptyLine(cline_info) abort + let info = a:cline_info + + " 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(info.cline, '^\s*[]})]') + + if col > 0 && !s:IsInStringOrComment(info.clnum, col) + call cursor(info.clnum, col) + let closing_bracket = info.cline[col - 1] + let bracket_pair = strpart('(){}[]', stridx(')}]', closing_bracket) * 2, 2) + + if searchpair(escape(bracket_pair[0], '\['), '', bracket_pair[1], 'bW', s:skip_expr) > 0 + if closing_bracket == ')' && col('.') != col('$') - 1 + let ind = virtcol('.') - 1 + elseif g:ruby_indent_block_style == 'do' + let ind = indent(line('.')) + else " g:ruby_indent_block_style == 'expression' + let ind = indent(s:GetMSL(line('.'))) + endif + endif + + return ind + endif + + return -1 +endfunction + +function! s:BlockComment(cline_info) abort + " If we have a =begin or =end set indent to first column. + if match(a:cline_info.cline, '^\s*\%(=begin\|=end\)$') != -1 + return 0 + endif + return -1 +endfunction + +function! s:DeindentingKeyword(cline_info) abort + let info = a:cline_info + + " If we have a deindenting keyword, find its match and indent to its level. + " TODO: this is messy + if s:Match(info.clnum, s:ruby_deindent_keywords) + call cursor(info.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 s:IsAssignment(line, col('.')) && + \ strpart(line, col('.') - 1, 2) !~ 'do' + " assignment to case/begin/etc, on the same line + if g:ruby_indent_assignment_style == 'hanging' + " hanging indent + let ind = virtcol('.') - 1 + else + " align with variable + let ind = indent(line('.')) + endif + elseif g:ruby_indent_block_style == 'do' + " align to line of the "do", not to the MSL + let ind = indent(line('.')) + elseif getline(msl) =~ '=\s*\(#.*\)\=$' + " in the case of assignment to the MSL, align to the starting line, + " not to the MSL + let ind = indent(line('.')) + else + " align to the MSL + let ind = indent(msl) + endif + endif + return ind + endif + + return -1 +endfunction + +function! s:MultilineStringOrLineComment(cline_info) abort + let info = a:cline_info + + " If we are in a multi-line string or line-comment, don't do anything to it. + if s:IsInStringOrDocumentation(info.clnum, matchend(info.cline, '^\s*') + 1) + return indent(info.clnum) + endif + return -1 +endfunction + +function! s:ClosingHeredocDelimiter(cline_info) abort + let info = a:cline_info + + " If we are at the closing delimiter of a "<<" heredoc-style string, set the + " indent to 0. + if info.cline =~ '^\k\+\s*$' + \ && s:IsInStringDelimiter(info.clnum, 1) + \ && search('\V<<'.info.cline, 'nbW') > 0 + return 0 + endif + + return -1 +endfunction + +function! s:LeadingOperator(cline_info) abort + " If the current line starts with a leading operator, add a level of indent. + if s:Match(a:cline_info.clnum, s:leading_operator_regex) + return indent(s:GetMSL(a:cline_info.clnum)) + a:cline_info.sw + endif + return -1 +endfunction + +function! s:EmptyInsideString(pline_info) abort + " If the line is empty and inside a string (the previous line is a string, + " too), use the previous line's indent + let info = a:pline_info + + let plnum = prevnonblank(info.clnum - 1) + let pline = getline(plnum) + + if info.cline =~ '^\s*$' + \ && s:IsInStringOrComment(plnum, 1) + \ && s:IsInStringOrComment(plnum, strlen(pline)) + return indent(plnum) + endif + return -1 +endfunction + +function! s:StartOfFile(pline_info) abort + " At the start of the file use zero indent. + if a:pline_info.plnum == 0 + return 0 + endif + return -1 +endfunction + +function! s:AfterAccessModifier(pline_info) abort + let info = a:pline_info + + if g:ruby_indent_access_modifier_style == 'indent' + " If the previous line was a private/protected keyword, add a + " level of indent. + if s:Match(info.plnum, s:indent_access_modifier_regex) + return indent(info.plnum) + info.sw + endif + elseif g:ruby_indent_access_modifier_style == 'outdent' + " If the previous line was a private/protected/public keyword, add + " a level of indent, since the keyword has been out-dented. + if s:Match(info.plnum, s:access_modifier_regex) + return indent(info.plnum) + info.sw + endif + endif + return -1 +endfunction + +" Example: +" +" if foo || bar || +" baz || bing +" puts "foo" +" end +" +function! s:ContinuedLine(pline_info) abort + let info = a:pline_info + + let col = s:Match(info.plnum, s:ruby_indent_keywords) + if s:Match(info.plnum, s:continuable_regex) && + \ s:Match(info.plnum, s:continuation_regex) + if col > 0 && s:IsAssignment(info.pline, col) + if g:ruby_indent_assignment_style == 'hanging' + " hanging indent + let ind = col - 1 + else + " align with variable + let ind = indent(info.plnum) + endif + else + let ind = indent(s:GetMSL(info.plnum)) + endif + return ind + info.sw + info.sw + endif + return -1 +endfunction + +function! s:AfterBlockOpening(pline_info) abort + let info = a:pline_info + + " If the previous line ended with a block opening, add a level of indent. + if s:Match(info.plnum, s:block_regex) + if g:ruby_indent_block_style == 'do' + " don't align to the msl, align to the "do" + let ind = indent(info.plnum) + info.sw + else + let plnum_msl = s:GetMSL(info.plnum) + + if getline(plnum_msl) =~ '=\s*\(#.*\)\=$' + " in the case of assignment to the msl, align to the starting line, + " not to the msl + let ind = indent(info.plnum) + info.sw + else + let ind = indent(plnum_msl) + info.sw + endif + endif + + return ind + endif + + return -1 +endfunction + +function! s:AfterLeadingOperator(pline_info) abort + " If the previous line started with a leading operator, use its MSL's level + " of indent + if s:Match(a:pline_info.plnum, s:leading_operator_regex) + return indent(s:GetMSL(a:pline_info.plnum)) + endif + return -1 +endfunction + +function! s:AfterHangingSplat(pline_info) abort + let info = a:pline_info + + " If the previous line ended with the "*" of a splat, add a level of indent + if info.pline =~ s:splat_regex + return indent(info.plnum) + info.sw + endif + return -1 +endfunction + +function! s:AfterUnbalancedBracket(pline_info) abort + let info = a:pline_info + + " 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 info.pline =~ '[[({]' || info.pline =~ '[])}]\s*\%(#.*\)\=$' + let [opening, closing] = s:ExtraBrackets(info.plnum) + + if opening.pos != -1 + if opening.type == '(' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0 + if col('.') + 1 == col('$') + return indent(info.plnum) + info.sw + else + return virtcol('.') + endif + else + let nonspace = matchend(info.pline, '\S', opening.pos + 1) - 1 + return nonspace > 0 ? nonspace : indent(info.plnum) + info.sw + endif + elseif closing.pos != -1 + call cursor(info.plnum, closing.pos + 1) + normal! % + + if s:Match(line('.'), s:ruby_indent_keywords) + return indent('.') + info.sw + else + return indent(s:GetMSL(line('.'))) + endif + else + call cursor(info.clnum, info.col) + end + endif + + return -1 +endfunction + +function! s:AfterEndKeyword(pline_info) abort + let info = a:pline_info + " If the previous line ended with an "end", match that "end"s beginning's + " indent. + let col = s:Match(info.plnum, '\%(^\|[^.:@$]\)\<end\>\s*\%(#.*\)\=$') + if col > 0 + call cursor(info.plnum, 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 + return -1 +endfunction + +function! s:AfterIndentKeyword(pline_info) abort + let info = a:pline_info + let col = s:Match(info.plnum, s:ruby_indent_keywords) + + if col > 0 + call cursor(info.plnum, col) + let ind = virtcol('.') - 1 + info.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(info.plnum, s:end_end_regex) + let ind = indent('.') + elseif s:IsAssignment(info.pline, col) + if g:ruby_indent_assignment_style == 'hanging' + " hanging indent + let ind = col + info.sw - 1 + else + " align with variable + let ind = indent(info.plnum) + info.sw + endif + endif + return ind + endif + + return -1 +endfunction + +function! s:PreviousNotMSL(msl_info) abort + let info = a:msl_info + + " If the previous line wasn't a MSL + if info.plnum != info.plnum_msl + " If previous line ends bracket and begins non-bracket continuation decrease indent by 1. + if s:Match(info.plnum, s:bracket_switch_continuation_regex) + " TODO (2016-10-07) Wrong/unused? How could it be "1"? + return indent(info.plnum) - 1 + " If previous line is a continuation return its indent. + " TODO: the || s:IsInString() thing worries me a bit. + elseif s:Match(info.plnum, s:non_bracket_continuation_regex) || s:IsInString(info.plnum, strlen(line)) + return indent(info.plnum) + endif + endif + + return -1 +endfunction + +function! s:IndentingKeywordInMSL(msl_info) abort + let info = a:msl_info + " 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 + let col = s:Match(info.plnum_msl, s:ruby_indent_keywords) + if col > 0 + let ind = indent(info.plnum_msl) + info.sw + if s:Match(info.plnum_msl, s:end_end_regex) + let ind = ind - info.sw + elseif s:IsAssignment(getline(info.plnum_msl), col) + if g:ruby_indent_assignment_style == 'hanging' + " hanging indent + let ind = col + info.sw - 1 + else + " align with variable + let ind = indent(info.plnum_msl) + info.sw + endif + endif + return ind + endif + return -1 +endfunction + +function! s:ContinuedHangingOperator(msl_info) abort + let info = a:msl_info + + " If the previous line ended with [*+/.,-=], but wasn't a block ending or a + " closing bracket, indent one extra level. + if s:Match(info.plnum_msl, s:non_bracket_continuation_regex) && !s:Match(info.plnum_msl, '^\s*\([\])}]\|end\)') + if info.plnum_msl == info.plnum + let ind = indent(info.plnum_msl) + info.sw + else + let ind = indent(info.plnum_msl) + endif + return ind + endif + + return -1 +endfunction + +" 4. Auxiliary Functions {{{1 " ====================== +function! s:IsInRubyGroup(groups, lnum, col) abort + let ids = map(copy(a:groups), 'hlID("ruby".v:val)') + return index(ids, synID(a:lnum, a:col, 1)) >= 0 +endfunction + " 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 +function! s:IsInStringOrComment(lnum, col) abort + return s:IsInRubyGroup(s:syng_strcom, a:lnum, a:col) endfunction " 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 +function! s:IsInString(lnum, col) abort + return s:IsInRubyGroup(s:syng_string, a:lnum, a:col) endfunction " Check if the character at lnum:col is inside a string or documentation. -function s:IsInStringOrDocumentation(lnum, col) - return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_stringdoc +function! s:IsInStringOrDocumentation(lnum, col) abort + return s:IsInRubyGroup(s:syng_stringdoc, a:lnum, a:col) 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' +function! s:IsInStringDelimiter(lnum, col) abort + return s:IsInRubyGroup(['StringDelimiter'], a:lnum, a:col) +endfunction + +function! s:IsAssignment(str, pos) abort + return strpart(a:str, 0, a:pos - 1) =~ '=\s*$' endfunction " Find line above 'lnum' that isn't empty, in a comment, or in a string. -function s:PrevNonBlankNonString(lnum) +function! s:PrevNonBlankNonString(lnum) abort let in_block = 0 let lnum = prevnonblank(a:lnum) while lnum > 0 @@ -191,10 +728,9 @@ function s:PrevNonBlankNonString(lnum) endfunction " Find line above 'lnum' that started the continuation 'lnum' may be part of. -function s:GetMSL(lnum) +function! s:GetMSL(lnum) abort " 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. @@ -291,14 +827,13 @@ function s:GetMSL(lnum) 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) +function! s:ExtraBrackets(lnum) abort let opening = {'parentheses': [], 'braces': [], 'brackets': []} let closing = {'parentheses': [], 'braces': [], 'brackets': []} @@ -360,7 +895,7 @@ function s:ExtraBrackets(lnum) return [rightmost_opening, rightmost_closing] endfunction -function s:Match(lnum, regex) +function! s:Match(lnum, regex) abort let line = getline(a:lnum) let offset = match(line, '\C'.a:regex) let col = offset + 1 @@ -380,7 +915,7 @@ endfunction " Locates the containing class/module's definition line, ignoring nested classes " along the way. " -function! s:FindContainingClass() +function! s:FindContainingClass() abort let saved_position = getpos('.') while searchpair(s:end_start_regex, s:end_middle_regex, s:end_end_regex, 'bW', @@ -396,297 +931,6 @@ function! s:FindContainingClass() return 0 endfunction -" 3. GetRubyIndent Function {{{1 -" ========================= - -function GetRubyIndent(...) - " 3.1. Setup {{{2 - " ---------- - - " The value of a single shift-width - let sw = shiftwidth() - - " 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(clnum) - let ind = -1 - - " If this line is an access modifier keyword, align according to the closest - " class declaration. - if g:ruby_indent_access_modifier_style == 'indent' - if s:Match(clnum, s:access_modifier_regex) - let class_line = s:FindContainingClass() - if class_line > 0 - return indent(class_line) + sw - endif - endif - elseif g:ruby_indent_access_modifier_style == 'outdent' - if s:Match(clnum, s:access_modifier_regex) - let class_line = s:FindContainingClass() - if class_line > 0 - return indent(class_line) - endif - endif - endif - - " 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 - elseif g:ruby_indent_block_style == 'do' - let ind = indent(line('.')) - else " g:ruby_indent_block_style == 'expression' - let ind = indent(s:GetMSL(line('.'))) - endif - endif - return ind - endif - - " If we have a =begin or =end set indent to first column. - if match(line, '^\s*\%(=begin\|=end\)$') != -1 - return 0 - endif - - " If we have a deindenting keyword, find its match and indent to its level. - " TODO: this is messy - 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 msl = s:GetMSL(line('.')) - let line = getline(line('.')) - - if strpart(line, 0, col('.') - 1) =~ '=\s*$' && - \ strpart(line, col('.') - 1, 2) !~ 'do' - " assignment to case/begin/etc, on the same line, hanging indent - let ind = virtcol('.') - 1 - elseif g:ruby_indent_block_style == 'do' - " align to line of the "do", not to the MSL - let ind = indent(line('.')) - elseif getline(msl) =~ '=\s*\(#.*\)\=$' - " in the case of assignment to the MSL, align to the starting line, - " not to the MSL - let ind = indent(line('.')) - else - " align to the MSL - 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(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 - - " If the current line starts with a leading operator, add a level of indent. - if s:Match(clnum, s:leading_operator_regex) - return indent(s:GetMSL(clnum)) + sw - 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(clnum - 1) - - " 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 - - " At the start of the file use zero indent. - if lnum == 0 - return 0 - endif - - " Set up variables for the previous line. - let line = getline(lnum) - let ind = indent(lnum) - - if g:ruby_indent_access_modifier_style == 'indent' - " If the previous line was a private/protected keyword, add a - " level of indent. - if s:Match(lnum, s:indent_access_modifier_regex) - return indent(lnum) + sw - endif - elseif g:ruby_indent_access_modifier_style == 'outdent' - " If the previous line was a private/protected/public keyword, add - " a level of indent, since the keyword has been out-dented. - if s:Match(lnum, s:access_modifier_regex) - return indent(lnum) + sw - endif - endif - - if s:Match(lnum, s:continuable_regex) && s:Match(lnum, s:continuation_regex) - return indent(s:GetMSL(lnum)) + sw + sw - endif - - " If the previous line ended with a block opening, add a level of indent. - if s:Match(lnum, s:block_regex) - let msl = s:GetMSL(lnum) - - if g:ruby_indent_block_style == 'do' - " don't align to the msl, align to the "do" - let ind = indent(lnum) + sw - elseif getline(msl) =~ '=\s*\(#.*\)\=$' - " in the case of assignment to the msl, align to the starting line, - " not to the msl - let ind = indent(lnum) + sw - else - let ind = indent(msl) + sw - endif - return ind - endif - - " If the previous line started with a leading operator, use its MSL's level - " of indent - if s:Match(lnum, s:leading_operator_regex) - return indent(s:GetMSL(lnum)) - endif - - " 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 - 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(s:GetMSL(line('.'))) - endif - else - call cursor(clnum, vcol) - end - endif - - " 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:ruby_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 - - " 3.4. Work on the MSL line. {{{2 - " -------------------------- - - " 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. - if p_lnum != lnum - " If previous line ends bracket and begins non-bracket continuation decrease indent by 1. - if s:Match(p_lnum, s:bracket_switch_continuation_regex) - return ind - 1 - " If previous line is a continuation return its indent. - " TODO: the || s:IsInString() thing worries me a bit. - elseif s:Match(p_lnum, s:non_bracket_continuation_regex) || s:IsInString(p_lnum,strlen(line)) - return ind - endif - endif - - " 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:ruby_indent_keywords) - let ind = msl_ind + sw - if s:Match(lnum, s:end_end_regex) - let ind = ind - sw - endif - return ind - endif - - " 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 - - return ind -endfunction - " }}}1 let &cpo = s:cpo_save diff --git a/runtime/syntax/eruby.vim b/runtime/syntax/eruby.vim index 4e175bcc2..6bb24fe56 100644 --- a/runtime/syntax/eruby.vim +++ b/runtime/syntax/eruby.vim @@ -3,8 +3,9 @@ " Maintainer: Tim Pope <vimNOSPAM@tpope.org> " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns <dougkearns@gmail.com> +" Last Change: 2018 Jul 04 -if exists("b:current_syntax") +if &syntax !~# '\<eruby\>' || get(b:, 'current_syntax') =~# '\<eruby\>' finish endif @@ -18,11 +19,13 @@ endif if &filetype =~ '^eruby\.' let b:eruby_subtype = matchstr(&filetype,'^eruby\.\zs\w\+') +elseif &filetype =~ '^.*\.eruby\>' + let b:eruby_subtype = matchstr(&filetype,'^.\{-\}\ze\.eruby\>') 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(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' @@ -41,16 +44,20 @@ elseif !exists("b:eruby_subtype") && main_syntax == 'eruby' endif if !exists("b:eruby_nest_level") - let b:eruby_nest_level = strlen(substitute(substitute(substitute(expand("%:t"),'@','','g'),'\c\.\%(erb\|rhtml\)\>','@','g'),'[^@]','','g')) + if &syntax =~# '\<eruby\.eruby\>' + let b:eruby_nest_level = strlen(substitute(substitute(&filetype,'\C\<eruby\>','@','g'),'[^@]','','g')) + else + let b:eruby_nest_level = strlen(substitute(substitute(substitute(expand("%:t"),'@','','g'),'\c\.\%(erb\|rhtml\)\>','@','g'),'[^@]','','g')) + endif endif if !b:eruby_nest_level let b:eruby_nest_level = 1 endif -if exists("b:eruby_subtype") && b:eruby_subtype != '' +if get(b:, 'eruby_subtype', '') !~# '^\%(eruby\)\=$' && &syntax =~# '^eruby\>' exe "runtime! syntax/".b:eruby_subtype.".vim" - unlet! b:current_syntax endif +unlet! b:current_syntax syn include @rubyTop syntax/ruby.vim syn cluster erubyRegions contains=erubyOneLiner,erubyBlock,erubyExpression,erubyComment @@ -65,7 +72,7 @@ exe 'syn region erubyComment matchgroup=erubyDelimiter start="<%\{1,'.b:erub hi def link erubyDelimiter PreProc hi def link erubyComment Comment -let b:current_syntax = 'eruby' +let b:current_syntax = matchstr(&syntax, '^.*\<eruby\>') if main_syntax == 'eruby' unlet main_syntax diff --git a/runtime/syntax/ruby.vim b/runtime/syntax/ruby.vim index ca7f51b1e..8b88378e6 100644 --- a/runtime/syntax/ruby.vim +++ b/runtime/syntax/ruby.vim @@ -3,6 +3,7 @@ " Maintainer: Doug Kearns <dougkearns@gmail.com> " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns <dougkearns@gmail.com> +" Last Change: 2018 Jul 09 " ---------------------------------------------------------------------------- " " Previous Maintainer: Mirko Nasato @@ -45,7 +46,7 @@ function! s:foldable(...) abort return 0 endfunction " }}} -syn cluster rubyNotTop contains=@rubyExtendedStringSpecial,@rubyRegexpSpecial,@rubyDeclaration,rubyConditional,rubyExceptional,rubyMethodExceptional,rubyTodo +syn cluster rubyNotTop contains=@rubyExtendedStringSpecial,@rubyRegexpSpecial,@rubyDeclaration,rubyConditional,rubyExceptional,rubyMethodExceptional,rubyTodo,rubyModuleName,rubyClassName,rubySymbolDelimiter " Whitespace Errors {{{1 if exists("ruby_space_errors") @@ -122,21 +123,24 @@ syn match rubyFloat "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)* syn match rubyLocalVariableOrMethod "\<[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent syn match rubyBlockArgument "&[_[:lower:]][_[:alnum:]]" contains=NONE display transparent +syn match rubyClassName "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)\@!" contained +syn match rubyModuleName "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)\@!" contained syn match rubyConstant "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)\@!" 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 "[]})\"':]\@1<!:\%(\^\|\~@\|\~\|<<\|<=>\|<=\|<\|===\|[=!]=\|[=!]\~\|!@\|!\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)" -syn match rubySymbol "[]})\"':]\@1<!:\$\%(-.\|[`~<=>_,;:!?/.'"@$*\&+0]\)" -syn match rubySymbol "[]})\"':]\@1<!:\%(\$\|@@\=\)\=\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" -syn match rubySymbol "[]})\"':]\@1<!:\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\%([?!=]>\@!\)\=" +syn match rubySymbolDelimiter ":" contained +syn match rubySymbol "[]})\"':]\@1<!:\%(\^\|\~@\|\~\|<<\|<=>\|<=\|<\|===\|[=!]=\|[=!]\~\|!@\|!\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)" contains=rubySymbolDelimiter +syn match rubySymbol "[]})\"':]\@1<!:\$\%(-.\|[`~<=>_,;:!?/.'"@$*\&+0]\)" contains=rubySymbolDelimiter +syn match rubySymbol "[]})\"':]\@1<!:\%(\$\|@@\=\)\=\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" contains=rubySymbolDelimiter +syn match rubySymbol "[]})\"':]\@1<!:\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\%([?!=]>\@!\)\=" contains=rubySymbolDelimiter if s:foldable(':') - syn region rubySymbol start="[]})\"':]\@1<!:'" end="'" skip="\\\\\|\\'" contains=rubyQuoteEscape fold - syn region rubySymbol start="[]})\"':]\@1<!:\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial fold + syn region rubySymbol matchgroup=rubySymbolDelimiter start="[]})\"':]\@1<!:'" end="'" skip="\\\\\|\\'" contains=rubyQuoteEscape fold + syn region rubySymbol matchgroup=rubySymbolDelimiter start="[]})\"':]\@1<!:\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial fold else - syn region rubySymbol start="[]})\"':]\@1<!:'" end="'" skip="\\\\\|\\'" contains=rubyQuoteEscape - syn region rubySymbol start="[]})\"':]\@1<!:\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial + syn region rubySymbol matchgroup=rubySymbolDelimiter start="[]})\"':]\@1<!:'" end="'" skip="\\\\\|\\'" contains=rubyQuoteEscape + syn region rubySymbol matchgroup=rubySymbolDelimiter start="[]})\"':]\@1<!:\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial endif syn match rubyCapitalizedMethod "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)*\s*(\@=" @@ -157,10 +161,10 @@ syn match rubyPredefinedConstant "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\%(RUBY_\%(VERSION " Normal Regular Expression {{{1 if s:foldable('/') 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 + syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/\%([ \t=]\|$\)\@!" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial fold else syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\|else\)\|[;\~=!|&(,{[<>?:*+-]\)\s*\)\@<=/" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial - syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/[ \t=]\@!" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial + syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/\%([ \t=]\|$\)\@!" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial endif " Generalized Regular Expression {{{1 @@ -275,10 +279,10 @@ else endif " Here Document {{{1 -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 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 if s:foldable('<<') 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 @@ -305,19 +309,19 @@ endif " eRuby Config {{{1 if exists('main_syntax') && main_syntax == 'eruby' let b:ruby_no_expensive = 1 -end +endif " Module, Class, Method and Alias Declarations {{{1 syn match rubyAliasDeclaration "[^[:space:];#.()]\+" contained contains=rubySymbol,rubyGlobalVariable,rubyPredefinedVariable nextgroup=rubyAliasDeclaration2 skipwhite syn match rubyAliasDeclaration2 "[^[:space:];#.()]\+" contained contains=rubySymbol,rubyGlobalVariable,rubyPredefinedVariable syn match rubyMethodDeclaration "[^[:space:];#(]\+" contained contains=rubyConstant,rubyBoolean,rubyPseudoVariable,rubyInstanceVariable,rubyClassVariable,rubyGlobalVariable -syn match rubyClassDeclaration "[^[:space:];#<]\+" contained contains=rubyConstant,rubyOperator -syn match rubyModuleDeclaration "[^[:space:];#<]\+" contained contains=rubyConstant,rubyOperator -syn match rubyFunction "\<[_[:alpha:]][_[:alnum:]]*[?!=]\=[[:alnum:]_.:?!=]\@!" contained containedin=rubyMethodDeclaration -syn match rubyFunction "\%(\s\|^\)\@1<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2 -syn match rubyFunction "\%([[:space:].]\|^\)\@2<=\%(\[\]=\=\|\*\*\|[-+!~]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|[=!]=\|[=!]\~\|!\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration +syn match rubyClassDeclaration "[^[:space:];#<]\+" contained contains=rubyClassName,rubyOperator +syn match rubyModuleDeclaration "[^[:space:];#<]\+" contained contains=rubyModuleName,rubyOperator +syn match rubyMethodName "\<[_[:alpha:]][_[:alnum:]]*[?!=]\=[[:alnum:]_.:?!=]\@!" contained containedin=rubyMethodDeclaration +syn match rubyMethodName "\%(\s\|^\)\@1<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2 +syn match rubyMethodName "\%([[:space:].]\|^\)\@2<=\%(\[\]=\=\|\*\*\|[-+!~]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|[=!]=\|[=!]\~\|!\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration -syn cluster rubyDeclaration contains=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration,rubyModuleDeclaration,rubyClassDeclaration,rubyFunction,rubyBlockParameter +syn cluster rubyDeclaration contains=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration,rubyModuleDeclaration,rubyClassDeclaration,rubyMethodName,rubyBlockParameter " Keywords {{{1 " Note: the following keywords have already been defined: @@ -335,7 +339,7 @@ syn match rubyBeginEnd "\<\%(BEGIN\|END\)\>[?!]\@!" if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") syn match rubyDefine "\<alias\>" nextgroup=rubyAliasDeclaration skipwhite skipnl syn match rubyDefine "\<def\>" nextgroup=rubyMethodDeclaration skipwhite skipnl - syn match rubyDefine "\<undef\>" nextgroup=rubyFunction skipwhite skipnl + syn match rubyDefine "\<undef\>" nextgroup=rubyMethodName skipwhite skipnl syn match rubyClass "\<class\>" nextgroup=rubyClassDeclaration skipwhite skipnl syn match rubyModule "\<module\>" nextgroup=rubyModuleDeclaration skipwhite skipnl @@ -377,8 +381,6 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") if s:foldable('[') syn region rubyArrayLiteral matchgroup=rubyArrayDelimiter start="\%(\w\|[\]})]\)\@<!\[" end="]" contains=ALLBUT,@rubyNotTop fold - else - syn region rubyArrayLiteral matchgroup=rubyArrayDelimiter start="\%(\w\|[\]})]\)\@<!\[" end="]" contains=ALLBUT,@rubyNotTop endif " statements without 'do' @@ -437,10 +439,12 @@ if !exists("ruby_no_special_methods") syn match rubyControl "\<\%(exit!\|\%(abort\|at_exit\|exit\|fork\|loop\|trap\)\>[?!]\@!\)" syn keyword rubyEval eval class_eval instance_eval module_eval syn keyword rubyException raise fail catch throw - " false positive with 'include?' - syn match rubyInclude "\<include\>[?!]\@!" - syn keyword rubyInclude autoload extend load prepend refine require require_relative using + syn keyword rubyInclude autoload gem load require require_relative syn keyword rubyKeyword callcc caller lambda proc + " false positive with 'include?' + syn match rubyMacro "\<include\>[?!]\@!" + syn keyword rubyMacro extend prepend refine using + syn keyword rubyMacro alias_method define_method define_singleton_method remove_method undef_method endif " Comments and Documentation {{{1 @@ -461,7 +465,7 @@ syn match rubyKeywordAsMethod "\(defined?\|exit!\)\@!\<[_[:lower:]][_[:alnum:]]* " More Symbols {{{1 syn match rubySymbol "\%([{(,]\_s*\)\zs\l\w*[!?]\=::\@!"he=e-1 -syn match rubySymbol "[]})\"':]\@1<!\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],]\@="he=e-1 +syn match rubySymbol "[]})\"':]\@1<!\<\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],]\@="he=e-1 syn match rubySymbol "\%([{(,]\_s*\)\zs[[:space:],{]\l\w*[!?]\=::\@!"hs=s+1,he=e-1 syn match rubySymbol "[[:space:],{(]\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],]\@="hs=s+1,he=e-1 @@ -477,6 +481,10 @@ hi def link rubyClass rubyDefine hi def link rubyModule rubyDefine hi def link rubyMethodExceptional rubyDefine hi def link rubyDefine Define +hi def link rubyAccess rubyMacro +hi def link rubyAttribute rubyMacro +hi def link rubyMacro Macro +hi def link rubyMethodName rubyFunction hi def link rubyFunction Function hi def link rubyConditional Conditional hi def link rubyConditionalModifier rubyConditional @@ -498,8 +506,9 @@ else endif hi def link rubyClassVariable rubyIdentifier hi def link rubyConstant Type +hi def link rubyClassName rubyConstant +hi def link rubyModuleName rubyConstant hi def link rubyGlobalVariable rubyIdentifier -hi def link rubyBlockParameter rubyIdentifier hi def link rubyInstanceVariable rubyIdentifier hi def link rubyPredefinedIdentifier rubyIdentifier hi def link rubyPredefinedConstant rubyPredefinedIdentifier @@ -508,8 +517,6 @@ hi def link rubySymbol Constant hi def link rubyKeyword Keyword hi def link rubyOperator Operator hi def link rubyBeginEnd Statement -hi def link rubyAccess Statement -hi def link rubyAttribute Statement hi def link rubyEval Statement hi def link rubyPseudoVariable Constant hi def link rubyCapitalizedMethod rubyLocalVariableOrMethod |