From 8e4076a6e54aa4679e664fa5eaa2c5ea002e2fcb Mon Sep 17 00:00:00 2001 From: James Eady Date: Fri, 2 Mar 2012 19:04:12 -0800 Subject: [PATCH 1/9] Fixed indent after escaped parenthesis in a regex --- indent/ruby.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indent/ruby.vim b/indent/ruby.vim index 6e84845f..1f635a21 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -33,7 +33,7 @@ set cpo&vim " ============ " Regex of syntax group names that are or delimit string or are comments. -let s:syng_strcom = '\' From 652ad729f2bc80a0bed2cc7f773ac3b17d771883 Mon Sep 17 00:00:00 2001 From: fakeleft Date: Tue, 20 Mar 2012 11:16:40 -0400 Subject: [PATCH 2/9] Make 'yes' the default, to match the prompt. --- bin/vim-ruby-install.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/vim-ruby-install.rb b/bin/vim-ruby-install.rb index f0461d45..81d81a7f 100755 --- a/bin/vim-ruby-install.rb +++ b/bin/vim-ruby-install.rb @@ -431,6 +431,7 @@ def path puts puts "Target directory '#{target_dir}' does not exist." response = Env.ask_user "Do you want to create it? [Yn] " + response = "y" if response.empty? if response.strip =~ /^y(es)?$/i FileUtils.mkdir_p(target_dir, :verbose => true) else From 3d43f02a4825daeba860e089d6cd65d505eb1245 Mon Sep 17 00:00:00 2001 From: Nick Quaranto Date: Mon, 26 Mar 2012 15:17:51 -0400 Subject: [PATCH 3/9] Add syntax detection for .jbuilder --- ftdetect/ruby.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ftdetect/ruby.vim b/ftdetect/ruby.vim index 19caa3e6..af24c41e 100644 --- a/ftdetect/ruby.vim +++ b/ftdetect/ruby.vim @@ -42,3 +42,6 @@ au BufNewFile,BufRead [tT]horfile,*.thor set filetype=ruby " Rabl au BufNewFile,BufRead *.rabl set filetype=ruby + +" jbuilder +au BufNewFile,BufRead *.jbuilder set filetype=ruby From 77528ef74725d6d0481053b7319fbfe3eaabf8c0 Mon Sep 17 00:00:00 2001 From: Steve Newell Date: Fri, 30 Mar 2012 15:35:56 -0600 Subject: [PATCH 4/9] Ignore doc/tags doc/tags gets created by Pathogen when you follow the install instructions for Command-t: :call pathogen#helptags() Other vim-* plugins already explicitly ignore this file. --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..926ccaaf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +doc/tags From a84858b52981c6b5442d7fec27919ec73300d0ae Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 31 Mar 2012 23:16:09 +1100 Subject: [PATCH 5/9] Fix whitespace. --- ftdetect/ruby.vim | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/ftdetect/ruby.vim b/ftdetect/ruby.vim index af24c41e..d2c39cf3 100644 --- a/ftdetect/ruby.vim +++ b/ftdetect/ruby.vim @@ -1,47 +1,49 @@ " Ruby -au BufNewFile,BufRead *.rb,*.rbw,*.gemspec set filetype=ruby +au BufNewFile,BufRead *.rb,*.rbw,*.gemspec set filetype=ruby " Ruby on Rails -au BufNewFile,BufRead *.builder,*.rxml,*.rjs set filetype=ruby +au BufNewFile,BufRead *.builder,*.rxml,*.rjs set filetype=ruby " Rakefile -au BufNewFile,BufRead [rR]akefile,*.rake set filetype=ruby +au BufNewFile,BufRead [rR]akefile,*.rake set filetype=ruby " Rantfile -au BufNewFile,BufRead [rR]antfile,*.rant set filetype=ruby +au BufNewFile,BufRead [rR]antfile,*.rant set filetype=ruby " IRB config -au BufNewFile,BufRead .irbrc,irbrc set filetype=ruby +au BufNewFile,BufRead .irbrc,irbrc set filetype=ruby " Pry config -au BufNewFile,BufRead .pryrc set filetype=ruby +au BufNewFile,BufRead .pryrc set filetype=ruby " Rackup -au BufNewFile,BufRead *.ru set filetype=ruby +au BufNewFile,BufRead *.ru set filetype=ruby " Capistrano -au BufNewFile,BufRead Capfile set filetype=ruby +au BufNewFile,BufRead Capfile set filetype=ruby " Bundler -au BufNewFile,BufRead Gemfile set filetype=ruby +au BufNewFile,BufRead Gemfile set filetype=ruby " Guard -au BufNewFile,BufRead Guardfile,.Guardfile set filetype=ruby +au BufNewFile,BufRead Guardfile,.Guardfile set filetype=ruby " Vagrant -au BufNewFile,BufRead [vV]agrantfile set filetype=ruby +au BufNewFile,BufRead [vV]agrantfile set filetype=ruby " Autotest -au BufNewFile,BufRead .autotest set filetype=ruby +au BufNewFile,BufRead .autotest set filetype=ruby " eRuby -au BufNewFile,BufRead *.erb,*.rhtml set filetype=eruby +au BufNewFile,BufRead *.erb,*.rhtml set filetype=eruby " Thor -au BufNewFile,BufRead [tT]horfile,*.thor set filetype=ruby +au BufNewFile,BufRead [tT]horfile,*.thor set filetype=ruby " Rabl -au BufNewFile,BufRead *.rabl set filetype=ruby +au BufNewFile,BufRead *.rabl set filetype=ruby -" jbuilder -au BufNewFile,BufRead *.jbuilder set filetype=ruby +" Jbuilder +au BufNewFile,BufRead *.jbuilder set filetype=ruby + +" vim: nowrap sw=2 sts=2 ts=8 noet: From 90f352333e15342940394c780d70087f5bd65390 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sun, 1 Apr 2012 01:57:03 +1100 Subject: [PATCH 6/9] Remove some RubyForge cruft. --- etc/release/README | 12 --- etc/release/cvsrelease | 167 -------------------------------------- etc/release/release.sh | 19 ----- etc/website/djk-theme.css | 34 -------- etc/website/index.html | 133 ------------------------------ etc/website/update.sh | 1 - 6 files changed, 366 deletions(-) delete mode 100644 etc/release/README delete mode 100755 etc/release/cvsrelease delete mode 100755 etc/release/release.sh delete mode 100644 etc/website/djk-theme.css delete mode 100644 etc/website/index.html delete mode 100644 etc/website/update.sh diff --git a/etc/release/README b/etc/release/README deleted file mode 100644 index e88dd296..00000000 --- a/etc/release/README +++ /dev/null @@ -1,12 +0,0 @@ -cvsrelease is a wicked shell script for creating tarballs and/or zips from -CVS. It is very flexible, allowing arbitrary scripts to be executed on the -temporary export tree before archiving it. One such application of this would -be the removal of some files from the "stable" version. - -release.sh is my wrapper around cvsrelease. The main benefit is that it -deduces the CVS root from the local working directory. It contains usage -information. When required, I will amend this, and add whatever other scripts -are needed, to produce stable and development releases for us. - -Gavin Sinclair, 2003-09-26 - diff --git a/etc/release/cvsrelease b/etc/release/cvsrelease deleted file mode 100755 index ac2ffcf8..00000000 --- a/etc/release/cvsrelease +++ /dev/null @@ -1,167 +0,0 @@ -#!/bin/sh - -# -# Automates the process of tagging, exporting and packaging a release from CVS. -# Steve Purcell -# - -AUTHOR='Steve Purcell ' -VERSION=`echo '$Revision$'|cut -d' ' -f2` -PROJECT='Visit http://cvsutils.sourceforge.net/ for updates and information' - -progname=`basename $0` - -function usage() { - cat <&2 -Creates appropriately named .tar.gz and .zip files containing the files in -the current \$CVSROOT for release 'release-tag' of the CVS module 'cvsmodule'. - - usage: $progname [options] -t release-tag -r release-number cvsmodule - -options: - -t The CVS tag name - -r The release number, e.g. 1.2 - -b branch Make the release in the branch with the given name (not - allowed unless -T is also set) - -z Make a '.zip'. release file as well as the usual '.tar.gz' file - -T Also create the CVS tag (use with caution) - -f flavour Name the release files cvsmodule-flavour-releasenum.tar.gz etc. - -x script Execute script inside exported module directory before - Packaging - -h Show this help page - -V Show version information - -The following example would create a CVS tag '0-3' for the module 'webunit', -and package that module into both a 'tar.gz' archive and a 'zip' archive -containing a top-level directory 'webunit-0.3'. - - % $progname -Tz -t 0-3 -r 0.3 webunit - -If a script is specified using the '-x' option, it will be executed in the -root directory of the exported module before the release file is created. -This option can be used to remove unwanted portions of a release, or to -pre-compile binaries for inclusion in the release file. The release tag and -number are exported to the script as \$RELEASETAG and \$RELEASENUM -respectively. Often that script will be used in conjunction with the '-f' -option. -EOF -} - -function showversion() { - echo "$progname version $VERSION, by $AUTHOR" - echo "$PROJECT" -} - -function message() { - echo "$progname$1" 1>&2 -} - -function error_exit() { - message "error: $1" 1>&2 - tidyup - exit 1 -} - -function tidyup() { - if [ -n "$tempdir" -a -d "$tempdir" ]; then - rm -r $tempdir - fi -} - - -## Begin option parsing -while getopts t:r:zThx:f:Vb: opt; do - case "$opt" in - t) releasetag="$OPTARG" ;; - r) releasenum="$OPTARG" ;; - b) frombranch="$OPTARG" ;; - z) makezip=1 ;; - T) maketag=1 ;; - f) flavour="$OPTARG" ;; - x) releasescript="$OPTARG" ;; - V) showversion; exit 0 ;; - h) usage; exit 0 ;; - *) usage; exit 2 ;; - esac -done - -shift $(($OPTIND - 1)) - -## Check values of options -module=$1 - -if [ -z "$module" -o -z "$releasetag" -o -z "$releasenum" ]; then - message "mandatory option(s) missing" - usage - exit 2 -fi -if [ -n "$frombranch" -a -z "$maketag" ]; then - message "option -b cannot be used without -T" - usage - exit 2 -fi - -## Prepare a directory in which to work -orig_dir=$PWD -tempdir=/tmp/$progname.$$ -mkdir $tempdir || error_exit "couldn't create $tempdir" -cd $tempdir - -message "CVS root is $CVSROOT" - -## Create the CVS tag if it was requested -if [ "$maketag" ]; then - if [ -n "$frombranch" ]; then - branch=$frombranch - else - branch=HEAD - fi - cvs co -r $branch $module || \ - error_exit "error checking out from CVS" - cvs tag $releasetag || \ - error_exit "error setting tag '$releasetag'" - rm -rf $module -fi - -## Choose a name for the top level directory -releasedir=$module-$releasenum - -## Export the files to package -message "exporting from CVS" -cvs export -r$releasetag -d $releasedir $module || \ - error_exit "error exporting code from CVS" - -## Choose a name for the generated archive files -if [ -n "$flavour" ]; then - archive_base=$orig_dir/$module-$flavour-$releasenum -else - archive_base=$orig_dir/$module-$releasenum -fi - -if [ -n "$releasescript" ]; then - message "running release script '$releasescript' in $releasedir" - (cd $releasedir && \ - RELEASETAG=$releasetag RELEASENUM=$releasenum $releasescript) || \ - error_exit "error running release script; aborting." -fi - -## Create a '.tar.gz' -tarball=$archive_base.tar.gz -message "creating release tarball: $tarball" -tar cfz $tarball $module-$releasenum || \ - error_exit "couldn't create $tarball" - -## And a '.zip' too if it was requested -if [ "$makezip" ]; then - zipfile=$archive_base.zip - message "creating release zipfile: $zipfile" - zip -qr $zipfile $module-$releasenum || \ - error_exit "couldn't create $zipfile" -fi - -## finish up -cd $orig_dir -tidyup - -message "done" -exit 0 diff --git a/etc/release/release.sh b/etc/release/release.sh deleted file mode 100755 index e15ef4d7..00000000 --- a/etc/release/release.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -# This depends on cvsrelease, downloadable from cvsutils.sourceforge.net, -# but included in this directory. It is covered by a BSD license. - -usage() { - echo "usage: $0 " 1>&2 - echo " eg: $0 v0_2_0 0.2.0" 1>&2 - exit 2 -} - -[ $# -eq 2 ] || usage - -release_tag=$1 -release_number=$2 - -export CVSROOT=`cat CVS/Root` -cvsrelease -z -t $release_tag -r $release_number vim-ruby - diff --git a/etc/website/djk-theme.css b/etc/website/djk-theme.css deleted file mode 100644 index da068b71..00000000 --- a/etc/website/djk-theme.css +++ /dev/null @@ -1,34 +0,0 @@ -body { - margin: 0em 2em; - font-family: Verdana, Helvetica, Arial, sans-serif; - color: black; - background-color: white; -} - -h1 { - padding: 0.2em 0.5em; - color: black; - background-color: #C1AEC9; - font-weight:900; - font-size: xx-large; -} - -h2 { - padding: 0.2em 0.5em; - border: thin solid silver; - color: white; - background-color: #653579; - font-weight:900; - font-size: x-large; -} - -p { - line-height: 1.3em; - padding: 0em 1em; -} - -.readme { - padding: 2em; - margin: 2em; - border: thin solid black; -} diff --git a/etc/website/index.html b/etc/website/index.html deleted file mode 100644 index 4041e505..00000000 --- a/etc/website/index.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - Vim/Ruby Configuration Files - - - - -

- Vim/Ruby Configuration Files -

-

- Introduction -

-

- If you edit Ruby code in Vim, there are some configuration files (distributed with Vim) that aim to make your life easier. These are maintained by three different people, but are grouped together in this project so we can keep them all up to date and offer them in a convenient download. -

-

- Below you will find the README file from the Git repository, which discusses the structure of the project, and how to take advantage of the resources it offers. -

-

- Gavin Sinclair, 2003-07-28 -

-

- Links -

-

- The links from the document below are presented here so they will be hyperlinked. -

-

- Project page: http://www.rubyforge.org/projects/vim-ruby
- Explanation: http://www.rubygarden.org/Ruby/page/show/VimRubySupport -

-

- README -

-

- This is the text of the README document in the project package. -

-
-                    +-----------------------------------+
-                    | vim-ruby RubyForge project README |
-                    +-----------------------------------+
-
-Summary:
-  This project contains Vim configuration files for editing and compiling Ruby
-  within Vim.  See the project homepage for more details.
-
-Web links:
-  Homepage: http://vim-ruby.rubyforge.org
-  Project:  http://www.rubyforge.org/vim-ruby
-
-For regular users:
-  - The project page should have two tarballs for download:
-     - vim-ruby-YYYY.MM.DD.tar.gz  (the current stable release)
-     - vim-ruby-devel-YYYY.MM.DD.tar.gz  (cutting-edge features we'd like you
-       to test)
-  - Please give feedback through the bug tracking and feature request features
-    of RubyForge.
-  - Feel free to join discussions on the vim-ruby-devel mailing list.
-    Instructions on how to join are in the project page somewhere.
-  - RubyForge also features forums, but the mailing list is better.
-
-For would-be contributors:
-  - Please get the latest from Git.
-  - Please join the mailing list and discuss changes, submit patches, etc.
-  - Thank you very much for taking an interest.
-
-Contents of the project:
-  - The autoload, compiler, ftdetect, ftplugin, indent and syntax directories
-    contain the ruby*.vim files that are to be copied to a location somewhere
-    in the Vim 'runtimepath'.
-  - vim-ruby-install.rb performs this copying.
-
-How you get these files into Vim:
-  - By downloading the project via a snapshot or Git, you can keep up with
-    the latest, make changes, and install the files to a Vim directory.
-  - By downloading one of the tarballs, you can easily install the latest
-    stable or development version wherever you like on your machine.  No
-    README, no vim-ruby-install.rb, just Vim files.  You would typically
-    install these into either $VIM/vimfiles, for system-wide use, or $HOME/.vim
-    ($HOME/vimfiles on Windows) for personal use.
-  - Remember that when you install Vim in the first place, all of these files
-    are present.  The purpose of downloading and installing them from
-    RubyForge is to get the latest version of them.
-
-Understanding the configuration files:
-  - See http://www.rubygarden.org/Ruby/page/show/VimRubySupport
-  - Email any one of us or ruby-talk if you want more information added to
-    this page.
-
-Git topics:
-  - Project was migrated from CVS in August, 2008.
-  - Files are tagged according to which version of Vim they are released in.
-  - The project was initiated in July 2003, when the current version of Vim
-    was 6.2.  Thus every file began its life tagged as vim6.2.
-  - Modifications to the files are made in the expectation that they need to
-    be tested by interested users.  They therefore (probably) don't have a
-    tag, and are available via "git pull --rebase", or a development snapshot.
-  - When a modification is considered stable, it is given a tag.
-    Everything that is stable gets released in vim-ruby-YYY.MM.DD.tar.gz files.
-  - When a new version of Vim is about to be released, the stable tarball is
-    contributed to it.  After it has been released, the files are tagged
-    accordingly.
-  - MORAL OF THE STORY: modifications are committed to the head of the tree;
-    when they are ready for release into userland, they are tagged "stable".
-
-Any questions or suggestions?
-  - If there's something about the project or its concepts that you don't
-    understand, send an email to the project maintainer, Gavin Sinclair
-    (gsinclair at gmail.com).
-  - To ask about the contents of the configuration files, ask on the mailing
-    list, as different people maintain the different files.  Gavin knows
-    nothing about the syntax file, for instance. (Come to think of it, nor does
-    Doug - djk)
-
-Project gossip:
-  - Two of the configuration file maintainers, Doug Kearns and Gavin Sinclair,
-    live in Australia (Jindabyne and Sydney respectively).  Tim Hammerquist,
-    the last man standing, has lived in the Reno/Lake Tahoe area of Nevada,
-    USA, since the late 1970s and doesn't like to gamble; a waste, really.
-  - While the individual effort to maintain these files has a long history,
-    this actual project began in late July 2003.  Therefore, if you're reading
-    this soon thereafter and something doesn't make sense, now is the time to
-    let us know.
-
-                           --= End of Document =--
-    
- - diff --git a/etc/website/update.sh b/etc/website/update.sh deleted file mode 100644 index 4daf235a..00000000 --- a/etc/website/update.sh +++ /dev/null @@ -1 +0,0 @@ -scp index.html gsinclair@rubyforge.org:/var/www/gforge-projects/vim-ruby/ From 643805906520dfe88747394c84dec2b5ecbe0205 Mon Sep 17 00:00:00 2001 From: Andrew Radev Date: Sat, 21 Apr 2012 12:20:35 +0300 Subject: [PATCH 7/9] Indent |(a, b)| blocks correctly Oddly enough, this also fixes a long-standing issue with nested blocks, noticeable in the change in etc/examples/indent/nested_hashes.rb. --- etc/examples/indent/blocks.rb | 25 +++++++++++++++++++ etc/examples/indent/continuation_blocks.rb | 6 ----- etc/examples/indent/nested_hashes.rb | 6 ++--- indent/ruby.vim | 28 +++++++++++++++++++++- 4 files changed, 55 insertions(+), 10 deletions(-) create mode 100644 etc/examples/indent/blocks.rb delete mode 100644 etc/examples/indent/continuation_blocks.rb diff --git a/etc/examples/indent/blocks.rb b/etc/examples/indent/blocks.rb new file mode 100644 index 00000000..05229177 --- /dev/null +++ b/etc/examples/indent/blocks.rb @@ -0,0 +1,25 @@ +proc do |(a, b)| + puts a + puts b +end + +proc do |foo, (a, b), bar| + puts a + puts b +end + +define_method "something" do |param| + if param == 42 + do_something + else + do_something_else + end +end + +def foo + opts.on('--coordinator host=HOST[,port=PORT]', + 'Specify the HOST and the PORT of the coordinator') do |str| + h = sub_opts_to_hash(str) + puts h + end +end diff --git a/etc/examples/indent/continuation_blocks.rb b/etc/examples/indent/continuation_blocks.rb deleted file mode 100644 index b81d7ae8..00000000 --- a/etc/examples/indent/continuation_blocks.rb +++ /dev/null @@ -1,6 +0,0 @@ -def foo - opts.on('--coordinator host=HOST[,port=PORT]', - 'Specify the HOST and the PORT of the coordinator') do |str| - h = sub_opts_to_hash(str) - end -end diff --git a/etc/examples/indent/nested_hashes.rb b/etc/examples/indent/nested_hashes.rb index 968b2915..70ecda27 100644 --- a/etc/examples/indent/nested_hashes.rb +++ b/etc/examples/indent/nested_hashes.rb @@ -46,8 +46,8 @@ class Foo var. func1(:param => 'value') { func1_5(:param => 'value') - var.func2(:param => 'value') { - puts "test" - } + var.func2(:param => 'value') { + puts "test" + } } end diff --git a/indent/ruby.vim b/indent/ruby.vim index 1f635a21..9f47670f 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -93,7 +93,7 @@ let s:bracket_continuation_regex = '\%([({[]\)\s*\%(#.*\)\=$' " Regex that defines blocks. let s:block_regex = - \ '\%(\\|{\)\s*\%(|\%([*@&]\=\h\w*,\=\s*\)\%(,\s*[*@&]\=\h\w*\)*|\)\=\s*\%(#.*\)\=$' + \ '\%(\\|{\)\s*\%(|\s*(\=\%([*@&]\=\h\w*,\=\s*\)\%(,\s*(\=\s*[*@&]\=\h\w*)\=\)*|\)\=\s*\%(#.*\)\=$' " 2. Auxiliary Functions {{{1 " ====================== @@ -152,15 +152,41 @@ function s:GetMSL(lnum) if line =~ s:non_bracket_continuation_regex && msl_body =~ s:non_bracket_continuation_regex " If the current line is a non-bracket continuation and so is the " previous one, keep its indent and continue looking for an MSL. + " + " Example: + " method_call one, + " two, + " three + " let msl = lnum elseif line =~ s:non_bracket_continuation_regex && (msl_body =~ s:bracket_continuation_regex || msl_body =~ s:block_regex) " If the current line is a bracket continuation or a block-starter, but " the previous is a non-bracket one, respect the previous' indentation, " and stop here. + " + " Example: + " method_call one, + " two { + " three + " return lnum elseif line =~ s:bracket_continuation_regex && (msl_body =~ s:bracket_continuation_regex || msl_body =~ s:block_regex) " If both lines are bracket continuations (the current may also be a " block-starter), use the current one's and stop here + " + " Example: + " method_call( + " other_method_call( + " foo + return msl + elseif line =~ s:block_regex && msl_body !~ s:continuation_regex && msl_body !~ s:block_regex + " If the previous line is a block-starter and the current one is + " mostly ordinary, use the current one as the MSL. + " + " Example: + " method_call do + " something + " something_else return msl else let col = match(line, s:continuation_regex) + 1 From 05b34b639cbb55f2e4210dc8767277d2ce62612b Mon Sep 17 00:00:00 2001 From: Andrew Radev Date: Sat, 21 Apr 2012 12:22:05 +0300 Subject: [PATCH 8/9] Oops. Fix syntactically invalid example --- etc/examples/indent/nested_hashes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/examples/indent/nested_hashes.rb b/etc/examples/indent/nested_hashes.rb index 70ecda27..48b00195 100644 --- a/etc/examples/indent/nested_hashes.rb +++ b/etc/examples/indent/nested_hashes.rb @@ -35,7 +35,7 @@ class Foo foo, bar = { :bar => { - :foo { 'bar' => 'baz' }, + :foo => { 'bar' => 'baz' }, :one => 'two', :three => 'four' } From 30c6aee79f739cf9d6c5f7052a376c25b695b482 Mon Sep 17 00:00:00 2001 From: Andrew Radev Date: Sat, 21 Apr 2012 12:25:00 +0300 Subject: [PATCH 9/9] More comments on parsing |(a, b)| --- indent/ruby.vim | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/indent/ruby.vim b/indent/ruby.vim index 9f47670f..fe91518d 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -92,6 +92,14 @@ let s:continuation_regex = let s:bracket_continuation_regex = '\%([({[]\)\s*\%(#.*\)\=$' " Regex that defines blocks. +" +" Note that there's a slight problem with this regex and s:continuation_regex. +" Code like this will be matched by both: +" +" method_call do |(a, b)| +" +" The reason is that the pipe matches a hanging "|" operator. +" let s:block_regex = \ '\%(\\|{\)\s*\%(|\s*(\=\%([*@&]\=\h\w*,\=\s*\)\%(,\s*(\=\s*[*@&]\=\h\w*)\=\)*|\)\=\s*\%(#.*\)\=$'