From 121c2f6c1e9bda3f524f66cc9a9cc8e0c982597d Mon Sep 17 00:00:00 2001 From: Gavin Sinclair Date: Sun, 27 Jul 2003 08:42:14 +0000 Subject: [PATCH 001/411] Initial revision --- README | 71 ++++++++++++ build.rb | 13 +++ compiler/ruby.vim | 58 ++++++++++ ftplugin/ruby.vim | 14 +++ indent/ruby.vim | 67 +++++++++++ install.rb | 27 +++++ syntax/ruby.vim | 285 ++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 535 insertions(+) create mode 100644 README create mode 100755 build.rb create mode 100644 compiler/ruby.vim create mode 100644 ftplugin/ruby.vim create mode 100644 indent/ruby.vim create mode 100755 install.rb create mode 100644 syntax/ruby.vim diff --git a/README b/README new file mode 100644 index 00000000..ea756602 --- /dev/null +++ b/README @@ -0,0 +1,71 @@ + +-----------------------------------+ + | 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-stable.tar.gz (the files ready for the next Vim release) + - vim-ruby-devel.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 anonymous CVS. + - Please join the mailing list and discuss changes, submit patches, etc. + - Thank you very much for taking an interest. + +Contents of the project: + - The compiler, ftplugin, indent and syntax directories contain the ruby.vim + files that are to be copied somewhere Vim can see them. + - install.rb performs this copying. + - build.rb creates a tarball for easy distribution. + +How you get these files into Vim: + - By downloading the project via a snapshot or anonymous CVS, 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 install.rb, just Vim files. You would typically install these + wherever Vim is installed, in the (for example) "vim62" directory. + - 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 www.rubygarden.org/ruby?VimRubySupport + +CVS topics: + - 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 "cvs update -A", or a development snapshot. + - When a modification is considered stable, it is tagged "stable". + Everything that is stable gets released in vim-ruby-stable.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@soyabean.com.au). + - 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. + diff --git a/build.rb b/build.rb new file mode 100755 index 00000000..7ac15361 --- /dev/null +++ b/build.rb @@ -0,0 +1,13 @@ +#!/usr/local/bin/ruby -w + +# This program creates a tarball which people can download and install whereever +# they like, so that they can get the tasty goodness without having to use CVS +# and install.rb. + +# How can we make it easy to build using different CVS tags? + +USAGE = <<-EOF +Usage: ruby build.rb +EOF + +raise "Not implemented" diff --git a/compiler/ruby.vim b/compiler/ruby.vim new file mode 100644 index 00000000..7bac74d9 --- /dev/null +++ b/compiler/ruby.vim @@ -0,0 +1,58 @@ +" Vim compiler file +" Compiler: Ruby syntax check and/or error reporting +" Maintainer: Tim Hammerquist +" Last Change: Tue Jul 16 00:38:00 PDT 2002 +" +" Changelog: +" 0.2: script saves and restores 'cpoptions' value to prevent problems with +" line continuations +" 0.1: initial release +" +" Contributors: +" Hugh Sasse +" Doug Kearns +" +" Todo: +" match error type %m +" +" Comments: +" I know this file isn't perfect. If you have any questions, suggestions, +" patches, etc., please don't hesitate to let me know. +" +" This is my first experience with 'errorformat' and compiler plugins and +" I welcome any input from more experienced (or clearer-thinking) +" individuals. + +if exists("current_compiler") + finish +endif +let current_compiler = "ruby" + +let s:cpo_save = &cpo +set cpo-=C + +" default settings runs script normally +" add '-c' switch to run syntax check only: +" +" setlocal makeprg=ruby\ -wc\ $* +" +" or add '-c' at :make command line: +" +" :make -c % +" +setlocal makeprg=ruby\ -w\ $* + +setlocal 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, + \%-Z%p^, + \%-G%.%# + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: ft=vim diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim new file mode 100644 index 00000000..e21afeee --- /dev/null +++ b/ftplugin/ruby.vim @@ -0,0 +1,14 @@ +" Vim filetype plugin +" Language: Ruby +" Maintainer: Gavin Sinclair +" Last Change: 2002/08/12 +" URL: www.soyabean.com.au/gavin/vim/index.html + +" Only do this when not done yet for this buffer +if (exists("b:did_ftplugin")) + finish +endif +let b:did_ftplugin = 1 + +" There are no known setting particularly appropriate for Ruby. Please +" contact the maintainer if you think of some. diff --git a/indent/ruby.vim b/indent/ruby.vim new file mode 100644 index 00000000..ce078f2a --- /dev/null +++ b/indent/ruby.vim @@ -0,0 +1,67 @@ +" Vim indent file +" Language: Ruby +" Maintainer: Gavin Sinclair +" Last Change: 2003 May 11 +" URL: www.soyabean.com.au/gavin/vim/index.html +" Changes: (since vim 6.1) +" - indentation after a line ending in comma, etc, (even in a comment) was +" broken, now fixed (2002/08/14) + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +setlocal indentexpr=GetRubyIndent() +setlocal nolisp +setlocal nosmartindent +setlocal autoindent +setlocal indentkeys+==end,=else,=elsif,=when,=ensure,=rescue + +" Only define the function once. +if exists("*GetRubyIndent") + finish +endif + +function GetRubyIndent() + " Find a non-blank line above the current line. + let lnum = prevnonblank(v:lnum - 1) + + " At the start of the file use zero indent. + if lnum == 0 + return 0 + endif + + " If the line trailed with [*+,.(] - but not in a comment - trust the user + if getline(lnum) =~ '\(\[^#\].*\)?\(\*\|\.\|+\|,\|(\)\(\s*#.*\)\=$' + return -1 + endif + + " Add a 'shiftwidth' after lines beginning with: + " module, class, dev, if, for, while, until, else, elsif, case, when, { + let ind = indent(lnum) + let flag = 0 + if getline(lnum) =~ '^\s*\(module\>\|class\>\|def\>\|if\>\|for\>\|while\>\|until\>\|else\>\|elsif\>\|case\>\|when\>\|unless\|begin\|ensure\>\|rescue\>\)' + \ || getline(lnum) =~ '{\s*$' + \ || getline(lnum) =~ '\({\|\\).*|.*|\s*$' + \ || getline(lnum) =~ '\\(\s*#.*\)\=$' + let ind = ind + &sw + let flag = 1 + endif + + " Subtract a 'shiftwidth' after lines ending with + " "end" when they begin with while, if, for, until + if flag == 1 && getline(lnum) =~ '\\(\s*#.*\)\=$' + let ind = ind - &sw + endif + + " Subtract a 'shiftwidth' on end, else and, elsif, when and } + if getline(v:lnum) =~ '^\s*\(end\>\|else\>\|elsif\>\|when\>\|ensure\>\|rescue\>\|}\)' + let ind = ind - &sw + endif + + return ind +endfunction + +" vim:sw=2 diff --git a/install.rb b/install.rb new file mode 100755 index 00000000..fe488431 --- /dev/null +++ b/install.rb @@ -0,0 +1,27 @@ +#!/usr/local/bin/ruby -w + +# This program will take the files +# compiler/ruby.vim +# ftplugin/ruby.vim +# indent/ruby.vim +# syntax/ruby.vim +# and install them in a place where Vim can see them. If the environment +# variable $VIM exists, it is assumed to point to, e.g. /usr/share/vim/vim62, so +# the files can be placed in $VIM/syntax, etc. But it is unlikely that $VIM is +# defined, so this program will guess a few locations, using Unix and Windows +# sensibilities. It will, in fact, default to the user's ~/.vim or +# $HOME/vimfiles. +# + +USAGE = <<-EOF +Usage: ruby install.rb [options] + + Options: + -g install in global vim configuration directory + -u install in user's (i.e. your) vim configuration directory (default) + -d DIR install in DIR + -i confirm before doing anything, especially overwriting files + -f no confirmations +EOF + +raise "Not implemented" diff --git a/syntax/ruby.vim b/syntax/ruby.vim new file mode 100644 index 00000000..e12b3f3c --- /dev/null +++ b/syntax/ruby.vim @@ -0,0 +1,285 @@ +" Vim syntax file +" Language: Ruby +" Maintainer: Doug Kearns +" Previous Maintainer: Mirko Nasato +" Last Change: 2003 May 31 +" URL: http://mugca.its.monash.edu.au/~djkea2/vim/syntax/ruby.vim + +" $Id: ruby.vim,v 1.1 2003/07/27 08:42:16 gsinclair Exp $ + +" Thanks to perl.vim authors, and to Reimer Behrends. :-) (MN) + +" For version 5.x: Clear all syntax items +" For version 6.x: Quit when a syntax file was already loaded +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +" Expression Substitution and Backslash Notation +syn match rubyExprSubst "\\\\\|\(\(\\M-\\C-\|\\c\|\\C-\|\\M-\)\w\)\|\(\\\o\{3}\|\\x\x\{2}\|\\[abefnrstv]\)" contained +syn match rubyExprSubst "#{[^}]*}" contained +syn match rubyExprSubst "#[$@]\w\+" contained + +" Numbers and ASCII Codes +syn match rubyNumber "\w\@" + +" Identifiers - constant, class and instance, global, symbol, iterator, predefined +syn match rubyLocalVariableOrMethod "[_[:lower:]][_[:alnum:]]*[?!=]\=" transparent contains=NONE + +if !exists("ruby_no_identifiers") + syn match rubyConstant "\(::\)\=\zs\u\w*" + syn match rubyClassVariable "@@\h\w*" + syn match rubyInstanceVariable "@\h\w*" + syn match rubyGlobalVariable "$\(\h\w*\|-.\)" + syn match rubySymbol ":\@?@\\_`~1-9]" + syn match rubyPredefinedVariable "$-[0FIKadilpvw]" + syn match rubyPredefinedVariable "$\(defout\|stderr\|stdin\|stdout\)\>" + syn match rubyPredefinedVariable "$\(DEBUG\|FILENAME\|KCODE\|LOAD_PATH\|SAFE\|VERBOSE\)\>" + syn match rubyPredefinedConstant "__\(FILE\|LINE\)__\>" + syn match rubyPredefinedConstant "\<\(::\)\=\zs\(MatchingData\|NotImplementError\|ARGF\|ARGV\|ENV\)\>" + syn match rubyPredefinedConstant "\<\(::\)\=\zs\(DATA\|FALSE\|NIL\|RUBY_PLATFORM\|RUBY_RELEASE_DATE\)\>" + syn match rubyPredefinedConstant "\<\(::\)\=\zs\(RUBY_VERSION\|STDERR\|STDIN\|STDOUT\|TOPLEVEL_BINDING\|TRUE\)\>" + "Obsolete Global Constants + "syn match rubyPredefinedConstant "\<\(::\)\=\zs\(PLATFORM\|RELEASE\|VERSION\)\>" +endif + +" +" BEGIN Autogenerated Stuff +" +" Generalized Regular Expression +syn region rubyString matchgroup=rubyStringDelimit start="%r!" end="![iomx]*" skip="\\\\\|\\!" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%r\"" end="\"[iomx]*" skip="\\\\\|\\\"" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%r#" end="#[iomx]*" skip="\\\\\|\\#" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%r\$" end="\$[iomx]*" skip="\\\\\|\\\$" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%r%" end="%[iomx]*" skip="\\\\\|\\%" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%r&" end="&[iomx]*" skip="\\\\\|\\&" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%r'" end="'[iomx]*" skip="\\\\\|\\'" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%r\*" end="\*[iomx]*" skip="\\\\\|\\\*" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%r+" end="+[iomx]*" skip="\\\\\|\\+" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%r-" end="-[iomx]*" skip="\\\\\|\\-" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%r\." end="\.[iomx]*" skip="\\\\\|\\\." contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%r/" end="/[iomx]*" skip="\\\\\|\\/" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%r:" end=":[iomx]*" skip="\\\\\|\\:" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%r;" end=";[iomx]*" skip="\\\\\|\\;" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%r=" end="=[iomx]*" skip="\\\\\|\\=" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%r?" end="?[iomx]*" skip="\\\\\|\\?" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%r@" end="@[iomx]*" skip="\\\\\|\\@" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%r\\" end="\\[iomx]*" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%r\^" end="\^[iomx]*" skip="\\\\\|\\\^" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%r`" end="`[iomx]*" skip="\\\\\|\\`" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%r|" end="|[iomx]*" skip="\\\\\|\\|" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%r\~" end="\~[iomx]*" skip="\\\\\|\\\~" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%r{" end="}[iomx]*" skip="\\\\\|\\}" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%r<" end=">[iomx]*" skip="\\\\\|\\>" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%r\[" end="\][iomx]*" skip="\\\\\|\\\]" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%r(" end=")[iomx]*" skip="\\\\\|\\)" contains=rubyExprSubst fold + +" Generalized Single Quoted String and Array of Strings +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]!" end="!" skip="\\\\\|\\!" +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]\"" end="\"" skip="\\\\\|\\\"" +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]#" end="#" skip="\\\\\|\\#" +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]\$" end="\$" skip="\\\\\|\\\$" +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]%" end="%" skip="\\\\\|\\%" +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]&" end="&" skip="\\\\\|\\&" +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]'" end="'" skip="\\\\\|\\'" +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]\*" end="\*" skip="\\\\\|\\\*" +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]+" end="+" skip="\\\\\|\\+" +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]-" end="-" skip="\\\\\|\\-" +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]\." end="\." skip="\\\\\|\\\." +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]/" end="/" skip="\\\\\|\\/" +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]:" end=":" skip="\\\\\|\\:" +syn region rubyString matchgroup=rubyStringDelimit start="%[wq];" end=";" skip="\\\\\|\\;" +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]=" end="=" skip="\\\\\|\\=" +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]?" end="?" skip="\\\\\|\\?" +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]@" end="@" skip="\\\\\|\\@" +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]\\" end="\\" +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]\^" end="\^" skip="\\\\\|\\\^" +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]`" end="`" skip="\\\\\|\\`" +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]|" end="|" skip="\\\\\|\\|" +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]\~" end="\~" skip="\\\\\|\\\~" +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]{" end="}" skip="\\\\\|\\}" +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]<" end=">" skip="\\\\\|\\>" +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]\[" end="\]" skip="\\\\\|\\\]" +syn region rubyString matchgroup=rubyStringDelimit start="%[wq](" end=")" skip="\\\\\|\\)" + +" Generalized Double Quoted String and Shell Command Output +syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=!" end="!" skip="\\\\\|\\!" contains=rubyExprSubst +syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=\"" end="\"" skip="\\\\\|\\\"" contains=rubyExprSubst +syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=#" end="#" skip="\\\\\|\\#" contains=rubyExprSubst +syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=\$" end="\$" skip="\\\\\|\\\$" contains=rubyExprSubst +syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=%" end="%" skip="\\\\\|\\%" contains=rubyExprSubst +syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=&" end="&" skip="\\\\\|\\&" contains=rubyExprSubst +syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\='" end="'" skip="\\\\\|\\'" contains=rubyExprSubst +syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=\*" end="\*" skip="\\\\\|\\\*" contains=rubyExprSubst +syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=+" end="+" skip="\\\\\|\\+" contains=rubyExprSubst +syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=-" end="-" skip="\\\\\|\\-" contains=rubyExprSubst +syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=\." end="\." skip="\\\\\|\\\." contains=rubyExprSubst +syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=/" end="/" skip="\\\\\|\\/" contains=rubyExprSubst +syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=:" end=":" skip="\\\\\|\\:" contains=rubyExprSubst +syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=;" end=";" skip="\\\\\|\\;" contains=rubyExprSubst +"syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\==" end="=" skip="\\\\\|\\=" contains=rubyExprSubst +syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]=" end="=" skip="\\\\\|\\=" contains=rubyExprSubst +syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=?" end="?" skip="\\\\\|\\?" contains=rubyExprSubst +syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=@" end="@" skip="\\\\\|\\@" contains=rubyExprSubst +syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=\\" end="\\" contains=rubyExprSubst +syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=\^" end="\^" skip="\\\\\|\\\^" contains=rubyExprSubst +syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=`" end="`" skip="\\\\\|\\`" contains=rubyExprSubst +syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=|" end="|" skip="\\\\\|\\|" contains=rubyExprSubst +syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=\~" end="\~" skip="\\\\\|\\\~" contains=rubyExprSubst +syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\={" end="}" skip="\\\\\|\\}" contains=rubyExprSubst +syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=<" end=">" skip="\\\\\|\\>" contains=rubyExprSubst +syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=\[" end="\]" skip="\\\\\|\\\]" contains=rubyExprSubst +syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=(" end=")" skip="\\\\\|\\)" contains=rubyExprSubst + +" Normal String and Shell Command Output +syn region rubyString matchgroup=rubyStringDelimit start="\"" end="\"" skip="\\\\\|\\\"" contains=rubyExprSubst +syn region rubyString matchgroup=rubyStringDelimit start="'" end="'" skip="\\\\\|\\'" +syn region rubyString matchgroup=rubyStringDelimit start="`" end="`" skip="\\\\\|\\`" contains=rubyExprSubst +" +" END Autogenerated Stuff +" + +" Normal Regular Expression +syn region rubyString matchgroup=rubyStringDelimit start="^\s*/" start="\" + + " *do* requiring *end* + syn region rubyDoBlock matchgroup=rubyControl start="\" end="\" contains=ALLBUT,rubyExprSubst,rubyTodo fold + + " *{* requiring *}* + syn region rubyCurlyBlock start="{" end="}" contains=ALLBUT,rubyExprSubst,rubyTodo fold + + " statements without *do* + syn region rubyNoDoBlock matchgroup=rubyControl start="\<\(case\|begin\)\>" start="^\s*\(if\|unless\)\>" start=";\s*\(if\|unless\)\>"hs=s+1 end="\" contains=ALLBUT,rubyExprSubst,rubyTodo fold + + " statement with optional *do* + syn region rubyOptDoBlock matchgroup=rubyControl start="\" start="^\s*\(while\|until\)\>" start=";\s*\(while\|until\)\>"hs=s+1 end="\" contains=ALLBUT,rubyExprSubst,rubyTodo,rubyDoBlock,rubyCurlyBlock fold + + if !exists("ruby_minlines") + let ruby_minlines = 50 + endif + exec "syn sync minlines=" . ruby_minlines + +else " not Expensive + syn region rubyFunction matchgroup=rubyControl start="^\s*def\s" matchgroup=NONE end="\ze\(\s\|(\|;\|$\)" skip="\.\|\(::\)" oneline fold + syn region rubyClassOrModule matchgroup=rubyControl start="^\s*\(class\|module\)\s" end="<\|$\|;\|\>"he=e-1 oneline fold + syn keyword rubyControl case begin do for if unless while until end +endif " Expensive? + +" Keywords +syn keyword rubyControl then else elsif when ensure rescue +syn keyword rubyControl and or not in loop +syn keyword rubyControl break redo retry next return +syn match rubyKeyword "\" +syn keyword rubyInclude load require +syn keyword rubyTodo FIXME NOTE TODO XXX contained +syn keyword rubyBoolean true false self nil +syn keyword rubyException raise fail catch throw +syn keyword rubyBeginEnd BEGIN END + +" Comments and Documentation +if version < 600 + syn match rubySharpBang "#!.*" +else + syn match rubySharpBang "\%^#!.*" +endif +syn match rubyComment "#.*" contains=rubyTodo +syn region rubyDocumentation start="^=begin" end="^=end.*$" contains=rubyTodo fold + +" Note: this is a hack to prevent 'keywords' being highlighted as such when used as method names +syn match rubyKeywordAsMethod "\.\@" transparent contains=NONE +syn match rubyKeywordAsMethod "\.\@" transparent contains=NONE +syn match rubyKeywordAsMethod "\.\@" transparent contains=NONE +syn match rubyKeywordAsMethod "\.\@" transparent contains=NONE +syn match rubyKeywordAsMethod "\.\@" transparent contains=NONE + +" __END__ Directive +syn region rubyData matchgroup=rubyDataDirective start="^__END__$" matchgroup=NONE end="." skip="." + +" Define the default highlighting. +" For version 5.7 and earlier: only when not done already +" For version 5.8 and later: only when an item doesn't have highlighting yet +if version >= 508 || !exists("did_ruby_syntax_inits") + if version < 508 + let did_ruby_syntax_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif + + HiLink rubyDefine Define + HiLink rubyFunction Function + HiLink rubyControl Statement + HiLink rubyInclude Include + HiLink rubyNumber Number + HiLink rubyBoolean Boolean + HiLink rubyException Exception + HiLink rubyClassOrModule Type + HiLink rubyIdentifier Identifier + HiLink rubyClassVariable rubyIdentifier + HiLink rubyConstant rubyIdentifier + HiLink rubyGlobalVariable rubyIdentifier + HiLink rubyIterator rubyIdentifier + HiLink rubyInstanceVariable rubyIdentifier + HiLink rubyPredefinedIdentifier rubyIdentifier + HiLink rubyPredefinedConstant rubyPredefinedIdentifier + HiLink rubyPredefinedVariable rubyPredefinedIdentifier + HiLink rubySymbol rubyIdentifier + HiLink rubySharpBang PreProc + HiLink rubyKeyword Keyword + HiLink rubyBeginEnd Statement + + HiLink rubyString String + HiLink rubyStringDelimit Delimiter + HiLink rubyExprSubst Special + + HiLink rubyComment Comment + HiLink rubyDocumentation Comment + HiLink rubyTodo Todo + HiLink rubyData Comment + HiLink rubyDataDirective Delimiter + + delcommand HiLink +endif + +let b:current_syntax = "ruby" + +" vim: nowrap tabstop=8 From 1e56eb8044f5eafab86c4b7d06c99985b3891fcf Mon Sep 17 00:00:00 2001 From: Gavin Sinclair Date: Mon, 28 Jul 2003 14:04:41 +0000 Subject: [PATCH 002/411] A few improvements --- README | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README b/README index ea756602..ed922efd 100644 --- a/README +++ b/README @@ -64,8 +64,18 @@ CVS topics: 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@soyabean.com.au). + (gsinclair at soyabean.com.au). - 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. +Project gossip: + - Two of the configuration file maintainers, Doug Kearns and Gavin Sinclair, + live in Australia (Melbourne and Sydney respectively). Tim Hammerquist, + the last man standing, has a cpan.org email address. + - 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 =-- From 564e60cfc79ba850366e7735ff9c5ec99f666c5a Mon Sep 17 00:00:00 2001 From: Gavin Sinclair Date: Tue, 29 Jul 2003 15:40:10 +0000 Subject: [PATCH 003/411] Much improved version submitted by Nikolai Weibull --- indent/ruby.vim | 151 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 132 insertions(+), 19 deletions(-) diff --git a/indent/ruby.vim b/indent/ruby.vim index ce078f2a..f3b2442f 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -6,6 +6,7 @@ " Changes: (since vim 6.1) " - indentation after a line ending in comma, etc, (even in a comment) was " broken, now fixed (2002/08/14) +" TODO: need to indent one level on [ " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -17,14 +18,54 @@ setlocal indentexpr=GetRubyIndent() setlocal nolisp setlocal nosmartindent setlocal autoindent -setlocal indentkeys+==end,=else,=elsif,=when,=ensure,=rescue +setlocal indentkeys+==end,=else,=elsif,=when,=ensure,=rescue,0),==begin,==end " Only define the function once. if exists("*GetRubyIndent") finish endif +function s:IsInStringOrComment(line, col) + return synIDattr(synID(a:line, a:col, 0), 'name') =~? 'string\|comment' +endfunction + +let g:ruby_indent_keywords = 'module,class,def,if,for,while,until,else,elsif,'. + \'case,when,unless,begin,ensure,rescue' + +function s:BuildIndentKeywords() + let idx = stridx(g:ruby_indent_keywords, ',') + while idx > -1 + let keyword = strpart(g:ruby_indent_keywords, 0, idx).'\>' + if exists('s:ruby_indent_keywords') + let s:ruby_indent_keywords = s:ruby_indent_keywords.'\|'.keyword + else + let s:ruby_indent_keywords = "\\(".keyword + endif + let g:ruby_indent_keywords = strpart(g:ruby_indent_keywords, idx + 1) + let idx = stridx(g:ruby_indent_keywords, ',') + endwhile + + if exists('s:ruby_indent_keywords') + let s:ruby_indent_keywords = s:ruby_indent_keywords.'\|'. + \g:ruby_indent_keywords.'\>\)' + else + let s:ruby_indent_keywords = g:ruby_indent_keywords.'\>' + endif +endfunction +call s:BuildIndentKeywords() + +let s:continuation_regexp = '[*+/.-]\s*\(#.*\)\=$' +let s:block_regexp = '\({\|\\)\s*\(|\(\h\w*\(,\s*\)\=\)\+|\s*\)\=\(#.*\)\=$' +let s:skip_expr = 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment"' + + +" FIXME: with a little reorginization (using returns instead of let ind = +" ...), we could speed things up a bit function GetRubyIndent() + " Set up variables for restoring position in file. Could use v:lnum here. + let clnum = line('.') + let ccol = col('.') + " Find a non-blank line above the current line. let lnum = prevnonblank(v:lnum - 1) @@ -33,35 +74,107 @@ function GetRubyIndent() return 0 endif - " If the line trailed with [*+,.(] - but not in a comment - trust the user - if getline(lnum) =~ '\(\[^#\].*\)?\(\*\|\.\|+\|,\|(\)\(\s*#.*\)\=$' - return -1 + let line = getline(lnum) + let ind = indent(lnum) + let did_indent = 0 + let did_end_indent = 0 + + " If the previous line ended with [*+/.-], indent one extra level. + let col = match(line, s:continuation_regexp) + 1 + if col > 0 && !s:IsInStringOrComment(lnum, col) + let ind + &sw + let did_indent = 1 endif - " Add a 'shiftwidth' after lines beginning with: - " module, class, dev, if, for, while, until, else, elsif, case, when, { - let ind = indent(lnum) - let flag = 0 - if getline(lnum) =~ '^\s*\(module\>\|class\>\|def\>\|if\>\|for\>\|while\>\|until\>\|else\>\|elsif\>\|case\>\|when\>\|unless\|begin\|ensure\>\|rescue\>\)' - \ || getline(lnum) =~ '{\s*$' - \ || getline(lnum) =~ '\({\|\\).*|.*|\s*$' - \ || getline(lnum) =~ '\\(\s*#.*\)\=$' + " If the previous line ended in a parentheses, get the indent of the line + " that opened it. + let col = matchend(line, '^\s*)') + 1 + if !did_indent && col > 0 + execute 'normal '.lnum.'G'.col.'|' + if searchpair('(', '', ')', 'bW', s:skip_expr) > 0 + let ind = indent('.') + let did_indent = 1 + endif + execute 'normal '.clnum.'G'.ccol.'|' + endif + + " If the previous line ended with an indenting keyword, add one level. + let col = match(line, '^\s*'.s:ruby_indent_keywords) + 1 + if !did_indent && col > 0 || line =~ s:block_regexp let ind = ind + &sw - let flag = 1 + let did_indent = 1 + let did_end_indent = 1 endif - " Subtract a 'shiftwidth' after lines ending with - " "end" when they begin with while, if, for, until - if flag == 1 && getline(lnum) =~ '\\(\s*#.*\)\=$' - let ind = ind - &sw + " Otherwise, check if the previous line was a continuation line. + if !did_indent + let my_lnum = prevnonblank(lnum - 1) + if my_lnum > 0 + let my_line = getline(my_lnum) + let my_ind = indent(my_lnum) + + if my_line =~ s:continuation_regexp + let col = match(my_line, s:continuation_regexp) + 1 + if col > 0 && !s:IsInStringOrComment(my_lnum, col) + let ind = my_ind + let did_indent = 1 + endif + endif + endif endif - " Subtract a 'shiftwidth' on end, else and, elsif, when and } - if getline(v:lnum) =~ '^\s*\(end\>\|else\>\|elsif\>\|when\>\|ensure\>\|rescue\>\|}\)' + " If we indented and the line ended with an 'end', decrese indent. + " TODO: make this more intelligent (check with searchpair()) + if did_indent && line =~ '\\s*\(#.*\)\=$' let ind = ind - &sw endif + " Get the current line. + let line = getline(v:lnum) + + " If we are inside a pair of braces, well at least after an opening one. + if 0 < searchpair('(', '', ')', 'bW', s:skip_expr) + let ind = virtcol('.') + execute 'normal '.clnum.'G'.ccol.'|' + endif + + " Deindent on a closing ) on an empty line. + let col = matchend(line, '^\s*)') + 1 + if col > 0 + execute 'normal '.col.'|' + if searchpair('(', '', ')', 'bW', s:skip_expr) > 0 + let ind = virtcol('.') - 1 + endif + execute 'normal '.ccol.'|' + endif + + + " If we got a brace on an empty line, find match and indent to its level. + let col = matchend(line, '^\s*}') + 1 + if col > 0 + execute 'normal '.col.'|' + if searchpair('{', '', '}', 'bW', s:skip_expr) > 0 + let ind = indent('.') + endif + execute 'normal '.ccol.'|' + endif + + " If we got an 'end' on an empty line, find match and indent to its level. + let col = matchend(line, + \'^\s*\(rescue\>\|else\>\|ensure\>\|end\>\|when\>\)') + 1 + if col > 0 + execute 'normal '.col.'|' + "\\|\\|\\|\\|\ + if searchpair('\\|\\|\\|\\|\\|\\|\\|\\|\\|\\|\', + \'\\|\\|\\|\\|\', '\', + \'bW', s:skip_expr) > 0 + let ind = indent('.') + endif + execute 'normal '.clnum.'G'.ccol.'|' + endif + return ind endfunction " vim:sw=2 + From 2ecf592572eddadd5021b18557b320a9c6345e81 Mon Sep 17 00:00:00 2001 From: Nikolai Weibull Date: Wed, 30 Jul 2003 15:06:07 +0000 Subject: [PATCH 004/411] Initial import. This one should work great. --- indent/ruby.vim | 332 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 240 insertions(+), 92 deletions(-) diff --git a/indent/ruby.vim b/indent/ruby.vim index f3b2442f..dd17f1d4 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -6,7 +6,6 @@ " Changes: (since vim 6.1) " - indentation after a line ending in comma, etc, (even in a comment) was " broken, now fixed (2002/08/14) -" TODO: need to indent one level on [ " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -15,23 +14,27 @@ endif let b:did_indent = 1 setlocal indentexpr=GetRubyIndent() -setlocal nolisp -setlocal nosmartindent -setlocal autoindent -setlocal indentkeys+==end,=else,=elsif,=when,=ensure,=rescue,0),==begin,==end +setlocal indentkeys=0{,0},!^F,o,O,e,=end,=elsif,=when,=ensure,=rescue +setlocal indentkeys+=0),0],==begin,==end " Only define the function once. if exists("*GetRubyIndent") finish endif -function s:IsInStringOrComment(line, col) - return synIDattr(synID(a:line, a:col, 0), 'name') =~? 'string\|comment' +" Check if the character at lnum:col is inside a string or ocmment. +function s:IsInStringOrComment(lnum, col) + return synIDattr(synID(a:lnum, a:col, 0), 'name') =~ + \'\' endfunction -let g:ruby_indent_keywords = 'module,class,def,if,for,while,until,else,elsif,'. - \'case,when,unless,begin,ensure,rescue' +" These comma-separated list of words at the beginning of a line add a level +" of indent. +let g:ruby_indent_keywords = 'module,class,def,if,for,while,until,else,' . + \'elsif,case,when,unless,begin,ensure,rescue' +" Build a regular expression from the g:ruby_indent_keywords variable. +" The result is stored in s:ruby_indent_keywords. function s:BuildIndentKeywords() let idx = stridx(g:ruby_indent_keywords, ',') while idx > -1 @@ -54,127 +57,272 @@ function s:BuildIndentKeywords() endfunction call s:BuildIndentKeywords() -let s:continuation_regexp = '[*+/.-]\s*\(#.*\)\=$' -let s:block_regexp = '\({\|\\)\s*\(|\(\h\w*\(,\s*\)\=\)\+|\s*\)\=\(#.*\)\=$' -let s:skip_expr = 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment"' +" Regular expression for continuations. +" XXX: add ( to this list? +let s:continuation_regexp = '[\*+/.,=(-]\s*\(#.*\)\=$' +" Regular expression for blocks. We can't check for {, it's done in another +" place. +let s:block_regexp = '\\s*\(|\(\h\w*\(,\s*\)\=\)\+|\s*\)\=\(#.*\)\=$' + +" Expression used to check whether we should skip a match with searchpair(). +let s:skip_expr = 'synIDattr(synID(line("."), col("."), 0), "name") =~ "\\"' +let s:end_skip_expr = s:skip_expr.' || (expand("") =~ "\\\\|\\\\|\\\\|\\" && getline(".") !~ "^\\s*\\<".expand("")."\\>" && getline(".") !~ expand("")."\\>.*\\")' + +" Find the previous non-blank line which isn't a comment-line or in a comment +" block. +function s:PrevNonBlank(lnum) + let in_block = 0 + let lnum = prevnonblank(a:lnum) + while lnum > 0 + let line = getline(lnum) + if line =~ '^=end$' + let in_block =1 + elseif in_block && line =~ '^=begin$' + let in_block = 0 + elseif !in_block + let line = substitute(line, '\s*#.*$', '', '') + if line !~ '^$' + break + endif + endif + let lnum = prevnonblank(lnum - 1) + endwhile + return lnum +endfunction -" FIXME: with a little reorginization (using returns instead of let ind = -" ...), we could speed things up a bit function GetRubyIndent() + " Part 1: Setup. + " ============== + " Set up variables for restoring position in file. Could use v:lnum here. - let clnum = line('.') - let ccol = col('.') + let vcol = col('.') + + " Part 2: Work on the current line. + " ================================= + + " Get the current line. + let line = getline(v:lnum) + let ind = -1 + + " If we got a closing bracket on an empty line, deindent one level or match + " the column in case of a parentheses. + let col = match(line, '^\s*\zs[]})]') + 1 + if col > 0 && !s:IsInStringOrComment(v:lnum, col) + execute 'normal! 0'.(col - 1).'l' + if line[col - 1] == ')' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0 + let ind = virtcol('.') - 1 + elseif line[col - 1] == '}' + \ && searchpair('{', '', '}', 'bW', s:skip_expr) > 0 + let p_lnum = line('.') + let my_lnum = s:PrevNonBlank(p_lnum - 1) + while my_lnum > 0 + let my_line = getline(my_lnum) + let col = match(my_line, s:continuation_regexp) + 1 + " If the line was a continuation not in a string, and we are currently + " not in a multiline-string, get it's indent and continue to previous + " line. + if col > 0 && !s:IsInStringOrComment(my_lnum, col) + let p_lnum = my_lnum + let my_lnum = s:PrevNonBlank(my_lnum - 1) + " Else, if we are in a multi-line string, continue to previous line. + " TODO: are these offsets correct? + elseif s:IsInStringOrComment(my_lnum, 1) + let my_lnum = s:PrevNonBlank(my_lnum - 1) + " Otherwise, exit the loop + else + let my_lnum = -1 + endif + endwhile + let ind = indent(p_lnum) + elseif && searchpair('\[', '', '\]', 'bW', s:skip_expr) > 0 + let ind = indent('.') + end + execute 'normal! '.v:lnum.'G0'.(vcol - ).'l' + endif + + " If we get a =begin, =end, or here-doc ender set deindent to first column. + " XXX: skip here-docs for the moment: \|EO[FSL]\|EOHELP + let col = match(line, '^\s*\zs\(=begin\|=end\)') + 1 + if col > 0 && !s:IsInStringOrComment(v:lnum, col) + let ind = 0 + endif + + " If we got a deindenting line on an empty line, find match and indent to + " its level. + let col = match(line, + \'^\s*\zs\(ensure\>\|else\>\|rescue\>\|elsif\>\|when\>\|end\>\)') + 1 + if col > 0 && !s:IsInStringOrComment(v:lnum, col) + normal 0 + if searchpair('\\|\\|\\|\\|\\|' . + \'\\|\\|\\|\\|\\|\', + \'\\|\\|\\|\\|\', '\', + \'bW', s:end_skip_expr) > 0 + let ind = indent('.') + endif + execute 'normal! '.v:lnum.'G0'.(vcol - 1).'l' + endif + + if ind != -1 + return ind + elseif s:IsInStringOrComment(v:lnum, matchend(line, '^\s*') + 1) + return indent('.') + endif + + " Part 3: Work on the previous line. + " ================================== " Find a non-blank line above the current line. - let lnum = prevnonblank(v:lnum - 1) + let lnum = s:PrevNonBlank(v:lnum - 1) " At the start of the file use zero indent. if lnum == 0 return 0 endif + " Set up variables for current line. let line = getline(lnum) let ind = indent(lnum) - let did_indent = 0 - let did_end_indent = 0 - - " If the previous line ended with [*+/.-], indent one extra level. - let col = match(line, s:continuation_regexp) + 1 - if col > 0 && !s:IsInStringOrComment(lnum, col) - let ind + &sw - let did_indent = 1 - endif + let did_kw_indent = 0 + let did_con_indent = 0 - " If the previous line ended in a parentheses, get the indent of the line - " that opened it. - let col = matchend(line, '^\s*)') + 1 - if !did_indent && col > 0 - execute 'normal '.lnum.'G'.col.'|' - if searchpair('(', '', ')', 'bW', s:skip_expr) > 0 - let ind = indent('.') - let did_indent = 1 - endif - execute 'normal '.clnum.'G'.ccol.'|' - endif - - " If the previous line ended with an indenting keyword, add one level. - let col = match(line, '^\s*'.s:ruby_indent_keywords) + 1 - if !did_indent && col > 0 || line =~ s:block_regexp + " If the previous line began with an indenting keyword, add one level. + let kcol = match(line, '^\s*'.s:ruby_indent_keywords) + 1 + let bcol = match(line, s:block_regexp) + 1 + if (kcol > 0 && !s:IsInStringOrComment(lnum, kcol)) + \ || (bcol > 0 && !s:IsInStringOrComment(lnum, bcol)) let ind = ind + &sw - let did_indent = 1 - let did_end_indent = 1 + let did_kw_indent = 1 endif - " Otherwise, check if the previous line was a continuation line. - if !did_indent - let my_lnum = prevnonblank(lnum - 1) - if my_lnum > 0 - let my_line = getline(my_lnum) - let my_ind = indent(my_lnum) - - if my_line =~ s:continuation_regexp - let col = match(my_line, s:continuation_regexp) + 1 - if col > 0 && !s:IsInStringOrComment(my_lnum, col) - let ind = my_ind - let did_indent = 1 + " If the previous line ended in a brackets, get the indent of the line + " that opened it. + if !did_kw_indent + let bcol = match(line, + \'[]})]\s*\(\(\\|\\|\\|\\|#\).*\)\=$') + 1 + if bcol > 0 && !s:IsInStringOrComment(lnum, bcol) + execute 'normal! '.lnum.'G0'.(bcol - 1).'l' + let open = '(' + let close = ')' + if line[bcol - 1] == '}' + let open = '{' + let close = '}' + elseif line[bcol - 1] == ']' + let open = '\[' + let close = '\]' + endif + if searchpair(open, '', close, 'bW', s:skip_expr) > 0 + let kcol = match(getline('.'), '^\s*'.s:ruby_indent_keywords) + 1 + if (kcol > 0 && !s:IsInStringOrComment(line('.'), kcol)) + let ind = indent('.') + &sw + let did_kw_indent = 1 + else + let ind = indent('.') + let did_con_indent = 1 endif endif + execute 'normal! '.v:lnum.'G0'.(vcol - 1).'l' endif endif - " If we indented and the line ended with an 'end', decrese indent. - " TODO: make this more intelligent (check with searchpair()) - if did_indent && line =~ '\\s*\(#.*\)\=$' - let ind = ind - &sw + " If the previous line was a continuation line, indent to match its parent. + " TODO: this gets executed a bit too often perhaps (with the string + " checking) + let p_line = line + let p_lnum = lnum + if !did_kw_indent && !did_con_indent + let my_lnum = s:PrevNonBlank(lnum - 1) + while my_lnum > 0 + let my_line = getline(my_lnum) + let col = match(my_line, s:continuation_regexp) + 1 + " If the line was a continuation not in a string, and we are currently + " not in a multiline-string, get it's indent and continue to previous + " line. + if col > 0 && !s:IsInStringOrComment(my_lnum, col) +" TODO: \ && !s:IsInStringOrComment(p_lnum, strlen(p_line)) + let ind = indent(my_lnum) + let p_line = my_line + let p_lnum = my_lnum + let my_lnum = s:PrevNonBlank(my_lnum - 1) + " Else, if we are in a multi-line string, continue to previous line. + elseif s:IsInStringOrComment(my_lnum, 1) + let my_lnum = s:PrevNonBlank(my_lnum - 1) + " Otherwise, exit the loop + else + let my_lnum = -1 + endif + endwhile endif - " Get the current line. - let line = getline(v:lnum) - - " If we are inside a pair of braces, well at least after an opening one. - if 0 < searchpair('(', '', ')', 'bW', s:skip_expr) - let ind = virtcol('.') - execute 'normal '.clnum.'G'.ccol.'|' + " If the previous line ended with [*+/.-=], indent one extra level. + if !did_kw_indent && !did_con_indent + let ccol = match(line, s:continuation_regexp) + 1 + if ccol > 0 && !s:IsInStringOrComment(lnum, ccol) + let ind = ind + &sw + endif endif - " Deindent on a closing ) on an empty line. - let col = matchend(line, '^\s*)') + 1 - if col > 0 - execute 'normal '.col.'|' - if searchpair('(', '', ')', 'bW', s:skip_expr) > 0 - let ind = virtcol('.') - 1 + " If we indented and the line ended with an 'end', decrease indent. + if did_kw_indent + let col = match(line, '\\s*\(#.*\)\=$') + 1 + if col > 0 && !s:IsInStringOrComment(lnum, col) + let ind = ind - &sw endif - execute 'normal '.ccol.'|' endif + " TODO: look over merging the two below somehow (and see what's needed) - " If we got a brace on an empty line, find match and indent to its level. - let col = matchend(line, '^\s*}') + 1 - if col > 0 - execute 'normal '.col.'|' - if searchpair('{', '', '}', 'bW', s:skip_expr) > 0 - let ind = indent('.') + " If the previous line contained an opening bracket, and we are still in it, + " add one level of indent. + let did_virt_indent = 0 + if line =~ '[[({]' + " TODO: hop somewhere? + let my_line = substitute(substitute(substitute(substitute(substitute(line, + \'\\"\|'."\\\\'", '', 'g'), '"[^"]*"', '', 'g'), "'[^']*'", '', 'g'), + \'\W?\S', '', 'g'), '#.*', '', '') + " If we have an opening parentheses, indent to it. + if strlen(substitute(my_line, '[^(]', '', 'g')) + \ > strlen(substitute(my_line, '[^)]', '', 'g')) + \ && searchpair('(', '', ')', 'bW', s:skip_expr) > 0 + let ind = virtcol('.') + let did_virt_indent = 1 + " Or, if we are inside a pair of braces or brackets, add one level. + elseif strridx(substitute(my_line, '{[^}]*}', '', 'g'), '{') > -1 + \ && !s:IsInStringOrComment(lnum, 1) + let ind = ind + &sw + let did_virt_indent = 1 + elseif strridx(substitute(my_line, '\[[^]]*\]', '', 'g'), '[') > -1 + \ && !s:IsInStringOrComment(lnum, 1) + let ind = ind + &sw + let did_virt_indent = 1 endif - execute 'normal '.ccol.'|' + execute 'normal! '.v:lnum.'G0'.(vcol - 1).'l' endif - " If we got an 'end' on an empty line, find match and indent to its level. - let col = matchend(line, - \'^\s*\(rescue\>\|else\>\|ensure\>\|end\>\|when\>\)') + 1 - if col > 0 - execute 'normal '.col.'|' - "\\|\\|\\|\\|\ - if searchpair('\\|\\|\\|\\|\\|\\|\\|\\|\\|\\|\', - \'\\|\\|\\|\\|\', '\', - \'bW', s:skip_expr) > 0 - let ind = indent('.') + " If the far previous line contained an opening bracket, and we are still in + " it, add one level of indent. + if !did_virt_indent && p_line =~ '[[({]' + execute 'normal! '.p_lnum.'G$' + let my_line = substitute(substitute(substitute(substitute(substitute(p_line, + \'\\"\|'."\\\\'", '', 'g'), '"[^"]*"', '', 'g'), "'[^']*'", '', 'g'), + \'\W?\S', '', 'g'), '#.*', '', '') + " If we have an opening parentheses, indent to it. + if strlen(substitute(my_line, '[^(]', '', 'g')) + \ > strlen(substitute(my_line, '[^)]', '', 'g')) + \ && searchpair('(', '', ')', 'bW', s:skip_expr) > 0 + let ind = virtcol('.') + " Or, if we are inside a pair of braces or brackets, add one level. + elseif strridx(substitute(my_line, '{[^}]*}', '', 'g'), '{') > -1 + \ && !s:IsInStringOrComment(lnum, 1) + let ind = ind + &sw + elseif strridx(substitute(my_line, '\[[^]]*\]', '', 'g'), '[') > -1 + \ && !s:IsInStringOrComment(lnum, 1) + let ind = ind + &sw endif - execute 'normal '.clnum.'G'.ccol.'|' + execute 'normal! '.v:lnum.'G0'.(vcol - 1).'l' endif return ind endfunction " vim:sw=2 - From af16b0f5e6e5579fe635766996e061c42d11af8e Mon Sep 17 00:00:00 2001 From: Nikolai Weibull Date: Wed, 30 Jul 2003 18:45:14 +0000 Subject: [PATCH 005/411] Small changes to fix obscure indentation issues. --- indent/ruby.vim | 44 +++++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/indent/ruby.vim b/indent/ruby.vim index dd17f1d4..8eec2ac4 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -22,12 +22,20 @@ if exists("*GetRubyIndent") finish endif -" Check if the character at lnum:col is inside a string or ocmment. +" Check if the character at lnum:col is inside a string or comment. function s:IsInStringOrComment(lnum, col) return synIDattr(synID(a:lnum, a:col, 0), 'name') =~ \'\' endfunction +" Check if the character at lnum:col is inside a string or ocmment. +" Works like s:IsInStringOrComment(), with the difference that string-delimits +" are not matched. +function s:IsInStringOrComment2(lnum, col) + return synIDattr(synID(a:lnum, a:col, 0), 'name') =~ + \'\' +endfunction + " These comma-separated list of words at the beginning of a line add a level " of indent. let g:ruby_indent_keywords = 'module,class,def,if,for,while,until,else,' . @@ -76,15 +84,17 @@ function s:PrevNonBlank(lnum) let lnum = prevnonblank(a:lnum) while lnum > 0 let line = getline(lnum) - if line =~ '^=end$' - let in_block =1 + " If the line is the end of an embedded document, beginning skipping. + if !in_block && line =~ '^=end$' + let in_block = 1 + " Else, if the line is the beginning of an embedded document, end + " skipping. elseif in_block && line =~ '^=begin$' let in_block = 0 - elseif !in_block - let line = substitute(line, '\s*#.*$', '', '') - if line !~ '^$' - break - endif + " Otherwise, if we aren't in an embedded document, check if the line is a + " comment line, and, if so, skip it. + elseif !in_block && line !~ '^\s*#.*$' + break endif let lnum = prevnonblank(lnum - 1) endwhile @@ -110,8 +120,11 @@ function GetRubyIndent() let col = match(line, '^\s*\zs[]})]') + 1 if col > 0 && !s:IsInStringOrComment(v:lnum, col) execute 'normal! 0'.(col - 1).'l' + " If it was a parentheses, search for its match and indent to its level. if line[col - 1] == ')' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0 let ind = virtcol('.') - 1 + " Else, if it was a brace, search for its match and find the line to which + " it belongs and indent to that lines level. elseif line[col - 1] == '}' \ && searchpair('{', '', '}', 'bW', s:skip_expr) > 0 let p_lnum = line('.') @@ -135,14 +148,16 @@ function GetRubyIndent() endif endwhile let ind = indent(p_lnum) - elseif && searchpair('\[', '', '\]', 'bW', s:skip_expr) > 0 + " Otherwise, it was a bracket, so search for it and indent to the matching + " lines level. + elseif searchpair('\[', '', '\]', 'bW', s:skip_expr) > 0 let ind = indent('.') end execute 'normal! '.v:lnum.'G0'.(vcol - ).'l' endif " If we get a =begin, =end, or here-doc ender set deindent to first column. - " XXX: skip here-docs for the moment: \|EO[FSL]\|EOHELP + " XXX: skip here-docs at the moment: \|EO[FSL]\|EOHELP let col = match(line, '^\s*\zs\(=begin\|=end\)') + 1 if col > 0 && !s:IsInStringOrComment(v:lnum, col) let ind = 0 @@ -154,6 +169,7 @@ function GetRubyIndent() \'^\s*\zs\(ensure\>\|else\>\|rescue\>\|elsif\>\|when\>\|end\>\)') + 1 if col > 0 && !s:IsInStringOrComment(v:lnum, col) normal 0 + " Find the matching parent statement to it if searchpair('\\|\\|\\|\\|\\|' . \'\\|\\|\\|\\|\\|\', \'\\|\\|\\|\\|\', '\', @@ -163,9 +179,14 @@ function GetRubyIndent() execute 'normal! '.v:lnum.'G0'.(vcol - 1).'l' endif + " If we got some indentation, use it if ind != -1 return ind - elseif s:IsInStringOrComment(v:lnum, matchend(line, '^\s*') + 1) + " Otherwise, check if we are in a multi-line string or line-comment and, if + " so, skip it. + " TODO: this needs more checking though + elseif s:IsInStringOrComment2(v:lnum, matchend(line, '^\s*') + 1) + \ || s:IsInStringOrComment2(v:lnum - 1, strlen(getline(v:lnum - 1))) return indent('.') endif @@ -197,6 +218,7 @@ function GetRubyIndent() " If the previous line ended in a brackets, get the indent of the line " that opened it. + " TODO: add comments to this part if !did_kw_indent let bcol = match(line, \'[]})]\s*\(\(\\|\\|\\|\\|#\).*\)\=$') + 1 From 9f8fdbc8cda5cd8fa1c89c57abbb7ab56b098fd7 Mon Sep 17 00:00:00 2001 From: Nikolai Weibull Date: Thu, 31 Jul 2003 14:31:17 +0000 Subject: [PATCH 006/411] Speed-up fix and multi-line string handling. --- indent/ruby.vim | 45 +++++++++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/indent/ruby.vim b/indent/ruby.vim index 8eec2ac4..b18de029 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -101,6 +101,15 @@ function s:PrevNonBlank(lnum) return lnum endfunction +" Move the cursor to the given line:col. +function s:GotoLineCol(line, col) + if a:col != 0 + execute 'normal! '.a:line.'G0'.a:col.'l' + else + execute 'normal! '.a:line.'G0' + endif +endfunction + function GetRubyIndent() " Part 1: Setup. " ============== @@ -119,7 +128,7 @@ function GetRubyIndent() " the column in case of a parentheses. let col = match(line, '^\s*\zs[]})]') + 1 if col > 0 && !s:IsInStringOrComment(v:lnum, col) - execute 'normal! 0'.(col - 1).'l' + call s:GotoLineCol(v:lnum, col - 1) " If it was a parentheses, search for its match and indent to its level. if line[col - 1] == ')' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0 let ind = virtcol('.') - 1 @@ -153,7 +162,7 @@ function GetRubyIndent() elseif searchpair('\[', '', '\]', 'bW', s:skip_expr) > 0 let ind = indent('.') end - execute 'normal! '.v:lnum.'G0'.(vcol - ).'l' + call s:GotoLineCol(v:lnum, vcol - 1) endif " If we get a =begin, =end, or here-doc ender set deindent to first column. @@ -168,7 +177,7 @@ function GetRubyIndent() let col = match(line, \'^\s*\zs\(ensure\>\|else\>\|rescue\>\|elsif\>\|when\>\|end\>\)') + 1 if col > 0 && !s:IsInStringOrComment(v:lnum, col) - normal 0 + call s:GotoLineCol(v:lnum, 0) " Find the matching parent statement to it if searchpair('\\|\\|\\|\\|\\|' . \'\\|\\|\\|\\|\\|\', @@ -176,7 +185,7 @@ function GetRubyIndent() \'bW', s:end_skip_expr) > 0 let ind = indent('.') endif - execute 'normal! '.v:lnum.'G0'.(vcol - 1).'l' + call s:GotoLineCol(v:lnum, vcol - 1) endif " If we got some indentation, use it @@ -186,7 +195,6 @@ function GetRubyIndent() " so, skip it. " TODO: this needs more checking though elseif s:IsInStringOrComment2(v:lnum, matchend(line, '^\s*') + 1) - \ || s:IsInStringOrComment2(v:lnum - 1, strlen(getline(v:lnum - 1))) return indent('.') endif @@ -196,6 +204,18 @@ function GetRubyIndent() " Find a non-blank line above the current line. let lnum = s:PrevNonBlank(v:lnum - 1) + " Ignore multi-line strings + " TODO: check this positioning + " TODO: is it necessary to check both ends? + while lnum > 0 + if s:IsInStringOrComment(lnum, 1) && + \ s:IsInStringOrComment(lnum, strlen(getline(lnum))) + let lnum = s:PrevNonBlank(lnum - 1) + else + break + endif + endwhile + " At the start of the file use zero indent. if lnum == 0 return 0 @@ -223,7 +243,7 @@ function GetRubyIndent() let bcol = match(line, \'[]})]\s*\(\(\\|\\|\\|\\|#\).*\)\=$') + 1 if bcol > 0 && !s:IsInStringOrComment(lnum, bcol) - execute 'normal! '.lnum.'G0'.(bcol - 1).'l' + call s:GotoLineCol(lnum, bcol - 1) let open = '(' let close = ')' if line[bcol - 1] == '}' @@ -243,7 +263,7 @@ function GetRubyIndent() let did_con_indent = 1 endif endif - execute 'normal! '.v:lnum.'G0'.(vcol - 1).'l' + call s:GotoLineCol(v:lnum, vcol - 1) endif endif @@ -260,14 +280,14 @@ function GetRubyIndent() " If the line was a continuation not in a string, and we are currently " not in a multiline-string, get it's indent and continue to previous " line. - if col > 0 && !s:IsInStringOrComment(my_lnum, col) -" TODO: \ && !s:IsInStringOrComment(p_lnum, strlen(p_line)) + if (col > 0 && !s:IsInStringOrComment(my_lnum, col)) +" \ && !s:IsInStringOrComment(p_lnum, strlen(p_line)) let ind = indent(my_lnum) let p_line = my_line let p_lnum = my_lnum let my_lnum = s:PrevNonBlank(my_lnum - 1) " Else, if we are in a multi-line string, continue to previous line. - elseif s:IsInStringOrComment(my_lnum, 1) + elseif s:IsInStringOrComment(my_lnum, strlen(my_line)) let my_lnum = s:PrevNonBlank(my_lnum - 1) " Otherwise, exit the loop else @@ -318,12 +338,13 @@ function GetRubyIndent() let ind = ind + &sw let did_virt_indent = 1 endif - execute 'normal! '.v:lnum.'G0'.(vcol - 1).'l' + call s:GotoLineCol(v:lnum, vcol - 1) endif " If the far previous line contained an opening bracket, and we are still in " it, add one level of indent. if !did_virt_indent && p_line =~ '[[({]' + " TODO: use s:GotoLineCol() execute 'normal! '.p_lnum.'G$' let my_line = substitute(substitute(substitute(substitute(substitute(p_line, \'\\"\|'."\\\\'", '', 'g'), '"[^"]*"', '', 'g'), "'[^']*'", '', 'g'), @@ -341,7 +362,7 @@ function GetRubyIndent() \ && !s:IsInStringOrComment(lnum, 1) let ind = ind + &sw endif - execute 'normal! '.v:lnum.'G0'.(vcol - 1).'l' + call s:GotoLineCol(v:lnum, vcol - 1) endif return ind From 89d42aea8a41ee5f738107378c2f81eb4d887ad7 Mon Sep 17 00:00:00 2001 From: Nikolai Weibull Date: Thu, 31 Jul 2003 18:17:09 +0000 Subject: [PATCH 007/411] Fixed a bug with array collectors in block variable specs, e.g. foo.each do |k, *v| ... end. --- indent/ruby.vim | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/indent/ruby.vim b/indent/ruby.vim index b18de029..440a4da8 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -25,7 +25,8 @@ endif " Check if the character at lnum:col is inside a string or comment. function s:IsInStringOrComment(lnum, col) return synIDattr(synID(a:lnum, a:col, 0), 'name') =~ - \'\' + \'\' endfunction " Check if the character at lnum:col is inside a string or ocmment. @@ -71,10 +72,10 @@ let s:continuation_regexp = '[\*+/.,=(-]\s*\(#.*\)\=$' " Regular expression for blocks. We can't check for {, it's done in another " place. -let s:block_regexp = '\\s*\(|\(\h\w*\(,\s*\)\=\)\+|\s*\)\=\(#.*\)\=$' +let s:block_regexp = '\\s*\(|\(\*\=\h\w*\(,\s*\)\=\)\+|\s*\)\=\(#.*\)\=$' " Expression used to check whether we should skip a match with searchpair(). -let s:skip_expr = 'synIDattr(synID(line("."), col("."), 0), "name") =~ "\\"' +let s:skip_expr = 'synIDattr(synID(line("."), col("."), 0), "name") =~ "\\"' let s:end_skip_expr = s:skip_expr.' || (expand("") =~ "\\\\|\\\\|\\\\|\\" && getline(".") !~ "^\\s*\\<".expand("")."\\>" && getline(".") !~ expand("")."\\>.*\\")' " Find the previous non-blank line which isn't a comment-line or in a comment From 26bde71457264de1cf83e866c97999c0aa86431b Mon Sep 17 00:00:00 2001 From: Gavin Sinclair Date: Wed, 6 Aug 2003 14:37:49 +0000 Subject: [PATCH 008/411] Included licence, disclaimer, $, credit, website --- indent/ruby.vim | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/indent/ruby.vim b/indent/ruby.vim index 440a4da8..2625d566 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -1,11 +1,17 @@ " Vim indent file " Language: Ruby -" Maintainer: Gavin Sinclair -" Last Change: 2003 May 11 -" URL: www.soyabean.com.au/gavin/vim/index.html -" Changes: (since vim 6.1) -" - indentation after a line ending in comma, etc, (even in a comment) was -" broken, now fixed (2002/08/14) +" Maintainer: Gavin Sinclair +" Developer: Nikolai Weibull +" Info: $Header: /var/cvs/vim-ruby/vim-ruby/indent/ruby.vim,v 1.7 2003/08/06 14:37:49 gsinclair Exp $ +" URL: http://vim-ruby.sourceforge.net +" Anon CVS: See above site +" Licence: GPL (http://www.gnu.org) +" Disclaimer: +" This program is distributed in the hope that it will be useful, +" but WITHOUT ANY WARRANTY; without even the implied warranty of +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +" GNU General Public License for more details. +" ---------------------------------------------------------------------------- " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -29,7 +35,7 @@ function s:IsInStringOrComment(lnum, col) \'\|Documentation\)\>' endfunction -" Check if the character at lnum:col is inside a string or ocmment. +" Check if the character at lnum:col is inside a string or comment. " Works like s:IsInStringOrComment(), with the difference that string-delimits " are not matched. function s:IsInStringOrComment2(lnum, col) @@ -367,6 +373,6 @@ function GetRubyIndent() endif return ind -endfunction +endfunction " GetRubyIndent() " vim:sw=2 From 28f7dfb63e2add5dd1f3f7e75a9703c82ad20b9f Mon Sep 17 00:00:00 2001 From: Gavin Sinclair Date: Wed, 6 Aug 2003 14:38:53 +0000 Subject: [PATCH 009/411] Changed $ to $ --- indent/ruby.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indent/ruby.vim b/indent/ruby.vim index 2625d566..d9df1672 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -2,7 +2,7 @@ " Language: Ruby " Maintainer: Gavin Sinclair " Developer: Nikolai Weibull -" Info: $Header: /var/cvs/vim-ruby/vim-ruby/indent/ruby.vim,v 1.7 2003/08/06 14:37:49 gsinclair Exp $ +" Info: $Id: ruby.vim,v 1.8 2003/08/06 14:38:53 gsinclair Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) From 9c181d354b8739c21646df2c8607bb9f39e0c0c9 Mon Sep 17 00:00:00 2001 From: Gavin Sinclair Date: Wed, 6 Aug 2003 14:41:41 +0000 Subject: [PATCH 010/411] Included licence, disclaimer, $, website --- ftplugin/ruby.vim | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index e21afeee..f7974949 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,8 +1,16 @@ " Vim filetype plugin -" Language: Ruby -" Maintainer: Gavin Sinclair -" Last Change: 2002/08/12 -" URL: www.soyabean.com.au/gavin/vim/index.html +" Language: Ruby +" Maintainer: Gavin Sinclair +" Info: $Id: ruby.vim,v 1.2 2003/08/06 14:41:41 gsinclair Exp $ +" URL: http://vim-ruby.sourceforge.net +" Anon CVS: See above site +" Licence: GPL (http://www.gnu.org) +" Disclaimer: +" This program is distributed in the hope that it will be useful, +" but WITHOUT ANY WARRANTY; without even the implied warranty of +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +" GNU General Public License for more details. +" ---------------------------------------------------------------------------- " Only do this when not done yet for this buffer if (exists("b:did_ftplugin")) From 70f59f079a05c1972963b9c55f67c4cc9ed1f8b7 Mon Sep 17 00:00:00 2001 From: Gavin Sinclair Date: Wed, 6 Aug 2003 14:46:50 +0000 Subject: [PATCH 011/411] Included licence, disclaimer, $, website --- compiler/ruby.vim | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/compiler/ruby.vim b/compiler/ruby.vim index 7bac74d9..7ca7bbbf 100644 --- a/compiler/ruby.vim +++ b/compiler/ruby.vim @@ -1,7 +1,17 @@ " Vim compiler file -" Compiler: Ruby syntax check and/or error reporting +" Language: Ruby +" Function: Syntax check and/or error reporting " Maintainer: Tim Hammerquist -" Last Change: Tue Jul 16 00:38:00 PDT 2002 +" Info: $Id: ruby.vim,v 1.2 2003/08/06 14:46:50 gsinclair Exp $ +" URL: http://vim-ruby.sourceforge.net +" Anon CVS: See above site +" Licence: GPL (http://www.gnu.org) +" Disclaimer: +" This program is distributed in the hope that it will be useful, +" but WITHOUT ANY WARRANTY; without even the implied warranty of +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +" GNU General Public License for more details. +" ---------------------------------------------------------------------------- " " Changelog: " 0.2: script saves and restores 'cpoptions' value to prevent problems with @@ -22,6 +32,7 @@ " This is my first experience with 'errorformat' and compiler plugins and " I welcome any input from more experienced (or clearer-thinking) " individuals. +" ---------------------------------------------------------------------------- if exists("current_compiler") finish From 31ae2b007801753e5342e488f0c0aa9f96f64a4f Mon Sep 17 00:00:00 2001 From: Gavin Sinclair Date: Wed, 6 Aug 2003 14:54:12 +0000 Subject: [PATCH 012/411] Included licence, disclaimer, $, website --- syntax/ruby.vim | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/syntax/ruby.vim b/syntax/ruby.vim index e12b3f3c..efa70780 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,13 +1,20 @@ " Vim syntax file -" Language: Ruby -" Maintainer: Doug Kearns +" Language: Ruby +" Maintainer: Doug Kearns +" Info: $Id: ruby.vim,v 1.2 2003/08/06 14:54:12 gsinclair Exp $ +" URL: http://vim-ruby.sourceforge.net +" Anon CVS: See above site +" Licence: GPL (http://www.gnu.org) +" Disclaimer: +" This program is distributed in the hope that it will be useful, +" but WITHOUT ANY WARRANTY; without even the implied warranty of +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +" GNU General Public License for more details. +" ---------------------------------------------------------------------------- +" " Previous Maintainer: Mirko Nasato -" Last Change: 2003 May 31 -" URL: http://mugca.its.monash.edu.au/~djkea2/vim/syntax/ruby.vim - -" $Id: ruby.vim,v 1.1 2003/07/27 08:42:16 gsinclair Exp $ - " Thanks to perl.vim authors, and to Reimer Behrends. :-) (MN) +" ---------------------------------------------------------------------------- " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded From de95f08de2db1edfa745bf989c9baabc6ff5230e Mon Sep 17 00:00:00 2001 From: Gavin Sinclair Date: Sat, 9 Aug 2003 04:55:58 +0000 Subject: [PATCH 013/411] Converted files to unix format --- compiler/ruby.vim | 4 ++-- ftplugin/ruby.vim | 4 +++- indent/ruby.vim | 4 ++-- syntax/ruby.vim | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/compiler/ruby.vim b/compiler/ruby.vim index 7ca7bbbf..9358d01d 100644 --- a/compiler/ruby.vim +++ b/compiler/ruby.vim @@ -2,7 +2,7 @@ " Language: Ruby " Function: Syntax check and/or error reporting " Maintainer: Tim Hammerquist -" Info: $Id: ruby.vim,v 1.2 2003/08/06 14:46:50 gsinclair Exp $ +" Info: $Id: ruby.vim,v 1.3 2003/08/09 04:55:58 gsinclair Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -66,4 +66,4 @@ setlocal errorformat= let &cpo = s:cpo_save unlet s:cpo_save -" vim: ft=vim +" vim: ft=vim ff=unix diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index f7974949..ad35a487 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.2 2003/08/06 14:41:41 gsinclair Exp $ +" Info: $Id: ruby.vim,v 1.3 2003/08/09 04:55:58 gsinclair Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -20,3 +20,5 @@ let b:did_ftplugin = 1 " There are no known setting particularly appropriate for Ruby. Please " contact the maintainer if you think of some. + +" vim: ff=unix diff --git a/indent/ruby.vim b/indent/ruby.vim index d9df1672..5a35d72e 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -2,7 +2,7 @@ " Language: Ruby " Maintainer: Gavin Sinclair " Developer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.8 2003/08/06 14:38:53 gsinclair Exp $ +" Info: $Id: ruby.vim,v 1.9 2003/08/09 04:55:58 gsinclair Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -375,4 +375,4 @@ function GetRubyIndent() return ind endfunction " GetRubyIndent() -" vim:sw=2 +" vim:sw=2 ff=unix diff --git a/syntax/ruby.vim b/syntax/ruby.vim index efa70780..039cf617 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.2 2003/08/06 14:54:12 gsinclair Exp $ +" Info: $Id: ruby.vim,v 1.3 2003/08/09 04:55:58 gsinclair Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -289,4 +289,4 @@ endif let b:current_syntax = "ruby" -" vim: nowrap tabstop=8 +" vim: nowrap tabstop=8 ff=unix From 6c831d98f87e83622ca1e50713b81d7fd165adc0 Mon Sep 17 00:00:00 2001 From: Tim Hammerquist Date: Wed, 13 Aug 2003 17:38:11 +0000 Subject: [PATCH 014/411] Fixed URL and email --- compiler/ruby.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/ruby.vim b/compiler/ruby.vim index 9358d01d..71e27764 100644 --- a/compiler/ruby.vim +++ b/compiler/ruby.vim @@ -1,9 +1,9 @@ " Vim compiler file " Language: Ruby " Function: Syntax check and/or error reporting -" Maintainer: Tim Hammerquist -" Info: $Id: ruby.vim,v 1.3 2003/08/09 04:55:58 gsinclair Exp $ -" URL: http://vim-ruby.sourceforge.net +" Maintainer: Tim Hammerquist +" Info: $Id: ruby.vim,v 1.4 2003/08/13 17:38:11 saiyix Exp $ +" URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) " Disclaimer: From cbe5e058fd58a8e457234c747a5f8018719e7e75 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 16 Aug 2003 12:09:24 +0000 Subject: [PATCH 015/411] string expression substitution of class variables does not require braces --- ChangeLog | 5 +++++ syntax/ruby.vim | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 ChangeLog diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 00000000..43740e87 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,5 @@ +2003-08-16 Doug Kearns + + * 18944: syntax/ruby.vim: string expression substitution of class + variables does not require braces. + diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 039cf617..3ee2af30 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.3 2003/08/09 04:55:58 gsinclair Exp $ +" Info: $Id: ruby.vim,v 1.4 2003/08/16 12:09:24 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -27,7 +27,7 @@ endif " Expression Substitution and Backslash Notation syn match rubyExprSubst "\\\\\|\(\(\\M-\\C-\|\\c\|\\C-\|\\M-\)\w\)\|\(\\\o\{3}\|\\x\x\{2}\|\\[abefnrstv]\)" contained syn match rubyExprSubst "#{[^}]*}" contained -syn match rubyExprSubst "#[$@]\w\+" contained +syn match rubyExprSubst "#\(\$\|@@\=\)\w\+" contained " Numbers and ASCII Codes syn match rubyNumber "\w\@ Date: Mon, 18 Aug 2003 08:21:08 +0000 Subject: [PATCH 016/411] allow for, while and until loop bodies to contain do...end blocks --- ChangeLog | 10 ++++++++-- syntax/ruby.vim | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 43740e87..59cec6f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ +2003-08-18 Doug Kearns + + * syntax/ruby.vim: allow for, while and until loop bodies to contain + do...end and {...} blocks - rubyOptDoBlock should contain rubyDoBlock + and rubyCurlyBlock. + 2003-08-16 Doug Kearns - * 18944: syntax/ruby.vim: string expression substitution of class - variables does not require braces. + * syntax/ruby.vim: string expression substitution of class variables + does not require braces. diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 3ee2af30..20ee0d77 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.4 2003/08/16 12:09:24 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.5 2003/08/18 08:21:08 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -196,7 +196,7 @@ if !exists("ruby_no_expensive") syn region rubyNoDoBlock matchgroup=rubyControl start="\<\(case\|begin\)\>" start="^\s*\(if\|unless\)\>" start=";\s*\(if\|unless\)\>"hs=s+1 end="\" contains=ALLBUT,rubyExprSubst,rubyTodo fold " statement with optional *do* - syn region rubyOptDoBlock matchgroup=rubyControl start="\" start="^\s*\(while\|until\)\>" start=";\s*\(while\|until\)\>"hs=s+1 end="\" contains=ALLBUT,rubyExprSubst,rubyTodo,rubyDoBlock,rubyCurlyBlock fold + syn region rubyOptDoBlock matchgroup=rubyControl start="\" start="^\s*\(while\|until\)\>" start=";\s*\(while\|until\)\>"hs=s+1 end="\" contains=ALLBUT,rubyExprSubst,rubyTodo fold if !exists("ruby_minlines") let ruby_minlines = 50 From a076204772084e192ca522aeccdc5bcc6e7b56c4 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Mon, 18 Aug 2003 09:52:48 +0000 Subject: [PATCH 017/411] retab the header sections --- ChangeLog | 6 ++++++ compiler/ruby.vim | 18 +++++++++--------- ftplugin/ruby.vim | 12 ++++++------ indent/ruby.vim | 14 +++++++------- syntax/ruby.vim | 14 +++++++------- 5 files changed, 35 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index 59cec6f5..724b3e5c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-08-18 Doug Kearns + + * compiler/ruby.vim, ftplugin/ruby.vim, indent/ruby.vim, + syntax/ruby.vim: retab the header section - Bram prefers as many TAB + characters as possible. + 2003-08-18 Doug Kearns * syntax/ruby.vim: allow for, while and until loop bodies to contain diff --git a/compiler/ruby.vim b/compiler/ruby.vim index 71e27764..c3cd38b1 100644 --- a/compiler/ruby.vim +++ b/compiler/ruby.vim @@ -1,17 +1,17 @@ " Vim compiler file " Language: Ruby -" Function: Syntax check and/or error reporting -" Maintainer: Tim Hammerquist -" Info: $Id: ruby.vim,v 1.4 2003/08/13 17:38:11 saiyix Exp $ -" URL: http://vim-ruby.rubyforge.org -" Anon CVS: See above site -" Licence: GPL (http://www.gnu.org) -" Disclaimer: +" Function: Syntax check and/or error reporting +" Maintainer: Tim Hammerquist +" Info: $Id: ruby.vim,v 1.5 2003/08/18 09:52:48 dkearns Exp $ +" URL: http://vim-ruby.rubyforge.org +" Anon CVS: See above site +" Licence: GPL (http://www.gnu.org) +" Disclaimer: " This program is distributed in the hope that it will be useful, " but WITHOUT ANY WARRANTY; without even the implied warranty of " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the " GNU General Public License for more details. -" ---------------------------------------------------------------------------- +" ---------------------------------------------------------------------------- " " Changelog: " 0.2: script saves and restores 'cpoptions' value to prevent problems with @@ -32,7 +32,7 @@ " This is my first experience with 'errorformat' and compiler plugins and " I welcome any input from more experienced (or clearer-thinking) " individuals. -" ---------------------------------------------------------------------------- +" ---------------------------------------------------------------------------- if exists("current_compiler") finish diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index ad35a487..b77128c3 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,16 +1,16 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.3 2003/08/09 04:55:58 gsinclair Exp $ -" URL: http://vim-ruby.sourceforge.net -" Anon CVS: See above site -" Licence: GPL (http://www.gnu.org) -" Disclaimer: +" Info: $Id: ruby.vim,v 1.4 2003/08/18 09:52:48 dkearns Exp $ +" URL: http://vim-ruby.sourceforge.net +" Anon CVS: See above site +" Licence: GPL (http://www.gnu.org) +" Disclaimer: " This program is distributed in the hope that it will be useful, " but WITHOUT ANY WARRANTY; without even the implied warranty of " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the " GNU General Public License for more details. -" ---------------------------------------------------------------------------- +" ---------------------------------------------------------------------------- " Only do this when not done yet for this buffer if (exists("b:did_ftplugin")) diff --git a/indent/ruby.vim b/indent/ruby.vim index 5a35d72e..d54f12e5 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -1,17 +1,17 @@ " Vim indent file " Language: Ruby " Maintainer: Gavin Sinclair -" Developer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.9 2003/08/09 04:55:58 gsinclair Exp $ -" URL: http://vim-ruby.sourceforge.net -" Anon CVS: See above site -" Licence: GPL (http://www.gnu.org) -" Disclaimer: +" Developer: Nikolai Weibull +" Info: $Id: ruby.vim,v 1.10 2003/08/18 09:52:48 dkearns Exp $ +" URL: http://vim-ruby.sourceforge.net +" Anon CVS: See above site +" Licence: GPL (http://www.gnu.org) +" Disclaimer: " This program is distributed in the hope that it will be useful, " but WITHOUT ANY WARRANTY; without even the implied warranty of " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the " GNU General Public License for more details. -" ---------------------------------------------------------------------------- +" ---------------------------------------------------------------------------- " Only load this indent file when no other was loaded. if exists("b:did_indent") diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 20ee0d77..04a5f94e 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,20 +1,20 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.5 2003/08/18 08:21:08 dkearns Exp $ -" URL: http://vim-ruby.sourceforge.net -" Anon CVS: See above site -" Licence: GPL (http://www.gnu.org) -" Disclaimer: +" Info: $Id: ruby.vim,v 1.6 2003/08/18 09:52:48 dkearns Exp $ +" URL: http://vim-ruby.sourceforge.net +" Anon CVS: See above site +" Licence: GPL (http://www.gnu.org) +" Disclaimer: " This program is distributed in the hope that it will be useful, " but WITHOUT ANY WARRANTY; without even the implied warranty of " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the " GNU General Public License for more details. -" ---------------------------------------------------------------------------- +" ---------------------------------------------------------------------------- " " Previous Maintainer: Mirko Nasato " Thanks to perl.vim authors, and to Reimer Behrends. :-) (MN) -" ---------------------------------------------------------------------------- +" ---------------------------------------------------------------------------- " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded From b6e96af0b12aa200e4b0c7cdf83dd3032d5e6f6f Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 21 Aug 2003 08:09:57 +0000 Subject: [PATCH 018/411] create Special Methods section and add ruby_no_special_methods variable --- ChangeLog | 8 +++++++ syntax/ruby.vim | 61 ++++++++++++++++++++++++++----------------------- 2 files changed, 41 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index 724b3e5c..58cb1cb9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2003-08-21 Doug Kearns + + * syntax/ruby.vim: no longer match NotImplementError as a predefined + global constant; move rubyTodo to the Comments and Documentation + section; create a Special Methods section and add the + ruby_no_special_methods variable to allow the highlighting of these + 'special' methods to be disabled. + 2003-08-18 Doug Kearns * compiler/ruby.vim, ftplugin/ruby.vim, indent/ruby.vim, diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 04a5f94e..6833eeea 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.6 2003/08/18 09:52:48 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.7 2003/08/21 08:09:57 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -33,7 +33,7 @@ syn match rubyExprSubst "#\(\$\|@@\=\)\w\+" contained syn match rubyNumber "\w\@" -" Identifiers - constant, class and instance, global, symbol, iterator, predefined +" Identifiers syn match rubyLocalVariableOrMethod "[_[:lower:]][_[:alnum:]]*[?!=]\=" transparent contains=NONE if !exists("ruby_no_identifiers") @@ -49,11 +49,12 @@ if !exists("ruby_no_identifiers") syn match rubyPredefinedVariable "$\(defout\|stderr\|stdin\|stdout\)\>" syn match rubyPredefinedVariable "$\(DEBUG\|FILENAME\|KCODE\|LOAD_PATH\|SAFE\|VERBOSE\)\>" syn match rubyPredefinedConstant "__\(FILE\|LINE\)__\>" - syn match rubyPredefinedConstant "\<\(::\)\=\zs\(MatchingData\|NotImplementError\|ARGF\|ARGV\|ENV\)\>" + syn match rubyPredefinedConstant "\<\(::\)\=\zs\(MatchingData\|ARGF\|ARGV\|ENV\)\>" syn match rubyPredefinedConstant "\<\(::\)\=\zs\(DATA\|FALSE\|NIL\|RUBY_PLATFORM\|RUBY_RELEASE_DATE\)\>" syn match rubyPredefinedConstant "\<\(::\)\=\zs\(RUBY_VERSION\|STDERR\|STDIN\|STDOUT\|TOPLEVEL_BINDING\|TRUE\)\>" "Obsolete Global Constants - "syn match rubyPredefinedConstant "\<\(::\)\=\zs\(PLATFORM\|RELEASE\|VERSION\)\>" + "syn match rubyPredefinedConstant "\<\(::\)\=\zs\(PLATFORM\|RELEASE_DATE\|VERSION\)\>" + "syn match rubyPredefinedConstant "\<\(::\)\=\zs\(NotImplementError\)\>" endif " @@ -164,15 +165,15 @@ if version < 600 syn region rubyString matchgroup=rubyStringDelimit start=+<<\(EOF\|'EOF'\|"EOF"\|`EOF`\)+hs=s+2 end=+^EOF$+ contains=rubyExprSubst fold syn region rubyString matchgroup=rubyStringDelimit start=+<<\(EOS\|'EOS'\|"EOS"\|`EOS`\)+hs=s+2 end=+^EOS$+ contains=rubyExprSubst fold else - syn region rubyString matchgroup=rubyStringDelimit start=+\(class\s*\)\@"he=e-1 oneline fold syn keyword rubyControl case begin do for if unless while until end -endif " Expensive? +endif " Keywords -syn keyword rubyControl then else elsif when ensure rescue -syn keyword rubyControl and or not in loop -syn keyword rubyControl break redo retry next return -syn match rubyKeyword "\" -syn keyword rubyInclude load require -syn keyword rubyTodo FIXME NOTE TODO XXX contained -syn keyword rubyBoolean true false self nil -syn keyword rubyException raise fail catch throw -syn keyword rubyBeginEnd BEGIN END +syn keyword rubyControl and break else elsif ensure in next not or redo rescue retry return then when +syn match rubyKeyword "\" + syn keyword rubyInclude load require + syn keyword rubyControl loop + syn keyword rubyException raise fail catch throw + syn keyword rubyKeyword lambda proc +endif " Comments and Documentation if version < 600 @@ -228,8 +232,9 @@ if version < 600 else syn match rubySharpBang "\%^#!.*" endif -syn match rubyComment "#.*" contains=rubyTodo -syn region rubyDocumentation start="^=begin" end="^=end.*$" contains=rubyTodo fold +syn keyword rubyTodo FIXME NOTE TODO XXX contained +syn match rubyComment "#.*" contains=rubyTodo +syn region rubyDocumentation start="^=begin" end="^=end.*$" contains=rubyTodo fold " Note: this is a hack to prevent 'keywords' being highlighted as such when used as method names syn match rubyKeywordAsMethod "\.\@" transparent contains=NONE From e48a441127eef6d945ba5feccf3a9ac2a7801e94 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 21 Aug 2003 14:19:53 +0000 Subject: [PATCH 019/411] add support for access control methods (public, protected and private) --- ChangeLog | 5 +++++ syntax/ruby.vim | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 58cb1cb9..4d90ec52 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-08-21 Doug Kearns + + * syntax/ruby.vim: add access control methods (public, protected and + private) to a new rubyAccess syntax group. + 2003-08-21 Doug Kearns * syntax/ruby.vim: no longer match NotImplementError as a predefined diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 6833eeea..66a62892 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.7 2003/08/21 08:09:57 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.8 2003/08/21 14:19:53 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -219,11 +219,12 @@ syn keyword rubyBeginEnd BEGIN END " Special Methods if !exists("ruby_no_special_methods") - syn match rubyInclude "^\s*include\>" + syn match rubyInclude "^\s*\(extend\|include\)\>" syn keyword rubyInclude load require syn keyword rubyControl loop syn keyword rubyException raise fail catch throw syn keyword rubyKeyword lambda proc + syn keyword rubyAccess public protected private endif " Comments and Documentation @@ -278,6 +279,7 @@ if version >= 508 || !exists("did_ruby_syntax_inits") HiLink rubySharpBang PreProc HiLink rubyKeyword Keyword HiLink rubyBeginEnd Statement + HiLink rubyAccess Statement HiLink rubyString String HiLink rubyStringDelimit Delimiter From 14ffd9a40190a2ab1e4fd837befef6840a78acbc Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sun, 24 Aug 2003 12:26:45 +0000 Subject: [PATCH 020/411] match $deferr explicitly and add support for several more 'special' methods --- ChangeLog | 8 ++++++++ syntax/ruby.vim | 37 ++++++++++++++++++++++++------------- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4d90ec52..cd202937 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2003-08-24 Doug Kearns + + * syntax/ruby.vim: add $deferr to rubyPredefinedVariable; add several + new methods (abort, at_exit, attr, attr_accessor, attr_reader, + attr_writer, autoload, callcc, caller, exit, extend, fork, eval, + class_eval, instance_eval, module_eval, private, protected, public, + trap) to the Special Methods section. + 2003-08-21 Doug Kearns * syntax/ruby.vim: add access control methods (public, protected and diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 66a62892..439e3c0b 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.8 2003/08/21 14:19:53 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.9 2003/08/24 12:26:45 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -46,7 +46,7 @@ if !exists("ruby_no_identifiers") syn match rubyPredefinedVariable "$[!"$&'*+,./0:;<=>?@\\_`~1-9]" syn match rubyPredefinedVariable "$-[0FIKadilpvw]" - syn match rubyPredefinedVariable "$\(defout\|stderr\|stdin\|stdout\)\>" + syn match rubyPredefinedVariable "$\(deferr\|defout\|stderr\|stdin\|stdout\)\>" syn match rubyPredefinedVariable "$\(DEBUG\|FILENAME\|KCODE\|LOAD_PATH\|SAFE\|VERBOSE\)\>" syn match rubyPredefinedConstant "__\(FILE\|LINE\)__\>" syn match rubyPredefinedConstant "\<\(::\)\=\zs\(MatchingData\|ARGF\|ARGV\|ENV\)\>" @@ -211,6 +211,8 @@ else endif " Keywords +" Note: the following keywords have already been defined: +" begin case class def do end for if module unless until while __FILE_ __LINE__ syn keyword rubyControl and break else elsif ensure in next not or redo rescue retry return then when syn match rubyKeyword "\" - syn keyword rubyInclude load require - syn keyword rubyControl loop - syn keyword rubyException raise fail catch throw - syn keyword rubyKeyword lambda proc syn keyword rubyAccess public protected private + syn keyword rubyAttribute attr attr_accessor attr_reader attr_writer + syn keyword rubyControl abort at_exit exit fork loop trap + syn keyword rubyEval eval class_eval instance_eval module_eval + syn keyword rubyException raise fail catch throw + syn keyword rubyInclude autoload extend include load require + syn keyword rubyKeyword callcc caller lambda proc endif " Comments and Documentation @@ -237,12 +240,18 @@ syn keyword rubyTodo FIXME NOTE TODO XXX contained syn match rubyComment "#.*" contains=rubyTodo syn region rubyDocumentation start="^=begin" end="^=end.*$" contains=rubyTodo fold -" Note: this is a hack to prevent 'keywords' being highlighted as such when used as method names -syn match rubyKeywordAsMethod "\.\@" transparent contains=NONE -syn match rubyKeywordAsMethod "\.\@" transparent contains=NONE -syn match rubyKeywordAsMethod "\.\@" transparent contains=NONE -syn match rubyKeywordAsMethod "\.\@" transparent contains=NONE -syn match rubyKeywordAsMethod "\.\@" transparent contains=NONE +" Note: this is a hack to prevent 'keywords' being highlighted as such when called as methods +syn match rubyKeywordAsMethod "\.\@" transparent contains=NONE +syn match rubyKeywordAsMethod "\.\@" transparent contains=NONE +syn match rubyKeywordAsMethod "\.\@" transparent contains=NONE +syn match rubyKeywordAsMethod "\.\@" transparent contains=NONE + +syn match rubyKeywordAsMethod "\.\@" transparent contains=NONE +syn match rubyKeywordAsMethod "\.\@" transparent contains=NONE +syn match rubyKeywordAsMethod "\.\@" transparent contains=NONE +syn match rubyKeywordAsMethod "\.\@" transparent contains=NONE +syn match rubyKeywordAsMethod "\.\@" transparent contains=NONE +syn match rubyKeywordAsMethod "\.\@" transparent contains=NONE " __END__ Directive syn region rubyData matchgroup=rubyDataDirective start="^__END__$" matchgroup=NONE end="." skip="." @@ -280,6 +289,8 @@ if version >= 508 || !exists("did_ruby_syntax_inits") HiLink rubyKeyword Keyword HiLink rubyBeginEnd Statement HiLink rubyAccess Statement + HiLink rubyAttribute Statement + HiLink rubyEval Statement HiLink rubyString String HiLink rubyStringDelimit Delimiter From e4423f6b26e36269e3bc5b9ef677c05e03d522c6 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Mon, 25 Aug 2003 14:31:33 +0000 Subject: [PATCH 021/411] add support for the new %W() word list literal and add folding to %q() strings and %w() word lists --- ChangeLog | 6 +++ syntax/ruby.vim | 112 ++++++++++++++++++++++++------------------------ 2 files changed, 62 insertions(+), 56 deletions(-) diff --git a/ChangeLog b/ChangeLog index cd202937..7e84f3cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-08-25 Doug Kearns + + * syntax/ruby.vim: add the new %W() word list literal with + interpolation; add folding to %q() single quoted strings and %w() word + list literals. + 2003-08-24 Doug Kearns * syntax/ruby.vim: add $deferr to rubyPredefinedVariable; add several diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 439e3c0b..cc0db68d 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.9 2003/08/24 12:26:45 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.10 2003/08/25 14:31:33 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -89,61 +89,61 @@ syn region rubyString matchgroup=rubyStringDelimit start="%r\[" end="\][iomx]*" syn region rubyString matchgroup=rubyStringDelimit start="%r(" end=")[iomx]*" skip="\\\\\|\\)" contains=rubyExprSubst fold " Generalized Single Quoted String and Array of Strings -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]!" end="!" skip="\\\\\|\\!" -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]\"" end="\"" skip="\\\\\|\\\"" -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]#" end="#" skip="\\\\\|\\#" -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]\$" end="\$" skip="\\\\\|\\\$" -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]%" end="%" skip="\\\\\|\\%" -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]&" end="&" skip="\\\\\|\\&" -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]'" end="'" skip="\\\\\|\\'" -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]\*" end="\*" skip="\\\\\|\\\*" -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]+" end="+" skip="\\\\\|\\+" -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]-" end="-" skip="\\\\\|\\-" -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]\." end="\." skip="\\\\\|\\\." -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]/" end="/" skip="\\\\\|\\/" -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]:" end=":" skip="\\\\\|\\:" -syn region rubyString matchgroup=rubyStringDelimit start="%[wq];" end=";" skip="\\\\\|\\;" -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]=" end="=" skip="\\\\\|\\=" -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]?" end="?" skip="\\\\\|\\?" -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]@" end="@" skip="\\\\\|\\@" -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]\\" end="\\" -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]\^" end="\^" skip="\\\\\|\\\^" -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]`" end="`" skip="\\\\\|\\`" -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]|" end="|" skip="\\\\\|\\|" -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]\~" end="\~" skip="\\\\\|\\\~" -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]{" end="}" skip="\\\\\|\\}" -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]<" end=">" skip="\\\\\|\\>" -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]\[" end="\]" skip="\\\\\|\\\]" -syn region rubyString matchgroup=rubyStringDelimit start="%[wq](" end=")" skip="\\\\\|\\)" - -" Generalized Double Quoted String and Shell Command Output -syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=!" end="!" skip="\\\\\|\\!" contains=rubyExprSubst -syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=\"" end="\"" skip="\\\\\|\\\"" contains=rubyExprSubst -syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=#" end="#" skip="\\\\\|\\#" contains=rubyExprSubst -syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=\$" end="\$" skip="\\\\\|\\\$" contains=rubyExprSubst -syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=%" end="%" skip="\\\\\|\\%" contains=rubyExprSubst -syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=&" end="&" skip="\\\\\|\\&" contains=rubyExprSubst -syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\='" end="'" skip="\\\\\|\\'" contains=rubyExprSubst -syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=\*" end="\*" skip="\\\\\|\\\*" contains=rubyExprSubst -syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=+" end="+" skip="\\\\\|\\+" contains=rubyExprSubst -syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=-" end="-" skip="\\\\\|\\-" contains=rubyExprSubst -syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=\." end="\." skip="\\\\\|\\\." contains=rubyExprSubst -syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=/" end="/" skip="\\\\\|\\/" contains=rubyExprSubst -syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=:" end=":" skip="\\\\\|\\:" contains=rubyExprSubst -syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=;" end=";" skip="\\\\\|\\;" contains=rubyExprSubst -"syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\==" end="=" skip="\\\\\|\\=" contains=rubyExprSubst -syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]=" end="=" skip="\\\\\|\\=" contains=rubyExprSubst -syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=?" end="?" skip="\\\\\|\\?" contains=rubyExprSubst -syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=@" end="@" skip="\\\\\|\\@" contains=rubyExprSubst -syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=\\" end="\\" contains=rubyExprSubst -syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=\^" end="\^" skip="\\\\\|\\\^" contains=rubyExprSubst -syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=`" end="`" skip="\\\\\|\\`" contains=rubyExprSubst -syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=|" end="|" skip="\\\\\|\\|" contains=rubyExprSubst -syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=\~" end="\~" skip="\\\\\|\\\~" contains=rubyExprSubst -syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\={" end="}" skip="\\\\\|\\}" contains=rubyExprSubst -syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=<" end=">" skip="\\\\\|\\>" contains=rubyExprSubst -syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=\[" end="\]" skip="\\\\\|\\\]" contains=rubyExprSubst -syn region rubyString matchgroup=rubyStringDelimit start="%[Qx]\=(" end=")" skip="\\\\\|\\)" contains=rubyExprSubst +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]!" end="!" skip="\\\\\|\\!" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]\"" end="\"" skip="\\\\\|\\\"" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]#" end="#" skip="\\\\\|\\#" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]\$" end="\$" skip="\\\\\|\\\$" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]%" end="%" skip="\\\\\|\\%" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]&" end="&" skip="\\\\\|\\&" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]'" end="'" skip="\\\\\|\\'" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]\*" end="\*" skip="\\\\\|\\\*" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]+" end="+" skip="\\\\\|\\+" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]-" end="-" skip="\\\\\|\\-" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]\." end="\." skip="\\\\\|\\\." fold +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]/" end="/" skip="\\\\\|\\/" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]:" end=":" skip="\\\\\|\\:" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[wq];" end=";" skip="\\\\\|\\;" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]=" end="=" skip="\\\\\|\\=" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]?" end="?" skip="\\\\\|\\?" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]@" end="@" skip="\\\\\|\\@" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]\\" end="\\" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]\^" end="\^" skip="\\\\\|\\\^" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]`" end="`" skip="\\\\\|\\`" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]|" end="|" skip="\\\\\|\\|" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]\~" end="\~" skip="\\\\\|\\\~" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]{" end="}" skip="\\\\\|\\}" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]<" end=">" skip="\\\\\|\\>" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[wq]\[" end="\]" skip="\\\\\|\\\]" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[wq](" end=")" skip="\\\\\|\\)" fold + +" Generalized Double Quoted String and Array of Strings and Shell Command Output +syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=!" end="!" skip="\\\\\|\\!" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=\"" end="\"" skip="\\\\\|\\\"" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=#" end="#" skip="\\\\\|\\#" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=\$" end="\$" skip="\\\\\|\\\$" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=%" end="%" skip="\\\\\|\\%" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=&" end="&" skip="\\\\\|\\&" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\='" end="'" skip="\\\\\|\\'" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=\*" end="\*" skip="\\\\\|\\\*" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=+" end="+" skip="\\\\\|\\+" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=-" end="-" skip="\\\\\|\\-" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=\." end="\." skip="\\\\\|\\\." contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=/" end="/" skip="\\\\\|\\/" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=:" end=":" skip="\\\\\|\\:" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=;" end=";" skip="\\\\\|\\;" contains=rubyExprSubst fold +"syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\==" end="=" skip="\\\\\|\\=" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]=" end="=" skip="\\\\\|\\=" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=?" end="?" skip="\\\\\|\\?" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=@" end="@" skip="\\\\\|\\@" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=\\" end="\\" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=\^" end="\^" skip="\\\\\|\\\^" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=`" end="`" skip="\\\\\|\\`" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=|" end="|" skip="\\\\\|\\|" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=\~" end="\~" skip="\\\\\|\\\~" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\={" end="}" skip="\\\\\|\\}" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=<" end=">" skip="\\\\\|\\>" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=\[" end="\]" skip="\\\\\|\\\]" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=(" end=")" skip="\\\\\|\\)" contains=rubyExprSubst fold " Normal String and Shell Command Output syn region rubyString matchgroup=rubyStringDelimit start="\"" end="\"" skip="\\\\\|\\\"" contains=rubyExprSubst From 80ebdbeda4f767a5c62f8ca4daf52270be073b8f Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 26 Aug 2003 11:10:09 +0000 Subject: [PATCH 022/411] fix ignored shebang highlighting --- ChangeLog | 5 +++++ syntax/ruby.vim | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7e84f3cc..9a568e8d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-08-26 Doug Kearns + + * syntax/ruby.vim: fix shebang highlighting which was being ignored + all together. + 2003-08-25 Doug Kearns * syntax/ruby.vim: add the new %W() word list literal with diff --git a/syntax/ruby.vim b/syntax/ruby.vim index cc0db68d..1af697cf 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.10 2003/08/25 14:31:33 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.11 2003/08/26 11:10:09 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -232,12 +232,12 @@ endif " Comments and Documentation if version < 600 - syn match rubySharpBang "#!.*" + syn match rubySharpBang "^#!.*" contained else syn match rubySharpBang "\%^#!.*" endif syn keyword rubyTodo FIXME NOTE TODO XXX contained -syn match rubyComment "#.*" contains=rubyTodo +syn match rubyComment "#.*" contains=rubySharpBang,rubyTodo syn region rubyDocumentation start="^=begin" end="^=end.*$" contains=rubyTodo fold " Note: this is a hack to prevent 'keywords' being highlighted as such when called as methods From 76ffc60935140e8512b90185a229db56f4a7ebbb Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 27 Aug 2003 08:10:19 +0000 Subject: [PATCH 023/411] don't allow the start of a heredoc to match after '.' or '::' --- ChangeLog | 5 +++++ syntax/ruby.vim | 32 ++++++++++++++++---------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9a568e8d..38ac06e5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-08-27 Doug Kearns + + * syntax/ruby.vim: don't allow '<<' after '.' or '::' to match as the + beginning of a heredoc. + 2003-08-26 Doug Kearns * syntax/ruby.vim: fix shebang highlighting which was being ignored diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 1af697cf..c20a9a75 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.11 2003/08/26 11:10:09 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.12 2003/08/27 08:10:19 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -158,22 +158,22 @@ syn region rubyString matchgroup=rubyStringDelimit start="^\s*/" start="\ Date: Thu, 28 Aug 2003 14:36:01 +0000 Subject: [PATCH 024/411] add folding support to __END__ directive data sections --- ChangeLog | 5 +++++ syntax/ruby.vim | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 38ac06e5..27b26acc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-08-28 Doug Kearns + + * syntax/ruby.vim: add folding support to embedded data sections after + an __END__ directive. + 2003-08-27 Doug Kearns * syntax/ruby.vim: don't allow '<<' after '.' or '::' to match as the diff --git a/syntax/ruby.vim b/syntax/ruby.vim index c20a9a75..db8476d0 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.12 2003/08/27 08:10:19 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.13 2003/08/28 14:36:01 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -254,7 +254,7 @@ syn match rubyKeywordAsMethod "\.\@" transparent contains=NONE " __END__ Directive -syn region rubyData matchgroup=rubyDataDirective start="^__END__$" matchgroup=NONE end="." skip="." +syn region rubyData matchgroup=rubyDataDirective start="^__END__$" matchgroup=NONE end="." skip="." fold " Define the default highlighting. " For version 5.7 and earlier: only when not done already From 9755fc4361222d7669798ae830e3ff99f65b2cd0 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 2 Sep 2003 09:45:08 +0000 Subject: [PATCH 025/411] prevent the optional 'do' in loop constructs from being matched as the beginning of a do/end code block --- ChangeLog | 6 ++++++ syntax/ruby.vim | 11 +++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 27b26acc..0e1cd0d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-09-02 Doug Kearns + + * syntax/ruby.vim: make sure that the optional do after for, until or + while is not matched as the beginning of a do/end code block; also + highlight the optional ':' for these loop constructs. + 2003-08-28 Doug Kearns * syntax/ruby.vim: add folding support to embedded data sections after diff --git a/syntax/ruby.vim b/syntax/ruby.vim index db8476d0..489f6c40 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.13 2003/08/28 14:36:01 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.14 2003/09/02 09:45:08 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -184,11 +184,11 @@ if !exists("ruby_no_expensive") syn region rubyBlock start="^\s*def\s\+"rs=s matchgroup=rubyDefine end="\" contains=ALLBUT,rubyExprSubst,rubyTodo nextgroup=rubyFunction fold syn region rubyBlock start="^\s*\(class\|module\)\>"rs=s matchgroup=rubyDefine end="\" contains=ALLBUT,rubyExprSubst,rubyTodo nextgroup=rubyClassOrModule fold - " modifiers + redundant *do* - syn match rubyControl "\<\(if\|unless\|while\|until\|do\)\>" + " modifiers + syn match rubyControl "\<\(if\|unless\|while\|until\)\>" " *do* requiring *end* - syn region rubyDoBlock matchgroup=rubyControl start="\" end="\" contains=ALLBUT,rubyExprSubst,rubyTodo fold + syn region rubyDoBlock matchgroup=rubyControl start="\(\<\(for\|until\|while\)\s.*\s\)\@" end="\" contains=ALLBUT,rubyExprSubst,rubyTodo fold " *{* requiring *}* syn region rubyCurlyBlock start="{" end="}" contains=ALLBUT,rubyExprSubst,rubyTodo fold @@ -198,6 +198,9 @@ if !exists("ruby_no_expensive") " statement with optional *do* syn region rubyOptDoBlock matchgroup=rubyControl start="\" start="^\s*\(while\|until\)\>" start=";\s*\(while\|until\)\>"hs=s+1 end="\" contains=ALLBUT,rubyExprSubst,rubyTodo fold + + " optional *do* + syn match rubyControl "\(\<\(for\|until\|while\)\s.*\s\)\@<=\(do\|:\)\>" if !exists("ruby_minlines") let ruby_minlines = 50 From c09027956efcc77bebcfc07d30131ec725332353 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 3 Sep 2003 03:46:52 +0000 Subject: [PATCH 026/411] update the compiler maintainer's email address --- ChangeLog | 4 ++++ compiler/ruby.vim | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0e1cd0d6..4b7aa728 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2003-09-03 Doug Kearns + + * compiler/ruby.vim: update the maintainer's email address. + 2003-09-02 Doug Kearns * syntax/ruby.vim: make sure that the optional do after for, until or diff --git a/compiler/ruby.vim b/compiler/ruby.vim index c3cd38b1..7c9838c3 100644 --- a/compiler/ruby.vim +++ b/compiler/ruby.vim @@ -1,8 +1,8 @@ " Vim compiler file " Language: Ruby " Function: Syntax check and/or error reporting -" Maintainer: Tim Hammerquist -" Info: $Id: ruby.vim,v 1.5 2003/08/18 09:52:48 dkearns Exp $ +" Maintainer: Tim Hammerquist +" Info: $Id: ruby.vim,v 1.6 2003/09/03 03:46:52 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) From 297cf9138df7b7012287f8b26bccaafa6f9e8a14 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Mon, 8 Sep 2003 14:18:41 +0000 Subject: [PATCH 027/411] add support for the new %s() symbol literal --- ChangeLog | 4 ++++ syntax/ruby.vim | 56 ++++++++++++++++++++++++------------------------- 2 files changed, 32 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4b7aa728..5788c4c8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2003-09-08 Doug Kearns + + * syntax/ruby.vim: add support for the new %s() symbol literal. + 2003-09-03 Doug Kearns * compiler/ruby.vim: update the maintainer's email address. diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 489f6c40..6129e23d 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.14 2003/09/02 09:45:08 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.15 2003/09/08 14:18:41 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -88,33 +88,33 @@ syn region rubyString matchgroup=rubyStringDelimit start="%r<" end=">[iomx]*" syn region rubyString matchgroup=rubyStringDelimit start="%r\[" end="\][iomx]*" skip="\\\\\|\\\]" contains=rubyExprSubst fold syn region rubyString matchgroup=rubyStringDelimit start="%r(" end=")[iomx]*" skip="\\\\\|\\)" contains=rubyExprSubst fold -" Generalized Single Quoted String and Array of Strings -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]!" end="!" skip="\\\\\|\\!" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]\"" end="\"" skip="\\\\\|\\\"" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]#" end="#" skip="\\\\\|\\#" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]\$" end="\$" skip="\\\\\|\\\$" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]%" end="%" skip="\\\\\|\\%" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]&" end="&" skip="\\\\\|\\&" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]'" end="'" skip="\\\\\|\\'" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]\*" end="\*" skip="\\\\\|\\\*" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]+" end="+" skip="\\\\\|\\+" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]-" end="-" skip="\\\\\|\\-" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]\." end="\." skip="\\\\\|\\\." fold -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]/" end="/" skip="\\\\\|\\/" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]:" end=":" skip="\\\\\|\\:" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[wq];" end=";" skip="\\\\\|\\;" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]=" end="=" skip="\\\\\|\\=" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]?" end="?" skip="\\\\\|\\?" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]@" end="@" skip="\\\\\|\\@" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]\\" end="\\" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]\^" end="\^" skip="\\\\\|\\\^" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]`" end="`" skip="\\\\\|\\`" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]|" end="|" skip="\\\\\|\\|" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]\~" end="\~" skip="\\\\\|\\\~" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]{" end="}" skip="\\\\\|\\}" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]<" end=">" skip="\\\\\|\\>" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[wq]\[" end="\]" skip="\\\\\|\\\]" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[wq](" end=")" skip="\\\\\|\\)" fold +" Generalized Single Quoted String, Symbol and Array of Strings +syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]!" end="!" skip="\\\\\|\\!" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]\"" end="\"" skip="\\\\\|\\\"" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]#" end="#" skip="\\\\\|\\#" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]\$" end="\$" skip="\\\\\|\\\$" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]%" end="%" skip="\\\\\|\\%" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]&" end="&" skip="\\\\\|\\&" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]'" end="'" skip="\\\\\|\\'" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]\*" end="\*" skip="\\\\\|\\\*" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]+" end="+" skip="\\\\\|\\+" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]-" end="-" skip="\\\\\|\\-" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]\." end="\." skip="\\\\\|\\\." fold +syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]/" end="/" skip="\\\\\|\\/" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]:" end=":" skip="\\\\\|\\:" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[qsw];" end=";" skip="\\\\\|\\;" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]=" end="=" skip="\\\\\|\\=" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]?" end="?" skip="\\\\\|\\?" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]@" end="@" skip="\\\\\|\\@" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]\\" end="\\" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]\^" end="\^" skip="\\\\\|\\\^" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]`" end="`" skip="\\\\\|\\`" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]|" end="|" skip="\\\\\|\\|" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]\~" end="\~" skip="\\\\\|\\\~" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]{" end="}" skip="\\\\\|\\}" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]<" end=">" skip="\\\\\|\\>" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]\[" end="\]" skip="\\\\\|\\\]" fold +syn region rubyString matchgroup=rubyStringDelimit start="%[qsw](" end=")" skip="\\\\\|\\)" fold " Generalized Double Quoted String and Array of Strings and Shell Command Output syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=!" end="!" skip="\\\\\|\\!" contains=rubyExprSubst fold From 065022dda2ba7541fd4f5c9afa176d6a3326ed5a Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Mon, 8 Sep 2003 15:39:09 +0000 Subject: [PATCH 028/411] add the @Spell cluster to support spell checking --- ChangeLog | 5 +++++ syntax/ruby.vim | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5788c4c8..88333074 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-09-08 Doug Kearns + + * syntax/ruby.vim: add the @Spell cluster to support spell checking + of comment text. + 2003-09-08 Doug Kearns * syntax/ruby.vim: add support for the new %s() symbol literal. diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 6129e23d..9d4624b7 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.15 2003/09/08 14:18:41 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.16 2003/09/08 15:39:09 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -240,8 +240,8 @@ else syn match rubySharpBang "\%^#!.*" endif syn keyword rubyTodo FIXME NOTE TODO XXX contained -syn match rubyComment "#.*" contains=rubySharpBang,rubyTodo -syn region rubyDocumentation start="^=begin" end="^=end.*$" contains=rubyTodo fold +syn match rubyComment "#.*" contains=rubySharpBang,rubyTodo,@Spell +syn region rubyDocumentation start="^=begin" end="^=end.*$" contains=rubyTodo,@Spell fold " Note: this is a hack to prevent 'keywords' being highlighted as such when called as methods syn match rubyKeywordAsMethod "\.\@" transparent contains=NONE From 9aa02ccb5cd064235b3ea2c8ac6e4f6eef647fd8 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 9 Sep 2003 05:08:32 +0000 Subject: [PATCH 029/411] highlight one line module, class, and method definitions correctly --- ChangeLog | 7 +++++++ syntax/ruby.vim | 38 +++++++++++++++++++++----------------- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 88333074..d102b47b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2003-09-09 Doug Kearns + + * syntax/ruby.vim: highlight one line module, class, and method + definitions, using the ';' terminator, correctly; split + rubyClassOrModule into two new syntax groups - rubyClass and + rubyModule. + 2003-09-08 Doug Kearns * syntax/ruby.vim: add the @Spell cluster to support spell checking diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 9d4624b7..9d1230e6 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.16 2003/09/08 15:39:09 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.17 2003/09/09 05:08:32 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -165,24 +165,26 @@ if version < 600 syn region rubyString matchgroup=rubyStringDelimit start=+<<\(EOF\|'EOF'\|"EOF"\|`EOF`\)+hs=s+2 end=+^EOF$+ contains=rubyExprSubst fold syn region rubyString matchgroup=rubyStringDelimit start=+<<\(EOS\|'EOS'\|"EOS"\|`EOS`\)+hs=s+2 end=+^EOS$+ contains=rubyExprSubst fold else - syn region rubyString matchgroup=rubyStringDelimit start=+\(class\s*\|\(\.\|::\)\_s*\)\@"he=e-1 oneline fold + syn region rubyFunction matchgroup=rubyDefine start="\" @@ -208,8 +210,9 @@ if !exists("ruby_no_expensive") exec "syn sync minlines=" . ruby_minlines else - syn region rubyFunction matchgroup=rubyControl start="^\s*def\s" matchgroup=NONE end="\ze\(\s\|(\|;\|$\)" skip="\.\|\(::\)" oneline fold - syn region rubyClassOrModule matchgroup=rubyControl start="^\s*\(class\|module\)\s" end="<\|$\|;\|\>"he=e-1 oneline fold + syn region rubyFunction matchgroup=rubyDefine start="\= 508 || !exists("did_ruby_syntax_inits") HiLink rubyNumber Number HiLink rubyBoolean Boolean HiLink rubyException Exception - HiLink rubyClassOrModule Type + HiLink rubyClass Type + HiLink rubyModule Type HiLink rubyIdentifier Identifier HiLink rubyClassVariable rubyIdentifier HiLink rubyConstant rubyIdentifier From d96300bfc34714bc07055a6dd7048aef7fb109a1 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 9 Sep 2003 05:37:42 +0000 Subject: [PATCH 030/411] rename the rubyStringDelimit syntax group rubyStringDelimiter --- ChangeLog | 5 ++ indent/ruby.vim | 6 +- syntax/ruby.vim | 202 ++++++++++++++++++++++++------------------------ 3 files changed, 109 insertions(+), 104 deletions(-) diff --git a/ChangeLog b/ChangeLog index d102b47b..57ab389f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-09-09 Doug Kearns + + * indent/ruby.vim, syntax/ruby.vim: rename the rubyStringDelimit + syntax group rubyStringDelimiter. + 2003-09-09 Doug Kearns * syntax/ruby.vim: highlight one line module, class, and method diff --git a/indent/ruby.vim b/indent/ruby.vim index d54f12e5..16490dc7 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -2,7 +2,7 @@ " Language: Ruby " Maintainer: Gavin Sinclair " Developer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.10 2003/08/18 09:52:48 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.11 2003/09/09 05:37:42 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -31,7 +31,7 @@ endif " Check if the character at lnum:col is inside a string or comment. function s:IsInStringOrComment(lnum, col) return synIDattr(synID(a:lnum, a:col, 0), 'name') =~ - \'\' endfunction @@ -81,7 +81,7 @@ let s:continuation_regexp = '[\*+/.,=(-]\s*\(#.*\)\=$' let s:block_regexp = '\\s*\(|\(\*\=\h\w*\(,\s*\)\=\)\+|\s*\)\=\(#.*\)\=$' " Expression used to check whether we should skip a match with searchpair(). -let s:skip_expr = 'synIDattr(synID(line("."), col("."), 0), "name") =~ "\\"' +let s:skip_expr = 'synIDattr(synID(line("."), col("."), 0), "name") =~ "\\"' let s:end_skip_expr = s:skip_expr.' || (expand("") =~ "\\\\|\\\\|\\\\|\\" && getline(".") !~ "^\\s*\\<".expand("")."\\>" && getline(".") !~ expand("")."\\>.*\\")' " Find the previous non-blank line which isn't a comment-line or in a comment diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 9d1230e6..b96b49c9 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.17 2003/09/09 05:08:32 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.18 2003/09/09 05:37:42 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -61,119 +61,119 @@ endif " BEGIN Autogenerated Stuff " " Generalized Regular Expression -syn region rubyString matchgroup=rubyStringDelimit start="%r!" end="![iomx]*" skip="\\\\\|\\!" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%r\"" end="\"[iomx]*" skip="\\\\\|\\\"" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%r#" end="#[iomx]*" skip="\\\\\|\\#" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%r\$" end="\$[iomx]*" skip="\\\\\|\\\$" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%r%" end="%[iomx]*" skip="\\\\\|\\%" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%r&" end="&[iomx]*" skip="\\\\\|\\&" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%r'" end="'[iomx]*" skip="\\\\\|\\'" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%r\*" end="\*[iomx]*" skip="\\\\\|\\\*" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%r+" end="+[iomx]*" skip="\\\\\|\\+" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%r-" end="-[iomx]*" skip="\\\\\|\\-" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%r\." end="\.[iomx]*" skip="\\\\\|\\\." contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%r/" end="/[iomx]*" skip="\\\\\|\\/" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%r:" end=":[iomx]*" skip="\\\\\|\\:" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%r;" end=";[iomx]*" skip="\\\\\|\\;" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%r=" end="=[iomx]*" skip="\\\\\|\\=" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%r?" end="?[iomx]*" skip="\\\\\|\\?" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%r@" end="@[iomx]*" skip="\\\\\|\\@" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%r\\" end="\\[iomx]*" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%r\^" end="\^[iomx]*" skip="\\\\\|\\\^" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%r`" end="`[iomx]*" skip="\\\\\|\\`" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%r|" end="|[iomx]*" skip="\\\\\|\\|" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%r\~" end="\~[iomx]*" skip="\\\\\|\\\~" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%r{" end="}[iomx]*" skip="\\\\\|\\}" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%r<" end=">[iomx]*" skip="\\\\\|\\>" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%r\[" end="\][iomx]*" skip="\\\\\|\\\]" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%r(" end=")[iomx]*" skip="\\\\\|\\)" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%r!" end="![iomx]*" skip="\\\\\|\\!" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%r\"" end="\"[iomx]*" skip="\\\\\|\\\"" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%r#" end="#[iomx]*" skip="\\\\\|\\#" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%r\$" end="\$[iomx]*" skip="\\\\\|\\\$" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%r%" end="%[iomx]*" skip="\\\\\|\\%" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%r&" end="&[iomx]*" skip="\\\\\|\\&" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%r'" end="'[iomx]*" skip="\\\\\|\\'" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%r\*" end="\*[iomx]*" skip="\\\\\|\\\*" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%r+" end="+[iomx]*" skip="\\\\\|\\+" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%r-" end="-[iomx]*" skip="\\\\\|\\-" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%r\." end="\.[iomx]*" skip="\\\\\|\\\." contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%r/" end="/[iomx]*" skip="\\\\\|\\/" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%r:" end=":[iomx]*" skip="\\\\\|\\:" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%r;" end=";[iomx]*" skip="\\\\\|\\;" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%r=" end="=[iomx]*" skip="\\\\\|\\=" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%r?" end="?[iomx]*" skip="\\\\\|\\?" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%r@" end="@[iomx]*" skip="\\\\\|\\@" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%r\\" end="\\[iomx]*" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%r\^" end="\^[iomx]*" skip="\\\\\|\\\^" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%r`" end="`[iomx]*" skip="\\\\\|\\`" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%r|" end="|[iomx]*" skip="\\\\\|\\|" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%r\~" end="\~[iomx]*" skip="\\\\\|\\\~" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%r{" end="}[iomx]*" skip="\\\\\|\\}" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%r<" end=">[iomx]*" skip="\\\\\|\\>" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%r\[" end="\][iomx]*" skip="\\\\\|\\\]" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%r(" end=")[iomx]*" skip="\\\\\|\\)" contains=rubyExprSubst fold " Generalized Single Quoted String, Symbol and Array of Strings -syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]!" end="!" skip="\\\\\|\\!" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]\"" end="\"" skip="\\\\\|\\\"" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]#" end="#" skip="\\\\\|\\#" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]\$" end="\$" skip="\\\\\|\\\$" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]%" end="%" skip="\\\\\|\\%" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]&" end="&" skip="\\\\\|\\&" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]'" end="'" skip="\\\\\|\\'" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]\*" end="\*" skip="\\\\\|\\\*" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]+" end="+" skip="\\\\\|\\+" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]-" end="-" skip="\\\\\|\\-" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]\." end="\." skip="\\\\\|\\\." fold -syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]/" end="/" skip="\\\\\|\\/" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]:" end=":" skip="\\\\\|\\:" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[qsw];" end=";" skip="\\\\\|\\;" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]=" end="=" skip="\\\\\|\\=" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]?" end="?" skip="\\\\\|\\?" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]@" end="@" skip="\\\\\|\\@" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]\\" end="\\" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]\^" end="\^" skip="\\\\\|\\\^" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]`" end="`" skip="\\\\\|\\`" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]|" end="|" skip="\\\\\|\\|" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]\~" end="\~" skip="\\\\\|\\\~" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]{" end="}" skip="\\\\\|\\}" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]<" end=">" skip="\\\\\|\\>" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[qsw]\[" end="\]" skip="\\\\\|\\\]" fold -syn region rubyString matchgroup=rubyStringDelimit start="%[qsw](" end=")" skip="\\\\\|\\)" fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]!" end="!" skip="\\\\\|\\!" fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]\"" end="\"" skip="\\\\\|\\\"" fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]#" end="#" skip="\\\\\|\\#" fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]\$" end="\$" skip="\\\\\|\\\$" fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]%" end="%" skip="\\\\\|\\%" fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]&" end="&" skip="\\\\\|\\&" fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]'" end="'" skip="\\\\\|\\'" fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]\*" end="\*" skip="\\\\\|\\\*" fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]+" end="+" skip="\\\\\|\\+" fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]-" end="-" skip="\\\\\|\\-" fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]\." end="\." skip="\\\\\|\\\." fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]/" end="/" skip="\\\\\|\\/" fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]:" end=":" skip="\\\\\|\\:" fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw];" end=";" skip="\\\\\|\\;" fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]=" end="=" skip="\\\\\|\\=" fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]?" end="?" skip="\\\\\|\\?" fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]@" end="@" skip="\\\\\|\\@" fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]\\" end="\\" fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]\^" end="\^" skip="\\\\\|\\\^" fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]`" end="`" skip="\\\\\|\\`" fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]|" end="|" skip="\\\\\|\\|" fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]\~" end="\~" skip="\\\\\|\\\~" fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]{" end="}" skip="\\\\\|\\}" fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]<" end=">" skip="\\\\\|\\>" fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]\[" end="\]" skip="\\\\\|\\\]" fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw](" end=")" skip="\\\\\|\\)" fold " Generalized Double Quoted String and Array of Strings and Shell Command Output -syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=!" end="!" skip="\\\\\|\\!" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=\"" end="\"" skip="\\\\\|\\\"" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=#" end="#" skip="\\\\\|\\#" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=\$" end="\$" skip="\\\\\|\\\$" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=%" end="%" skip="\\\\\|\\%" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=&" end="&" skip="\\\\\|\\&" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\='" end="'" skip="\\\\\|\\'" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=\*" end="\*" skip="\\\\\|\\\*" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=+" end="+" skip="\\\\\|\\+" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=-" end="-" skip="\\\\\|\\-" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=\." end="\." skip="\\\\\|\\\." contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=/" end="/" skip="\\\\\|\\/" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=:" end=":" skip="\\\\\|\\:" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=;" end=";" skip="\\\\\|\\;" contains=rubyExprSubst fold -"syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\==" end="=" skip="\\\\\|\\=" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]=" end="=" skip="\\\\\|\\=" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=?" end="?" skip="\\\\\|\\?" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=@" end="@" skip="\\\\\|\\@" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=\\" end="\\" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=\^" end="\^" skip="\\\\\|\\\^" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=`" end="`" skip="\\\\\|\\`" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=|" end="|" skip="\\\\\|\\|" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=\~" end="\~" skip="\\\\\|\\\~" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\={" end="}" skip="\\\\\|\\}" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=<" end=">" skip="\\\\\|\\>" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=\[" end="\]" skip="\\\\\|\\\]" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimit start="%[QWx]\=(" end=")" skip="\\\\\|\\)" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=!" end="!" skip="\\\\\|\\!" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\"" end="\"" skip="\\\\\|\\\"" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=#" end="#" skip="\\\\\|\\#" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\$" end="\$" skip="\\\\\|\\\$" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=%" end="%" skip="\\\\\|\\%" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=&" end="&" skip="\\\\\|\\&" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\='" end="'" skip="\\\\\|\\'" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\*" end="\*" skip="\\\\\|\\\*" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=+" end="+" skip="\\\\\|\\+" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=-" end="-" skip="\\\\\|\\-" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\." end="\." skip="\\\\\|\\\." contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=/" end="/" skip="\\\\\|\\/" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=:" end=":" skip="\\\\\|\\:" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=;" end=";" skip="\\\\\|\\;" contains=rubyExprSubst fold +"syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\==" end="=" skip="\\\\\|\\=" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]=" end="=" skip="\\\\\|\\=" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=?" end="?" skip="\\\\\|\\?" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=@" end="@" skip="\\\\\|\\@" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\\" end="\\" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\^" end="\^" skip="\\\\\|\\\^" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=`" end="`" skip="\\\\\|\\`" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=|" end="|" skip="\\\\\|\\|" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\~" end="\~" skip="\\\\\|\\\~" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\={" end="}" skip="\\\\\|\\}" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=<" end=">" skip="\\\\\|\\>" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\[" end="\]" skip="\\\\\|\\\]" contains=rubyExprSubst fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=(" end=")" skip="\\\\\|\\)" contains=rubyExprSubst fold " Normal String and Shell Command Output -syn region rubyString matchgroup=rubyStringDelimit start="\"" end="\"" skip="\\\\\|\\\"" contains=rubyExprSubst -syn region rubyString matchgroup=rubyStringDelimit start="'" end="'" skip="\\\\\|\\'" -syn region rubyString matchgroup=rubyStringDelimit start="`" end="`" skip="\\\\\|\\`" contains=rubyExprSubst +syn region rubyString matchgroup=rubyStringDelimiter start="\"" end="\"" skip="\\\\\|\\\"" contains=rubyExprSubst +syn region rubyString matchgroup=rubyStringDelimiter start="'" end="'" skip="\\\\\|\\'" +syn region rubyString matchgroup=rubyStringDelimiter start="`" end="`" skip="\\\\\|\\`" contains=rubyExprSubst " " END Autogenerated Stuff " " Normal Regular Expression -syn region rubyString matchgroup=rubyStringDelimit start="^\s*/" start="\" @@ -300,7 +300,7 @@ if version >= 508 || !exists("did_ruby_syntax_inits") HiLink rubyEval Statement HiLink rubyString String - HiLink rubyStringDelimit Delimiter + HiLink rubyStringDelimiter Delimiter HiLink rubyExprSubst Special HiLink rubyComment Comment From d889584786054c0b6488807543efa2acfd189fbf Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 9 Sep 2003 11:53:17 +0000 Subject: [PATCH 031/411] remove Vim 5.x sections and simplify general delimited input syntax groups --- ChangeLog | 6 ++ syntax/ruby.vim | 173 +++++++++++++----------------------------------- 2 files changed, 52 insertions(+), 127 deletions(-) diff --git a/ChangeLog b/ChangeLog index 57ab389f..08afa2cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-09-09 Doug Kearns + + * syntax/ruby.vim: remove Vim 5.x specific sections and simplify the + generalized string, regular expression, symbol, and word list literal + syntax groups. + 2003-09-09 Doug Kearns * indent/ruby.vim, syntax/ruby.vim: rename the rubyStringDelimit diff --git a/syntax/ruby.vim b/syntax/ruby.vim index b96b49c9..1f89fb21 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.18 2003/09/09 05:37:42 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.19 2003/09/09 11:53:17 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -57,124 +57,47 @@ if !exists("ruby_no_identifiers") "syn match rubyPredefinedConstant "\<\(::\)\=\zs\(NotImplementError\)\>" endif -" -" BEGIN Autogenerated Stuff -" -" Generalized Regular Expression -syn region rubyString matchgroup=rubyStringDelimiter start="%r!" end="![iomx]*" skip="\\\\\|\\!" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%r\"" end="\"[iomx]*" skip="\\\\\|\\\"" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%r#" end="#[iomx]*" skip="\\\\\|\\#" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%r\$" end="\$[iomx]*" skip="\\\\\|\\\$" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%r%" end="%[iomx]*" skip="\\\\\|\\%" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%r&" end="&[iomx]*" skip="\\\\\|\\&" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%r'" end="'[iomx]*" skip="\\\\\|\\'" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%r\*" end="\*[iomx]*" skip="\\\\\|\\\*" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%r+" end="+[iomx]*" skip="\\\\\|\\+" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%r-" end="-[iomx]*" skip="\\\\\|\\-" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%r\." end="\.[iomx]*" skip="\\\\\|\\\." contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%r/" end="/[iomx]*" skip="\\\\\|\\/" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%r:" end=":[iomx]*" skip="\\\\\|\\:" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%r;" end=";[iomx]*" skip="\\\\\|\\;" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%r=" end="=[iomx]*" skip="\\\\\|\\=" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%r?" end="?[iomx]*" skip="\\\\\|\\?" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%r@" end="@[iomx]*" skip="\\\\\|\\@" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%r\\" end="\\[iomx]*" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%r\^" end="\^[iomx]*" skip="\\\\\|\\\^" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%r`" end="`[iomx]*" skip="\\\\\|\\`" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%r|" end="|[iomx]*" skip="\\\\\|\\|" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%r\~" end="\~[iomx]*" skip="\\\\\|\\\~" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%r{" end="}[iomx]*" skip="\\\\\|\\}" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%r<" end=">[iomx]*" skip="\\\\\|\\>" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%r\[" end="\][iomx]*" skip="\\\\\|\\\]" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%r(" end=")[iomx]*" skip="\\\\\|\\)" contains=rubyExprSubst fold - -" Generalized Single Quoted String, Symbol and Array of Strings -syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]!" end="!" skip="\\\\\|\\!" fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]\"" end="\"" skip="\\\\\|\\\"" fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]#" end="#" skip="\\\\\|\\#" fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]\$" end="\$" skip="\\\\\|\\\$" fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]%" end="%" skip="\\\\\|\\%" fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]&" end="&" skip="\\\\\|\\&" fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]'" end="'" skip="\\\\\|\\'" fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]\*" end="\*" skip="\\\\\|\\\*" fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]+" end="+" skip="\\\\\|\\+" fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]-" end="-" skip="\\\\\|\\-" fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]\." end="\." skip="\\\\\|\\\." fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]/" end="/" skip="\\\\\|\\/" fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]:" end=":" skip="\\\\\|\\:" fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw];" end=";" skip="\\\\\|\\;" fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]=" end="=" skip="\\\\\|\\=" fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]?" end="?" skip="\\\\\|\\?" fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]@" end="@" skip="\\\\\|\\@" fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]\\" end="\\" fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]\^" end="\^" skip="\\\\\|\\\^" fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]`" end="`" skip="\\\\\|\\`" fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]|" end="|" skip="\\\\\|\\|" fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]\~" end="\~" skip="\\\\\|\\\~" fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]{" end="}" skip="\\\\\|\\}" fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]<" end=">" skip="\\\\\|\\>" fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]\[" end="\]" skip="\\\\\|\\\]" fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw](" end=")" skip="\\\\\|\\)" fold - -" Generalized Double Quoted String and Array of Strings and Shell Command Output -syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=!" end="!" skip="\\\\\|\\!" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\"" end="\"" skip="\\\\\|\\\"" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=#" end="#" skip="\\\\\|\\#" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\$" end="\$" skip="\\\\\|\\\$" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=%" end="%" skip="\\\\\|\\%" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=&" end="&" skip="\\\\\|\\&" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\='" end="'" skip="\\\\\|\\'" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\*" end="\*" skip="\\\\\|\\\*" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=+" end="+" skip="\\\\\|\\+" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=-" end="-" skip="\\\\\|\\-" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\." end="\." skip="\\\\\|\\\." contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=/" end="/" skip="\\\\\|\\/" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=:" end=":" skip="\\\\\|\\:" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=;" end=";" skip="\\\\\|\\;" contains=rubyExprSubst fold -"syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\==" end="=" skip="\\\\\|\\=" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]=" end="=" skip="\\\\\|\\=" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=?" end="?" skip="\\\\\|\\?" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=@" end="@" skip="\\\\\|\\@" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\\" end="\\" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\^" end="\^" skip="\\\\\|\\\^" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=`" end="`" skip="\\\\\|\\`" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=|" end="|" skip="\\\\\|\\|" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\~" end="\~" skip="\\\\\|\\\~" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\={" end="}" skip="\\\\\|\\}" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=<" end=">" skip="\\\\\|\\>" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\[" end="\]" skip="\\\\\|\\\]" contains=rubyExprSubst fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=(" end=")" skip="\\\\\|\\)" contains=rubyExprSubst fold +" Normal Regular Expression +syn region rubyString matchgroup=rubyStringDelimiter start="^\s*/" start="\" transparent contains=NONE -syn match rubyKeywordAsMethod "\.\@" transparent contains=NONE -syn match rubyKeywordAsMethod "\.\@" transparent contains=NONE -syn match rubyKeywordAsMethod "\.\@" transparent contains=NONE - -syn match rubyKeywordAsMethod "\.\@" transparent contains=NONE -syn match rubyKeywordAsMethod "\.\@" transparent contains=NONE -syn match rubyKeywordAsMethod "\.\@" transparent contains=NONE -syn match rubyKeywordAsMethod "\.\@" transparent contains=NONE -syn match rubyKeywordAsMethod "\.\@" transparent contains=NONE -syn match rubyKeywordAsMethod "\.\@" transparent contains=NONE +syn match rubyKeywordAsMethod "\(\(\.\@" transparent contains=NONE +syn match rubyKeywordAsMethod "\(\(\.\@" transparent contains=NONE +syn match rubyKeywordAsMethod "\(\(\.\@" transparent contains=NONE +syn match rubyKeywordAsMethod "\(\(\.\@" transparent contains=NONE + +syn match rubyKeywordAsMethod "\(\(\.\@" transparent contains=NONE +syn match rubyKeywordAsMethod "\(\(\.\@" transparent contains=NONE +syn match rubyKeywordAsMethod "\(\(\.\@" transparent contains=NONE +syn match rubyKeywordAsMethod "\(\(\.\@" transparent contains=NONE +syn match rubyKeywordAsMethod "\(\(\.\@" transparent contains=NONE +syn match rubyKeywordAsMethod "\(\(\.\@" transparent contains=NONE " __END__ Directive syn region rubyData matchgroup=rubyDataDirective start="^__END__$" matchgroup=NONE end="." skip="." fold From afd57812c4ba55b9090adfdf1010f5156125a9b5 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 11 Sep 2003 06:51:25 +0000 Subject: [PATCH 032/411] improve support for symbols, integers and floats --- ChangeLog | 5 ++++ syntax/ruby.vim | 71 ++++++++++++++++++++++++++----------------------- 2 files changed, 43 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index 08afa2cb..71e386b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-09-11 Doug Kearns + + * syntax/ruby.vim: improve support for symbols, integers and floating + point numbers; add the display argument to :syntax where appropriate. + 2003-09-09 Doug Kearns * syntax/ruby.vim: remove Vim 5.x specific sections and simplify the diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 1f89fb21..7d3272d1 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.19 2003/09/09 11:53:17 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.20 2003/09/11 06:51:25 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -25,33 +25,38 @@ elseif exists("b:current_syntax") endif " Expression Substitution and Backslash Notation -syn match rubyExprSubst "\\\\\|\(\(\\M-\\C-\|\\c\|\\C-\|\\M-\)\w\)\|\(\\\o\{3}\|\\x\x\{2}\|\\[abefnrstv]\)" contained -syn match rubyExprSubst "#{[^}]*}" contained -syn match rubyExprSubst "#\(\$\|@@\=\)\w\+" contained +syn match rubyExprSubst "\\\\\|\(\(\\M-\\C-\|\\c\|\\C-\|\\M-\)\w\)\|\(\\\o\{3}\|\\x\x\{2}\|\\[abefnrstv]\)" contained display +syn match rubyExprSubst "#{[^}]*}" contained display +syn match rubyExprSubst "#\(\$\|@@\=\)\w\+" contained display " Numbers and ASCII Codes -syn match rubyNumber "\w\@" +syn match rubyInteger "\w\@" display +syn match rubyFloat "\<\d\+\(_\d\+\)*\.\d\+\(_\d\+\)*\>" display +syn match rubyFloat "\<\(\d\+\(_\d\+\)*\(\.\d\+\(_\d\+\)*\)\=\)\([eE][-+]\=\(\d\+\(_\d\+\)*\)\+\)\>" display " Identifiers -syn match rubyLocalVariableOrMethod "[_[:lower:]][_[:alnum:]]*[?!=]\=" transparent contains=NONE +syn match rubyLocalVariableOrMethod "[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent if !exists("ruby_no_identifiers") - syn match rubyConstant "\(::\)\=\zs\u\w*" - syn match rubyClassVariable "@@\h\w*" - syn match rubyInstanceVariable "@\h\w*" - syn match rubyGlobalVariable "$\(\h\w*\|-.\)" - syn match rubySymbol ":\@?@\\_`~1-9]" - syn match rubyPredefinedVariable "$-[0FIKadilpvw]" - syn match rubyPredefinedVariable "$\(deferr\|defout\|stderr\|stdin\|stdout\)\>" - syn match rubyPredefinedVariable "$\(DEBUG\|FILENAME\|KCODE\|LOAD_PATH\|SAFE\|VERBOSE\)\>" - syn match rubyPredefinedConstant "__\(FILE\|LINE\)__\>" - syn match rubyPredefinedConstant "\<\(::\)\=\zs\(MatchingData\|ARGF\|ARGV\|ENV\)\>" - syn match rubyPredefinedConstant "\<\(::\)\=\zs\(DATA\|FALSE\|NIL\|RUBY_PLATFORM\|RUBY_RELEASE_DATE\)\>" - syn match rubyPredefinedConstant "\<\(::\)\=\zs\(RUBY_VERSION\|STDERR\|STDIN\|STDOUT\|TOPLEVEL_BINDING\|TRUE\)\>" + syn match rubyConstant "\(::\)\=\zs\u\w*" display + syn match rubyClassVariable "@@\h\w*" display + syn match rubyInstanceVariable "@\h\w*" display + syn match rubyGlobalVariable "$\(\h\w*\|-.\)" + syn match rubySymbol ":\@\|<=\|<\|===\|==\|=\~\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)" + syn match rubySymbol ":\@_,;:!?/.'"@$*\&+0]\)" + syn match rubySymbol ":\@?@\_`~1-9]" + syn match rubyPredefinedVariable "$-[0FIKadilpvw]" display + syn match rubyPredefinedVariable "$\(deferr\|defout\|stderr\|stdin\|stdout\)\>" display + syn match rubyPredefinedVariable "$\(DEBUG\|FILENAME\|KCODE\|LOAD_PATH\|SAFE\|VERBOSE\)\>" display + syn match rubyPredefinedConstant "__\(FILE\|LINE\)__\>" display + syn match rubyPredefinedConstant "\<\(::\)\=\zs\(MatchingData\|ARGF\|ARGV\|ENV\)\>" display + syn match rubyPredefinedConstant "\<\(::\)\=\zs\(DATA\|FALSE\|NIL\|RUBY_PLATFORM\|RUBY_RELEASE_DATE\)\>" display + syn match rubyPredefinedConstant "\<\(::\)\=\zs\(RUBY_VERSION\|STDERR\|STDIN\|STDOUT\|TOPLEVEL_BINDING\|TRUE\)\>" display "Obsolete Global Constants "syn match rubyPredefinedConstant "\<\(::\)\=\zs\(PLATFORM\|RELEASE_DATE\|VERSION\)\>" "syn match rubyPredefinedConstant "\<\(::\)\=\zs\(NotImplementError\)\>" @@ -110,7 +115,7 @@ if !exists("ruby_no_expensive") syn region rubyBlock start="\" matchgroup=rubyDefine end="\(^\|;\)\s*\zs\" contains=ALLBUT,rubyExprSubst,rubyTodo nextgroup=rubyModule fold " modifiers - syn match rubyControl "\<\(if\|unless\|while\|until\)\>" + syn match rubyControl "\<\(if\|unless\|while\|until\)\>" display " *do* requiring *end* syn region rubyDoBlock matchgroup=rubyControl start="\(\<\(for\|until\|while\)\s.*\s\)\@" end="\" contains=ALLBUT,rubyExprSubst,rubyTodo fold @@ -143,7 +148,7 @@ endif " Note: the following keywords have already been defined: " begin case class def do end for if module unless until while __FILE_ __LINE__ syn keyword rubyControl and break else elsif ensure in next not or redo rescue retry return then when -syn match rubyKeyword "\= 508 || !exists("did_ruby_syntax_inits") HiLink rubyFunction Function HiLink rubyControl Statement HiLink rubyInclude Include - HiLink rubyNumber Number + HiLink rubyInteger Number + HiLink rubyFloat Float HiLink rubyBoolean Boolean HiLink rubyException Exception HiLink rubyClass Type @@ -211,22 +217,21 @@ if version >= 508 || !exists("did_ruby_syntax_inits") HiLink rubyPredefinedConstant rubyPredefinedIdentifier HiLink rubyPredefinedVariable rubyPredefinedIdentifier HiLink rubySymbol rubyIdentifier - HiLink rubySharpBang PreProc HiLink rubyKeyword Keyword HiLink rubyBeginEnd Statement HiLink rubyAccess Statement HiLink rubyAttribute Statement HiLink rubyEval Statement - HiLink rubyString String - HiLink rubyStringDelimiter Delimiter - HiLink rubyExprSubst Special - HiLink rubyComment Comment - HiLink rubyDocumentation Comment - HiLink rubyTodo Todo HiLink rubyData Comment HiLink rubyDataDirective Delimiter + HiLink rubyDocumentation Comment + HiLink rubyExprSubst Special + HiLink rubySharpBang PreProc + HiLink rubyStringDelimiter Delimiter + HiLink rubyString String + HiLink rubyTodo Todo delcommand HiLink endif From 1542cb0532b5dc4f522f2f036e38c3906561777d Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 11 Sep 2003 14:25:47 +0000 Subject: [PATCH 033/411] fix ruby_no_expensive matchgroup typos --- ChangeLog | 5 +++++ syntax/ruby.vim | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 71e386b2..206d0a5b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-09-11 Doug Kearns + + * syntax/ruby.vim: fix my accidental redefinition of the + ruby_no_expensive matchgroups. + 2003-09-11 Doug Kearns * syntax/ruby.vim: improve support for symbols, integers and floating diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 7d3272d1..b37380cb 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.20 2003/09/11 06:51:25 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.21 2003/09/11 14:25:47 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -138,9 +138,9 @@ if !exists("ruby_no_expensive") exec "syn sync minlines=" . ruby_minlines else - syn region rubyFunction matchgroup=rubyDefine start="\ Date: Tue, 16 Sep 2003 15:33:54 +0000 Subject: [PATCH 034/411] Contribution by Hugh Sasse. Alpha state. --- install.rb | 90 +++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 68 insertions(+), 22 deletions(-) diff --git a/install.rb b/install.rb index fe488431..6fa6c1cf 100755 --- a/install.rb +++ b/install.rb @@ -1,27 +1,73 @@ #!/usr/local/bin/ruby -w - -# This program will take the files -# compiler/ruby.vim -# ftplugin/ruby.vim -# indent/ruby.vim -# syntax/ruby.vim -# and install them in a place where Vim can see them. If the environment -# variable $VIM exists, it is assumed to point to, e.g. /usr/share/vim/vim62, so -# the files can be placed in $VIM/syntax, etc. But it is unlikely that $VIM is -# defined, so this program will guess a few locations, using Unix and Windows -# sensibilities. It will, in fact, default to the user's ~/.vim or -# $HOME/vimfiles. # +# Script to install the vim files in a useful directory. +# +# Revision: $Id: install.rb,v 1.2 2003/09/16 15:33:54 gsinclair Exp $ +# Status: alpha +# +# This was contributed by Hugh Sasse and is *UNTESTED*. Usual disclaimers apply. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# Known issues (summarised by Hugh): +# Only checks the places I could think of at the time. +# Doesn't bother to preserve the old files in any way. +# Doesn't ask the user if none of the directoriss apply, but that +# would make it interactive. +# Should it say "Job Done" or something? Silent success is a unix +# idiom, but not so on Win*. +# Doesn't check the files are in the correct format: no ^Ms for +# unix... +# Hasn't a clue what to do about Data Forks and .... thingy forks +# on the mac.:-) Is there Ruby for pre OS-X Macs? +# +# Gavin's notes: +# Doesn't include any Windows paths. Should detect OS. +# TODO: revision 1.1 described some handy CLI-options which could +# be worked into here (e.g. global vs user directory). +# TODO: improve banner at the top with some of the nice doco from +# revision 1.1 +# + +require "ftools" + +PREFIXSTUB=["/usr/local/share/vim", + "/usr/local/vim", + "/usr/share/vim", + "/usr/vim", + "/opt/share/vim", + "/opt/vim"] + +stub = PREFIXSTUB.detect { |x| File.exist?(x) and File.directory?(x) } + +prefix = Dir.glob("#{stub}/vim*").sort[-1] -USAGE = <<-EOF -Usage: ruby install.rb [options] +f = "ruby.vim" - Options: - -g install in global vim configuration directory - -u install in user's (i.e. your) vim configuration directory (default) - -d DIR install in DIR - -i confirm before doing anything, especially overwriting files - -f no confirmations -EOF +pairs = [ + ["./compiler/#{f}", "#{prefix}/compiler/#{f}"], + ["./ftplugin/#{f}", "#{prefix}/ftplugin/#{f}"], + ["./indent/#{f}", "#{prefix}/indent/#{f}"], + ["./syntax/#{f}", "#{prefix}/syntax/#{f}"], +] -raise "Not implemented" +pairs.each do |from, to| + unless File.compare(from, to) + # If it is the same don't bother copying. + if File.exist?(to) and File.mtime(to) > File.mtime(from) + # If the file to replace is newer, it could be someone's interim + # patch, We assume they want to keep it, unless this is + # called with -f. Warn about not doing so otherwise. + if ARGV.include?("-f") + File.install(from, to) + else + $stderr.puts "#{to} is newer than #{from}. `#{$0} -f` to force replacement" + end + else + File.install(from, to) + end + end +end From 317a80e9f160ddba42c9b9c2f00a1205c2e23820 Mon Sep 17 00:00:00 2001 From: Gavin Sinclair Date: Tue, 16 Sep 2003 15:44:52 +0000 Subject: [PATCH 035/411] Introduce Hugh Sasse's install.rb --- ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index 206d0a5b..47babfd4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-09-17 Gavin Sinclair + + * install.rb: replace with Hugh Sasse's contribution. Alpha state + until tested, and with several issues and todos listed. + 2003-09-11 Doug Kearns * syntax/ruby.vim: fix my accidental redefinition of the From 3458aa5812a6327967e96de2a8016c34f4516640 Mon Sep 17 00:00:00 2001 From: Gavin Sinclair Date: Tue, 16 Sep 2003 15:55:07 +0000 Subject: [PATCH 036/411] Corrected email address --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 47babfd4..403c4500 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -2003-09-17 Gavin Sinclair +2003-09-17 Gavin Sinclair * install.rb: replace with Hugh Sasse's contribution. Alpha state until tested, and with several issues and todos listed. From 5a57c85123c14d563328b5212f3b7ec818c88c42 Mon Sep 17 00:00:00 2001 From: Gavin Sinclair Date: Tue, 16 Sep 2003 16:06:45 +0000 Subject: [PATCH 037/411] Added Ned Konz's matchit support --- ftplugin/ruby.vim | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index b77128c3..b2e6415e 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,16 +1,20 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.4 2003/08/18 09:52:48 dkearns Exp $ -" URL: http://vim-ruby.sourceforge.net -" Anon CVS: See above site -" Licence: GPL (http://www.gnu.org) -" Disclaimer: +" Info: $Id: ruby.vim,v 1.5 2003/09/16 16:06:45 gsinclair Exp $ +" URL: http://vim-ruby.sourceforge.net +" Anon CVS: See above site +" Licence: GPL (http://www.gnu.org) +" Disclaimer: " This program is distributed in the hope that it will be useful, " but WITHOUT ANY WARRANTY; without even the implied warranty of " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the " GNU General Public License for more details. " ---------------------------------------------------------------------------- +" +" Matchit support thanks to Ned Konz. See his ftplugin/ruby.vim at +" http://bike-nomad.com/vim/ruby.vim. +" ---------------------------------------------------------------------------- " Only do this when not done yet for this buffer if (exists("b:did_ftplugin")) @@ -18,7 +22,14 @@ if (exists("b:did_ftplugin")) endif let b:did_ftplugin = 1 -" There are no known setting particularly appropriate for Ruby. Please -" contact the maintainer if you think of some. +" Matchit support +if exists("loaded_matchit") + if !exists("b:match_words") + let b:match_ignorecase = 0 + let b:match_words = +\ '\%(\%(\%(^\|[;=]\)\s*\)\@<=\%(class\|module\|while\|begin\|until\|for\|if\|unless\|def\|case\)\|\:' . +\ '\<\%(else\|elsif\|ensure\|rescue\|when\)\>:\%(^\|[^.]\)\@<=\' + endif +endif " vim: ff=unix From d7e3317aeda9bd940fa77e78afb5aabcf5f6a5ad Mon Sep 17 00:00:00 2001 From: Gavin Sinclair Date: Tue, 16 Sep 2003 16:09:47 +0000 Subject: [PATCH 038/411] matchit support for ftplugin/ruby.vim (credit: Ned Konz) --- ChangeLog | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 403c4500..9963eddc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,11 @@ 2003-09-17 Gavin Sinclair - * install.rb: replace with Hugh Sasse's contribution. Alpha state + * ftplugin/ruby.vim: implemented matchit support (thanks to Ned Konz + and Hugh Sasse). + +2003-09-17 Gavin Sinclair + + * install.rb: replaced with Hugh Sasse's contribution. Alpha state until tested, and with several issues and todos listed. 2003-09-11 Doug Kearns From ec7ae2c5db16dcb011f6bcf141c1ce02a79a7cb4 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 18 Sep 2003 00:27:15 +0000 Subject: [PATCH 039/411] match some more common regexps and if\unless expressions --- ChangeLog | 5 +++++ syntax/ruby.vim | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9963eddc..fcfd4056 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-09-18 Doug Kearns + + * syntax/ruby.vim: match regexp after 'not' and 'then'; match if and + unless expressions following '=' and '('. + 2003-09-17 Gavin Sinclair * ftplugin/ruby.vim: implemented matchit support (thanks to Ned Konz diff --git a/syntax/ruby.vim b/syntax/ruby.vim index b37380cb..cb05d886 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.21 2003/09/11 14:25:47 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.22 2003/09/18 00:27:15 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -26,7 +26,7 @@ endif " Expression Substitution and Backslash Notation syn match rubyExprSubst "\\\\\|\(\(\\M-\\C-\|\\c\|\\C-\|\\M-\)\w\)\|\(\\\o\{3}\|\\x\x\{2}\|\\[abefnrstv]\)" contained display -syn match rubyExprSubst "#{[^}]*}" contained display +syn match rubyExprSubst "#{[^}]*}" contained syn match rubyExprSubst "#\(\$\|@@\=\)\w\+" contained display " Numbers and ASCII Codes @@ -63,7 +63,7 @@ if !exists("ruby_no_identifiers") endif " Normal Regular Expression -syn region rubyString matchgroup=rubyStringDelimiter start="^\s*/" start="\ Date: Thu, 18 Sep 2003 08:28:24 +0000 Subject: [PATCH 040/411] Included comments and USAGE string from revisino 1.1. --- install.rb | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/install.rb b/install.rb index 6fa6c1cf..10ea5900 100755 --- a/install.rb +++ b/install.rb @@ -2,7 +2,21 @@ # # Script to install the vim files in a useful directory. # -# Revision: $Id: install.rb,v 1.2 2003/09/16 15:33:54 gsinclair Exp $ +# This program will take the files +# compiler/ruby.vim +# ftplugin/ruby.vim +# indent/ruby.vim +# syntax/ruby.vim +# and install them in a place where Vim can see them. If the environment +# variable $VIM exists, it is assumed to point to, e.g. /usr/share/vim/vim62, so +# the files can be placed in $VIM/syntax, etc. But it is unlikely that $VIM is +# defined, so this program will guess a few locations, using Unix and Windows +# sensibilities. It will, in fact, default to the user's ~/.vim or +# $HOME/vimfiles. +# +# ------------------------------------------------------------------------------ +# +# Revision: $Id: install.rb,v 1.3 2003/09/18 08:28:24 gsinclair Exp $ # Status: alpha # # This was contributed by Hugh Sasse and is *UNTESTED*. Usual disclaimers apply. @@ -12,6 +26,8 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # +# ------------------------------------------------------------------------------ +# # Known issues (summarised by Hugh): # Only checks the places I could think of at the time. # Doesn't bother to preserve the old files in any way. @@ -31,9 +47,26 @@ # TODO: improve banner at the top with some of the nice doco from # revision 1.1 # +# ------------------------------------------------------------------------------ +# require "ftools" +# +# This USAGE string does not apply to the current implementation, but it is a +# good guide for future work. +# +USAGE = <<-EOF +Usage: ruby install.rb [options] + + Options: + -g install in global vim configuration directory + -u install in user's (i.e. your) vim configuration directory (default) + -d DIR install in DIR + -i confirm before doing anything, especially overwriting files + -f no confirmations +EOF + PREFIXSTUB=["/usr/local/share/vim", "/usr/local/vim", "/usr/share/vim", From 0c8f88f1fe08737753b0a4b41889d5802219e5b3 Mon Sep 17 00:00:00 2001 From: Gavin Sinclair Date: Thu, 18 Sep 2003 08:29:57 +0000 Subject: [PATCH 041/411] Updated install.rb with comments. --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index fcfd4056..ab100fbc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2003-09-18 Gavin Sinclair + + * install.rb: Included comments and USAGE string from revisino 1.1. + 2003-09-18 Doug Kearns * syntax/ruby.vim: match regexp after 'not' and 'then'; match if and From 0ded4460b3d0ea645fa1104baca93b735bd6027c Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 18 Sep 2003 15:10:14 +0000 Subject: [PATCH 042/411] replace all syntax patterns surrounded by \(\) with \%(\) --- ChangeLog | 5 +++ syntax/ruby.vim | 108 ++++++++++++++++++++++++------------------------ 2 files changed, 59 insertions(+), 54 deletions(-) diff --git a/ChangeLog b/ChangeLog index ab100fbc..4c8eeb25 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-09-18 Doug Kearns + + * syntax/ruby.vim: replace all patterns surrounded by \(\) with \%(\) + when the sub-expression is not used. + 2003-09-18 Gavin Sinclair * install.rb: Included comments and USAGE string from revisino 1.1. diff --git a/syntax/ruby.vim b/syntax/ruby.vim index cb05d886..7b158574 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.22 2003/09/18 00:27:15 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.23 2003/09/18 15:10:14 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -25,41 +25,41 @@ elseif exists("b:current_syntax") endif " Expression Substitution and Backslash Notation -syn match rubyExprSubst "\\\\\|\(\(\\M-\\C-\|\\c\|\\C-\|\\M-\)\w\)\|\(\\\o\{3}\|\\x\x\{2}\|\\[abefnrstv]\)" contained display -syn match rubyExprSubst "#{[^}]*}" contained -syn match rubyExprSubst "#\(\$\|@@\=\)\w\+" contained display +syn match rubyExprSubst "\\\\\|\%(\%(\\M-\\C-\|\\c\|\\C-\|\\M-\)\w\)\|\%(\\\o\{3}\|\\x\x\{2}\|\\[abefnrstv]\)" contained display +syn match rubyExprSubst "#{[^}]*}" contained +syn match rubyExprSubst "#\%(\$\|@@\=\)\w\+" contained display " Numbers and ASCII Codes -syn match rubyInteger "\w\@" display -syn match rubyFloat "\<\d\+\(_\d\+\)*\.\d\+\(_\d\+\)*\>" display -syn match rubyFloat "\<\(\d\+\(_\d\+\)*\(\.\d\+\(_\d\+\)*\)\=\)\([eE][-+]\=\(\d\+\(_\d\+\)*\)\+\)\>" display +syn match rubyInteger "\w\@" display +syn match rubyFloat "\<\d\+\%(_\d\+\)*\.\d\+\%(_\d\+\)*\>" display +syn match rubyFloat "\<\%(\d\+\%(_\d\+\)*\%(\.\d\+\%(_\d\+\)*\)\=\)\%([eE][-+]\=\%(\d\+\%(_\d\+\)*\)\+\)\>" display " Identifiers syn match rubyLocalVariableOrMethod "[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent if !exists("ruby_no_identifiers") - syn match rubyConstant "\(::\)\=\zs\u\w*" display + syn match rubyConstant "\%(::\)\=\zs\u\w*" display syn match rubyClassVariable "@@\h\w*" display syn match rubyInstanceVariable "@\h\w*" display - syn match rubyGlobalVariable "$\(\h\w*\|-.\)" - syn match rubySymbol ":\@\|<=\|<\|===\|==\|=\~\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)" - syn match rubySymbol ":\@_,;:!?/.'"@$*\&+0]\)" - syn match rubySymbol ":\@\|<=\|<\|===\|==\|=\~\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)" + syn match rubySymbol ":\@_,;:!?/.'"@$*\&+0]\)" + syn match rubySymbol ":\@?@\_`~1-9]" syn match rubyPredefinedVariable "$-[0FIKadilpvw]" display - syn match rubyPredefinedVariable "$\(deferr\|defout\|stderr\|stdin\|stdout\)\>" display - syn match rubyPredefinedVariable "$\(DEBUG\|FILENAME\|KCODE\|LOAD_PATH\|SAFE\|VERBOSE\)\>" display - syn match rubyPredefinedConstant "__\(FILE\|LINE\)__\>" display - syn match rubyPredefinedConstant "\<\(::\)\=\zs\(MatchingData\|ARGF\|ARGV\|ENV\)\>" display - syn match rubyPredefinedConstant "\<\(::\)\=\zs\(DATA\|FALSE\|NIL\|RUBY_PLATFORM\|RUBY_RELEASE_DATE\)\>" display - syn match rubyPredefinedConstant "\<\(::\)\=\zs\(RUBY_VERSION\|STDERR\|STDIN\|STDOUT\|TOPLEVEL_BINDING\|TRUE\)\>" display + syn match rubyPredefinedVariable "$\%(deferr\|defout\|stderr\|stdin\|stdout\)\>" display + syn match rubyPredefinedVariable "$\%(DEBUG\|FILENAME\|KCODE\|LOAD_PATH\|SAFE\|VERBOSE\)\>" display + syn match rubyPredefinedConstant "__\%(FILE\|LINE\)__\>" display + syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(MatchingData\|ARGF\|ARGV\|ENV\)\>" display + syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(DATA\|FALSE\|NIL\|RUBY_PLATFORM\|RUBY_RELEASE_DATE\)\>" display + syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(RUBY_VERSION\|STDERR\|STDIN\|STDOUT\|TOPLEVEL_BINDING\|TRUE\)\>" display "Obsolete Global Constants - "syn match rubyPredefinedConstant "\<\(::\)\=\zs\(PLATFORM\|RELEASE_DATE\|VERSION\)\>" - "syn match rubyPredefinedConstant "\<\(::\)\=\zs\(NotImplementError\)\>" + "syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(PLATFORM\|RELEASE_DATE\|VERSION\)\>" + "syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(NotImplementError\)\>" endif " Normal Regular Expression @@ -94,43 +94,43 @@ syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\[" e syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=(" end=")" skip="\\\\\|\\)" contains=rubyExprSubst fold " Here Document -syn region rubyString matchgroup=rubyStringDelimiter start=+\(\(class\s*\|\(\.\|::\)\)\_s*\)\@" matchgroup=rubyDefine end="\(^\|;\)\s*\zs\" contains=ALLBUT,rubyExprSubst,rubyTodo nextgroup=rubyFunction fold - syn region rubyBlock start="\" matchgroup=rubyDefine end="\(^\|;\)\s*\zs\" contains=ALLBUT,rubyExprSubst,rubyTodo nextgroup=rubyClass fold - syn region rubyBlock start="\" matchgroup=rubyDefine end="\(^\|;\)\s*\zs\" contains=ALLBUT,rubyExprSubst,rubyTodo nextgroup=rubyModule fold + syn region rubyBlock start="\" matchgroup=rubyDefine end="\%(^\|;\)\s*\zs\" contains=ALLBUT,rubyExprSubst,rubyTodo nextgroup=rubyFunction fold + syn region rubyBlock start="\" matchgroup=rubyDefine end="\%(^\|;\)\s*\zs\" contains=ALLBUT,rubyExprSubst,rubyTodo nextgroup=rubyClass fold + syn region rubyBlock start="\" matchgroup=rubyDefine end="\%(^\|;\)\s*\zs\" contains=ALLBUT,rubyExprSubst,rubyTodo nextgroup=rubyModule fold " modifiers - syn match rubyControl "\<\(if\|unless\|while\|until\)\>" display + syn match rubyControl "\<\%(if\|unless\|while\|until\)\>" display " *do* requiring *end* - syn region rubyDoBlock matchgroup=rubyControl start="\(\<\(for\|until\|while\)\s.*\s\)\@" end="\" contains=ALLBUT,rubyExprSubst,rubyTodo fold + syn region rubyDoBlock matchgroup=rubyControl start="\%(\<\%(for\|until\|while\)\s.*\s\)\@" end="\" contains=ALLBUT,rubyExprSubst,rubyTodo fold " *{* requiring *}* syn region rubyCurlyBlock start="{" end="}" contains=ALLBUT,rubyExprSubst,rubyTodo fold " statements without *do* - syn region rubyNoDoBlock matchgroup=rubyControl start="\<\(case\|begin\)\>" start="^\s*\(if\|unless\)\>" start="[;=(]\s*\(if\|unless\)\>"hs=s+1 end="\" contains=ALLBUT,rubyExprSubst,rubyTodo fold + syn region rubyNoDoBlock matchgroup=rubyControl start="\<\%(case\|begin\)\>" start="^\s*\%(if\|unless\)\>" start="[;=(]\s*\%(if\|unless\)\>"hs=s+1 end="\" contains=ALLBUT,rubyExprSubst,rubyTodo fold " statement with optional *do* - syn region rubyOptDoBlock matchgroup=rubyControl start="\" start="^\s*\(while\|until\)\>" start=";\s*\(while\|until\)\>"hs=s+1 end="\" contains=ALLBUT,rubyExprSubst,rubyTodo fold + syn region rubyOptDoBlock matchgroup=rubyControl start="\" start="^\s*\%(while\|until\)\>" start=";\s*\%(while\|until\)\>"hs=s+1 end="\" contains=ALLBUT,rubyExprSubst,rubyTodo fold " optional *do* - syn match rubyControl "\(\<\(for\|until\|while\)\s.*\s\)\@<=\(do\|:\)\>" + syn match rubyControl "\%(\<\%(for\|until\|while\)\s.*\s\)\@<=\%(do\|:\)\>" if !exists("ruby_minlines") let ruby_minlines = 50 @@ -138,9 +138,9 @@ if !exists("ruby_no_expensive") exec "syn sync minlines=" . ruby_minlines else - syn region rubyFunction matchgroup=rubyControl start="\" transparent contains=NONE -syn match rubyKeywordAsMethod "\(\(\.\@" transparent contains=NONE -syn match rubyKeywordAsMethod "\(\(\.\@" transparent contains=NONE -syn match rubyKeywordAsMethod "\(\(\.\@" transparent contains=NONE - -syn match rubyKeywordAsMethod "\(\(\.\@" transparent contains=NONE -syn match rubyKeywordAsMethod "\(\(\.\@" transparent contains=NONE -syn match rubyKeywordAsMethod "\(\(\.\@" transparent contains=NONE -syn match rubyKeywordAsMethod "\(\(\.\@" transparent contains=NONE -syn match rubyKeywordAsMethod "\(\(\.\@" transparent contains=NONE -syn match rubyKeywordAsMethod "\(\(\.\@" transparent contains=NONE +syn match rubyKeywordAsMethod "\%(\%(\.\@" transparent contains=NONE +syn match rubyKeywordAsMethod "\%(\%(\.\@" transparent contains=NONE +syn match rubyKeywordAsMethod "\%(\%(\.\@" transparent contains=NONE +syn match rubyKeywordAsMethod "\%(\%(\.\@" transparent contains=NONE + +syn match rubyKeywordAsMethod "\%(\%(\.\@" transparent contains=NONE +syn match rubyKeywordAsMethod "\%(\%(\.\@" transparent contains=NONE +syn match rubyKeywordAsMethod "\%(\%(\.\@" transparent contains=NONE +syn match rubyKeywordAsMethod "\%(\%(\.\@" transparent contains=NONE +syn match rubyKeywordAsMethod "\%(\%(\.\@" transparent contains=NONE +syn match rubyKeywordAsMethod "\%(\%(\.\@" transparent contains=NONE " __END__ Directive syn region rubyData matchgroup=rubyDataDirective start="^__END__$" matchgroup=NONE end="." skip="." fold From d41bd86af1cce54c2be34f20f6988e3208f1081a Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 18 Sep 2003 15:13:56 +0000 Subject: [PATCH 043/411] split rubyInteger syntax group into multiple groups --- ChangeLog | 6 ++++++ syntax/ruby.vim | 18 +++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4c8eeb25..999b7b4c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-09-18 Doug Kearns + + * syntax/ruby.vim: improve float and decimal matching; split + rubyInteger into multiple syntax groups - rubyASCIICode, + rubyHexadecimal, rubyDecimal, rubyOctal, rubyBinary. + 2003-09-18 Doug Kearns * syntax/ruby.vim: replace all patterns surrounded by \(\) with \%(\) diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 7b158574..29bfc855 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.23 2003/09/18 15:10:14 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.24 2003/09/18 15:13:56 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -30,10 +30,13 @@ syn match rubyExprSubst "#{[^}]*}" contained syn match rubyExprSubst "#\%(\$\|@@\=\)\w\+" contained display " Numbers and ASCII Codes -syn match rubyInteger "\w\@" display -syn match rubyFloat "\<\d\+\%(_\d\+\)*\.\d\+\%(_\d\+\)*\>" display -syn match rubyFloat "\<\%(\d\+\%(_\d\+\)*\%(\.\d\+\%(_\d\+\)*\)\=\)\%([eE][-+]\=\%(\d\+\%(_\d\+\)*\)\+\)\>" display +syn match rubyASCIICode "\w\@" display +syn match rubyDecimal "\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\>" display +syn match rubyOctal "\<0\o\+\%(_\o\+\)*\>" display +syn match rubyBinary "\<0b[01]\+\%(_[01]\+\)*\>" display +syn match rubyFloat "\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\.\d\+\%(_\d\+\)*\>" display +syn match rubyFloat "\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE][-+]\=\d\+\%(_\d\+\)*\)\>" display " Identifiers syn match rubyLocalVariableOrMethod "[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent @@ -202,6 +205,11 @@ if version >= 508 || !exists("did_ruby_syntax_inits") HiLink rubyControl Statement HiLink rubyInclude Include HiLink rubyInteger Number + HiLink rubyASCIICode rubyInteger + HiLink rubyBinary rubyInteger + HiLink rubyOctal rubyInteger + HiLink rubyHexadecimal rubyInteger + HiLink rubyDecimal rubyInteger HiLink rubyFloat Float HiLink rubyBoolean Boolean HiLink rubyException Exception From e4e786bf67f1181e623dbe00e0f903e99b8c8594 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 19 Sep 2003 11:20:21 +0000 Subject: [PATCH 044/411] add syntax file documentation --- syntax/doc/ruby.txt | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 syntax/doc/ruby.txt diff --git a/syntax/doc/ruby.txt b/syntax/doc/ruby.txt new file mode 100644 index 00000000..31db10a2 --- /dev/null +++ b/syntax/doc/ruby.txt @@ -0,0 +1,24 @@ +RUBY *ruby.vim* *ruby-syntax* + +There are a few options to the Ruby syntax highlighting. + +By default, the "end" keyword is colorized according to the opening statement +of the block it closes. While useful, this feature can be expensive: if you +experience slow redrawing (or you are on a terminal with poor color support) +you may want to turn it off by defining the "ruby_no_expensive" variable: > + :let ruby_no_expensive = 1 +In this case the same color will be used for all control keywords. + +If you do want this feature enabled, but notice highlighting errors while +scrolling backwards, which are fixed when redrawing with CTRL-L, try setting +the "ruby_minlines" variable to a value larger than 50: > + :let ruby_minlines = 100 +Ideally, this value should be a number of lines large enough to embrace your +largest class or module. + +Finally, if you do not like to see too many color items around, you can define +"ruby_no_identifiers": > + :let ruby_no_identifiers = 1 +This will prevent highlighting of special identifiers like "ConstantName", +"$global_var", "@instace_var", "| iterator |", and ":symbol". + From 5cd574f94d395c4a00a8f52e7524272c91e53264 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 19 Sep 2003 11:39:10 +0000 Subject: [PATCH 045/411] fix minor typos --- ChangeLog | 4 ++++ install.rb | 4 ++-- syntax/doc/ruby.txt | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 999b7b4c..75587611 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2003-09-19 Doug Kearns + + * install.rb, syntax/doc/ruby.txt: fix minor typos. + 2003-09-18 Doug Kearns * syntax/ruby.vim: improve float and decimal matching; split diff --git a/install.rb b/install.rb index 10ea5900..0d96cb2b 100755 --- a/install.rb +++ b/install.rb @@ -16,7 +16,7 @@ # # ------------------------------------------------------------------------------ # -# Revision: $Id: install.rb,v 1.3 2003/09/18 08:28:24 gsinclair Exp $ +# Revision: $Id: install.rb,v 1.4 2003/09/19 11:39:10 dkearns Exp $ # Status: alpha # # This was contributed by Hugh Sasse and is *UNTESTED*. Usual disclaimers apply. @@ -31,7 +31,7 @@ # Known issues (summarised by Hugh): # Only checks the places I could think of at the time. # Doesn't bother to preserve the old files in any way. -# Doesn't ask the user if none of the directoriss apply, but that +# Doesn't ask the user if none of the directories apply, but that # would make it interactive. # Should it say "Job Done" or something? Silent success is a unix # idiom, but not so on Win*. diff --git a/syntax/doc/ruby.txt b/syntax/doc/ruby.txt index 31db10a2..afa9f5f0 100644 --- a/syntax/doc/ruby.txt +++ b/syntax/doc/ruby.txt @@ -20,5 +20,5 @@ Finally, if you do not like to see too many color items around, you can define "ruby_no_identifiers": > :let ruby_no_identifiers = 1 This will prevent highlighting of special identifiers like "ConstantName", -"$global_var", "@instace_var", "| iterator |", and ":symbol". +"$global_var", "@@class_var", "@instance_var", "| iterator |", and ":symbol". From 07a9dd5cb2a6e505c59881430173359c42a3e3fc Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 19 Sep 2003 11:49:35 +0000 Subject: [PATCH 046/411] match singleton class definitions without whitespace --- ChangeLog | 5 +++++ syntax/ruby.vim | 10 ++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 75587611..4258a282 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-09-19 Doug Kearns + + * syntax/ruby.vim: match singleton class definitions with no + whitespace between 'class' and '<<'. + 2003-09-19 Doug Kearns * install.rb, syntax/doc/ruby.txt: fix minor typos. diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 29bfc855..26636196 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.24 2003/09/18 15:13:56 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.25 2003/09/19 11:49:35 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -111,11 +111,12 @@ syn region rubyString matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%(\ if !exists("ruby_no_expensive") syn region rubyFunction matchgroup=rubyDefine start="\" display @@ -143,6 +144,7 @@ if !exists("ruby_no_expensive") else syn region rubyFunction matchgroup=rubyControl start="\ Date: Sun, 21 Sep 2003 14:07:56 +0000 Subject: [PATCH 047/411] highlight escaped string interpolation correctly --- ChangeLog | 7 +++++ syntax/ruby.vim | 72 ++++++++++++++++++++++++++----------------------- 2 files changed, 46 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4258a282..23d23dac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2003-09-21 Doug Kearns + + * syntax/ruby.vim: highlight escaped string interpolation correctly; + allow hexadecimal and octal escape sequences to match with less than 3 + and 2 digits respectively; split rubyExprSubst into multiple syntax + groups - rubyInterpolation, rubyNoInterpolation, rubyEscape. + 2003-09-19 Doug Kearns * syntax/ruby.vim: match singleton class definitions with no diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 26636196..3a01646a 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.25 2003/09/19 11:49:35 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.26 2003/09/21 14:07:56 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -25,12 +25,17 @@ elseif exists("b:current_syntax") endif " Expression Substitution and Backslash Notation -syn match rubyExprSubst "\\\\\|\%(\%(\\M-\\C-\|\\c\|\\C-\|\\M-\)\w\)\|\%(\\\o\{3}\|\\x\x\{2}\|\\[abefnrstv]\)" contained display -syn match rubyExprSubst "#{[^}]*}" contained -syn match rubyExprSubst "#\%(\$\|@@\=\)\w\+" contained display +syn match rubyEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display +syn match rubyEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display +syn match rubyInterpolation "#{[^}]*}" contained +syn match rubyInterpolation "#\%(\$\|@@\=\)\w\+" contained display +syn match rubyNoInterpolation "\\#{[^}]*}" contained +syn match rubyNoInterpolation "\\#\%(\$\|@@\=\)\w\+" contained display + +syn cluster rubyStringSpecial contains=rubyInterpolation,rubyNoInterpolation,rubyEscape " Numbers and ASCII Codes -syn match rubyASCIICode "\w\@" display syn match rubyDecimal "\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\>" display syn match rubyOctal "\<0\o\+\%(_\o\+\)*\>" display @@ -66,19 +71,19 @@ if !exists("ruby_no_identifiers") endif " Normal Regular Expression -syn region rubyString matchgroup=rubyStringDelimiter start="^\s*/" start="\" display " *do* requiring *end* - syn region rubyDoBlock matchgroup=rubyControl start="\%(\<\%(for\|until\|while\)\s.*\s\)\@" end="\" contains=ALLBUT,rubyExprSubst,rubyTodo fold + syn region rubyDoBlock matchgroup=rubyControl start="\%(\<\%(for\|until\|while\)\s.*\s\)\@" end="\" contains=ALLBUT,@rubyStringSpecial,rubyTodo fold " *{* requiring *}* - syn region rubyCurlyBlock start="{" end="}" contains=ALLBUT,rubyExprSubst,rubyTodo fold + syn region rubyCurlyBlock start="{" end="}" contains=ALLBUT,@rubyStringSpecial,rubyTodo fold " statements without *do* - syn region rubyNoDoBlock matchgroup=rubyControl start="\<\%(case\|begin\)\>" start="^\s*\%(if\|unless\)\>" start="[;=(]\s*\%(if\|unless\)\>"hs=s+1 end="\" contains=ALLBUT,rubyExprSubst,rubyTodo fold + syn region rubyNoDoBlock matchgroup=rubyControl start="\<\%(case\|begin\)\>" start="^\s*\%(if\|unless\)\>" start="[;=(]\s*\%(if\|unless\)\>"hs=s+1 end="\" contains=ALLBUT,@rubyStringSpecial,rubyTodo fold " statement with optional *do* - syn region rubyOptDoBlock matchgroup=rubyControl start="\" start="^\s*\%(while\|until\)\>" start=";\s*\%(while\|until\)\>"hs=s+1 end="\" contains=ALLBUT,rubyExprSubst,rubyTodo fold + syn region rubyOptDoBlock matchgroup=rubyControl start="\" start="^\s*\%(while\|until\)\>" start=";\s*\%(while\|until\)\>"hs=s+1 end="\" contains=ALLBUT,@rubyStringSpecial,rubyTodo fold " optional *do* syn match rubyControl "\%(\<\%(for\|until\|while\)\s.*\s\)\@<=\%(do\|:\)\>" @@ -237,7 +242,8 @@ if version >= 508 || !exists("did_ruby_syntax_inits") HiLink rubyData Comment HiLink rubyDataDirective Delimiter HiLink rubyDocumentation Comment - HiLink rubyExprSubst Special + HiLink rubyEscape Special + HiLink rubyInterpolation Special HiLink rubySharpBang PreProc HiLink rubyStringDelimiter Delimiter HiLink rubyString String From 03507c21b511829b3dc0380403de859ed661cee7 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sun, 21 Sep 2003 14:24:27 +0000 Subject: [PATCH 048/411] match regexp after common Kernel methods --- ChangeLog | 4 ++++ syntax/ruby.vim | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 23d23dac..8528b495 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2003-09-21 Doug Kearns + + * syntax/ruby.vim: match regexp after split, scan, sub and gsub. + 2003-09-21 Doug Kearns * syntax/ruby.vim: highlight escaped string interpolation correctly; diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 3a01646a..b59ba88a 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.26 2003/09/21 14:07:56 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.27 2003/09/21 14:24:27 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -72,6 +72,7 @@ endif " Normal Regular Expression syn region rubyString matchgroup=rubyStringDelimiter start="^\s*/" start="\ Date: Mon, 22 Sep 2003 12:19:34 +0000 Subject: [PATCH 049/411] link rubyOperator to the Operator highlight group --- ChangeLog | 5 +++++ syntax/ruby.vim | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8528b495..88f07f3f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-09-22 Doug Kearns + + * syntax/ruby.vim: link the rubyOperator syntax group to the Operator + highlight group. + 2003-09-21 Doug Kearns * syntax/ruby.vim: match regexp after split, scan, sub and gsub. diff --git a/syntax/ruby.vim b/syntax/ruby.vim index b59ba88a..72dad6f7 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.27 2003/09/21 14:24:27 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.28 2003/09/22 12:19:34 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -234,6 +234,7 @@ if version >= 508 || !exists("did_ruby_syntax_inits") HiLink rubyPredefinedVariable rubyPredefinedIdentifier HiLink rubySymbol rubyIdentifier HiLink rubyKeyword Keyword + HiLink rubyOperator Operator HiLink rubyBeginEnd Statement HiLink rubyAccess Statement HiLink rubyAttribute Statement From 4fb9132c7cb7c513ef551d56ccaa2c8a17b3b8b3 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 25 Sep 2003 14:42:25 +0000 Subject: [PATCH 050/411] link rubyNoInterpolation to rubyString and merge integer groups into rubyInteger --- ChangeLog | 6 ++++++ syntax/ruby.vim | 21 +++++++++------------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 88f07f3f..753cb84d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-09-25 Doug Kearns + + * syntax/ruby.vim: link the rubyNoInterpolation syntax group to the + rubyString; merge rubyHexadecimal, rubyDecimal, rubyOctal, rubyBinary + into rubyInteger. + 2003-09-22 Doug Kearns * syntax/ruby.vim: link the rubyOperator syntax group to the Operator diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 72dad6f7..7ab5c29a 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.28 2003/09/22 12:19:34 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.29 2003/09/25 14:42:26 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -35,13 +35,13 @@ syn match rubyNoInterpolation "\\#\%(\$\|@@\=\)\w\+" contained display syn cluster rubyStringSpecial contains=rubyInterpolation,rubyNoInterpolation,rubyEscape " Numbers and ASCII Codes -syn match rubyASCIICode "\w\@" display -syn match rubyDecimal "\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\>" display -syn match rubyOctal "\<0\o\+\%(_\o\+\)*\>" display -syn match rubyBinary "\<0b[01]\+\%(_[01]\+\)*\>" display -syn match rubyFloat "\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\.\d\+\%(_\d\+\)*\>" display -syn match rubyFloat "\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE][-+]\=\d\+\%(_\d\+\)*\)\>" display +syn match rubyASCIICode "\w\@" display +syn match rubyInteger "\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\>" display +syn match rubyInteger "\<0\o\+\%(_\o\+\)*\>" display +syn match rubyInteger "\<0b[01]\+\%(_[01]\+\)*\>" display +syn match rubyFloat "\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\.\d\+\%(_\d\+\)*\>" display +syn match rubyFloat "\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE][-+]\=\d\+\%(_\d\+\)*\)\>" display " Identifiers syn match rubyLocalVariableOrMethod "[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent @@ -214,10 +214,6 @@ if version >= 508 || !exists("did_ruby_syntax_inits") HiLink rubyInclude Include HiLink rubyInteger Number HiLink rubyASCIICode rubyInteger - HiLink rubyBinary rubyInteger - HiLink rubyOctal rubyInteger - HiLink rubyHexadecimal rubyInteger - HiLink rubyDecimal rubyInteger HiLink rubyFloat Float HiLink rubyBoolean Boolean HiLink rubyException Exception @@ -246,6 +242,7 @@ if version >= 508 || !exists("did_ruby_syntax_inits") HiLink rubyDocumentation Comment HiLink rubyEscape Special HiLink rubyInterpolation Special + HiLink rubyNoInterpolation rubyString HiLink rubySharpBang PreProc HiLink rubyStringDelimiter Delimiter HiLink rubyString String From d5f0ecaf99aa725a5a928ea9baedce7d07741341 Mon Sep 17 00:00:00 2001 From: Gavin Sinclair Date: Fri, 26 Sep 2003 11:57:33 +0000 Subject: [PATCH 051/411] Initial revision. --- etc/website/index.html | 110 +++++++++++++++++++++++++++++++++++++++++ etc/website/update.sh | 1 + 2 files changed, 111 insertions(+) create mode 100644 etc/website/index.html create mode 100644 etc/website/update.sh diff --git a/etc/website/index.html b/etc/website/index.html new file mode 100644 index 00000000..6d0a7166 --- /dev/null +++ b/etc/website/index.html @@ -0,0 +1,110 @@ + + + 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 project CVS, 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?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-stable.tar.gz (the files ready for the next Vim release)
+     - vim-ruby-devel.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 anonymous CVS.
+  - Please join the mailing list and discuss changes, submit patches, etc.
+  - Thank you very much for taking an interest.
+
+Contents of the project:
+  - The compiler, ftplugin, indent and syntax directories contain the ruby.vim
+    files that are to be copied somewhere Vim can see them.
+  - install.rb performs this copying.
+  - build.rb creates a tarball for easy distribution.
+
+How you get these files into Vim:
+  - By downloading the project via a snapshot or anonymous CVS, 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 install.rb, just Vim files.  You would typically install these
+    wherever Vim is installed, in the (for example) "vim62" directory.
+  - 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 www.rubygarden.org/ruby?VimRubySupport
+
+CVS topics:
+  - 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 "cvs update -A", or a development snapshot.
+  - When a modification is considered stable, it is tagged "stable".
+    Everything that is stable gets released in vim-ruby-stable.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 soyabean.com.au).
+  - 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.
+
+Project gossip:
+  - Two of the configuration file maintainers, Doug Kearns and Gavin Sinclair,
+    live in Australia (Melbourne and Sydney respectively).  Tim Hammerquist,
+    the last man standing, has a cpan.org email address.
+  - 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
new file mode 100644
index 00000000..4daf235a
--- /dev/null
+++ b/etc/website/update.sh
@@ -0,0 +1 @@
+scp index.html gsinclair@rubyforge.org:/var/www/gforge-projects/vim-ruby/

From 22cd8472610bccc0ee4544bee960a0745a0a3cf8 Mon Sep 17 00:00:00 2001
From: Gavin Sinclair 
Date: Fri, 26 Sep 2003 12:20:36 +0000
Subject: [PATCH 052/411] Initial revision

---
 etc/cvsrelease | 167 +++++++++++++++++++++++++++++++++++++++++++++++++
 etc/release.sh |  19 ++++++
 2 files changed, 186 insertions(+)
 create mode 100755 etc/cvsrelease
 create mode 100755 etc/release.sh

diff --git a/etc/cvsrelease b/etc/cvsrelease
new file mode 100755
index 00000000..3625c38e
--- /dev/null
+++ b/etc/cvsrelease
@@ -0,0 +1,167 @@
+#!/bin/sh
+
+#
+# Automates the process of tagging, exporting and packaging a release from CVS.
+# Steve Purcell 
+#
+
+AUTHOR='Steve Purcell '
+VERSION=`echo '$Revision: 1.1 $'|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.sh b/etc/release.sh
new file mode 100755
index 00000000..e13a56d5
--- /dev/null
+++ b/etc/release.sh
@@ -0,0 +1,19 @@
+#!/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 -t $release_tag -r $release_number rj
+

From 09af1f7a04e0ed3ae01a152cc0bffdface0476e3 Mon Sep 17 00:00:00 2001
From: Gavin Sinclair 
Date: Fri, 26 Sep 2003 12:27:54 +0000
Subject: [PATCH 053/411] etc/* - new directory

---
 ChangeLog | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 753cb84d..6a4b14ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2003-09-26  Gavin Sinclair 
+
+	* etc/release/*: added to aid in the production of releases.
+	* etc/website/*: now anyone can have a crack at the
+	  vim.ruby.rubyforge.org website!
+
 2003-09-25  Doug Kearns  
 
 	* syntax/ruby.vim: link the rubyNoInterpolation syntax group to the

From 569e3d6403b205625f88bb40f62407705d2e7348 Mon Sep 17 00:00:00 2001
From: Gavin Sinclair 
Date: Fri, 26 Sep 2003 12:29:12 +0000
Subject: [PATCH 054/411] Moved this file to etc/release/

---
 etc/cvsrelease | 167 -------------------------------------------------
 etc/release.sh |  19 ------
 2 files changed, 186 deletions(-)
 delete mode 100755 etc/cvsrelease
 delete mode 100755 etc/release.sh

diff --git a/etc/cvsrelease b/etc/cvsrelease
deleted file mode 100755
index 3625c38e..00000000
--- a/etc/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: 1.1 $'|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.sh b/etc/release.sh
deleted file mode 100755
index e13a56d5..00000000
--- a/etc/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 -t $release_tag -r $release_number rj
-

From 4aa507155af0424bcea0b8a9c9f4b52a2b667cf3 Mon Sep 17 00:00:00 2001
From: Nikolai Weibull 
Date: Fri, 26 Sep 2003 12:29:16 +0000
Subject: [PATCH 055/411] updated the use of rubyASCIICode instead of
 rubyNumber where appropriate

---
 indent/ruby.vim | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/indent/ruby.vim b/indent/ruby.vim
index 16490dc7..54d8f226 100644
--- a/indent/ruby.vim
+++ b/indent/ruby.vim
@@ -2,7 +2,7 @@
 " Language:	Ruby
 " Maintainer:	Gavin Sinclair 
 " Developer:	Nikolai Weibull 
-" Info:		$Id: ruby.vim,v 1.11 2003/09/09 05:37:42 dkearns Exp $
+" Info:		$Id: ruby.vim,v 1.12 2003/09/26 12:29:16 pcp Exp $
 " URL:		http://vim-ruby.sourceforge.net
 " Anon CVS:	See above site
 " Licence:	GPL (http://www.gnu.org)
@@ -31,7 +31,7 @@ endif
 " Check if the character at lnum:col is inside a string or comment.
 function s:IsInStringOrComment(lnum, col)
   return synIDattr(synID(a:lnum, a:col, 0), 'name') =~ 
-	\'\'
 endfunction
 
@@ -40,7 +40,7 @@ endfunction
 " are not matched.
 function s:IsInStringOrComment2(lnum, col)
   return synIDattr(synID(a:lnum, a:col, 0), 'name') =~ 
-	\'\'
+	\'\'
 endfunction
 
 " These comma-separated list of words at the beginning of a line add a level
@@ -74,14 +74,19 @@ call s:BuildIndentKeywords()
 
 " Regular expression for continuations.
 " XXX: add ( to this list?
-let s:continuation_regexp = '[\*+/.,=(-]\s*\(#.*\)\=$'
+" XXX: there's a problem with some things where we are indenting for brackets,
+" but also get for continuation (of ,). Two uncertain items are in this list,
+" [ and {
+let s:continuation_regexp = '[\\*+/.,=({[-]\s*\(#.*\)\=$'
 
 " Regular expression for blocks.  We can't check for {, it's done in another
 " place.
-let s:block_regexp = '\\s*\(|\(\*\=\h\w*\(,\s*\)\=\)\+|\s*\)\=\(#.*\)\=$'
+let s:block_regexp = '\\s*\(|\([*@]\=\h\w*\(,\s*\)\=\)\+|\s*\)\=\(#.*\)\=$'
 
 " Expression used to check whether we should skip a match with searchpair().
-let s:skip_expr = 'synIDattr(synID(line("."), col("."), 0), "name") =~ "\\"'
+" XXX: this should be expanded some how with class and module to avoid
+" confusion with object.class.foo stuff.
+let s:skip_expr = 'synIDattr(synID(line("."), col("."), 0), "name") =~ "\\"'
 let s:end_skip_expr = s:skip_expr.' || (expand("") =~ "\\\\|\\\\|\\\\|\\" && getline(".") !~ "^\\s*\\<".expand("")."\\>" && getline(".") !~ expand("")."\\>.*\\")'
 
 " Find the previous non-blank line which isn't a comment-line or in a comment
@@ -175,7 +180,7 @@ function GetRubyIndent()
   " If we get a =begin, =end, or here-doc ender set deindent to first column.
   " XXX: skip here-docs at the moment: \|EO[FSL]\|EOHELP
   let col = match(line, '^\s*\zs\(=begin\|=end\)') + 1
-  if col > 0 && !s:IsInStringOrComment(v:lnum, col)
+  if col > 0
     let ind = 0
   endif
 
@@ -308,6 +313,8 @@ function GetRubyIndent()
     let ccol = match(line, s:continuation_regexp) + 1
     if ccol > 0 && !s:IsInStringOrComment(lnum, ccol)
       let ind = ind + &sw
+" XXX:
+      let did_con_indent = 1
     endif
   endif
 
@@ -336,11 +343,11 @@ function GetRubyIndent()
       let ind = virtcol('.')
       let did_virt_indent = 1
     " Or, if we are inside a pair of braces or brackets, add one level.
-    elseif strridx(substitute(my_line, '{[^}]*}', '', 'g'), '{') > -1
+    elseif !did_con_indent && strridx(substitute(my_line, '{[^}]*}', '', 'g'), '{') > -1
 	  \ && !s:IsInStringOrComment(lnum, 1)
-      let ind = ind + &sw
+       let ind = ind + &sw
       let did_virt_indent = 1
-    elseif strridx(substitute(my_line, '\[[^]]*\]', '', 'g'), '[') > -1
+    elseif !did_con_endint && strridx(substitute(my_line, '\[[^]]*\]', '', 'g'), '[') > -1
 	  \ && !s:IsInStringOrComment(lnum, 1)
       let ind = ind + &sw
       let did_virt_indent = 1
@@ -350,6 +357,7 @@ function GetRubyIndent()
 
   " If the far previous line contained an opening bracket, and we are still in
   " it, add one level of indent.
+  " TODO: do we really need to check for did_con_indent here?  don't think so
   if !did_virt_indent && p_line =~ '[[({]'
     " TODO: use s:GotoLineCol()
     execute 'normal! '.p_lnum.'G$'
@@ -362,10 +370,10 @@ function GetRubyIndent()
 	  \ && searchpair('(', '', ')', 'bW', s:skip_expr) > 0
       let ind = virtcol('.')
     " Or, if we are inside a pair of braces or brackets, add one level.
-    elseif strridx(substitute(my_line, '{[^}]*}', '', 'g'), '{') > -1
+    elseif !did_con_indent && strridx(substitute(my_line, '{[^}]*}', '', 'g'), '{') > -1
 	  \ && !s:IsInStringOrComment(lnum, 1)
       let ind = ind + &sw
-    elseif strridx(substitute(my_line, '\[[^]]*\]', '', 'g'), '[') > -1
+    elseif !did_con_indent && strridx(substitute(my_line, '\[[^]]*\]', '', 'g'), '[') > -1
 	  \ && !s:IsInStringOrComment(lnum, 1)
       let ind = ind + &sw
     endif

From d9b7880a895ac612abb36bde3c45409d631054ef Mon Sep 17 00:00:00 2001
From: Gavin Sinclair 
Date: Fri, 26 Sep 2003 12:35:05 +0000
Subject: [PATCH 056/411] Initial revision

---
 etc/release/README | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 etc/release/README

diff --git a/etc/release/README b/etc/release/README
new file mode 100644
index 00000000..e88dd296
--- /dev/null
+++ b/etc/release/README
@@ -0,0 +1,12 @@
+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
+

From 2d2b6878cfd0e7751b8e04c59904b15c2d565dde Mon Sep 17 00:00:00 2001
From: Gavin Sinclair 
Date: Fri, 26 Sep 2003 12:38:58 +0000
Subject: [PATCH 057/411] Moved from etc/

---
 etc/release/cvsrelease | 167 +++++++++++++++++++++++++++++++++++++++++
 etc/release/release.sh |  19 +++++
 2 files changed, 186 insertions(+)
 create mode 100755 etc/release/cvsrelease
 create mode 100755 etc/release/release.sh

diff --git a/etc/release/cvsrelease b/etc/release/cvsrelease
new file mode 100755
index 00000000..3625c38e
--- /dev/null
+++ b/etc/release/cvsrelease
@@ -0,0 +1,167 @@
+#!/bin/sh
+
+#
+# Automates the process of tagging, exporting and packaging a release from CVS.
+# Steve Purcell 
+#
+
+AUTHOR='Steve Purcell '
+VERSION=`echo '$Revision: 1.1 $'|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
new file mode 100755
index 00000000..556cf996
--- /dev/null
+++ b/etc/release/release.sh
@@ -0,0 +1,19 @@
+#!/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 -t $release_tag -r $release_number vim-ruby
+

From e243bc9a61ce4e3c4281608c9c29273a3d99335e Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Fri, 26 Sep 2003 13:19:39 +0000
Subject: [PATCH 058/411] update references to rubyExprSubst

---
 ChangeLog       |  6 ++++++
 indent/ruby.vim | 11 ++++++-----
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6a4b14ae..aacad5ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2003-09-26  Doug Kearns  
+
+	* indent/ruby.vim: update references to rubyExprSubst - this syntax
+	group has been split into rubyInterpolation, rubyNoInterpolation and
+	rubyEscape.
+
 2003-09-26  Gavin Sinclair 
 
 	* etc/release/*: added to aid in the production of releases.
diff --git a/indent/ruby.vim b/indent/ruby.vim
index 54d8f226..a0a4aae0 100644
--- a/indent/ruby.vim
+++ b/indent/ruby.vim
@@ -2,7 +2,7 @@
 " Language:	Ruby
 " Maintainer:	Gavin Sinclair 
 " Developer:	Nikolai Weibull 
-" Info:		$Id: ruby.vim,v 1.12 2003/09/26 12:29:16 pcp Exp $
+" Info:		$Id: ruby.vim,v 1.13 2003/09/26 13:19:39 dkearns Exp $
 " URL:		http://vim-ruby.sourceforge.net
 " Anon CVS:	See above site
 " Licence:	GPL (http://www.gnu.org)
@@ -31,8 +31,8 @@ endif
 " Check if the character at lnum:col is inside a string or comment.
 function s:IsInStringOrComment(lnum, col)
   return synIDattr(synID(a:lnum, a:col, 0), 'name') =~ 
-	\'\'
+	\'\'
 endfunction
 
 " Check if the character at lnum:col is inside a string or comment.
@@ -40,7 +40,8 @@ endfunction
 " are not matched.
 function s:IsInStringOrComment2(lnum, col)
   return synIDattr(synID(a:lnum, a:col, 0), 'name') =~ 
-	\'\'
+	\'\'
 endfunction
 
 " These comma-separated list of words at the beginning of a line add a level
@@ -86,7 +87,7 @@ let s:block_regexp = '\\s*\(|\([*@]\=\h\w*\(,\s*\)\=\)\+|\s*\)\=\(#.*\)\=$'
 " Expression used to check whether we should skip a match with searchpair().
 " XXX: this should be expanded some how with class and module to avoid
 " confusion with object.class.foo stuff.
-let s:skip_expr = 'synIDattr(synID(line("."), col("."), 0), "name") =~ "\\"'
+let s:skip_expr = 'synIDattr(synID(line("."), col("."), 0), "name") =~ "\\"'
 let s:end_skip_expr = s:skip_expr.' || (expand("") =~ "\\\\|\\\\|\\\\|\\" && getline(".") !~ "^\\s*\\<".expand("")."\\>" && getline(".") !~ expand("")."\\>.*\\")'
 
 " Find the previous non-blank line which isn't a comment-line or in a comment

From e357f4726048c9679dabac43d0d9de908b20ee52 Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Fri, 26 Sep 2003 13:44:38 +0000
Subject: [PATCH 059/411] add a DOCTYPE declaration and close the open PRE
 element

---
 ChangeLog              | 5 +++++
 etc/website/index.html | 6 ++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index aacad5ae..e55a208e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-09-26  Doug Kearns  
+
+	* etc/website/index.html: close the open PRE element and add a DOCTYPE
+	declaration.
+
 2003-09-26  Doug Kearns  
 
 	* indent/ruby.vim: update references to rubyExprSubst - this syntax
diff --git a/etc/website/index.html b/etc/website/index.html
index 6d0a7166..df6c0c41 100644
--- a/etc/website/index.html
+++ b/etc/website/index.html
@@ -1,3 +1,5 @@
+
 
     
         Vim/Ruby Configuration Files
@@ -22,7 +24,7 @@ 

Links

Explanation: http://www.rubygarden.org/ruby?VimRubySupport

README

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

+

                     +-----------------------------------+
                     | vim-ruby RubyForge project README |
@@ -105,6 +107,6 @@ 

README

let us know. --= End of Document =-- -
+        
From 85530cd466af43a523915bf17eea55fb7510160f Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 30 Sep 2003 12:01:58 +0000 Subject: [PATCH 060/411] update DJK's current location --- ChangeLog | 8 ++++++-- etc/website/index.html | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index e55a208e..5447c527 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2003-09-30 Doug Kearns + + * etc/website/index.html: update DJK's current location. + 2003-09-26 Doug Kearns * etc/website/index.html: close the open PRE element and add a DOCTYPE @@ -17,7 +21,7 @@ 2003-09-25 Doug Kearns - * syntax/ruby.vim: link the rubyNoInterpolation syntax group to the + * syntax/ruby.vim: link the rubyNoInterpolation syntax group to rubyString; merge rubyHexadecimal, rubyDecimal, rubyOctal, rubyBinary into rubyInteger. @@ -28,7 +32,7 @@ 2003-09-21 Doug Kearns - * syntax/ruby.vim: match regexp after split, scan, sub and gsub. + * syntax/ruby.vim: match regexps after split, scan, sub and gsub. 2003-09-21 Doug Kearns diff --git a/etc/website/index.html b/etc/website/index.html index df6c0c41..8f8f9d13 100644 --- a/etc/website/index.html +++ b/etc/website/index.html @@ -99,7 +99,7 @@

README

Project gossip: - Two of the configuration file maintainers, Doug Kearns and Gavin Sinclair, - live in Australia (Melbourne and Sydney respectively). Tim Hammerquist, + live in Australia (Jindabyne and Sydney respectively). Tim Hammerquist, the last man standing, has a cpan.org email address. - 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 From 38b54fd88a74b25a0099f5d57fa8dc07b7f8bd64 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 30 Sep 2003 13:09:50 +0000 Subject: [PATCH 061/411] create rubyPseudoVariable syntax group --- ChangeLog | 6 ++++++ syntax/ruby.vim | 36 ++++++++++++++++++------------------ 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5447c527..6b5c28ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-09-30 Doug Kearns + + * syntax/ruby.vim: create rubyPseudoVariable syntax group; move self, + nil, __LINE__ and __FILE_ to rubyPseudoVariable; link rubyBoolean to + rubyPseudoVariable. + 2003-09-30 Doug Kearns * etc/website/index.html: update DJK's current location. diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 7ab5c29a..c131fab9 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.29 2003/09/25 14:42:26 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.30 2003/09/30 13:09:50 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -25,22 +25,22 @@ elseif exists("b:current_syntax") endif " Expression Substitution and Backslash Notation -syn match rubyEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display -syn match rubyEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display -syn match rubyInterpolation "#{[^}]*}" contained -syn match rubyInterpolation "#\%(\$\|@@\=\)\w\+" contained display -syn match rubyNoInterpolation "\\#{[^}]*}" contained -syn match rubyNoInterpolation "\\#\%(\$\|@@\=\)\w\+" contained display +syn match rubyEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display +syn match rubyEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display +syn match rubyInterpolation "#{[^}]*}" contained +syn match rubyInterpolation "#\%(\$\|@@\=\)\w\+" contained display +syn match rubyNoInterpolation "\\#{[^}]*}" contained +syn match rubyNoInterpolation "\\#\%(\$\|@@\=\)\w\+" contained display syn cluster rubyStringSpecial contains=rubyInterpolation,rubyNoInterpolation,rubyEscape " Numbers and ASCII Codes syn match rubyASCIICode "\w\@" display -syn match rubyInteger "\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\>" display +syn match rubyInteger "\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\>" display syn match rubyInteger "\<0\o\+\%(_\o\+\)*\>" display -syn match rubyInteger "\<0b[01]\+\%(_[01]\+\)*\>" display -syn match rubyFloat "\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\.\d\+\%(_\d\+\)*\>" display +syn match rubyInteger "\<0b[01]\+\%(_[01]\+\)*\>" display +syn match rubyFloat "\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\.\d\+\%(_\d\+\)*\>" display syn match rubyFloat "\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE][-+]\=\d\+\%(_\d\+\)*\)\>" display " Identifiers @@ -61,7 +61,6 @@ if !exists("ruby_no_identifiers") syn match rubyPredefinedVariable "$-[0FIKadilpvw]" display syn match rubyPredefinedVariable "$\%(deferr\|defout\|stderr\|stdin\|stdout\)\>" display syn match rubyPredefinedVariable "$\%(DEBUG\|FILENAME\|KCODE\|LOAD_PATH\|SAFE\|VERBOSE\)\>" display - syn match rubyPredefinedConstant "__\%(FILE\|LINE\)__\>" display syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(MatchingData\|ARGF\|ARGV\|ENV\)\>" display syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(DATA\|FALSE\|NIL\|RUBY_PLATFORM\|RUBY_RELEASE_DATE\)\>" display syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(RUBY_VERSION\|STDERR\|STDIN\|STDOUT\|TOPLEVEL_BINDING\|TRUE\)\>" display @@ -105,12 +104,12 @@ syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=(" en " Here Document syn region rubyString matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%(\.\|::\)\)\_s*\)\@ Date: Fri, 3 Oct 2003 10:22:53 +0000 Subject: [PATCH 062/411] link rubyPseudoVariable to the Constant highlight group --- ChangeLog | 8 ++++++-- syntax/ruby.vim | 5 +++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6b5c28ba..f9202a27 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,12 @@ +2003-10-03 Doug Kearns + + * syntax/ruby.vim: link rubyBoolean to rubyPseudoVariable; link + rubyPseudoVariable to the Constant highlight group. + 2003-09-30 Doug Kearns * syntax/ruby.vim: create rubyPseudoVariable syntax group; move self, - nil, __LINE__ and __FILE_ to rubyPseudoVariable; link rubyBoolean to - rubyPseudoVariable. + nil, __LINE__ and __FILE_ to rubyPseudoVariable. 2003-09-30 Doug Kearns diff --git a/syntax/ruby.vim b/syntax/ruby.vim index c131fab9..9ac5d0e1 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.30 2003/09/30 13:09:50 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.31 2003/10/03 10:22:54 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -215,7 +215,7 @@ if version >= 508 || !exists("did_ruby_syntax_inits") HiLink rubyInteger Number HiLink rubyASCIICode rubyInteger HiLink rubyFloat Float - HiLink rubyBoolean Boolean + HiLink rubyBoolean rubyPseudoVariable HiLink rubyException Exception HiLink rubyClass Type HiLink rubyModule Type @@ -235,6 +235,7 @@ if version >= 508 || !exists("did_ruby_syntax_inits") HiLink rubyAccess Statement HiLink rubyAttribute Statement HiLink rubyEval Statement + HiLink rubyPseudoVariable Constant HiLink rubyComment Comment HiLink rubyData Comment From 61b99f8afc9a26ad695432f03c3b7c0ed2ae9ab4 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 3 Oct 2003 11:06:35 +0000 Subject: [PATCH 063/411] simplify the rubyData pattern --- ChangeLog | 5 +++++ syntax/ruby.vim | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index f9202a27..d59db98a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-10-03 Doug Kearns + + * syntax/ruby.vim: simplify the rubyData pattern by using the new EOF + atom. + 2003-10-03 Doug Kearns * syntax/ruby.vim: link rubyBoolean to rubyPseudoVariable; link diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 9ac5d0e1..fab81ea1 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.31 2003/10/03 10:22:54 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.32 2003/10/03 11:06:35 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -156,7 +156,7 @@ endif " Keywords " Note: the following keywords have already been defined: -" begin case class def do end for if module unless until while __FILE_ __LINE__ +" begin case class def do end for if module unless until while syn keyword rubyControl and break else elsif ensure in next not or redo rescue retry return then when syn match rubyOperator "\" transparent contains=NONE " __END__ Directive -syn region rubyData matchgroup=rubyDataDirective start="^__END__$" matchgroup=NONE end="." skip="." fold +syn region rubyData matchgroup=rubyDataDirective start="^__END__$" end="\%$" fold " Define the default highlighting. " For version 5.7 and earlier: only when not done already From e9499f02996f1bc0295575648870561869e76adc Mon Sep 17 00:00:00 2001 From: Nikolai Weibull Date: Thu, 9 Oct 2003 23:00:27 +0000 Subject: [PATCH 064/411] Hohoho. Santa comes early this year. Made parts very much clearer in intent and in execution. Added the s:LineHasOpenParen function. Seems to work. --- indent/ruby.vim | 90 ++++++++++++++++++++++++------------------------- 1 file changed, 44 insertions(+), 46 deletions(-) diff --git a/indent/ruby.vim b/indent/ruby.vim index a0a4aae0..69a235a2 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -2,7 +2,7 @@ " Language: Ruby " Maintainer: Gavin Sinclair " Developer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.13 2003/09/26 13:19:39 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.14 2003/10/09 23:00:27 pcp Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -28,20 +28,20 @@ if exists("*GetRubyIndent") finish endif +let s:skip_regex = '\' +let s:skip_regex2 = '\' " Check if the character at lnum:col is inside a string or comment. function s:IsInStringOrComment(lnum, col) - return synIDattr(synID(a:lnum, a:col, 0), 'name') =~ - \'\' + return synIDattr(synID(a:lnum, a:col, 0), 'name') =~ s:skip_regex endfunction " Check if the character at lnum:col is inside a string or comment. " Works like s:IsInStringOrComment(), with the difference that string-delimits " are not matched. function s:IsInStringOrComment2(lnum, col) - return synIDattr(synID(a:lnum, a:col, 0), 'name') =~ - \'\' + return synIDattr(synID(a:lnum, a:col, 0), 'name') =~ s:skip_regex2 endfunction " These comma-separated list of words at the beginning of a line add a level @@ -74,10 +74,6 @@ endfunction call s:BuildIndentKeywords() " Regular expression for continuations. -" XXX: add ( to this list? -" XXX: there's a problem with some things where we are indenting for brackets, -" but also get for continuation (of ,). Two uncertain items are in this list, -" [ and { let s:continuation_regexp = '[\\*+/.,=({[-]\s*\(#.*\)\=$' " Regular expression for blocks. We can't check for {, it's done in another @@ -87,7 +83,7 @@ let s:block_regexp = '\\s*\(|\([*@]\=\h\w*\(,\s*\)\=\)\+|\s*\)\=\(#.*\)\=$' " Expression used to check whether we should skip a match with searchpair(). " XXX: this should be expanded some how with class and module to avoid " confusion with object.class.foo stuff. -let s:skip_expr = 'synIDattr(synID(line("."), col("."), 0), "name") =~ "\\"' +let s:skip_expr = "synIDattr(synID(line('.'), col('.'), 0), 'name') =~ '".s:skip_regex."'" let s:end_skip_expr = s:skip_expr.' || (expand("") =~ "\\\\|\\\\|\\\\|\\" && getline(".") !~ "^\\s*\\<".expand("")."\\>" && getline(".") !~ expand("")."\\>.*\\")' " Find the previous non-blank line which isn't a comment-line or in a comment @@ -123,6 +119,30 @@ function s:GotoLineCol(line, col) endif endfunction +" Check if line has more opening parentheses than closing +function s:LineHasOpeningParen(line, lnum) + let i = 0 + let n = strlen(a:line) + let open_paren = 0 + let open_brace = 0 + let open_bracket = 0 + while i < n + let c = a:line[i] + if c =~ '[](){}[]' + \&& synIDattr(synID(a:lnum, i + 1, 0), 'name') !~ s:skip_regex + if c == '(' || c == ')' + let open_paren = open_paren + (c == '(' ? 1 : -1) + elseif c == '{' || c == '}' + let open_brace = open_brace + (c == '{' ? 1 : -1) + elseif c == '[' || c == '[' + let open_bracket = open_bracket + (c == '[' ? 1 : -1) + endif + endif + let i = i + 1 + endwhile + return "" . (open_paren ? 1 : 0).(open_brace ? 1 : 0).(open_bracket ? 1 : 0) +endfunction + function GetRubyIndent() " Part 1: Setup. " ============== @@ -333,26 +353,15 @@ function GetRubyIndent() " add one level of indent. let did_virt_indent = 0 if line =~ '[[({]' - " TODO: hop somewhere? - let my_line = substitute(substitute(substitute(substitute(substitute(line, - \'\\"\|'."\\\\'", '', 'g'), '"[^"]*"', '', 'g'), "'[^']*'", '', 'g'), - \'\W?\S', '', 'g'), '#.*', '', '') - " If we have an opening parentheses, indent to it. - if strlen(substitute(my_line, '[^(]', '', 'g')) - \ > strlen(substitute(my_line, '[^)]', '', 'g')) - \ && searchpair('(', '', ')', 'bW', s:skip_expr) > 0 + let counts = s:LineHasOpeningParen(line, lnum) + if counts[0] == '1' + \&& searchpair('(', '', ')', 'bW', s:skip_expr) > 0 let ind = virtcol('.') let did_virt_indent = 1 - " Or, if we are inside a pair of braces or brackets, add one level. - elseif !did_con_indent && strridx(substitute(my_line, '{[^}]*}', '', 'g'), '{') > -1 - \ && !s:IsInStringOrComment(lnum, 1) - let ind = ind + &sw - let did_virt_indent = 1 - elseif !did_con_endint && strridx(substitute(my_line, '\[[^]]*\]', '', 'g'), '[') > -1 - \ && !s:IsInStringOrComment(lnum, 1) + elseif !did_con_indent && (counts[1] == '1' || counts[2] == '1') let ind = ind + &sw let did_virt_indent = 1 - endif + end call s:GotoLineCol(v:lnum, vcol - 1) endif @@ -360,28 +369,17 @@ function GetRubyIndent() " it, add one level of indent. " TODO: do we really need to check for did_con_indent here? don't think so if !did_virt_indent && p_line =~ '[[({]' - " TODO: use s:GotoLineCol() - execute 'normal! '.p_lnum.'G$' - let my_line = substitute(substitute(substitute(substitute(substitute(p_line, - \'\\"\|'."\\\\'", '', 'g'), '"[^"]*"', '', 'g'), "'[^']*'", '', 'g'), - \'\W?\S', '', 'g'), '#.*', '', '') - " If we have an opening parentheses, indent to it. - if strlen(substitute(my_line, '[^(]', '', 'g')) - \ > strlen(substitute(my_line, '[^)]', '', 'g')) - \ && searchpair('(', '', ')', 'bW', s:skip_expr) > 0 + let counts = s:LineHasOpeningParen(p_line, p_lnum) + if counts[0] == '1' + \&& searchpair('(', '', ')', 'bW', s:skip_expr) > 0 let ind = virtcol('.') - " Or, if we are inside a pair of braces or brackets, add one level. - elseif !did_con_indent && strridx(substitute(my_line, '{[^}]*}', '', 'g'), '{') > -1 - \ && !s:IsInStringOrComment(lnum, 1) - let ind = ind + &sw - elseif !did_con_indent && strridx(substitute(my_line, '\[[^]]*\]', '', 'g'), '[') > -1 - \ && !s:IsInStringOrComment(lnum, 1) + elseif !did_con_indent && (counts[1] == '1' || counts[2] == '1') let ind = ind + &sw - endif + end call s:GotoLineCol(v:lnum, vcol - 1) endif return ind -endfunction " GetRubyIndent() +endfunction -" vim:sw=2 ff=unix +" vim: sw=2 sts=2 ts=8 ff=unix: From e1a45d7a00d6949bf5a379d8a850b343ecee8595 Mon Sep 17 00:00:00 2001 From: Nikolai Weibull Date: Fri, 10 Oct 2003 22:45:12 +0000 Subject: [PATCH 065/411] May have fixed the blah.class/blah.module bug. Hopefully it is enough. --- indent/ruby.vim | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/indent/ruby.vim b/indent/ruby.vim index 69a235a2..a42385dd 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -2,7 +2,7 @@ " Language: Ruby " Maintainer: Gavin Sinclair " Developer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.14 2003/10/09 23:00:27 pcp Exp $ +" Info: $Id: ruby.vim,v 1.15 2003/10/10 22:45:12 pcp Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -212,8 +212,11 @@ function GetRubyIndent() if col > 0 && !s:IsInStringOrComment(v:lnum, col) call s:GotoLineCol(v:lnum, 0) " Find the matching parent statement to it + " XXX: fixed the .class problem here, but I don't know if its the best way + " to do it if searchpair('\\|\\|\\|\\|\\|' . - \'\\|\\|\\|\\|\\|\', + \'\\|\\|\\|\\|' . + \'\<\.\@\|\<\.\@', \'\\|\\|\\|\\|\', '\', \'bW', s:end_skip_expr) > 0 let ind = indent('.') From 3a28565fc0f299ae658a0657a18fef9bb1d50ed0 Mon Sep 17 00:00:00 2001 From: Nikolai Weibull Date: Sun, 12 Oct 2003 01:09:41 +0000 Subject: [PATCH 066/411] *** empty log message *** --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index d59db98a..111c5231 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2003-10-12 Nikolai Weibull + + * indent/ruby.vim: Fixed bugs #89 and #102. + 2003-10-03 Doug Kearns * syntax/ruby.vim: simplify the rubyData pattern by using the new EOF From 2d56fd59be5cd26bb5c67e273747613ee0e42847 Mon Sep 17 00:00:00 2001 From: Nikolai Weibull Date: Sun, 12 Oct 2003 02:43:27 +0000 Subject: [PATCH 067/411] Fixed a bug with $' and $" variables --- ChangeLog | 2 ++ syntax/ruby.vim | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 111c5231..62516952 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 2003-10-12 Nikolai Weibull * indent/ruby.vim: Fixed bugs #89 and #102. + * syntax/ruby.vim: The $' and $" variables weren't being matched if + ruby_no_identifiers was on. This messed up string matching. 2003-10-03 Doug Kearns diff --git a/syntax/ruby.vim b/syntax/ruby.vim index fab81ea1..46694810 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.32 2003/10/03 11:06:35 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.33 2003/10/12 02:43:27 pcp Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -57,7 +57,7 @@ if !exists("ruby_no_identifiers") syn region rubySymbol start=":\@?@\_`~1-9]" + syn match rubyPredefinedVariable "$[!$&*+,./0:;<=>?@\_`~1-9]" syn match rubyPredefinedVariable "$-[0FIKadilpvw]" display syn match rubyPredefinedVariable "$\%(deferr\|defout\|stderr\|stdin\|stdout\)\>" display syn match rubyPredefinedVariable "$\%(DEBUG\|FILENAME\|KCODE\|LOAD_PATH\|SAFE\|VERBOSE\)\>" display @@ -67,6 +67,8 @@ if !exists("ruby_no_identifiers") "Obsolete Global Constants "syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(PLATFORM\|RELEASE_DATE\|VERSION\)\>" "syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(NotImplementError\)\>" +else + syn match NONE +$['"]+ endif " Normal Regular Expression From 7ec507eb1e72c230e4ea7883c59b2761037f2ee6 Mon Sep 17 00:00:00 2001 From: Nikolai Weibull Date: Sun, 12 Oct 2003 14:02:30 +0000 Subject: [PATCH 068/411] Total rewrite of indent/ruby.vim. Closes bugs #59 and #71. --- ChangeLog | 7 + indent/ruby.vim | 462 +++++++++++++++++++++--------------------------- 2 files changed, 208 insertions(+), 261 deletions(-) diff --git a/ChangeLog b/ChangeLog index 62516952..db9d99b9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,13 @@ * indent/ruby.vim: Fixed bugs #89 and #102. * syntax/ruby.vim: The $' and $" variables weren't being matched if ruby_no_identifiers was on. This messed up string matching. + * indent/ruby.vim: Basically did a total rewrite in the process. + Everything is well documented now, and should be rather simple to + understand. There is probably room for optimization still, but it + works rather fast, indenting tk.rb (5200+ lines) in under 15 seconds. + I'm betting searchpair() may be executing a bit too often still, but a + lot of special cases have now been taken care of. This version also + fixes bug #59 and #71. 2003-10-03 Doug Kearns diff --git a/indent/ruby.vim b/indent/ruby.vim index a42385dd..025a9d5e 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -2,10 +2,10 @@ " Language: Ruby " Maintainer: Gavin Sinclair " Developer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.15 2003/10/10 22:45:12 pcp Exp $ -" URL: http://vim-ruby.sourceforge.net +" Info: $Id: ruby.vim,v 1.16 2003/10/12 14:02:30 pcp Exp $ +" URL: http://vim-ruby.rubyforge.org/ " Anon CVS: See above site -" Licence: GPL (http://www.gnu.org) +" Licence: GPL (http://www.gnu.org/) " Disclaimer: " This program is distributed in the hope that it will be useful, " but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -13,96 +13,111 @@ " GNU General Public License for more details. " ---------------------------------------------------------------------------- +" 0. Initialization {{{1 +" ================= + " Only load this indent file when no other was loaded. if exists("b:did_indent") finish endif let b:did_indent = 1 +" Now, set up our indentation expression and keys that trigger it. setlocal indentexpr=GetRubyIndent() -setlocal indentkeys=0{,0},!^F,o,O,e,=end,=elsif,=when,=ensure,=rescue -setlocal indentkeys+=0),0],==begin,==end +setlocal indentkeys=0{,0},0),0],!^F,o,O,e +setlocal indentkeys+==end,=elsif,=when,=ensure,=rescue,==begin,==end " Only define the function once. if exists("*GetRubyIndent") finish endif -let s:skip_regex = '\' -let s:skip_regex2 = '\' -" Check if the character at lnum:col is inside a string or comment. -function s:IsInStringOrComment(lnum, col) - return synIDattr(synID(a:lnum, a:col, 0), 'name') =~ s:skip_regex -endfunction +" 1. Variables {{{1 +" ============ -" Check if the character at lnum:col is inside a string or comment. -" Works like s:IsInStringOrComment(), with the difference that string-delimits -" are not matched. -function s:IsInStringOrComment2(lnum, col) - return synIDattr(synID(a:lnum, a:col, 0), 'name') =~ s:skip_regex2 -endfunction +" Items in this regex are syntax groups that delimit strings or comments. +let s:skip_regex = '\' -" These comma-separated list of words at the beginning of a line add a level -" of indent. -let g:ruby_indent_keywords = 'module,class,def,if,for,while,until,else,' . - \'elsif,case,when,unless,begin,ensure,rescue' - -" Build a regular expression from the g:ruby_indent_keywords variable. -" The result is stored in s:ruby_indent_keywords. -function s:BuildIndentKeywords() - let idx = stridx(g:ruby_indent_keywords, ',') - while idx > -1 - let keyword = strpart(g:ruby_indent_keywords, 0, idx).'\>' - if exists('s:ruby_indent_keywords') - let s:ruby_indent_keywords = s:ruby_indent_keywords.'\|'.keyword - else - let s:ruby_indent_keywords = "\\(".keyword - endif - let g:ruby_indent_keywords = strpart(g:ruby_indent_keywords, idx + 1) - let idx = stridx(g:ruby_indent_keywords, ',') - endwhile +" Items in this regex are syntax groups that delimit strings or comments but +" in a less general fashion. +let s:skip_regex2 = '\' - if exists('s:ruby_indent_keywords') - let s:ruby_indent_keywords = s:ruby_indent_keywords.'\|'. - \g:ruby_indent_keywords.'\>\)' - else - let s:ruby_indent_keywords = g:ruby_indent_keywords.'\>' - endif -endfunction -call s:BuildIndentKeywords() +" Items in this regex are syntax groups that delimit strings. +let s:skip_regex3 = '\' + +" This regex is used for matching words that, at the start of a line, add +" a level of indent. +let s:ruby_indent_keywords = '^\s*\%(\zs\<\%(module\|class\|def\|if\|for' . + \ '\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure' . + \ '\|rescue\)\>\|\h\w*\s*=\s*\zs\<\%(if\|unless\|while\|until\)\)' " Regular expression for continuations. -let s:continuation_regexp = '[\\*+/.,=({[-]\s*\(#.*\)\=$' +let s:continuation_regexp = '\%([\\*+/.,=-]\|\W?\|||\|&&\)\s*\%(#.*\)\=$' +let s:continuation_regexp2 = '\%([\\*+/.,=({[-]\|\W?\|||\|&&\)\s*\%(#.*\)\=$' " Regular expression for blocks. We can't check for {, it's done in another " place. -let s:block_regexp = '\\s*\(|\([*@]\=\h\w*\(,\s*\)\=\)\+|\s*\)\=\(#.*\)\=$' +let s:block_regexp = '\%(\\|{\)\s*\%(|\%([*@]\=\h\w*,\=\s*\)\+|\)\=\s*' . + \ '\%(#.*\)\=$' " Expression used to check whether we should skip a match with searchpair(). -" XXX: this should be expanded some how with class and module to avoid -" confusion with object.class.foo stuff. -let s:skip_expr = "synIDattr(synID(line('.'), col('.'), 0), 'name') =~ '".s:skip_regex."'" -let s:end_skip_expr = s:skip_expr.' || (expand("") =~ "\\\\|\\\\|\\\\|\\" && getline(".") !~ "^\\s*\\<".expand("")."\\>" && getline(".") !~ expand("")."\\>.*\\")' +let s:skip_expr = 'synIDattr(synID(line("."), col("."), 0), "name") =~ ' . + \ "'".s:skip_regex."'" + +" Expression used for searchpair() call for finding match for 'end'. +let s:end_skip_expr = s:skip_expr . + \ ' || (expand("") =~ "\\<\\(if\\|unless\\|while\\|until\\)\\>"' . + \ ' && getline(".") !~ "^\\s*\\<".expand("")."\\>"' . + \ ' && getline(".") !~ "\\h\\w*\\s*=\\s*\\<".expand("")."\\>"' . + \ ' && getline(".") !~ expand("")."\\>.*\\")' + +" 2. Auxiliary Functions {{{1 +" ====================== + +" Move the cursor to the given line:col. +function s:GotoLineCol(line, col) + if a:col != 0 + execute 'normal! '.a:line.'G0'.a:col.'l' + else + execute 'normal! '.a:line.'G0' + endif +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, 0), 'name') =~ s:skip_regex +endfunction + +" Check if the character at lnum:col is inside a string or comment. +function s:IsInStringOrComment2(lnum, col) + return synIDattr(synID(a:lnum, a:col, 0), 'name') =~ s:skip_regex2 +endfunction + +" Check if the character at lnum:col is inside a string. +function s:IsInString(lnum, col) + return synIDattr(synID(a:lnum, a:col, 0), 'name') =~ s:skip_regex3 +endfunction " Find the previous non-blank line which isn't a comment-line or in a comment " block. -function s:PrevNonBlank(lnum) +function s:PrevNonBlankNonString(lnum) let in_block = 0 let lnum = prevnonblank(a:lnum) while lnum > 0 let line = getline(lnum) - " If the line is the end of an embedded document, beginning skipping. + " Go in and out of blocks depending on if the line matches this. + " Also skip the line if it contains only whitespace and a comment. + " Lastly, skip it if it is in a multi-line string. if !in_block && line =~ '^=end$' let in_block = 1 - " Else, if the line is the beginning of an embedded document, end - " skipping. elseif in_block && line =~ '^=begin$' let in_block = 0 - " Otherwise, if we aren't in an embedded document, check if the line is a - " comment line, and, if so, skip it. elseif !in_block && line !~ '^\s*#.*$' + \ && !(s:IsInStringOrComment(lnum, 1) + \ && s:IsInStringOrComment(lnum, strlen(getline(lnum)))) break endif let lnum = prevnonblank(lnum - 1) @@ -110,147 +125,126 @@ function s:PrevNonBlank(lnum) return lnum endfunction -" Move the cursor to the given line:col. -function s:GotoLineCol(line, col) - if a:col != 0 - execute 'normal! '.a:line.'G0'.a:col.'l' - else - execute 'normal! '.a:line.'G0' - endif +" Get the Most Significant Line before lnum. This is the line that started +" the continuation lnum may be a part of. +function s:GetMSL(lnum) + " Start on the line we're at and use its indent. + let msl = a:lnum + let lnum = s:PrevNonBlankNonString(a:lnum - 1) + while lnum > 0 + " If we have a continuation line which isn't in a string, use that + " lines instead of the one we previously had. + " Otherwise, we are done. + let line = getline(lnum) + let col = match(line, s:continuation_regexp2) + 1 + if (col > 0 && !s:IsInStringOrComment(lnum, col)) + \ || s:IsInString(lnum, strlen(line)) + let msl = lnum + else + break + endif + let lnum = s:PrevNonBlankNonString(lnum - 1) + endwhile + return msl endfunction " Check if line has more opening parentheses than closing -function s:LineHasOpeningParen(line, lnum) +function s:LineHasOpeningParen(lnum) + let lnum = a:lnum + let line = getline(lnum) let i = 0 - let n = strlen(a:line) - let open_paren = 0 - let open_brace = 0 - let open_bracket = 0 + let n = strlen(line) + let open_0 = 0 + let open_2 = 0 + let open_4 = 0 while i < n - let c = a:line[i] - if c =~ '[](){}[]' - \&& synIDattr(synID(a:lnum, i + 1, 0), 'name') !~ s:skip_regex - if c == '(' || c == ')' - let open_paren = open_paren + (c == '(' ? 1 : -1) - elseif c == '{' || c == '}' - let open_brace = open_brace + (c == '{' ? 1 : -1) - elseif c == '[' || c == '[' - let open_bracket = open_bracket + (c == '[' ? 1 : -1) + let idx = stridx('(){}[]', line[i]) + if idx > -1 && !s:IsInStringOrComment(lnum, i + 1) + if idx % 2 == 0 + let open_{idx} = open_{idx} + 1 + else + let open_{idx - 1} = open_{idx - 1} - 1 endif endif let i = i + 1 endwhile - return "" . (open_paren ? 1 : 0).(open_brace ? 1 : 0).(open_bracket ? 1 : 0) + return (open_0 > 0) . (open_2 > 0) . (open_4 > 0) endfunction +" 3. GetRubyIndent Function {{{1 +" ========================= + function GetRubyIndent() - " Part 1: Setup. - " ============== + " 3.1. Setup {{{2 + " ---------- " Set up variables for restoring position in file. Could use v:lnum here. let vcol = col('.') - " Part 2: Work on the current line. - " ================================= + " 3.2. Work on the current line {{{2 + " ----------------------------- " Get the current line. let line = getline(v:lnum) let ind = -1 - " If we got a closing bracket on an empty line, deindent one level or match - " the column in case of a parentheses. + " If we got a closing bracket on an empty line, find its match and indent + " according to it. let col = match(line, '^\s*\zs[]})]') + 1 if col > 0 && !s:IsInStringOrComment(v:lnum, col) call s:GotoLineCol(v:lnum, col - 1) " If it was a parentheses, search for its match and indent to its level. + " If it was a brace or bracket, search for its match and indent to that + " lines level. if line[col - 1] == ')' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0 let ind = virtcol('.') - 1 - " Else, if it was a brace, search for its match and find the line to which - " it belongs and indent to that lines level. - elseif line[col - 1] == '}' - \ && searchpair('{', '', '}', 'bW', s:skip_expr) > 0 - let p_lnum = line('.') - let my_lnum = s:PrevNonBlank(p_lnum - 1) - while my_lnum > 0 - let my_line = getline(my_lnum) - let col = match(my_line, s:continuation_regexp) + 1 - " If the line was a continuation not in a string, and we are currently - " not in a multiline-string, get it's indent and continue to previous - " line. - if col > 0 && !s:IsInStringOrComment(my_lnum, col) - let p_lnum = my_lnum - let my_lnum = s:PrevNonBlank(my_lnum - 1) - " Else, if we are in a multi-line string, continue to previous line. - " TODO: are these offsets correct? - elseif s:IsInStringOrComment(my_lnum, 1) - let my_lnum = s:PrevNonBlank(my_lnum - 1) - " Otherwise, exit the loop - else - let my_lnum = -1 - endif - endwhile - let ind = indent(p_lnum) - " Otherwise, it was a bracket, so search for it and indent to the matching - " lines level. - elseif searchpair('\[', '', '\]', 'bW', s:skip_expr) > 0 - let ind = indent('.') - end - call s:GotoLineCol(v:lnum, vcol - 1) + else + let begin = '{' + let end = '}' + if line[col - 1] == ']' + let begin = '[' + let end = ']' + endif + " If we find a matching brace/bracket, we need to find the line it + " belongs to and indent to that line's level of indent. + if searchpair(begin, '', end, 'bW', s:skip_expr) > 0 + let ind = indent(s:GetMSL(line('.'))) + endif + endif + return ind endif - " If we get a =begin, =end, or here-doc ender set deindent to first column. - " XXX: skip here-docs at the moment: \|EO[FSL]\|EOHELP - let col = match(line, '^\s*\zs\(=begin\|=end\)') + 1 + " If we have a =begin or =end set indent to first column. + let col = match(line, '^\s*\zs\%(=begin\|=end\)$') + 1 if col > 0 - let ind = 0 + return 0 endif - " If we got a deindenting line on an empty line, find match and indent to - " its level. + " If we have a deindenting keyword on an empty line, find its match and + " indent to its level. let col = match(line, - \'^\s*\zs\(ensure\>\|else\>\|rescue\>\|elsif\>\|when\>\|end\>\)') + 1 + \ '^\s*\zs\<\%(ensure\|else\|rescue\|elsif\|when\|end\)\>') + 1 if col > 0 && !s:IsInStringOrComment(v:lnum, col) call s:GotoLineCol(v:lnum, 0) - " Find the matching parent statement to it - " XXX: fixed the .class problem here, but I don't know if its the best way - " to do it - if searchpair('\\|\\|\\|\\|\\|' . - \'\\|\\|\\|\\|' . - \'\<\.\@\|\<\.\@', - \'\\|\\|\\|\\|\', '\', - \'bW', s:end_skip_expr) > 0 + if searchpair('\<\%(def\|do\|if\|unless\|case\|begin\|until\|for\|while' . + \ '\|\.\@', + \ '\<\%(ensure\|else\|rescue\|when\|elsif\)\>', '\', 'bW', + \ s:end_skip_expr) > 0 let ind = indent('.') endif - call s:GotoLineCol(v:lnum, vcol - 1) + return ind endif - " If we got some indentation, use it - if ind != -1 - return ind - " Otherwise, check if we are in a multi-line string or line-comment and, if - " so, skip it. - " TODO: this needs more checking though - elseif s:IsInStringOrComment2(v:lnum, matchend(line, '^\s*') + 1) + " If we are in a multi-line string or line-comment, don't do anything to it. + if s:IsInStringOrComment2(v:lnum, matchend(line, '^\s*') + 1) return indent('.') endif - " Part 3: Work on the previous line. - " ================================== + " 3.3. Work on the previous line. {{{2 + " ------------------------------- - " Find a non-blank line above the current line. - let lnum = s:PrevNonBlank(v:lnum - 1) - - " Ignore multi-line strings - " TODO: check this positioning - " TODO: is it necessary to check both ends? - while lnum > 0 - if s:IsInStringOrComment(lnum, 1) && - \ s:IsInStringOrComment(lnum, strlen(getline(lnum))) - let lnum = s:PrevNonBlank(lnum - 1) - else - break - endif - endwhile + " Find a non-blank, non-multi-line string line above the current line. + let lnum = s:PrevNonBlankNonString(v:lnum - 1) " At the start of the file use zero indent. if lnum == 0 @@ -260,129 +254,75 @@ function GetRubyIndent() " Set up variables for current line. let line = getline(lnum) let ind = indent(lnum) - let did_kw_indent = 0 - let did_con_indent = 0 - - " If the previous line began with an indenting keyword, add one level. - let kcol = match(line, '^\s*'.s:ruby_indent_keywords) + 1 - let bcol = match(line, s:block_regexp) + 1 - if (kcol > 0 && !s:IsInStringOrComment(lnum, kcol)) - \ || (bcol > 0 && !s:IsInStringOrComment(lnum, bcol)) - let ind = ind + &sw - let did_kw_indent = 1 + + " If the previous line ended with a block opening, add a level of indent. + let col = match(line, s:block_regexp) + 1 + if col > 0 && !s:IsInStringOrComment(lnum, col) + return indent(s:GetMSL(lnum)) + &sw endif - " If the previous line ended in a brackets, get the indent of the line - " that opened it. - " TODO: add comments to this part - if !did_kw_indent - let bcol = match(line, - \'[]})]\s*\(\(\\|\\|\\|\\|#\).*\)\=$') + 1 - if bcol > 0 && !s:IsInStringOrComment(lnum, bcol) - call s:GotoLineCol(lnum, bcol - 1) - let open = '(' - let close = ')' - if line[bcol - 1] == '}' - let open = '{' - let close = '}' - elseif line[bcol - 1] == ']' - let open = '\[' - let close = '\]' - endif - if searchpair(open, '', close, 'bW', s:skip_expr) > 0 - let kcol = match(getline('.'), '^\s*'.s:ruby_indent_keywords) + 1 - if (kcol > 0 && !s:IsInStringOrComment(line('.'), kcol)) - let ind = indent('.') + &sw - let did_kw_indent = 1 - else - let ind = indent('.') - let did_con_indent = 1 - endif - endif + " If the previous line contained an opening bracket, and we are still in it, + " add one level of indent. + if line =~ '[[({]' + let counts = s:LineHasOpeningParen(lnum) + if counts[0] == '1' + \&& searchpair('(', '', ')', 'bW', s:skip_expr) > 0 + return virtcol('.') + elseif (counts[1] == '1' || counts[2] == '1') + return ind + &sw + else call s:GotoLineCol(v:lnum, vcol - 1) - endif + end endif - " If the previous line was a continuation line, indent to match its parent. - " TODO: this gets executed a bit too often perhaps (with the string - " checking) - let p_line = line + " 3.4. Work on the MSL line. {{{2 + " -------------------------- + let p_lnum = lnum - if !did_kw_indent && !did_con_indent - let my_lnum = s:PrevNonBlank(lnum - 1) - while my_lnum > 0 - let my_line = getline(my_lnum) - let col = match(my_line, s:continuation_regexp) + 1 - " If the line was a continuation not in a string, and we are currently - " not in a multiline-string, get it's indent and continue to previous - " line. - if (col > 0 && !s:IsInStringOrComment(my_lnum, col)) -" \ && !s:IsInStringOrComment(p_lnum, strlen(p_line)) - let ind = indent(my_lnum) - let p_line = my_line - let p_lnum = my_lnum - let my_lnum = s:PrevNonBlank(my_lnum - 1) - " Else, if we are in a multi-line string, continue to previous line. - elseif s:IsInStringOrComment(my_lnum, strlen(my_line)) - let my_lnum = s:PrevNonBlank(my_lnum - 1) - " Otherwise, exit the loop - else - let my_lnum = -1 - endif - endwhile - endif + let lnum = s:GetMSL(lnum) - " If the previous line ended with [*+/.-=], indent one extra level. - if !did_kw_indent && !did_con_indent - let ccol = match(line, s:continuation_regexp) + 1 - if ccol > 0 && !s:IsInStringOrComment(lnum, ccol) - let ind = ind + &sw -" XXX: - let did_con_indent = 1 - endif + " Continuation line + let ccol = match(line, s:continuation_regexp) + 1 + if lnum != p_lnum && ccol > 0 && !s:IsInStringOrComment(p_lnum, ccol) + \ || s:IsInString(p_lnum, strlen(line)) + return ind endif - " If we indented and the line ended with an 'end', decrease indent. - if did_kw_indent - let col = match(line, '\\s*\(#.*\)\=$') + 1 + let line = getline(lnum) + let msl_ind = indent(lnum) +" if indent(lnum) < ind +" let ind = indent(lnum) +" endif + + " If the previous line began with an indenting keyword, add a level of + " indent. + " TODO: this does not take into account contrived things such as + " module Foo; class Bar; end + let col = match(line, s:ruby_indent_keywords) + 1 + if col > 0 && !s:IsInStringOrComment(lnum, col) + let ind = msl_ind + &sw + let col = match(line, '\\s*\%(#.*\)\=$') + 1 if col > 0 && !s:IsInStringOrComment(lnum, col) let ind = ind - &sw endif + return ind endif - " TODO: look over merging the two below somehow (and see what's needed) - - " If the previous line contained an opening bracket, and we are still in it, - " add one level of indent. - let did_virt_indent = 0 - if line =~ '[[({]' - let counts = s:LineHasOpeningParen(line, lnum) - if counts[0] == '1' - \&& searchpair('(', '', ')', 'bW', s:skip_expr) > 0 - let ind = virtcol('.') - let did_virt_indent = 1 - elseif !did_con_indent && (counts[1] == '1' || counts[2] == '1') - let ind = ind + &sw - let did_virt_indent = 1 - end - call s:GotoLineCol(v:lnum, vcol - 1) + " If the previous line ended with [*+/.-=], indent one extra level. + let ccol = match(line, s:continuation_regexp) + 1 + if ccol > 0 && !s:IsInStringOrComment(lnum, ccol) + if lnum == p_lnum + let ind = msl_ind + &sw + else + let ind = msl_ind + endif endif - " If the far previous line contained an opening bracket, and we are still in - " it, add one level of indent. - " TODO: do we really need to check for did_con_indent here? don't think so - if !did_virt_indent && p_line =~ '[[({]' - let counts = s:LineHasOpeningParen(p_line, p_lnum) - if counts[0] == '1' - \&& searchpair('(', '', ')', 'bW', s:skip_expr) > 0 - let ind = virtcol('.') - elseif !did_con_indent && (counts[1] == '1' || counts[2] == '1') - let ind = ind + &sw - end - call s:GotoLineCol(v:lnum, vcol - 1) - endif + " }}}2 return ind endfunction +" }}}1 + " vim: sw=2 sts=2 ts=8 ff=unix: From 43f9dba22a85df68f2f88677596b106b8f17b17c Mon Sep 17 00:00:00 2001 From: Nikolai Weibull Date: Mon, 13 Oct 2003 01:31:10 +0000 Subject: [PATCH 069/411] Fix bug #62. Cleanup, fixup, speedup. --- ChangeLog | 5 ++ indent/ruby.vim | 214 +++++++++++++++++++++++------------------------- 2 files changed, 107 insertions(+), 112 deletions(-) diff --git a/ChangeLog b/ChangeLog index db9d99b9..e7907bc0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-10-13 Nikolai Weibull + + * indent/ruby.vim: General cleanup, speedup, fixup. Fixes bug #62. + Indentiation of tk.rb (5200+ lines) takes under 13 seconds now. + 2003-10-12 Nikolai Weibull * indent/ruby.vim: Fixed bugs #89 and #102. diff --git a/indent/ruby.vim b/indent/ruby.vim index 025a9d5e..4525f82a 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -2,7 +2,7 @@ " Language: Ruby " Maintainer: Gavin Sinclair " Developer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.16 2003/10/12 14:02:30 pcp Exp $ +" Info: $Id: ruby.vim,v 1.17 2003/10/13 01:31:10 pcp Exp $ " URL: http://vim-ruby.rubyforge.org/ " Anon CVS: See above site " Licence: GPL (http://www.gnu.org/) @@ -35,44 +35,57 @@ endif " 1. Variables {{{1 " ============ -" Items in this regex are syntax groups that delimit strings or comments. -let s:skip_regex = '\' -" Items in this regex are syntax groups that delimit strings or comments but -" in a less general fashion. -let s:skip_regex2 = '\' -" Items in this regex are syntax groups that delimit strings. -let s:skip_regex3 = '\' +" Regex of syntax group names that are strings. +let s:syng_string = + \ '\' -" This regex is used for matching words that, at the start of a line, add -" a level of indent. +" Expression used to check whether we should skip a match with searchpair(). +let s:skip_expr = + \ "synIDattr(synID(line('.'),col('.'),0),'name') =~ '".s:syng_strcom."'" + +" Regex used for words that, at the start of a line, add a level of indent. let s:ruby_indent_keywords = '^\s*\%(\zs\<\%(module\|class\|def\|if\|for' . \ '\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure' . - \ '\|rescue\)\>\|\h\w*\s*=\s*\zs\<\%(if\|unless\|while\|until\)\)' + \ '\|rescue\)\>\|\h\w*\s*=\s*\zs\<\%(if\|unless\)\>\)' -" Regular expression for continuations. -let s:continuation_regexp = '\%([\\*+/.,=-]\|\W?\|||\|&&\)\s*\%(#.*\)\=$' -let s:continuation_regexp2 = '\%([\\*+/.,=({[-]\|\W?\|||\|&&\)\s*\%(#.*\)\=$' +" Regex used for words that, at the start of a line, remove a level of indent. +let s:ruby_deindent_keywords = + \ '^\s*\zs\<\%(ensure\|else\|rescue\|elsif\|when\|end\)\>' -" Regular expression for blocks. We can't check for {, it's done in another -" place. -let s:block_regexp = '\%(\\|{\)\s*\%(|\%([*@]\=\h\w*,\=\s*\)\+|\)\=\s*' . - \ '\%(#.*\)\=$' +" Regex that defines the start-match for the 'end' keyword. +let s:end_start_regex = '\%(^\s*\%(\zs\<\%(module\|class\|def\|if\|for' . + \ '\|while\|until\|case\|unless\|begin\)\>' . + \ '\|\h\w*\s*=\s*\zs\<\%(if\|unless\)\>\)' . + \ '\|\\)' -" Expression used to check whether we should skip a match with searchpair(). -let s:skip_expr = 'synIDattr(synID(line("."), col("."), 0), "name") =~ ' . - \ "'".s:skip_regex."'" +" Regex that defines the middle-match for the 'end' keyword. +let s:end_middle_regex = '\<\%(ensure\|else\|rescue\|when\|elsif\)\>' -" Expression used for searchpair() call for finding match for 'end'. +" Regex that defines the end-match for the 'end' keyword. +let s:end_end_regex = '\\s*\%(#.*\)\=$' + +" Expression used for searchpair() call for finding match for 'end' keyword. let s:end_skip_expr = s:skip_expr . - \ ' || (expand("") =~ "\\<\\(if\\|unless\\|while\\|until\\)\\>"' . - \ ' && getline(".") !~ "^\\s*\\<".expand("")."\\>"' . - \ ' && getline(".") !~ "\\h\\w*\\s*=\\s*\\<".expand("")."\\>"' . - \ ' && getline(".") !~ expand("")."\\>.*\\")' + \ ' || (expand("") == "do"' . + \ ' && getline(".") =~ "^\\s*\\")' + +" Regex that defines continuation lines, not including (, {, or [. +let s:continuation_regex = '\%([\\*+/.,=-]\|\W?\|||\|&&\)\s*\%(#.*\)\=$' + +" Regex that defines continuation lines. +let s:continuation_regex2 = '\%([\\*+/.,=({[-]\|\W?\|||\|&&\)\s*\%(#.*\)\=$' + +" Regex that defines blocks. +let s:block_regex = + \ '\%(\\|{\)\s*\%(|\%([*@]\=\h\w*,\=\s*\)\+|\)\=\s*\%(#.*\)\=$' " 2. Auxiliary Functions {{{1 " ====================== @@ -88,55 +101,54 @@ 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, 0), 'name') =~ s:skip_regex + return synIDattr(synID(a:lnum, a:col, 0), 'name') =~ s:syng_strcom endfunction " Check if the character at lnum:col is inside a string or comment. function s:IsInStringOrComment2(lnum, col) - return synIDattr(synID(a:lnum, a:col, 0), 'name') =~ s:skip_regex2 + return synIDattr(synID(a:lnum, a:col, 0), 'name') =~ s:syng_strcom2 endfunction " Check if the character at lnum:col is inside a string. function s:IsInString(lnum, col) - return synIDattr(synID(a:lnum, a:col, 0), 'name') =~ s:skip_regex3 + return synIDattr(synID(a:lnum, a:col, 0), 'name') =~ s:syng_string endfunction -" Find the previous non-blank line which isn't a comment-line or in a comment -" block. +" Find line above 'lnum' that isn't empty, in a comment, or in a string. function s:PrevNonBlankNonString(lnum) let in_block = 0 let lnum = prevnonblank(a:lnum) while lnum > 0 + " Go in and out of blocks comments as necessary. + " If the line isn't empty (with opt. comment) or in a string, end search. let line = getline(lnum) - " Go in and out of blocks depending on if the line matches this. - " Also skip the line if it contains only whitespace and a comment. - " Lastly, skip it if it is in a multi-line string. - if !in_block && line =~ '^=end$' - let in_block = 1 - elseif in_block && line =~ '^=begin$' - let in_block = 0 - elseif !in_block && line !~ '^\s*#.*$' - \ && !(s:IsInStringOrComment(lnum, 1) - \ && s:IsInStringOrComment(lnum, strlen(getline(lnum)))) - break + if in_block + if line =~ '^=begin$' + let in_block = 0 + endif + else + if line =~ '^=end$' + let in_block = 1 + elseif line !~ '^\s*#.*$' && !(s:IsInStringOrComment(lnum, 1) + \ && s:IsInStringOrComment(lnum, strlen(line))) + break + endif endif let lnum = prevnonblank(lnum - 1) endwhile return lnum endfunction -" Get the Most Significant Line before lnum. This is the line that started -" the continuation lnum may be a part of. +" Find line above 'lnum' that started the continuation 'lnum' may be part of. function s:GetMSL(lnum) " Start on the line we're at and use its indent. let msl = a:lnum let lnum = s:PrevNonBlankNonString(a:lnum - 1) while lnum > 0 - " If we have a continuation line which isn't in a string, use that - " lines instead of the one we previously had. - " Otherwise, we are done. + " If we have a continuation line, or we're in a string, use line as MSL. + " Otherwise, terminate search as we have found our MSL already. let line = getline(lnum) - let col = match(line, s:continuation_regexp2) + 1 + let col = match(line, s:continuation_regex2) + 1 if (col > 0 && !s:IsInStringOrComment(lnum, col)) \ || s:IsInString(lnum, strlen(line)) let msl = lnum @@ -148,29 +160,32 @@ function s:GetMSL(lnum) return msl endfunction -" Check if line has more opening parentheses than closing -function s:LineHasOpeningParen(lnum) - let lnum = a:lnum - let line = getline(lnum) - let i = 0 - let n = strlen(line) +" Check if line 'lnum' has more opening brackets than closing ones. +function s:LineHasOpeningBrackets(lnum) let open_0 = 0 let open_2 = 0 let open_4 = 0 - while i < n - let idx = stridx('(){}[]', line[i]) - if idx > -1 && !s:IsInStringOrComment(lnum, i + 1) + let line = getline(a:lnum) + let pos = match(line, '[][(){}]', 0) + while pos != -1 + if !s:IsInStringOrComment(a:lnum, pos + 1) + let idx = stridx('(){}[]', line[pos]) if idx % 2 == 0 let open_{idx} = open_{idx} + 1 else let open_{idx - 1} = open_{idx - 1} - 1 endif endif - let i = i + 1 + let pos = match(line, '[][(){}]', pos + 1) endwhile return (open_0 > 0) . (open_2 > 0) . (open_4 > 0) endfunction +function s:Match(lnum, regex) + let col = match(getline(a:lnum), a:regex) + 1 + return col > 0 && !s:IsInStringOrComment(a:lnum, col) ? col : 0 +endfunction + " 3. GetRubyIndent Function {{{1 " ========================= @@ -189,47 +204,28 @@ function GetRubyIndent() let ind = -1 " If we got a closing bracket on an empty line, find its match and indent - " according to it. - let col = match(line, '^\s*\zs[]})]') + 1 + " according to it. For parentheses we indent to its column - 1, for the + " others we indent to the containing line's MSL's level. Return -1 if fail. + let col = matchend(line, '^\s*[]})]') if col > 0 && !s:IsInStringOrComment(v:lnum, col) call s:GotoLineCol(v:lnum, col - 1) - " If it was a parentheses, search for its match and indent to its level. - " If it was a brace or bracket, search for its match and indent to that - " lines level. - if line[col - 1] == ')' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0 - let ind = virtcol('.') - 1 - else - let begin = '{' - let end = '}' - if line[col - 1] == ']' - let begin = '[' - let end = ']' - endif - " If we find a matching brace/bracket, we need to find the line it - " belongs to and indent to that line's level of indent. - if searchpair(begin, '', end, 'bW', s:skip_expr) > 0 - let ind = indent(s:GetMSL(line('.'))) - endif + let brackets = strpart('(){}[]', stridx(')}]', line[col - 1]) * 2, 2) + if searchpair(brackets[0], '', brackets[1], 'bW', s:skip_expr) > 0 + let ind = line[col-1]==')' ? virtcol('.')-1 : indent(s:GetMSL(line('.'))) endif return ind endif " If we have a =begin or =end set indent to first column. - let col = match(line, '^\s*\zs\%(=begin\|=end\)$') + 1 - if col > 0 + if match(line, '^\s*\%(=begin\|=end\)$') != -1 return 0 endif - " If we have a deindenting keyword on an empty line, find its match and - " indent to its level. - let col = match(line, - \ '^\s*\zs\<\%(ensure\|else\|rescue\|elsif\|when\|end\)\>') + 1 - if col > 0 && !s:IsInStringOrComment(v:lnum, col) + " If we have a deindenting keyword, find its match and indent to its level. + if s:Match(v:lnum, s:ruby_deindent_keywords) call s:GotoLineCol(v:lnum, 0) - if searchpair('\<\%(def\|do\|if\|unless\|case\|begin\|until\|for\|while' . - \ '\|\.\@', - \ '\<\%(ensure\|else\|rescue\|when\|elsif\)\>', '\', 'bW', - \ s:end_skip_expr) > 0 + if searchpair(s:end_start_regex, s:end_middle_regex, s:end_end_regex, 'bW', + \ s:end_skip_expr) > 0 let ind = indent('.') endif return ind @@ -256,19 +252,17 @@ function GetRubyIndent() let ind = indent(lnum) " If the previous line ended with a block opening, add a level of indent. - let col = match(line, s:block_regexp) + 1 - if col > 0 && !s:IsInStringOrComment(lnum, col) + if s:Match(lnum, s:block_regex) return indent(s:GetMSL(lnum)) + &sw endif " If the previous line contained an opening bracket, and we are still in it, - " add one level of indent. + " add indent depending on the bracket type. if line =~ '[[({]' - let counts = s:LineHasOpeningParen(lnum) - if counts[0] == '1' - \&& searchpair('(', '', ')', 'bW', s:skip_expr) > 0 + let counts = s:LineHasOpeningBrackets(lnum) + if counts[0] == '1' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0 return virtcol('.') - elseif (counts[1] == '1' || counts[2] == '1') + elseif counts[1] == '1' || counts[2] == '1' return ind + &sw else call s:GotoLineCol(v:lnum, vcol - 1) @@ -278,39 +272,35 @@ function GetRubyIndent() " 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) - " Continuation line - let ccol = match(line, s:continuation_regexp) + 1 - if lnum != p_lnum && ccol > 0 && !s:IsInStringOrComment(p_lnum, ccol) - \ || s:IsInString(p_lnum, strlen(line)) - return ind + " If the previous line wasn't a MSL and is continuation return its indent. + " TODO: the || s:IsInString() thing worries me a bit. + if p_lnum != lnum + if s:Match(p_lnum,s:continuation_regex)||s:IsInString(p_lnum,strlen(line)) + 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 indent(lnum) < ind -" let ind = indent(lnum) -" endif - " If the previous line began with an indenting keyword, add a level of - " indent. + " 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 = match(line, s:ruby_indent_keywords) + 1 - if col > 0 && !s:IsInStringOrComment(lnum, col) + if s:Match(lnum, s:ruby_indent_keywords) let ind = msl_ind + &sw - let col = match(line, '\\s*\%(#.*\)\=$') + 1 - if col > 0 && !s:IsInStringOrComment(lnum, col) + if s:Match(lnum, s:end_end_regex) let ind = ind - &sw endif return ind endif " If the previous line ended with [*+/.-=], indent one extra level. - let ccol = match(line, s:continuation_regexp) + 1 - if ccol > 0 && !s:IsInStringOrComment(lnum, ccol) + if s:Match(lnum, s:continuation_regex) if lnum == p_lnum let ind = msl_ind + &sw else From 4f2c7a261948b2076b4338f0a59bb2b1d92bfb13 Mon Sep 17 00:00:00 2001 From: Nikolai Weibull Date: Mon, 13 Oct 2003 01:40:23 +0000 Subject: [PATCH 070/411] Cleanup --- ChangeLog | 2 ++ ftplugin/ruby.vim | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index e7907bc0..fa5285c8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ * indent/ruby.vim: General cleanup, speedup, fixup. Fixes bug #62. Indentiation of tk.rb (5200+ lines) takes under 13 seconds now. + * ftplugin/ruby.vim: Cleanup. Nested if's unnecessary. Also modified + modeline. 2003-10-12 Nikolai Weibull diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index b2e6415e..bcfd896c 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.5 2003/09/16 16:06:45 gsinclair Exp $ +" Info: $Id: ruby.vim,v 1.6 2003/10/13 01:40:23 pcp Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -18,18 +18,18 @@ " Only do this when not done yet for this buffer if (exists("b:did_ftplugin")) - finish + finish endif let b:did_ftplugin = 1 " Matchit support -if exists("loaded_matchit") - if !exists("b:match_words") - let b:match_ignorecase = 0 - let b:match_words = -\ '\%(\%(\%(^\|[;=]\)\s*\)\@<=\%(class\|module\|while\|begin\|until\|for\|if\|unless\|def\|case\)\|\:' . -\ '\<\%(else\|elsif\|ensure\|rescue\|when\)\>:\%(^\|[^.]\)\@<=\' - endif +if exists("loaded_matchit") && !exists("b:match_words") + let b:match_ignorecase = 0 + let b:match_words = + \ '\%(\%(\%(^\|[;=]\)\s*\)\@<=\%(class\|module\|while\|begin\|until' . + \ '\|for\|if\|unless\|def\|case\)\|\:' . + \ '\<\%(else\|elsif\|ensure\|rescue\|when\)\>:' . + \ '\%(^\|[^.]\)\@<=\' endif -" vim: ff=unix +" vim: sw=2 sts=2 ts=8 ff=unix: From a4865fc248f5336a633066cb66e9bd09103f6f70 Mon Sep 17 00:00:00 2001 From: Tim Hammerquist Date: Tue, 14 Oct 2003 06:38:22 +0000 Subject: [PATCH 071/411] Minor gossip added. --- README | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README b/README index ed922efd..06b87f0c 100644 --- a/README +++ b/README @@ -72,7 +72,8 @@ Any questions or suggestions? Project gossip: - Two of the configuration file maintainers, Doug Kearns and Gavin Sinclair, live in Australia (Melbourne and Sydney respectively). Tim Hammerquist, - the last man standing, has a cpan.org email address. + 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 From 6431616799f213d1a3eb00c219766a4e4c819df9 Mon Sep 17 00:00:00 2001 From: Nikolai Weibull Date: Tue, 14 Oct 2003 10:36:10 +0000 Subject: [PATCH 072/411] Fix for $' and $". --- ChangeLog | 6 ++++++ syntax/ruby.vim | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index fa5285c8..61caf0c6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-10-14 Nikolai Weibull + + * syntax/ruby.vim: Readded matching of $' and $" when + ruby_no_identifiers was off. Got accidentaly removed with previous + fix. + 2003-10-13 Nikolai Weibull * indent/ruby.vim: General cleanup, speedup, fixup. Fixes bug #62. diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 46694810..7e93ac5c 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.33 2003/10/12 02:43:27 pcp Exp $ +" Info: $Id: ruby.vim,v 1.34 2003/10/14 10:36:10 pcp Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -57,7 +57,7 @@ if !exists("ruby_no_identifiers") syn region rubySymbol start=":\@?@\_`~1-9]" + syn match rubyPredefinedVariable #$[!$&"'*+,./0:;<=>?@\_`~1-9]# syn match rubyPredefinedVariable "$-[0FIKadilpvw]" display syn match rubyPredefinedVariable "$\%(deferr\|defout\|stderr\|stdin\|stdout\)\>" display syn match rubyPredefinedVariable "$\%(DEBUG\|FILENAME\|KCODE\|LOAD_PATH\|SAFE\|VERBOSE\)\>" display From 9517132d7a700f03d6a7c72ae5cdedca306b6c43 Mon Sep 17 00:00:00 2001 From: Nikolai Weibull Date: Tue, 14 Oct 2003 23:31:36 +0000 Subject: [PATCH 073/411] Fixed bug #114 and related issues. --- ChangeLog | 7 +++++++ indent/ruby.vim | 29 +++++++++++++++++++---------- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 61caf0c6..879c4011 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2003-10-15 Nikolai Weibull + + * indent/ruby.vim: Fixed bug #114. Also fixed a related problem with + documentation blocks. They would indent relative to the other code. + Now it simply indents with zero width (to match =begin) by default. + Otherwise acts like 'autoindent'. + 2003-10-14 Nikolai Weibull * syntax/ruby.vim: Readded matching of $' and $" when diff --git a/indent/ruby.vim b/indent/ruby.vim index 4525f82a..a4c07424 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -2,7 +2,7 @@ " Language: Ruby " Maintainer: Gavin Sinclair " Developer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.17 2003/10/13 01:31:10 pcp Exp $ +" Info: $Id: ruby.vim,v 1.18 2003/10/14 23:31:36 pcp Exp $ " URL: http://vim-ruby.rubyforge.org/ " Anon CVS: See above site " Licence: GPL (http://www.gnu.org/) @@ -47,6 +47,10 @@ let s:syng_strcom2 = '\' +" Regex of syntax group names that are strings or documentation. +let s:syng_stringdoc = + \'\' + " Expression used to check whether we should skip a match with searchpair(). let s:skip_expr = \ "synIDattr(synID(line('.'),col('.'),0),'name') =~ '".s:syng_strcom."'" @@ -114,6 +118,11 @@ function s:IsInString(lnum, col) return synIDattr(synID(a:lnum, a:col, 0), 'name') =~ s:syng_string 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, 0), 'name') =~ s:syng_stringdoc +endfunction + " Find line above 'lnum' that isn't empty, in a comment, or in a string. function s:PrevNonBlankNonString(lnum) let in_block = 0 @@ -122,17 +131,17 @@ function s:PrevNonBlankNonString(lnum) " Go in and out of blocks comments as necessary. " If the line isn't empty (with opt. comment) or in a string, end search. let line = getline(lnum) - if in_block - if line =~ '^=begin$' + if line =~ '^=begin$' + if in_block let in_block = 0 - endif - else - if line =~ '^=end$' - let in_block = 1 - elseif line !~ '^\s*#.*$' && !(s:IsInStringOrComment(lnum, 1) - \ && s:IsInStringOrComment(lnum, strlen(line))) + else break endif + elseif !in_block && line =~ '^=end$' + let in_block = 1 + elseif !in_block && line !~ '^\s*#.*$' && !(s:IsInStringOrComment(lnum, 1) + \ && s:IsInStringOrComment(lnum, strlen(line))) + break endif let lnum = prevnonblank(lnum - 1) endwhile @@ -232,7 +241,7 @@ function GetRubyIndent() endif " If we are in a multi-line string or line-comment, don't do anything to it. - if s:IsInStringOrComment2(v:lnum, matchend(line, '^\s*') + 1) + if s:IsInStringOrDocumentation(v:lnum, matchend(line, '^\s*') + 1) return indent('.') endif From 2bac714875b15066480b213e63ceabd1d2cc4596 Mon Sep 17 00:00:00 2001 From: Nikolai Weibull Date: Wed, 15 Oct 2003 15:14:26 +0000 Subject: [PATCH 074/411] *** empty log message *** --- ChangeLog | 4 +++- indent/ruby.vim | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 879c4011..4594ee8c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,7 +3,9 @@ * indent/ruby.vim: Fixed bug #114. Also fixed a related problem with documentation blocks. They would indent relative to the other code. Now it simply indents with zero width (to match =begin) by default. - Otherwise acts like 'autoindent'. + Otherwise acts like 'autoindent'. Also fixed a problem with | and & + not being recognized as continuation lines. This may cause problems + with do blocks, we'll see 2003-10-14 Nikolai Weibull diff --git a/indent/ruby.vim b/indent/ruby.vim index a4c07424..72c51532 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -2,7 +2,7 @@ " Language: Ruby " Maintainer: Gavin Sinclair " Developer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.18 2003/10/14 23:31:36 pcp Exp $ +" Info: $Id: ruby.vim,v 1.19 2003/10/15 15:14:26 pcp Exp $ " URL: http://vim-ruby.rubyforge.org/ " Anon CVS: See above site " Licence: GPL (http://www.gnu.org/) @@ -82,10 +82,10 @@ let s:end_skip_expr = s:skip_expr . \ ' && getline(".") =~ "^\\s*\\")' " Regex that defines continuation lines, not including (, {, or [. -let s:continuation_regex = '\%([\\*+/.,=-]\|\W?\|||\|&&\)\s*\%(#.*\)\=$' +let s:continuation_regex = '\%([\\*+/.,=|&-]\|\W?\|||\|&&\)\s*\%(#.*\)\=$' " Regex that defines continuation lines. -let s:continuation_regex2 = '\%([\\*+/.,=({[-]\|\W?\|||\|&&\)\s*\%(#.*\)\=$' +let s:continuation_regex2 = '\%([\\*+/.,=({[|&-]\|\W?\|||\|&&\)\s*\%(#.*\)\=$' " Regex that defines blocks. let s:block_regex = From 917c8a23f8d698275749f3cff6a831f94b4865e7 Mon Sep 17 00:00:00 2001 From: Nikolai Weibull Date: Wed, 15 Oct 2003 15:23:41 +0000 Subject: [PATCH 075/411] *** empty log message *** --- ChangeLog | 4 +++- indent/ruby.vim | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4594ee8c..a5951bb3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,7 +5,9 @@ Now it simply indents with zero width (to match =begin) by default. Otherwise acts like 'autoindent'. Also fixed a problem with | and & not being recognized as continuation lines. This may cause problems - with do blocks, we'll see + with do blocks, we'll see. + * indent/ruby.vim: In response to previous note. It proved fatal. + Fixed now. 2003-10-14 Nikolai Weibull diff --git a/indent/ruby.vim b/indent/ruby.vim index 72c51532..9b1146dc 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -2,7 +2,7 @@ " Language: Ruby " Maintainer: Gavin Sinclair " Developer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.19 2003/10/15 15:14:26 pcp Exp $ +" Info: $Id: ruby.vim,v 1.20 2003/10/15 15:23:41 pcp Exp $ " URL: http://vim-ruby.rubyforge.org/ " Anon CVS: See above site " Licence: GPL (http://www.gnu.org/) @@ -82,10 +82,10 @@ let s:end_skip_expr = s:skip_expr . \ ' && getline(".") =~ "^\\s*\\")' " Regex that defines continuation lines, not including (, {, or [. -let s:continuation_regex = '\%([\\*+/.,=|&-]\|\W?\|||\|&&\)\s*\%(#.*\)\=$' +let s:continuation_regex = '\%([\\*+/.,=-]\|\W[|&?]\|||\|&&\)\s*\%(#.*\)\=$' " Regex that defines continuation lines. -let s:continuation_regex2 = '\%([\\*+/.,=({[|&-]\|\W?\|||\|&&\)\s*\%(#.*\)\=$' +let s:continuation_regex2 = '\%([\\*+/.,=({[-]\|\W[|&?]\|||\|&&\)\s*\%(#.*\)\=$' " Regex that defines blocks. let s:block_regex = From ecf15d757cf2ed468307bf7be0b9d5787ac25826 Mon Sep 17 00:00:00 2001 From: Gavin Sinclair Date: Fri, 17 Oct 2003 09:29:09 +0000 Subject: [PATCH 076/411] * README: Minor addition. * etc/website/index.html: Synced with README. --- ChangeLog | 5 +++++ README | 3 +++ etc/website/index.html | 5 ++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a5951bb3..befe8cdd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-10-17 Gavin Sinclair + + * README: Minor addition. + * etc/website/index.html: Synced with README. + 2003-10-15 Nikolai Weibull * indent/ruby.vim: Fixed bug #114. Also fixed a related problem with diff --git a/README b/README index 06b87f0c..0279ec9a 100644 --- a/README +++ b/README @@ -45,6 +45,9 @@ How you get these files into Vim: Understanding the configuration files: - See www.rubygarden.org/ruby?VimRubySupport + - Email any one of us or ruby-talk if you want more information added to + this page. + CVS topics: - Files are tagged according to which version of Vim they are released in. diff --git a/etc/website/index.html b/etc/website/index.html index 8f8f9d13..c9b646df 100644 --- a/etc/website/index.html +++ b/etc/website/index.html @@ -73,6 +73,8 @@

README

Understanding the configuration files: - See www.rubygarden.org/ruby?VimRubySupport + - Email any one of us or ruby-talk if you want more information added to + this page. CVS topics: - Files are tagged according to which version of Vim they are released in. @@ -100,7 +102,8 @@

README

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 a cpan.org email address. + 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 From d41c15b1dca266340806add9a89ead9893321b19 Mon Sep 17 00:00:00 2001 From: Nikolai Weibull Date: Sat, 18 Oct 2003 13:24:00 +0000 Subject: [PATCH 077/411] Fixed bug with [] matching --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index befe8cdd..555c1fe6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2003-10-18 Nikolai Weibull + + * indent/ruby.vim: Fixed a silly bug with the [] matching. + 2003-10-17 Gavin Sinclair * README: Minor addition. From 28792f5b524bbdafd970fd227dc26f7ff223eefa Mon Sep 17 00:00:00 2001 From: Nikolai Weibull Date: Mon, 20 Oct 2003 01:02:13 +0000 Subject: [PATCH 078/411] Added support for ?:. --- ChangeLog | 7 +++++++ indent/ruby.vim | 11 ++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 555c1fe6..76829830 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2003-10-20 Nikolai Weibull + + * indent/ruby.vim: Added support for ?: multilining, such as + a ? + b : + c. + 2003-10-18 Nikolai Weibull * indent/ruby.vim: Fixed a silly bug with the [] matching. diff --git a/indent/ruby.vim b/indent/ruby.vim index 9b1146dc..405d4e42 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -2,7 +2,7 @@ " Language: Ruby " Maintainer: Gavin Sinclair " Developer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.20 2003/10/15 15:23:41 pcp Exp $ +" Info: $Id: ruby.vim,v 1.21 2003/10/20 01:02:13 pcp Exp $ " URL: http://vim-ruby.rubyforge.org/ " Anon CVS: See above site " Licence: GPL (http://www.gnu.org/) @@ -82,10 +82,11 @@ let s:end_skip_expr = s:skip_expr . \ ' && getline(".") =~ "^\\s*\\")' " Regex that defines continuation lines, not including (, {, or [. -let s:continuation_regex = '\%([\\*+/.,=-]\|\W[|&?]\|||\|&&\)\s*\%(#.*\)\=$' +let s:continuation_regex = '\%([\\*+/.,=:-]\|\W[|&?]\|||\|&&\)\s*\%(#.*\)\=$' " Regex that defines continuation lines. -let s:continuation_regex2 = '\%([\\*+/.,=({[-]\|\W[|&?]\|||\|&&\)\s*\%(#.*\)\=$' +let s:continuation_regex2 = + \ '\%([\\*+/.,=:({[-]\|\W[|&?]\|||\|&&\)\s*\%(#.*\)\=$' " Regex that defines blocks. let s:block_regex = @@ -218,8 +219,8 @@ function GetRubyIndent() let col = matchend(line, '^\s*[]})]') if col > 0 && !s:IsInStringOrComment(v:lnum, col) call s:GotoLineCol(v:lnum, col - 1) - let brackets = strpart('(){}[]', stridx(')}]', line[col - 1]) * 2, 2) - if searchpair(brackets[0], '', brackets[1], 'bW', s:skip_expr) > 0 + let bs = strpart('(){}[]', stridx(')}]', line[col - 1]) * 2, 2) + if searchpair(escape(bs[0], '\['), '', bs[1], 'bW', s:skip_expr) > 0 let ind = line[col-1]==')' ? virtcol('.')-1 : indent(s:GetMSL(line('.'))) endif return ind From 5b646019a29deb45fcaf8eaa1870674b8720b7a4 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 6 Nov 2003 09:01:25 +0000 Subject: [PATCH 079/411] add support for the new decimal and octal base indicators --- ChangeLog | 5 +++++ syntax/ruby.vim | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 76829830..61827e02 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-11-06 Doug Kearns + + * syntax/ruby.vim: add support for the new decimal and octal base + indicators and capitalization of all base indicators. + 2003-10-20 Nikolai Weibull * indent/ruby.vim: Added support for ?: multilining, such as diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 7e93ac5c..98ac7ca7 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.34 2003/10/14 10:36:10 pcp Exp $ +" Info: $Id: ruby.vim,v 1.35 2003/11/06 09:01:25 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -36,10 +36,10 @@ syn cluster rubyStringSpecial contains=rubyInterpolation,rubyNoInterpolation,rub " Numbers and ASCII Codes syn match rubyASCIICode "\w\@" display -syn match rubyInteger "\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\>" display -syn match rubyInteger "\<0\o\+\%(_\o\+\)*\>" display -syn match rubyInteger "\<0b[01]\+\%(_[01]\+\)*\>" display +syn match rubyInteger "\<0[xX]\x\+\%(_\x\+\)*\>" display +syn match rubyInteger "\<\%(0[dD]\)\=\%(0\|[1-9]\d*\%(_\d\+\)*\)\>" display +syn match rubyInteger "\<0[oO]\=\o\+\%(_\o\+\)*\>" display +syn match rubyInteger "\<0[bB][01]\+\%(_[01]\+\)*\>" display syn match rubyFloat "\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\.\d\+\%(_\d\+\)*\>" display syn match rubyFloat "\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE][-+]\=\d\+\%(_\d\+\)*\)\>" display From 28c28e7cb9b7d57c64c3ffced84a6093eb5b636e Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 6 Nov 2003 10:17:33 +0000 Subject: [PATCH 080/411] update DJK's current location again --- ChangeLog | 4 ++++ README | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 61827e02..2be9514e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2003-11-06 Doug Kearns + + * README: update DJK's current location. + 2003-11-06 Doug Kearns * syntax/ruby.vim: add support for the new decimal and octal base diff --git a/README b/README index 0279ec9a..ddb1ab93 100644 --- a/README +++ b/README @@ -74,7 +74,7 @@ Any questions or suggestions? Project gossip: - Two of the configuration file maintainers, Doug Kearns and Gavin Sinclair, - live in Australia (Melbourne and Sydney respectively). Tim Hammerquist, + 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, From 947531624d0d35b10097942ed81f88d4c4ab75fd Mon Sep 17 00:00:00 2001 From: Gavin Sinclair Date: Sat, 10 Jan 2004 23:06:11 +0000 Subject: [PATCH 081/411] * ftplugin/ruby.vim: Added matchit instructions. --- ChangeLog | 4 ++++ ftplugin/ruby.vim | 40 +++++++++++++++++++++++++++++++++++----- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2be9514e..468ed06b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2004-01-11 Gavin Sinclair + + * ftplugin/ruby.vim: Added matchit instructions. + 2003-11-06 Doug Kearns * README: update DJK's current location. diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index bcfd896c..e220012f 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.6 2003/10/13 01:40:23 pcp Exp $ +" Info: $Id: ruby.vim,v 1.7 2004/01/10 23:06:11 gsinclair Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -26,10 +26,40 @@ let b:did_ftplugin = 1 if exists("loaded_matchit") && !exists("b:match_words") let b:match_ignorecase = 0 let b:match_words = - \ '\%(\%(\%(^\|[;=]\)\s*\)\@<=\%(class\|module\|while\|begin\|until' . - \ '\|for\|if\|unless\|def\|case\)\|\:' . - \ '\<\%(else\|elsif\|ensure\|rescue\|when\)\>:' . - \ '\%(^\|[^.]\)\@<=\' + \ '\%(\%(\%(^\|[;=]\)\s*\)\@<=\%(class\|module\|while\|begin\|until' . + \ '\|for\|if\|unless\|def\|case\)\|\:' . + \ '\<\%(else\|elsif\|ensure\|rescue\|when\)\>:' . + \ '\%(^\|[^.]\)\@<=\' endif +" +" Instructions for enabling "matchit" support: +" +" 1. Look for the latest "matchit" plugin at +" +" http://www.vim.org/scripts/script.php?script_id=39 +" +" It is also packaged with Vim, in the $VIMRUNTIME/macros directory. +" +" 2. Copy "matchit.txt" into a "doc" directory (e.g. $HOME/.vim/doc). +" +" 3. Copy "matchit.vim" into a "plugin" directory (e.g. $HOME/.vim/plugin). +" +" 4. Ensure this file (ftplugin/ruby.vim) is installed. +" +" 5. Ensure you have this line in your $HOME/.vimrc: +" filetype plugin on +" +" 6. Restart Vim and create the matchit documentation: +" +" :helptags ~/.vim/doc +" +" Now you can do ":help matchit", and you should be able to use "%" on Ruby +" keywords. Try ":echo b:match_words" to be sure. +" +" Thanks to Mark J. Reed for the instructions. See ":help vimrc" for the +" locations of plugin directories, etc., as there are several options, and it +" differs on Windows. Email gsinclair@soyabean.com.au if you need help. +" + " vim: sw=2 sts=2 ts=8 ff=unix: From f769b5853314c4afd4f938d0f7f44bdddc1dde5d Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sun, 8 Feb 2004 06:51:41 +0000 Subject: [PATCH 082/411] convert index.html to valid HTML 4.01 Strict --- ChangeLog | 4 +++ etc/website/index.html | 75 +++++++++++++++++++++++++----------------- 2 files changed, 49 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index 468ed06b..2507e6c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2004-02-08 Doug Kearns + + * etc/website/index.html: convert to valid HTML 4.01 Strict. + 2004-01-11 Gavin Sinclair * ftplugin/ruby.vim: Added matchit instructions. diff --git a/etc/website/index.html b/etc/website/index.html index c9b646df..ccea2a5c 100644 --- a/etc/website/index.html +++ b/etc/website/index.html @@ -1,31 +1,45 @@ - - - - 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 project CVS, 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?VimRubySupport -

README

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

-

+
+
+  
+    
+    
+      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 project CVS, 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?VimRubySupport +

+

+ README +

+

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

+
                     +-----------------------------------+
                     | vim-ruby RubyForge project README |
                     +-----------------------------------+
@@ -110,6 +124,7 @@ 

README

let us know. --= End of Document =-- -
- + +
+ From c32d71f0d7898e4c1e2c3ac7d22259f57f109dc0 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 23 Mar 2004 01:50:23 +0000 Subject: [PATCH 083/411] add simple CSS style sheet to project page --- ChangeLog | 5 +++++ etc/website/djk-theme.css | 34 ++++++++++++++++++++++++++++++++++ etc/website/index.html | 3 ++- 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 etc/website/djk-theme.css diff --git a/ChangeLog b/ChangeLog index 2507e6c2..4a471f8f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-03-23 Doug Kearns + + * etc/website/index.html, etc/website/djk-theme.css: add simple CSS + style sheet + 2004-02-08 Doug Kearns * etc/website/index.html: convert to valid HTML 4.01 Strict. diff --git a/etc/website/djk-theme.css b/etc/website/djk-theme.css new file mode 100644 index 00000000..da068b71 --- /dev/null +++ b/etc/website/djk-theme.css @@ -0,0 +1,34 @@ +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 index ccea2a5c..58137d85 100644 --- a/etc/website/index.html +++ b/etc/website/index.html @@ -6,6 +6,7 @@ Vim/Ruby Configuration Files +

@@ -39,7 +40,7 @@

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

-
+    
                     +-----------------------------------+
                     | vim-ruby RubyForge project README |
                     +-----------------------------------+

From 477859c40853411a4d6bc7698a54d9288f5a2f61 Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Thu, 1 Apr 2004 10:39:48 +0000
Subject: [PATCH 084/411] add a new compiler plugin for Test::Unit

---
 ChangeLog             |  4 ++++
 compiler/rubyunit.vim | 38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+)
 create mode 100644 compiler/rubyunit.vim

diff --git a/ChangeLog b/ChangeLog
index 4a471f8f..4adc21bf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2004-04-01  Doug Kearns  
+
+	* compiler/rubyunit.vim: added a new compiler plugin for Test::Unit
+
 2004-03-23  Doug Kearns  
 
 	* etc/website/index.html, etc/website/djk-theme.css: add simple CSS
diff --git a/compiler/rubyunit.vim b/compiler/rubyunit.vim
new file mode 100644
index 00000000..e9c6b6ce
--- /dev/null
+++ b/compiler/rubyunit.vim
@@ -0,0 +1,38 @@
+" Vim compiler file
+" Language:	Test::Unit - Ruby Unit Testing Framework
+" Maintainer:	Doug Kearns 
+" Info:		$Id: rubyunit.vim,v 1.1 2004/04/01 10:39:48 dkearns Exp $
+" URL:		http://vim-ruby.sourceforge.net
+" Anon CVS:	See above site
+" Licence:	GPL (http://www.gnu.org)
+" Disclaimer:
+"    This program is distributed in the hope that it will be useful,
+"    but WITHOUT ANY WARRANTY; without even the implied warranty of
+"    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+"    GNU General Public License for more details.
+" ----------------------------------------------------------------------------
+
+if exists("current_compiler")
+  finish
+endif
+let current_compiler = "rubyunit"
+
+let s:cpo_save = &cpo
+set cpo-=C
+
+setlocal makeprg=ruby
+
+setlocal errorformat=\%Etest%[%^\ ]%#(%[%^\ ]%#)\ [%f:%l]:,
+                     \%Z%m%\\%.,
+                     \%C%m%\\%.,
+                     \%-GLoaded%.%#,
+                     \%-GStarted%.%#,
+                     \%-G%[EF%.]%.%#,
+                     \%-GFinished\ in%.%#,
+                     \%-G\ %\\+%\\d%\\+)\ Failure:,
+                     \%-G\ %\\+%\\d%\\+)\ Error:
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim: nowrap tabstop=8 ff=unix

From 6236732882ada3737dabc21aa6023b91ae988d72 Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Tue, 6 Apr 2004 15:04:09 +0000
Subject: [PATCH 085/411] added filetype/filetype.vim

---
 ChangeLog             | 5 +++++
 filetype/filetype.vim | 2 ++
 2 files changed, 7 insertions(+)
 create mode 100644 filetype/filetype.vim

diff --git a/ChangeLog b/ChangeLog
index 4adc21bf..e5104cdb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-04-07  Doug Kearns  
+
+	* filetype/filetype.vim: added RubyGems specification and installation
+	files and Rakefiles
+
 2004-04-01  Doug Kearns  
 
 	* compiler/rubyunit.vim: added a new compiler plugin for Test::Unit
diff --git a/filetype/filetype.vim b/filetype/filetype.vim
new file mode 100644
index 00000000..e949cd67
--- /dev/null
+++ b/filetype/filetype.vim
@@ -0,0 +1,2 @@
+" Ruby
+au BufNewFile,BufRead *.rb,*.rbw,*.gem,*.gemspec,Rakefile* setf ruby

From e45d06cfbba224a1367fe20ba1f9b3ad9eac0602 Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Fri, 23 Apr 2004 14:11:54 +0000
Subject: [PATCH 086/411] add ruby_fold variable to control setting foldmethod

---
 ChangeLog       |  9 +++++++--
 syntax/ruby.vim | 10 +++++++++-
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e5104cdb..3c189b1b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,11 +1,16 @@
+2004-04-23  Ward Wouts   
+
+	* syntax/ruby.vim: add ruby_fold variable to control the setting of
+	the foldmethod option
+
 2004-04-07  Doug Kearns  
 
-	* filetype/filetype.vim: added RubyGems specification and installation
+	* filetype/filetype.vim: add RubyGems specification and installation
 	files and Rakefiles
 
 2004-04-01  Doug Kearns  
 
-	* compiler/rubyunit.vim: added a new compiler plugin for Test::Unit
+	* compiler/rubyunit.vim: add a new compiler plugin for Test::Unit
 
 2004-03-23  Doug Kearns  
 
diff --git a/syntax/ruby.vim b/syntax/ruby.vim
index 98ac7ca7..dd7c676e 100644
--- a/syntax/ruby.vim
+++ b/syntax/ruby.vim
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language:	Ruby
 " Maintainer:	Doug Kearns 
-" Info:		$Id: ruby.vim,v 1.35 2003/11/06 09:01:25 dkearns Exp $
+" Info:		$Id: ruby.vim,v 1.36 2004/04/23 14:11:54 dkearns Exp $
 " URL:		http://vim-ruby.sourceforge.net
 " Anon CVS:	See above site
 " Licence:	GPL (http://www.gnu.org)
@@ -24,6 +24,14 @@ elseif exists("b:current_syntax")
   finish
 endif
 
+if version < 600 && exists("ruby_fold")
+  unlet ruby_fold
+endif
+
+if exists("ruby_fold")
+  setlocal foldmethod=syntax
+endif
+
 " Expression Substitution and Backslash Notation
 syn match rubyEscape		"\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}"								contained display
 syn match rubyEscape		"\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)"	contained display

From d031639e3cf4c6514a761035d558f4d0403e84f7 Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Tue, 27 Apr 2004 09:34:50 +0000
Subject: [PATCH 087/411] match 'rakefile' as a Rakefile

---
 ChangeLog             | 4 ++++
 filetype/filetype.vim | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 3c189b1b..ec789d82 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2004-04-27  Doug Kearns  
+
+	* filetype/filetype.vim: match 'rakefile' as a Rakefile
+
 2004-04-23  Ward Wouts   
 
 	* syntax/ruby.vim: add ruby_fold variable to control the setting of
diff --git a/filetype/filetype.vim b/filetype/filetype.vim
index e949cd67..22713ab4 100644
--- a/filetype/filetype.vim
+++ b/filetype/filetype.vim
@@ -1,2 +1,2 @@
 " Ruby
-au BufNewFile,BufRead *.rb,*.rbw,*.gem,*.gemspec,Rakefile* setf ruby
+au BufNewFile,BufRead *.rb,*.rbw,*.gem,*.gemspec,[Rr]akefile* setf ruby

From 66692e848c2ff6f23d734672123ed41e927a029f Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Thu, 29 Apr 2004 04:38:36 +0000
Subject: [PATCH 088/411] move matching of [Rr]akefile* to a later location in
 filetype.vim

---
 ChangeLog             | 8 +++++++-
 filetype/filetype.vim | 6 +++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ec789d82..5000c7f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,10 @@
-2004-04-27  Doug Kearns  
+2004-04-29  Doug Kearns  
+
+	* filetype/filetype.vim: move matching of [Rr]akefile* to a separate
+	section which is located later in the file to avoid incorrectly
+	matching other filetypes prefixed with [Rr]akefile
+
+2005-04-27  Doug Kearns  
 
 	* filetype/filetype.vim: match 'rakefile' as a Rakefile
 
diff --git a/filetype/filetype.vim b/filetype/filetype.vim
index 22713ab4..70a80b27 100644
--- a/filetype/filetype.vim
+++ b/filetype/filetype.vim
@@ -1,2 +1,6 @@
 " Ruby
-au BufNewFile,BufRead *.rb,*.rbw,*.gem,*.gemspec,[Rr]akefile* setf ruby
+au BufNewFile,BufRead *.rb,*.rbw,*.gem,*.gemspec	setf ruby
+
+" Ruby Makefile
+au BufNewFile,BufRead [rR]akefile*			setf ruby
+

From 5dc4f022c093faefcf2da84ef6aaff06e993e391 Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Tue, 11 May 2004 08:04:03 +0000
Subject: [PATCH 089/411] add documentation for ruby_no_special_methods and
 ruby_fold syntax configuration variables

---
 ChangeLog           |  5 +++++
 syntax/doc/ruby.txt | 18 +++++++++++++++---
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5000c7f6..7d28b32b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-05-11  Doug Kearns  
+
+	* syntax/doc/ruby.txt: add documentation for the
+	ruby_no_special_methods and ruby_fold configuration variables
+
 2004-04-29  Doug Kearns  
 
 	* filetype/filetype.vim: move matching of [Rr]akefile* to a separate
diff --git a/syntax/doc/ruby.txt b/syntax/doc/ruby.txt
index afa9f5f0..66a7a395 100644
--- a/syntax/doc/ruby.txt
+++ b/syntax/doc/ruby.txt
@@ -8,7 +8,7 @@ experience slow redrawing (or you are on a terminal with poor color support)
 you may want to turn it off by defining the "ruby_no_expensive" variable: >
         :let ruby_no_expensive = 1
 In this case the same color will be used for all control keywords.
-                        
+
 If you do want this feature enabled, but notice highlighting errors while
 scrolling backwards, which are fixed when redrawing with CTRL-L, try setting
 the "ruby_minlines" variable to a value larger than 50: >
@@ -16,9 +16,21 @@ the "ruby_minlines" variable to a value larger than 50: >
 Ideally, this value should be a number of lines large enough to embrace your
 largest class or module.
 
-Finally, if you do not like to see too many color items around, you can define
-"ruby_no_identifiers": >                                
+Highlighting of special identifiers can be disabled by defining
+"ruby_no_identifiers": >
         :let ruby_no_identifiers = 1
 This will prevent highlighting of special identifiers like "ConstantName",
 "$global_var", "@@class_var", "@instance_var", "| iterator |", and ":symbol".
 
+Significant methods of Class, Object, Module and Kernel are highlighted by
+default. This can be disabled by defining "ruby_no_special_methods": >
+        :let ruby_no_special_methods = 1
+This will prevent highlighting of special methods such as "require",
+"private", "raise" and "proc".
+
+Folding can be enabled by defining "ruby_fold": >
+        :let ruby_fold = 1
+This will set the 'foldmethod' option to "syntax" and allow folding of
+classes, modules, methods, code blocks, heredocs and comments.
+
+ vim: ts=8 tw=78

From c8937804ca4b3ff5ec4d853f857397a4f12764ca Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Tue, 11 May 2004 08:29:23 +0000
Subject: [PATCH 090/411] add initial support for parsing Test::Unit errors

---
 ChangeLog             |  5 +++++
 compiler/rubyunit.vim | 20 ++++++++++----------
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7d28b32b..9116cdb8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-05-11  Doug Kearns  
+
+	* compiler/rubyunit.vim: add a initial support for parsing Test::Unit
+	errors
+
 2004-05-11  Doug Kearns  
 
 	* syntax/doc/ruby.txt: add documentation for the
diff --git a/compiler/rubyunit.vim b/compiler/rubyunit.vim
index e9c6b6ce..a482ea20 100644
--- a/compiler/rubyunit.vim
+++ b/compiler/rubyunit.vim
@@ -1,7 +1,7 @@
 " Vim compiler file
 " Language:	Test::Unit - Ruby Unit Testing Framework
 " Maintainer:	Doug Kearns 
-" Info:		$Id: rubyunit.vim,v 1.1 2004/04/01 10:39:48 dkearns Exp $
+" Info:		$Id: rubyunit.vim,v 1.2 2004/05/11 08:29:23 dkearns Exp $
 " URL:		http://vim-ruby.sourceforge.net
 " Anon CVS:	See above site
 " Licence:	GPL (http://www.gnu.org)
@@ -23,16 +23,16 @@ set cpo-=C
 setlocal makeprg=ruby
 
 setlocal errorformat=\%Etest%[%^\ ]%#(%[%^\ ]%#)\ [%f:%l]:,
-                     \%Z%m%\\%.,
-                     \%C%m%\\%.,
-                     \%-GLoaded%.%#,
-                     \%-GStarted%.%#,
-                     \%-G%[EF%.]%.%#,
-                     \%-GFinished\ in%.%#,
-                     \%-G\ %\\+%\\d%\\+)\ Failure:,
-                     \%-G\ %\\+%\\d%\\+)\ Error:
+		     \%E\ %\\+%f:%l:in\ %.%#,
+		     \%Z%m%\\%.,
+		     \%-GLoaded%.%#,
+		     \%-GStarted%.%#,
+		     \%-G%[EF%.]%.%#,
+		     \%-GFinished\ in%.%#,
+		     \%-G\ %\\+%\\d%\\+)\ Failure:,
+		     \%-G\ %\\+%\\d%\\+)\ Error:
 
 let &cpo = s:cpo_save
 unlet s:cpo_save
 
-" vim: nowrap tabstop=8 ff=unix
+" vim: nowrap ts=8 ff=unix

From 198b7bc56cd5b350355f716715d1036c1d8ee992 Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Wed, 12 May 2004 13:35:07 +0000
Subject: [PATCH 091/411] check for folding feature before setting foldmethod
 to syntax

---
 ChangeLog       |  5 +++++
 syntax/ruby.vim | 10 +++-------
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9116cdb8..ecadb22a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-05-12  Doug Kearns  
+
+	* syntax/ruby.vim: check for the folding feature rather than just the
+	vim version when testing if the foldmethod should be set to syntax
+
 2004-05-11  Doug Kearns  
 
 	* compiler/rubyunit.vim: add a initial support for parsing Test::Unit
diff --git a/syntax/ruby.vim b/syntax/ruby.vim
index dd7c676e..dc66e012 100644
--- a/syntax/ruby.vim
+++ b/syntax/ruby.vim
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language:	Ruby
 " Maintainer:	Doug Kearns 
-" Info:		$Id: ruby.vim,v 1.36 2004/04/23 14:11:54 dkearns Exp $
+" Info:		$Id: ruby.vim,v 1.37 2004/05/12 13:35:07 dkearns Exp $
 " URL:		http://vim-ruby.sourceforge.net
 " Anon CVS:	See above site
 " Licence:	GPL (http://www.gnu.org)
@@ -24,11 +24,7 @@ elseif exists("b:current_syntax")
   finish
 endif
 
-if version < 600 && exists("ruby_fold")
-  unlet ruby_fold
-endif
-
-if exists("ruby_fold")
+if has("folding") && exists("ruby_fold")
   setlocal foldmethod=syntax
 endif
 
@@ -264,4 +260,4 @@ endif
 
 let b:current_syntax = "ruby"
 
-" vim: nowrap tabstop=8 ff=unix
+" vim: nowrap ts=8 ff=unix

From 6fc1d64cb8e631aace02e1975098ae487ec8129c Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Wed, 19 May 2004 07:57:57 +0000
Subject: [PATCH 092/411] match Test::Unit assert messages

---
 ChangeLog             | 6 +++++-
 compiler/rubyunit.vim | 3 ++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ecadb22a..89781255 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2004-05-19  Doug Kearns  
+
+	* compiler/rubyunit.vim: match assert messages
+
 2004-05-12  Doug Kearns  
 
 	* syntax/ruby.vim: check for the folding feature rather than just the
@@ -5,7 +9,7 @@
 
 2004-05-11  Doug Kearns  
 
-	* compiler/rubyunit.vim: add a initial support for parsing Test::Unit
+	* compiler/rubyunit.vim: add initial support for parsing Test::Unit
 	errors
 
 2004-05-11  Doug Kearns  
diff --git a/compiler/rubyunit.vim b/compiler/rubyunit.vim
index a482ea20..7018aefb 100644
--- a/compiler/rubyunit.vim
+++ b/compiler/rubyunit.vim
@@ -1,7 +1,7 @@
 " Vim compiler file
 " Language:	Test::Unit - Ruby Unit Testing Framework
 " Maintainer:	Doug Kearns 
-" Info:		$Id: rubyunit.vim,v 1.2 2004/05/11 08:29:23 dkearns Exp $
+" Info:		$Id: rubyunit.vim,v 1.3 2004/05/19 07:57:57 dkearns Exp $
 " URL:		http://vim-ruby.sourceforge.net
 " Anon CVS:	See above site
 " Licence:	GPL (http://www.gnu.org)
@@ -25,6 +25,7 @@ setlocal makeprg=ruby
 setlocal errorformat=\%Etest%[%^\ ]%#(%[%^\ ]%#)\ [%f:%l]:,
 		     \%E\ %\\+%f:%l:in\ %.%#,
 		     \%Z%m%\\%.,
+		     \%C%m%\\%.,
 		     \%-GLoaded%.%#,
 		     \%-GStarted%.%#,
 		     \%-G%[EF%.]%.%#,

From 9925d464fe04fb654df45ec1bd10b7eb925fcc74 Mon Sep 17 00:00:00 2001
From: Gavin Sinclair 
Date: Fri, 27 Aug 2004 07:49:06 +0000
Subject: [PATCH 093/411] Fixed bug #198 on RubyForge

---
 install.rb | 51 +++++++++++++++++++++++++++++----------------------
 1 file changed, 29 insertions(+), 22 deletions(-)

diff --git a/install.rb b/install.rb
index 0d96cb2b..f9d325e5 100755
--- a/install.rb
+++ b/install.rb
@@ -16,7 +16,7 @@
 #
 # ------------------------------------------------------------------------------
 #
-# Revision: $Id: install.rb,v 1.4 2003/09/19 11:39:10 dkearns Exp $
+# Revision: $Id: install.rb,v 1.5 2004/08/27 07:49:06 gsinclair Exp $
 # Status: alpha
 #
 # This was contributed by Hugh Sasse and is *UNTESTED*.  Usual disclaimers apply.
@@ -52,10 +52,10 @@
 
 require "ftools"
 
-#
-# This USAGE string does not apply to the current implementation, but it is a
-# good guide for future work.
-#
+  #
+  # This USAGE string does not apply to the current implementation, but it is a
+  # good guide for future work.
+  #
 USAGE = <<-EOF
 Usage: ruby install.rb [options]
 
@@ -67,16 +67,18 @@
    -f      no confirmations
 EOF
 
-PREFIXSTUB=["/usr/local/share/vim",
-        "/usr/local/vim",
-        "/usr/share/vim",
-        "/usr/vim",
-        "/opt/share/vim",
-        "/opt/vim"]
+PREFIXSTUB=[
+  "/usr/local/share/vim",
+  "/usr/local/vim",
+  "/usr/share/vim",
+  "/usr/vim",
+  "/opt/share/vim",
+  "/opt/vim"
+]
 
 stub = PREFIXSTUB.detect { |x| File.exist?(x) and File.directory?(x) }
 
-prefix = Dir.glob("#{stub}/vim*").sort[-1]
+prefix = Dir.glob("#{stub}/vim*").select { |x| x =~ /vim\d+/ }.sort[-1]
 
 f = "ruby.vim"
 
@@ -88,19 +90,24 @@
 ]
 
 pairs.each do |from, to|
+  if File.exists?(to)
     unless File.compare(from, to)
         # If it is the same don't bother copying.
-        if File.exist?(to) and File.mtime(to) > File.mtime(from)
-            # If the file to replace is newer, it could be someone's interim
-            # patch, We assume they want to keep it, unless this is
-            # called with -f. Warn about not doing so otherwise.
-            if ARGV.include?("-f")
-                File.install(from, to)
-            else
-                $stderr.puts "#{to} is newer than #{from}. `#{$0} -f` to force replacement"
-            end
+      if File.exist?(to) and File.mtime(to) > File.mtime(from)
+          # If the file to replace is newer, it could be someone's interim
+          # patch, We assume they want to keep it, unless this is
+          # called with -f. Warn about not doing so otherwise.
+        if ARGV.include?("-f")
+          File.install(from, to)
         else
-            File.install(from, to)
+          $stderr.puts "#{to} is newer than #{from}. `#{$0} -f` to force replacement"
         end
+      else
+        File.install(from, to)
+      end
     end
+  else
+    File.install(from, to)
+  end
 end
+

From e1b2c6892cb6affd2644c3be927cf51076e81ad5 Mon Sep 17 00:00:00 2001
From: Gavin Sinclair 
Date: Fri, 27 Aug 2004 07:49:12 +0000
Subject: [PATCH 094/411] *** empty log message ***

---
 Rakefile | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)
 create mode 100644 Rakefile

diff --git a/Rakefile b/Rakefile
new file mode 100644
index 00000000..bb626d4d
--- /dev/null
+++ b/Rakefile
@@ -0,0 +1,77 @@
+
+require 'fileutils'
+require 'pathname'
+
+TGZ_DIR = 'build/pkg/tgz'
+ZIP_DIR = 'build/pkg/zip'
+RELEASE_FILES = FileList[
+  'README', 'ChangeLog', 'install.rb',
+  '{compiler,filetype,ftplugin,indent,syntax}/*.vim'
+]
+
+desc 'Create a ZIP file with \r\n line endings'
+task :zip do
+  zipfile = "vim-ruby-#{Date.today}.zip"
+  prepare_directory(ZIP_DIR) do |path|
+    system "u2d -D #{path}"
+  end
+  Dir.chdir(ZIP_DIR) do
+    system "zip -r ../#{zipfile} ."
+  end
+  #FileUtils.rm_rf ZIP_DIR
+end
+
+desc 'Create a TGZ file with \n line endings'
+task :tgz do
+  tgzfile = "vim-ruby-#{Date.today}.tgz"
+  prepare_directory(TGZ_DIR) do |path|
+    system "d2u -U #{path}"
+  end
+  system "chmod -R 644 #{TGZ_DIR}"
+  Dir.chdir(TGZ_DIR) do
+    system "tar zcvf ../#{tgzfile} ."
+  end
+  #FileUtils.rm_rf TGZ_DIR
+end
+
+
+# Supporting methods
+
+  #
+  # Copies a whole path to the given directory.  For example
+  # 
+  #   copy_path('./compiler/ruby.vim', 'build/pkg/tgz')
+  #
+  # will create the file 'build/pkg/tgz/compiler/ruby.vim', creating any
+  # directories it needs to on the way.
+  #
+  # Since the entire _path_ is used in determining the target path (which is _dir_
+  # + _path_), you'd better be in the base directory of the files you're copying
+  # before you call this.
+  #
+  # The path to the copied file is returned (Pathname).
+  #
+def copy_path(path, dir)
+  path, dir = Pathname.new(path), Pathname.new(dir)
+  target_path = dir.join(path)
+  unless target_path.dirname.exist?
+    target_path.dirname.mkpath
+  end
+  FileUtils.cp(path.to_s, target_path.to_s)
+  target_path
+end
+
+  #
+  # Copy all vim-ruby files for release into the given directory (creating it first
+  # if necessary).  The full path to each newly-created file is yielded, allowing
+  # transformations such as line endings and permissions.
+  #
+def prepare_directory(dir)  # :yield: path
+  raise "Inappropriate directory" unless [TGZ_DIR, ZIP_DIR].include? dir
+  FileUtils.rm_rf dir
+  FileUtils.mkpath dir
+  RELEASE_FILES.each do |path|
+    newpath = copy_path path, dir
+    yield newpath
+  end
+end

From e79f4ddcac718c67bd92e6a36b19778801bacab2 Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Sat, 4 Sep 2004 10:30:13 +0000
Subject: [PATCH 095/411] update compiler plugins to use new CompilerSet
 command

---
 ChangeLog             |  5 +++++
 compiler/ruby.vim     | 13 ++++++++-----
 compiler/rubyunit.vim | 28 ++++++++++++++++------------
 3 files changed, 29 insertions(+), 17 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 89781255..2c2651b6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-09-04  Doug Kearns  
+
+	* compiler/rubyunit.vim, compiler/ruby.vim: update to use new
+	CompilerSet command
+
 2004-05-19  Doug Kearns  
 
 	* compiler/rubyunit.vim: match assert messages
diff --git a/compiler/ruby.vim b/compiler/ruby.vim
index 7c9838c3..d9a77dad 100644
--- a/compiler/ruby.vim
+++ b/compiler/ruby.vim
@@ -2,7 +2,7 @@
 " Language:	Ruby
 " Function:	Syntax check and/or error reporting
 " Maintainer:	Tim Hammerquist 
-" Info:		$Id: ruby.vim,v 1.6 2003/09/03 03:46:52 dkearns Exp $
+" Info:		$Id: ruby.vim,v 1.7 2004/09/04 10:30:13 dkearns Exp $
 " URL:		http://vim-ruby.rubyforge.org
 " Anon CVS:	See above site
 " Licence:	GPL (http://www.gnu.org)
@@ -32,28 +32,31 @@
 "   This is my first experience with 'errorformat' and compiler plugins and
 "   I welcome any input from more experienced (or clearer-thinking)
 "   individuals.
-" ----------------------------------------------------------------------------
 
 if exists("current_compiler")
   finish
 endif
 let current_compiler = "ruby"
 
+if exists(":CompilerSet") != 2		" older Vim always used :setlocal
+  command -nargs=* CompilerSet setlocal 
+endif
+
 let s:cpo_save = &cpo
 set cpo-=C
 
 " default settings runs script normally
 " add '-c' switch to run syntax check only:
 "
-"   setlocal makeprg=ruby\ -wc\ $*
+"   CompilerSet makeprg=ruby\ -wc\ $*
 "
 " or add '-c' at :make command line:
 "
 "   :make -c %
 "
-setlocal makeprg=ruby\ -w\ $*
+CompilerSet makeprg=ruby\ -w\ $*
 
-setlocal errorformat=
+CompilerSet errorformat=
     \%+E%f:%l:\ parse\ error,
     \%W%f:%l:\ warning:\ %m,
     \%E%f:%l:in\ %*[^:]:\ %m,
diff --git a/compiler/rubyunit.vim b/compiler/rubyunit.vim
index 7018aefb..77e4f5c6 100644
--- a/compiler/rubyunit.vim
+++ b/compiler/rubyunit.vim
@@ -1,7 +1,7 @@
 " Vim compiler file
 " Language:	Test::Unit - Ruby Unit Testing Framework
 " Maintainer:	Doug Kearns 
-" Info:		$Id: rubyunit.vim,v 1.3 2004/05/19 07:57:57 dkearns Exp $
+" Info:		$Id: rubyunit.vim,v 1.4 2004/09/04 10:30:13 dkearns Exp $
 " URL:		http://vim-ruby.sourceforge.net
 " Anon CVS:	See above site
 " Licence:	GPL (http://www.gnu.org)
@@ -17,21 +17,25 @@ if exists("current_compiler")
 endif
 let current_compiler = "rubyunit"
 
+if exists(":CompilerSet") != 2		" older Vim always used :setlocal
+  command -nargs=* CompilerSet setlocal 
+endif
+
 let s:cpo_save = &cpo
 set cpo-=C
 
-setlocal makeprg=ruby
+CompilerSet makeprg=ruby
 
-setlocal errorformat=\%Etest%[%^\ ]%#(%[%^\ ]%#)\ [%f:%l]:,
-		     \%E\ %\\+%f:%l:in\ %.%#,
-		     \%Z%m%\\%.,
-		     \%C%m%\\%.,
-		     \%-GLoaded%.%#,
-		     \%-GStarted%.%#,
-		     \%-G%[EF%.]%.%#,
-		     \%-GFinished\ in%.%#,
-		     \%-G\ %\\+%\\d%\\+)\ Failure:,
-		     \%-G\ %\\+%\\d%\\+)\ Error:
+CompilerSet errorformat=\%Etest%[%^\ ]%#(%[%^\ ]%#)\ [%f:%l]:,
+			\%E\ %\\+%f:%l:in\ %.%#,
+			\%Z%m%\\%.,
+			\%C%m%\\%.,
+			\%-GLoaded%.%#,
+			\%-GStarted%.%#,
+			\%-G%[EF%.]%.%#,
+			\%-GFinished\ in%.%#,
+			\%-G\ %\\+%\\d%\\+)\ Failure:,
+			\%-G\ %\\+%\\d%\\+)\ Error:
 
 let &cpo = s:cpo_save
 unlet s:cpo_save

From a2a173da2bafbfa53382db29f9c2bdaa8c3a485d Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Sun, 5 Sep 2004 06:00:46 +0000
Subject: [PATCH 096/411] add accidently removed comment divider

---
 compiler/ruby.vim | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/compiler/ruby.vim b/compiler/ruby.vim
index d9a77dad..4a488eb3 100644
--- a/compiler/ruby.vim
+++ b/compiler/ruby.vim
@@ -2,7 +2,7 @@
 " Language:	Ruby
 " Function:	Syntax check and/or error reporting
 " Maintainer:	Tim Hammerquist 
-" Info:		$Id: ruby.vim,v 1.7 2004/09/04 10:30:13 dkearns Exp $
+" Info:		$Id: ruby.vim,v 1.8 2004/09/05 06:00:46 dkearns Exp $
 " URL:		http://vim-ruby.rubyforge.org
 " Anon CVS:	See above site
 " Licence:	GPL (http://www.gnu.org)
@@ -32,6 +32,7 @@
 "   This is my first experience with 'errorformat' and compiler plugins and
 "   I welcome any input from more experienced (or clearer-thinking)
 "   individuals.
+" ----------------------------------------------------------------------------
 
 if exists("current_compiler")
   finish

From 4186c73503b70a7f3b942fb4de416b7c11a5bcc7 Mon Sep 17 00:00:00 2001
From: Gavin Sinclair 
Date: Wed, 8 Sep 2004 14:21:21 +0000
Subject: [PATCH 097/411] *** empty log message ***

---
 install.rb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/install.rb b/install.rb
index f9d325e5..b18bf56f 100755
--- a/install.rb
+++ b/install.rb
@@ -16,7 +16,7 @@
 #
 # ------------------------------------------------------------------------------
 #
-# Revision: $Id: install.rb,v 1.5 2004/08/27 07:49:06 gsinclair Exp $
+# Revision: $Id: install.rb,v 1.6 2004/09/08 14:21:21 gsinclair Exp $
 # Status: alpha
 #
 # This was contributed by Hugh Sasse and is *UNTESTED*.  Usual disclaimers apply.
@@ -80,6 +80,8 @@
 
 prefix = Dir.glob("#{stub}/vim*").select { |x| x =~ /vim\d+/ }.sort[-1]
 
+puts "Determined Vim location: #{prefix}"
+
 f = "ruby.vim"
 
 pairs = [

From 1b7f42b0ceb07c55302232ca9b34dcfba7777e77 Mon Sep 17 00:00:00 2001
From: Gavin Sinclair 
Date: Sun, 19 Sep 2004 15:36:50 +0000
Subject: [PATCH 098/411] Cleaned out crap and generate gem

---
 Rakefile | 93 ++++++++++++++++----------------------------------------
 1 file changed, 27 insertions(+), 66 deletions(-)

diff --git a/Rakefile b/Rakefile
index bb626d4d..0116432b 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,77 +1,38 @@
+require 'rubygems'
+require 'rake/gempackagetask'
 
-require 'fileutils'
-require 'pathname'
-
-TGZ_DIR = 'build/pkg/tgz'
-ZIP_DIR = 'build/pkg/zip'
+PACKAGE_NAME = 'vim-ruby'
 RELEASE_FILES = FileList[
-  'README', 'ChangeLog', 'install.rb',
+  'README', 'ChangeLog', 'bin/*.rb',
   '{compiler,filetype,ftplugin,indent,syntax}/*.vim'
 ]
-
-desc 'Create a ZIP file with \r\n line endings'
-task :zip do
-  zipfile = "vim-ruby-#{Date.today}.zip"
-  prepare_directory(ZIP_DIR) do |path|
-    system "u2d -D #{path}"
-  end
-  Dir.chdir(ZIP_DIR) do
-    system "zip -r ../#{zipfile} ."
+PACKAGE_VERSION = Time.now.strftime('%Y.%m.%d')
+
+def gemspec
+  Gem::Specification.new do |s|
+    s.name                  = PACKAGE_NAME
+    s.version               = PACKAGE_VERSION
+    s.files                 = RELEASE_FILES.to_a
+    s.summary               = "Ruby configuration files for Vim.  Run 'vim-ruby-install.rb' to complete installation."
+    s.description           = s.summary + "\n\nThis package doesn't contain a Ruby library."
+    s.requirements          << 'RubyGems 0.8+' << 'Vim 6.0+'
+    s.required_ruby_version = '>= 1.8.0'
+    s.require_path          = '.'
+    s.bindir                = 'bin'
+    s.executables           = ['vim-ruby-install.rb']
+    s.author                = 'Gavin Sinclair et al.'
+    s.email                 = 'gsinclair@soyabean.com.au'
+    s.homepage              = 'http://vim-ruby.rubyforge.org'
+    s.rubyforge_project     = 'vim-ruby'
+    s.has_rdoc              = false
   end
-  #FileUtils.rm_rf ZIP_DIR
 end
 
-desc 'Create a TGZ file with \n line endings'
-task :tgz do
-  tgzfile = "vim-ruby-#{Date.today}.tgz"
-  prepare_directory(TGZ_DIR) do |path|
-    system "d2u -U #{path}"
-  end
-  system "chmod -R 644 #{TGZ_DIR}"
-  Dir.chdir(TGZ_DIR) do
-    system "tar zcvf ../#{tgzfile} ."
-  end
-  #FileUtils.rm_rf TGZ_DIR
+Rake::GemPackageTask.new(gemspec) do |t|
+  t.package_dir = 'etc/package'
+  t.need_tar = true
 end
 
-
 # Supporting methods
 
-  #
-  # Copies a whole path to the given directory.  For example
-  # 
-  #   copy_path('./compiler/ruby.vim', 'build/pkg/tgz')
-  #
-  # will create the file 'build/pkg/tgz/compiler/ruby.vim', creating any
-  # directories it needs to on the way.
-  #
-  # Since the entire _path_ is used in determining the target path (which is _dir_
-  # + _path_), you'd better be in the base directory of the files you're copying
-  # before you call this.
-  #
-  # The path to the copied file is returned (Pathname).
-  #
-def copy_path(path, dir)
-  path, dir = Pathname.new(path), Pathname.new(dir)
-  target_path = dir.join(path)
-  unless target_path.dirname.exist?
-    target_path.dirname.mkpath
-  end
-  FileUtils.cp(path.to_s, target_path.to_s)
-  target_path
-end
-
-  #
-  # Copy all vim-ruby files for release into the given directory (creating it first
-  # if necessary).  The full path to each newly-created file is yielded, allowing
-  # transformations such as line endings and permissions.
-  #
-def prepare_directory(dir)  # :yield: path
-  raise "Inappropriate directory" unless [TGZ_DIR, ZIP_DIR].include? dir
-  FileUtils.rm_rf dir
-  FileUtils.mkpath dir
-  RELEASE_FILES.each do |path|
-    newpath = copy_path path, dir
-    yield newpath
-  end
-end
+# vim: ft=ruby

From 791111a621e3772afe06988be717c53b9fa1dcb3 Mon Sep 17 00:00:00 2001
From: Gavin Sinclair 
Date: Sun, 19 Sep 2004 15:37:35 +0000
Subject: [PATCH 099/411] initial revision

---
 bin/vim-ruby-install.rb | 373 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 373 insertions(+)
 create mode 100755 bin/vim-ruby-install.rb

diff --git a/bin/vim-ruby-install.rb b/bin/vim-ruby-install.rb
new file mode 100755
index 00000000..53654d58
--- /dev/null
+++ b/bin/vim-ruby-install.rb
@@ -0,0 +1,373 @@
+#!/usr/bin/env ruby
+
+# vim-ruby-install: install the Vim config files for Ruby editing
+#
+#  * scope out the target directry and get user to confirm
+#    * if no directory found, ask user
+#    * allow user to force a search for a Windows gvim installation
+#  * find source files from gem or from current directory
+#  * copy to target directory, taking account of
+#    * line endings (NL for Unix-ish; CRLF for Windows)
+#    * permissions (755 for directories; 644 for files)
+#
+
+require 'rbconfig'
+include Config
+require 'fileutils'
+require 'optparse'
+require 'pathname'
+
+SOURCE_FILES = %w{
+  compiler/ruby.vim
+  compiler/rubyunit.vim
+  ftplugin/ruby.vim
+  indent/ruby.vim
+  syntax/ruby.vim
+}
+# XXX: what do we do with 'filetype/filetype.vim' ???
+                  
+
+  #
+  # Miscelleneous functions in the user's environment.
+  #
+class Env
+    #
+    # Returns :UNIX or :WINDOWS, according to CONFIG['host_os'] and $options[:windows].
+    #
+  def Env.determine_target_os
+    os = CONFIG['host_os']
+    if os =~ /mswin/ or $options[:windows]
+      return :WINDOWS
+    else
+      return :UNIX
+    end
+  end
+
+    #
+    # Returns the path to the directory where the vim configuration files will be copied from.
+    # The first preference is the current directory.  If that fails, we look for the RubyGems
+    # package 'vim-ruby'.  Failing that, we return +nil+.
+    #
+  def Env.determine_source_directory
+      # 1. Try the current directory.
+    if SOURCE_FILES.all? { |path| FileTest.file?(path) }
+      return '.'
+    end
+      # 2. Try the gem 'vim-ruby'.
+    begin
+      require 'rubygems'
+      raise "Need RubyGems 0.8+" if Gem::RubyGemsPackageVersion < '0.8'
+    rescue LoadError
+      return nil
+    end
+    #vim_ruby_gem_dir = Gem.latest_load_paths.grep(%r{gems/vim-ruby}).last
+    vim_ruby_gem_dir = Gem.all_load_paths.grep(%r{gems/vim-ruby}).sort.last
+    if vim_ruby_gem_dir
+      Dir.chdir(vim_ruby_gem_dir) do
+        if SOURCE_FILES.all? { |path| FileTest.file?(path) }
+          return vim_ruby_gem_dir
+        end
+      end
+    end
+    return nil
+  end
+
+  def Env.ask_user(message)
+    print message
+    gets.strip
+  end
+end  # class Env
+
+
+  #
+  # A FileWriter writes files with pre-selected line endings and permissions.
+  #
+  #   writer = FileWriter.new(:UNIX, 0664)
+  #   writer.copy(source, target) 
+  #
+class FileWriter
+  LINE_ENDINGS = { :UNIX => "\n", :WINDOWS => "\r\n" }
+  
+  def initialize(ending, file_permissions=0644, directory_permissions=0755)
+    @ending = LINE_ENDINGS[ending] or raise "No/invalid line ending given: #{ending}"
+    @permissions = {
+      :file => file_permissions,
+      :dir  => directory_permissions
+    }
+  end
+    # Source and target paths assumed to be Pathname objects.  Copy the source to the target,
+    # ensuring the right line endings.
+  def copy(source_path, target_path)
+    _ensure_directory_exists(target_path)
+    target_path.open('wb', @permissions[:file]) do |io|
+      lines = source_path.read.split("\n")
+      lines.each do |line|
+        io.write(line.chomp + @ending)
+      end
+    end
+    puts "#{source_path.to_s.ljust(25)} -> #{target_path}"
+  end
+    # Create the given directory with the correct directory permissions.
+  def mkpath(directory)
+    FileUtils.mkdir_p directory.to_s, :mode => @permissions[:dir], :verbose => true
+  end
+  def _ensure_directory_exists(path)
+    dir = path.dirname
+    unless dir.directory?
+      mkpath(dir)
+    end
+  end
+end  # class FileWriter
+
+
+  #
+  # Represents the target base directory for installs.  Handles writing the files through a
+  # given FileWriter.
+  #
+class TargetDirectory
+  def self.finder
+    TargetDirectory::Finder.new
+  end
+  def initialize(directory, writer)
+    @directory = directory  # String
+    @writer    = writer     # FileWriter
+    @directory = Pathname.new(@directory)
+  end
+    # Copies the given relative path from the current directory to the target.
+  def copy(path)
+    source_path = Pathname.new(path)
+    target_path = @directory + path
+    @writer.copy(source_path, target_path)
+  end
+  def [](path)
+    @directory + path
+  end
+  def path
+    @directory
+  end
+end  # class TargetDirectory
+
+
+  #
+  # Represents the target directory.  Can find candidates, based on the operating system and
+  # user options; but is ultimately created with one in mind.
+  #
+class TargetDirectory::Finder
+  POTENTIAL_DIRECTORIES = {
+    :UNIX => [
+      "/usr/local/share/vim",
+      "/usr/local/vim",
+      "/usr/share/vim",
+      "/usr/vim",
+      "/opt/share/vim",
+      "/opt/vim"
+    ],
+    :WINDOWS => [ File.join(ENV['PROGRAMFILES'], 'vim') ]
+  }
+
+    # Guides the user through a selection process, ending in a chosen directory. 
+  def find_target_directory
+      # 1. Try the potentials (if there are any).
+    if dirs = _potential_directories and not dirs.empty?
+      puts
+      puts "Possible Vim installation directories:"
+      dirs.each_with_index do |dir, idx|
+        puts "  #{idx+1}) #{dir}"
+      end
+      puts 
+      r = Env.ask_user "Please select one (or anything else to specify another directory): "
+      if (1..dirs.size).include? r.to_i
+        chosen_directory = dirs[r.to_i - 1]
+        return chosen_directory
+      end
+    end 
+      # 2. We didn't find any, or the user wants to enter another.
+    if dirs.empty?
+      puts
+      puts "Couldn't find any Vim installation directories."
+    end
+    loop do
+      dir = Env.ask_user "Please enter the full path to your Vim installation directory: "
+      dir = File.expand_path(dir)
+      if FileTest.directory?(dir)
+        entered_directory = dir
+        puts
+        return entered_directory
+      else
+        puts " *** That directory doesn't exist!"
+      end
+    end
+      # 3. We don't get here; every path contains a return statement.
+  end
+  
+ private 
+
+    # Return an array of _potential_ directories (i.e. they exist).  Take the options into
+    # account.
+  def _potential_directories
+    dirs = POTENTIAL_DIRECTORIES[Env.determine_target_os].select { |d| FileTest.directory?(d) }
+    dirs.map { |d| _vim_runtime_directory(d) }
+  end
+
+    # Given a directory like '/usr/share/vim', returns a directory like '/usr/share/vim/vim63'.
+  def _vim_runtime_directory(dir)
+    if File.basename(dir) =~ /vim\d+/
+      dir
+    else
+      Dir.glob("#{dir}/vim*").select { |d| d =~ /vim\d+/ }.sort.last
+    end
+  end
+
+end  # class TargetDirectory::Finder
+
+
+  #
+  # VimRubyInstaller is the class that copies the files from the source directory to the target
+  # directory, both of which are provided.  
+  #
+class VimRubyInstaller
+
+    # +source+ and +target+ are the base directories from and to which the configuration files
+    # will be copied.  Both are strings.
+  def initialize(source, target)
+    @source_dir = source
+    unless FileTest.directory?(target)
+      raise "Chosen target directory ('#{target}') doesn't exist"
+    end
+    file_writer = FileWriter.new(Env.determine_target_os)
+    @target_dir = TargetDirectory.new(target, file_writer)
+  end
+
+    # Since we know the source and target directories, all we have to do is copy the files
+    # across.  If the target file is _newer_ than the source file, we make a backup of it and
+    # report that to the user.
+  def install
+    backupdir = BackupDir.new("./vim-ruby-backup.#{Process.pid}")
+    Dir.chdir(@source_dir) do
+      SOURCE_FILES.each do |path|
+        source_path = Pathname.new(path)
+        target_path = @target_dir[path]
+        if target_path.file? and target_path.mtime > source_path.mtime
+            # We're going to overwrite a newer file; back it up, unless they're the same.
+          unless _same_contents?(target_path, source_path)
+            backupdir.backup(target_path, path)
+          end
+        end
+        @target_dir.copy(path)
+      end
+    end
+    backups = backupdir.contents
+    unless backups.empty?
+      puts 
+      puts "The following backups were made as the files were newer than the ones"
+      puts "you were installing:"
+      backups.each do |path|
+        puts " * #{path}"
+      end
+      puts
+      puts "These backups are located in this directory: #{backupdir.path}"
+    end
+  end
+
+    # Test two files for equality of contents, ignoring line endings.
+  def _same_contents?(p1, p2)
+    contents1 = p1.read.split("\n").map { |line| line.chomp }
+    contents2 = p2.read.split("\n").map { |line| line.chomp }
+    contents1 == contents2
+  end
+
+    # A directory for holding backups of configuration files.
+  class BackupDir
+    def initialize(path)
+      @base = Pathname.new(path)
+    end
+      # Copy basedir/path to @path/path.
+    def backup(basedir, path)
+      @base.mkpath unless @base.directory?
+      source = Pathname.new(basedir) + path
+      target = @base + path
+      target.dirname.mkpath
+      FileUtils.cp(source.to_s, target.to_s)
+    end
+    def [](path)
+      @base + path
+    end
+    def contents
+      return [] unless @base.directory?
+      results = []
+      Dir.chdir(@base) do
+        Pathname.new('.').find do |path|
+          results << path if path.file?
+        end
+      end
+      results
+    end
+    def path
+      @base
+    end
+  end  # class VimRubyInstaller::BackupDir
+
+end  # class VimRubyInstaller
+
+#
+#  * * *  M A I N  * * *
+#
+
+$options = {
+  :windows    => false,
+  :target_dir => nil
+}
+
+op = OptionParser.new do |p|
+  p.banner = %{
+     vim-ruby-install.rb: Install the vim-ruby configuration files
+
+      About:
+        * Detects the Vim runtime directory
+          * User to confirm before proceeding
+          * User may specify other directory
+        * Takes config files from current directory or from vim-ruby gem
+        * Writes files with correct permissions and line endings
+
+      Usage:
+        direct:   ruby bin/vim-ruby-install.rb [options]
+        gem:      vim-ruby-install.rb [options]
+
+      Options:
+  }.gsub(/^    /, '')
+  p.on('--windows', 'Install into Windows directories') do
+    $options[:windows] = true
+  end
+  p.on('-d DIR', '--directory', 'Install into given directory') do |dir|
+    $options[:target_dir] = dir
+  end
+  p.on('-h', '--help', 'Show this message') do
+    puts p
+    exit
+  end
+  p.on_tail %{
+      Notes:
+
+        * "Direct" usage means unpacking a vim-ruby tarball and running this
+          program from the vim-ruby directory.
+
+        * The convenient alternative is to use RubyGems:
+            gem install vim-ruby
+            vim-ruby-install.rb
+
+        * The --windows option is designed for forcing an install into the
+          Windows (gvim) configuration directory; useful when running from
+          Cygwin or MinGW.
+    
+        * This installer is quite new (2004-09-20).  Please report bugs to
+          gsinclair@soyabea.com.au.
+  }.gsub(/^    /, '')
+end
+op.parse!(ARGV)
+
+source_dir = Env.determine_source_directory
+target_dir = $options[:target_dir] || TargetDirectory.finder.find_target_directory
+VimRubyInstaller.new(source_dir, target_dir).install
+
+# vim: ft=ruby
+

From 6f619c260da488fe71ae837578fbed9731eab80b Mon Sep 17 00:00:00 2001
From: Gavin Sinclair 
Date: Sun, 19 Sep 2004 15:39:46 +0000
Subject: [PATCH 100/411] Replaced by bin/vim-ruby-install.rb

---
 install.rb | 115 -----------------------------------------------------
 1 file changed, 115 deletions(-)
 delete mode 100755 install.rb

diff --git a/install.rb b/install.rb
deleted file mode 100755
index b18bf56f..00000000
--- a/install.rb
+++ /dev/null
@@ -1,115 +0,0 @@
-#!/usr/local/bin/ruby -w
-#
-# Script to install the vim files in a useful directory.
-#
-# This program will take the files
-#   compiler/ruby.vim
-#   ftplugin/ruby.vim
-#   indent/ruby.vim
-#   syntax/ruby.vim
-# and install them in a place where Vim can see them.  If the environment
-# variable $VIM exists, it is assumed to point to, e.g. /usr/share/vim/vim62, so
-# the files can be placed in $VIM/syntax, etc.  But it is unlikely that $VIM is
-# defined, so this program will guess a few locations, using Unix and Windows
-# sensibilities.  It will, in fact, default to the user's ~/.vim or
-# $HOME/vimfiles.
-#
-# ------------------------------------------------------------------------------
-#
-# Revision: $Id: install.rb,v 1.6 2004/09/08 14:21:21 gsinclair Exp $
-# Status: alpha
-#
-# This was contributed by Hugh Sasse and is *UNTESTED*.  Usual disclaimers apply.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU General Public License for more details.
-#
-# ------------------------------------------------------------------------------
-#
-# Known issues (summarised by Hugh):
-#   Only checks the places I could think of at the time.
-#   Doesn't bother to preserve the old files in any way.
-#   Doesn't ask the user if none of the directories apply, but that
-#       would make it interactive.
-#   Should it say "Job Done" or something? Silent success is a unix
-#       idiom, but not so on Win*.
-#   Doesn't check the files are in the correct format: no ^Ms for
-#       unix...
-#   Hasn't a clue what to do about Data Forks and .... thingy forks
-#       on the mac.:-) Is there Ruby for pre OS-X Macs?
-#
-# Gavin's notes:
-#   Doesn't include any Windows paths.  Should detect OS.
-#   TODO: revision 1.1 described some handy CLI-options which could
-#       be worked into here (e.g. global vs user directory).
-#   TODO: improve banner at the top with some of the nice doco from
-#       revision 1.1
-#
-# ------------------------------------------------------------------------------
-#
-
-require "ftools"
-
-  #
-  # This USAGE string does not apply to the current implementation, but it is a
-  # good guide for future work.
-  #
-USAGE = <<-EOF
-Usage: ruby install.rb [options]
-
- Options:
-   -g      install in global vim configuration directory
-   -u      install in user's (i.e. your) vim configuration directory (default)
-   -d DIR  install in DIR
-   -i      confirm before doing anything, especially overwriting files
-   -f      no confirmations
-EOF
-
-PREFIXSTUB=[
-  "/usr/local/share/vim",
-  "/usr/local/vim",
-  "/usr/share/vim",
-  "/usr/vim",
-  "/opt/share/vim",
-  "/opt/vim"
-]
-
-stub = PREFIXSTUB.detect { |x| File.exist?(x) and File.directory?(x) }
-
-prefix = Dir.glob("#{stub}/vim*").select { |x| x =~ /vim\d+/ }.sort[-1]
-
-puts "Determined Vim location: #{prefix}"
-
-f = "ruby.vim"
-
-pairs = [
-    ["./compiler/#{f}", "#{prefix}/compiler/#{f}"],
-    ["./ftplugin/#{f}", "#{prefix}/ftplugin/#{f}"],
-    ["./indent/#{f}", "#{prefix}/indent/#{f}"],
-    ["./syntax/#{f}", "#{prefix}/syntax/#{f}"],
-]
-
-pairs.each do |from, to|
-  if File.exists?(to)
-    unless File.compare(from, to)
-        # If it is the same don't bother copying.
-      if File.exist?(to) and File.mtime(to) > File.mtime(from)
-          # If the file to replace is newer, it could be someone's interim
-          # patch, We assume they want to keep it, unless this is
-          # called with -f. Warn about not doing so otherwise.
-        if ARGV.include?("-f")
-          File.install(from, to)
-        else
-          $stderr.puts "#{to} is newer than #{from}. `#{$0} -f` to force replacement"
-        end
-      else
-        File.install(from, to)
-      end
-    end
-  else
-    File.install(from, to)
-  end
-end
-

From 5ee7fa51fa40ae801a7cd5f8a2d2b0cddd8af708 Mon Sep 17 00:00:00 2001
From: Gavin Sinclair 
Date: Sun, 19 Sep 2004 15:41:11 +0000
Subject: [PATCH 101/411] Not needed; Rake handles packaging

---
 build.rb | 13 -------------
 1 file changed, 13 deletions(-)
 delete mode 100755 build.rb

diff --git a/build.rb b/build.rb
deleted file mode 100755
index 7ac15361..00000000
--- a/build.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/local/bin/ruby -w
-
-# This program creates a tarball which people can download and install whereever
-# they like, so that they can get the tasty goodness without having to use CVS
-# and install.rb.
-
-# How can we make it easy to build using different CVS tags?
-
-USAGE = <<-EOF
-Usage: ruby build.rb
-EOF
-
-raise "Not implemented"

From 170cdc784c4cb167c88a009cf58905de8c0bc986 Mon Sep 17 00:00:00 2001
From: Gavin Sinclair 
Date: Sun, 19 Sep 2004 15:48:18 +0000
Subject: [PATCH 102/411] *** empty log message ***

---
 ChangeLog | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 2c2651b6..c7b516c7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2004-09-20  Gavin Sinclair 
+
+	* bin/vim-ruby-install.rb: added
+	* Rakefile: 'rake package' generates TGZ and GEM
+	* install.rb: removed
+	* build.rb: removed
+
 2004-09-04  Doug Kearns  
 
 	* compiler/rubyunit.vim, compiler/ruby.vim: update to use new

From af49ba8409f05edb0d406f60efb435ba9c25903a Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Thu, 30 Sep 2004 14:44:27 +0000
Subject: [PATCH 103/411] match regexp values in hash literals

---
 ChangeLog       | 4 ++++
 syntax/ruby.vim | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c7b516c7..e0600a79 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2004-10-01  Doug Kearns  
+
+	* syntax/ruby.vim: match regexp values in hash literals
+
 2004-09-20  Gavin Sinclair 
 
 	* bin/vim-ruby-install.rb: added
diff --git a/syntax/ruby.vim b/syntax/ruby.vim
index dc66e012..9eeda555 100644
--- a/syntax/ruby.vim
+++ b/syntax/ruby.vim
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language:	Ruby
 " Maintainer:	Doug Kearns 
-" Info:		$Id: ruby.vim,v 1.37 2004/05/12 13:35:07 dkearns Exp $
+" Info:		$Id: ruby.vim,v 1.38 2004/09/30 14:44:27 dkearns Exp $
 " URL:		http://vim-ruby.sourceforge.net
 " Anon CVS:	See above site
 " Licence:	GPL (http://www.gnu.org)
@@ -77,7 +77,7 @@ endif
 
 " Normal Regular Expression
 syn region rubyString matchgroup=rubyStringDelimiter start="^\s*/" start="\
Date: Sat, 27 Nov 2004 14:44:37 +0000
Subject: [PATCH 104/411] update DJK's email address

---
 ChangeLog             | 5 +++++
 compiler/ruby.vim     | 4 ++--
 compiler/rubyunit.vim | 4 ++--
 syntax/ruby.vim       | 4 ++--
 4 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e0600a79..37f6b394 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-11-28  Doug Kearns  
+
+	* compiler/ruby.vim, compiler/rubyunit.vim, syntax/ruby.vim: update
+	DJK's email address
+
 2004-10-01  Doug Kearns  
 
 	* syntax/ruby.vim: match regexp values in hash literals
diff --git a/compiler/ruby.vim b/compiler/ruby.vim
index 4a488eb3..b94b3232 100644
--- a/compiler/ruby.vim
+++ b/compiler/ruby.vim
@@ -2,7 +2,7 @@
 " Language:	Ruby
 " Function:	Syntax check and/or error reporting
 " Maintainer:	Tim Hammerquist 
-" Info:		$Id: ruby.vim,v 1.8 2004/09/05 06:00:46 dkearns Exp $
+" Info:		$Id: ruby.vim,v 1.9 2004/11/27 14:44:37 dkearns Exp $
 " URL:		http://vim-ruby.rubyforge.org
 " Anon CVS:	See above site
 " Licence:	GPL (http://www.gnu.org)
@@ -20,7 +20,7 @@
 "
 " Contributors:
 "   Hugh Sasse 
-"   Doug Kearns 
+"   Doug Kearns 
 "
 " Todo:
 "   match error type %m
diff --git a/compiler/rubyunit.vim b/compiler/rubyunit.vim
index 77e4f5c6..e55e99da 100644
--- a/compiler/rubyunit.vim
+++ b/compiler/rubyunit.vim
@@ -1,7 +1,7 @@
 " Vim compiler file
 " Language:	Test::Unit - Ruby Unit Testing Framework
-" Maintainer:	Doug Kearns 
-" Info:		$Id: rubyunit.vim,v 1.4 2004/09/04 10:30:13 dkearns Exp $
+" Maintainer:	Doug Kearns 
+" Info:		$Id: rubyunit.vim,v 1.5 2004/11/27 14:44:37 dkearns Exp $
 " URL:		http://vim-ruby.sourceforge.net
 " Anon CVS:	See above site
 " Licence:	GPL (http://www.gnu.org)
diff --git a/syntax/ruby.vim b/syntax/ruby.vim
index 9eeda555..a58fbf70 100644
--- a/syntax/ruby.vim
+++ b/syntax/ruby.vim
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language:	Ruby
-" Maintainer:	Doug Kearns 
-" Info:		$Id: ruby.vim,v 1.38 2004/09/30 14:44:27 dkearns Exp $
+" Maintainer:	Doug Kearns 
+" Info:		$Id: ruby.vim,v 1.39 2004/11/27 14:44:37 dkearns Exp $
 " URL:		http://vim-ruby.sourceforge.net
 " Anon CVS:	See above site
 " Licence:	GPL (http://www.gnu.org)

From 53e6d7eed4d74da03294c01ed5b05f96d507f3f6 Mon Sep 17 00:00:00 2001
From: Gavin Sinclair 
Date: Wed, 23 Mar 2005 22:19:44 +0000
Subject: [PATCH 105/411]  * syntax/ruby.vim: Improved hilighting of %{...}
 strings with   delimiters (Ken Miller).

---
 ChangeLog | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 37f6b394..af96e10e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-03-24  Gavin Sinclair 
+
+	* syntax/ruby.vim: Improved hilighting of %{...} strings with
+	delimiters (Ken Miller).
+
 2004-11-28  Doug Kearns  
 
 	* compiler/ruby.vim, compiler/rubyunit.vim, syntax/ruby.vim: update

From 1e56abcd1c4bc8c92cae127a7cfe8b0602e831e2 Mon Sep 17 00:00:00 2001
From: Gavin Sinclair 
Date: Wed, 23 Mar 2005 22:19:44 +0000
Subject: [PATCH 106/411]  * syntax/ruby.vim: Improved hilighting of %{...}
 strings with  nested brackets (Ken Miller).

---
 syntax/ruby.vim | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/syntax/ruby.vim b/syntax/ruby.vim
index a58fbf70..b0f751ed 100644
--- a/syntax/ruby.vim
+++ b/syntax/ruby.vim
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language:	Ruby
 " Maintainer:	Doug Kearns 
-" Info:		$Id: ruby.vim,v 1.39 2004/11/27 14:44:37 dkearns Exp $
+" Info:		$Id: ruby.vim,v 1.40 2005/03/23 22:19:44 gsinclair Exp $
 " URL:		http://vim-ruby.sourceforge.net
 " Anon CVS:	See above site
 " Licence:	GPL (http://www.gnu.org)
@@ -35,8 +35,12 @@ syn match rubyInterpolation	"#{[^}]*}"				contained
 syn match rubyInterpolation	"#\%(\$\|@@\=\)\w\+"			contained display
 syn match rubyNoInterpolation	"\\#{[^}]*}"				contained
 syn match rubyNoInterpolation	"\\#\%(\$\|@@\=\)\w\+"			contained display
+syn region rubyNestedBrackets	start="("	end=")"		skip="\\\\\|\\)"	contained	contains=@rubyStringSpecial
+syn region rubyNestedBrackets	start="{"	end="}"		skip="\\\\\|\\}"	contained	contains=@rubyStringSpecial
+syn region rubyNestedBrackets	start="<"	end=">"		skip="\\\\\|\\>"	contained	contains=@rubyStringSpecial
+syn region rubyNestedBrackets	start="\["	end="\]"	skip="\\\\\|\\\]"	contained	contains=@rubyStringSpecial
 
-syn cluster rubyStringSpecial contains=rubyInterpolation,rubyNoInterpolation,rubyEscape
+syn cluster rubyStringSpecial contains=rubyInterpolation,rubyNoInterpolation,rubyEscape,rubyNestedBrackets
 
 " Numbers and ASCII Codes
 syn match rubyASCIICode	"\w\@= 508 || !exists("did_ruby_syntax_inits")
   HiLink rubyEscape			Special
   HiLink rubyInterpolation		Special
   HiLink rubyNoInterpolation		rubyString
+  HiLink rubyNestedBrackets		rubyString
   HiLink rubySharpBang			PreProc
   HiLink rubyStringDelimiter		Delimiter
   HiLink rubyString			String

From 437ecebef2b6012852850bb2288839f8263dc890 Mon Sep 17 00:00:00 2001
From: Gavin Sinclair 
Date: Wed, 23 Mar 2005 22:37:24 +0000
Subject: [PATCH 107/411]  * syntax/ruby.vim: Corrected hilighting of |(x,y)|
 iterator   parameters (Tilman Sauerbeck).

---
 ChangeLog       | 2 ++
 syntax/ruby.vim | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index af96e10e..75c5c4f8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,8 @@
 
 	* syntax/ruby.vim: Improved hilighting of %{...} strings with
 	delimiters (Ken Miller).
+	* syntax/ruby.vim: Corrected hilighting of |(x,y)| iterator
+	parameters (Tilman Sauerbeck).
 
 2004-11-28  Doug Kearns  
 
diff --git a/syntax/ruby.vim b/syntax/ruby.vim
index b0f751ed..ec8f4fb0 100644
--- a/syntax/ruby.vim
+++ b/syntax/ruby.vim
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language:	Ruby
 " Maintainer:	Doug Kearns 
-" Info:		$Id: ruby.vim,v 1.40 2005/03/23 22:19:44 gsinclair Exp $
+" Info:		$Id: ruby.vim,v 1.41 2005/03/23 22:37:24 gsinclair Exp $
 " URL:		http://vim-ruby.sourceforge.net
 " Anon CVS:	See above site
 " Licence:	GPL (http://www.gnu.org)
@@ -63,7 +63,7 @@ if !exists("ruby_no_identifiers")
   syn match  rubySymbol			":\@_,;:!?/.'"@$*\&+0]\)"
   syn match  rubySymbol			":\@?@\_`~1-9]#
   syn match rubyPredefinedVariable "$-[0FIKadilpvw]"									display

From c926078d9dc0b6f068cf740cebc229b6280a6704 Mon Sep 17 00:00:00 2001
From: Gavin Sinclair 
Date: Wed, 23 Mar 2005 23:35:31 +0000
Subject: [PATCH 108/411]  * indent/ruby.vim: Improved indenting of %{...}
 strings with   nested brackets (Ken Miller).

---
 ChangeLog       |  4 +++-
 indent/ruby.vim | 10 +++++-----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 75c5c4f8..a2d85e0f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,9 @@
 2005-03-24  Gavin Sinclair 
 
 	* syntax/ruby.vim: Improved hilighting of %{...} strings with
-	delimiters (Ken Miller).
+	nested brackets (Ken Miller).
+	* indent/ruby.vim: Improved indenting of %{...} strings with
+	nested brackets (Ken Miller).
 	* syntax/ruby.vim: Corrected hilighting of |(x,y)| iterator
 	parameters (Tilman Sauerbeck).
 
diff --git a/indent/ruby.vim b/indent/ruby.vim
index 405d4e42..dfcfd98d 100644
--- a/indent/ruby.vim
+++ b/indent/ruby.vim
@@ -2,7 +2,7 @@
 " Language:	Ruby
 " Maintainer:	Gavin Sinclair 
 " Developer:	Nikolai Weibull 
-" Info:		$Id: ruby.vim,v 1.21 2003/10/20 01:02:13 pcp Exp $
+" Info:		$Id: ruby.vim,v 1.22 2005/03/23 23:35:31 gsinclair Exp $
 " URL:		http://vim-ruby.rubyforge.org/
 " Anon CVS:	See above site
 " Licence:	GPL (http://www.gnu.org/)
@@ -37,19 +37,19 @@ endif
 
 " Regex of synax group names that are or delimit string or are comments.
 let s:syng_strcom = '\'
+      \ '\|Interpolation\|NoInterpolation\|NestedBrackets\|Escape\|Comment\|Documentation\)\>'
 
 " Regex of syntax group names that are strings or comments.
 let s:syng_strcom2 = '\'
+      \ '\|Interpolation\|NoInterpolation\|NestedBrackets\|Escape\|Comment\|Documentation\)\>'
 
 " Regex of syntax group names that are strings.
 let s:syng_string =
-      \ '\'
+      \ '\'
 
 " Regex of syntax group names that are strings or documentation.
 let s:syng_stringdoc =
-  \'\'
+  \'\'
 
 " Expression used to check whether we should skip a match with searchpair().
 let s:skip_expr =

From 1b64a0811c6d8d0e0f84654d04bdd79a228610bc Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Wed, 30 Mar 2005 15:10:25 +0000
Subject: [PATCH 109/411] add configurable highlighting of whitespace errors

---
 ChangeLog       |  5 +++++
 syntax/ruby.vim | 18 +++++++++++++++---
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a2d85e0f..8711f5da 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-03-31  Doug Kearns  
+
+	* syntax/ruby.vim: add configurable highlighting of trailing space and
+	'space before tab' errors (Tilman Sauerbeck)
+
 2005-03-24  Gavin Sinclair 
 
 	* syntax/ruby.vim: Improved hilighting of %{...} strings with
diff --git a/syntax/ruby.vim b/syntax/ruby.vim
index ec8f4fb0..c30e627e 100644
--- a/syntax/ruby.vim
+++ b/syntax/ruby.vim
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language:	Ruby
 " Maintainer:	Doug Kearns 
-" Info:		$Id: ruby.vim,v 1.41 2005/03/23 22:37:24 gsinclair Exp $
+" Info:		$Id: ruby.vim,v 1.42 2005/03/30 15:10:25 dkearns Exp $
 " URL:		http://vim-ruby.sourceforge.net
 " Anon CVS:	See above site
 " Licence:	GPL (http://www.gnu.org)
@@ -28,6 +28,15 @@ if has("folding") && exists("ruby_fold")
   setlocal foldmethod=syntax
 endif
 
+if exists("ruby_space_errors")
+  if !exists("ruby_no_trail_space_error")
+    syn match rubySpaceError display excludenl "\s\+$"
+  endif
+  if !exists("ruby_no_tab_space_error")
+    syn match rubySpaceError display " \+\t"me=e-1
+  endif
+endif
+
 " Expression Substitution and Backslash Notation
 syn match rubyEscape		"\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}"								contained display
 syn match rubyEscape		"\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)"	contained display
@@ -188,8 +197,8 @@ endif
 " Comments and Documentation
 syn match   rubySharpBang     "\%^#!.*" display
 syn keyword rubyTodo          FIXME NOTE TODO XXX contained
-syn match   rubyComment       "#.*" contains=rubySharpBang,rubyTodo,@Spell
-syn region  rubyDocumentation start="^=begin" end="^=end.*$" contains=rubyTodo,@Spell fold
+syn match   rubyComment       "#.*" contains=rubySharpBang,rubySpaceError,rubyTodo,@Spell
+syn region  rubyDocumentation start="^=begin" end="^=end.*$" contains=rubySpaceError,rubyTodo,@Spell fold
 
 " Note: this is a hack to prevent 'keywords' being highlighted as such when called as methods
 syn match rubyKeywordAsMethod "\%(\%(\.\@"			transparent contains=NONE
@@ -260,6 +269,9 @@ if version >= 508 || !exists("did_ruby_syntax_inits")
   HiLink rubyString			String
   HiLink rubyTodo			Todo
 
+  HiLink rubyError			Error
+  HiLink rubySpaceError			rubyError
+
   delcommand HiLink
 endif
 

From 924b3fcc2910bcafee167d9e1c19fcc47f8be329 Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Mon, 4 Apr 2005 12:09:21 +0000
Subject: [PATCH 110/411] add documentation for the ruby_space_errors
 configuration variable

---
 ChangeLog           |  6 ++++++
 syntax/doc/ruby.txt | 23 +++++++++++++++++++++--
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8711f5da..25a4e1d1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-04-04  Doug Kearns  
+
+	* syntax/doc/ruby.txt: add documentation for the ruby_space_errors,
+	ruby_no_trail_space_error and ruby_no_tab_space_error configuration
+	variables
+
 2005-03-31  Doug Kearns  
 
 	* syntax/ruby.vim: add configurable highlighting of trailing space and
diff --git a/syntax/doc/ruby.txt b/syntax/doc/ruby.txt
index 66a7a395..a7979450 100644
--- a/syntax/doc/ruby.txt
+++ b/syntax/doc/ruby.txt
@@ -1,36 +1,55 @@
 RUBY                                            *ruby.vim* *ruby-syntax*
 
-There are a few options to the Ruby syntax highlighting.
+There are a number of options to the Ruby syntax highlighting.
 
 By default, the "end" keyword is colorized according to the opening statement
 of the block it closes. While useful, this feature can be expensive: if you
 experience slow redrawing (or you are on a terminal with poor color support)
 you may want to turn it off by defining the "ruby_no_expensive" variable: >
+
         :let ruby_no_expensive = 1
+
 In this case the same color will be used for all control keywords.
 
 If you do want this feature enabled, but notice highlighting errors while
 scrolling backwards, which are fixed when redrawing with CTRL-L, try setting
 the "ruby_minlines" variable to a value larger than 50: >
+
         :let ruby_minlines = 100
+
 Ideally, this value should be a number of lines large enough to embrace your
 largest class or module.
 
 Highlighting of special identifiers can be disabled by defining
 "ruby_no_identifiers": >
+
         :let ruby_no_identifiers = 1
+
 This will prevent highlighting of special identifiers like "ConstantName",
 "$global_var", "@@class_var", "@instance_var", "| iterator |", and ":symbol".
 
 Significant methods of Class, Object, Module and Kernel are highlighted by
 default. This can be disabled by defining "ruby_no_special_methods": >
+
         :let ruby_no_special_methods = 1
+
 This will prevent highlighting of special methods such as "require",
 "private", "raise" and "proc".
 
 Folding can be enabled by defining "ruby_fold": >
+
         :let ruby_fold = 1
+
 This will set the 'foldmethod' option to "syntax" and allow folding of
 classes, modules, methods, code blocks, heredocs and comments.
 
- vim: ts=8 tw=78
+Whitespace errors can be highlighted by defining "ruby_space_errors": >
+
+	:let ruby_space_errors = 1
+
+This will highlight trailing whitespace and tabs preceded by a space character
+as errors. This can be refined by defining "ruby_no_trail_space_error" and
+"ruby_no_tab_space_error" which will ignore trailing whitespace and tabs after
+spaces respectively.
+
+vim: ts=8 tw=78

From 6e7772591e68368014122e8de815f5e00a157c9a Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Mon, 4 Apr 2005 13:10:30 +0000
Subject: [PATCH 111/411] minor improvement to block parameter highlighting

---
 ChangeLog       | 4 ++++
 syntax/ruby.vim | 5 +++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 25a4e1d1..30a51858 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2005-04-04  Doug Kearns  
+
+	* syntax//ruby.vim: minor improvement to block parameter highlighting
+
 2005-04-04  Doug Kearns  
 
 	* syntax/doc/ruby.txt: add documentation for the ruby_space_errors,
diff --git a/syntax/ruby.vim b/syntax/ruby.vim
index c30e627e..1dfba82f 100644
--- a/syntax/ruby.vim
+++ b/syntax/ruby.vim
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language:	Ruby
 " Maintainer:	Doug Kearns 
-" Info:		$Id: ruby.vim,v 1.42 2005/03/30 15:10:25 dkearns Exp $
+" Info:		$Id: ruby.vim,v 1.43 2005/04/04 13:10:30 dkearns Exp $
 " URL:		http://vim-ruby.sourceforge.net
 " Anon CVS:	See above site
 " Licence:	GPL (http://www.gnu.org)
@@ -72,7 +72,8 @@ if !exists("ruby_no_identifiers")
   syn match  rubySymbol			":\@_,;:!?/.'"@$*\&+0]\)"
   syn match  rubySymbol			":\@?@\_`~1-9]#
   syn match rubyPredefinedVariable "$-[0FIKadilpvw]"									display

From 3adf39cfaa2e2f85bb16e673ecc5cf63487f7fe5 Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Mon, 4 Apr 2005 14:06:03 +0000
Subject: [PATCH 112/411] highlight nested delimiters in generalized quotes

---
 ChangeLog       |  7 ++++++-
 syntax/ruby.vim | 56 +++++++++++++++++++++++++++----------------------
 2 files changed, 37 insertions(+), 26 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 30a51858..d4e7bfc5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
 2005-04-04  Doug Kearns  
 
-	* syntax//ruby.vim: minor improvement to block parameter highlighting
+	* syntax/ruby.vim: highlight nested delimiters in generalized quotes
+	(Bertram Scharpf and Ken Miller)
+
+2005-04-04  Doug Kearns  
+
+	* syntax/ruby.vim: minor improvement to block parameter highlighting
 
 2005-04-04  Doug Kearns  
 
diff --git a/syntax/ruby.vim b/syntax/ruby.vim
index 1dfba82f..7993d98f 100644
--- a/syntax/ruby.vim
+++ b/syntax/ruby.vim
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language:	Ruby
 " Maintainer:	Doug Kearns 
-" Info:		$Id: ruby.vim,v 1.43 2005/04/04 13:10:30 dkearns Exp $
+" Info:		$Id: ruby.vim,v 1.44 2005/04/04 14:06:03 dkearns Exp $
 " URL:		http://vim-ruby.sourceforge.net
 " Anon CVS:	See above site
 " Licence:	GPL (http://www.gnu.org)
@@ -44,12 +44,14 @@ syn match rubyInterpolation	"#{[^}]*}"				contained
 syn match rubyInterpolation	"#\%(\$\|@@\=\)\w\+"			contained display
 syn match rubyNoInterpolation	"\\#{[^}]*}"				contained
 syn match rubyNoInterpolation	"\\#\%(\$\|@@\=\)\w\+"			contained display
-syn region rubyNestedBrackets	start="("	end=")"		skip="\\\\\|\\)"	contained	contains=@rubyStringSpecial
-syn region rubyNestedBrackets	start="{"	end="}"		skip="\\\\\|\\}"	contained	contains=@rubyStringSpecial
-syn region rubyNestedBrackets	start="<"	end=">"		skip="\\\\\|\\>"	contained	contains=@rubyStringSpecial
-syn region rubyNestedBrackets	start="\["	end="\]"	skip="\\\\\|\\\]"	contained	contains=@rubyStringSpecial
+syn match rubyDelimEscape	"\\[(<{\[]"	contained display
+syn region rubyNestedParens	start="("	end=")"		skip="\\\\\|\\)"	contained	contains=@rubyStringSpecial,rubyNestedParens,rubyDelimEscape
+syn region rubyNestedCurlies	start="{"	end="}"		skip="\\\\\|\\}"	contained	contains=@rubyStringSpecial,rubyNestedCurlies,rubyDelimEscape
+syn region rubyNestedAngles	start="<"	end=">"		skip="\\\\\|\\>"	contained	contains=@rubyStringSpecial,rubyNestedAngles,rubyDelimEscape
+syn region rubyNestedBrackets	start="\["	end="\]"	skip="\\\\\|\\\]"	contained	contains=@rubyStringSpecial,rubyNestedBrackets,rubyDelimEscape
 
-syn cluster rubyStringSpecial contains=rubyInterpolation,rubyNoInterpolation,rubyEscape,rubyNestedBrackets
+syn cluster rubyStringSpecial		contains=rubyInterpolation,rubyNoInterpolation,rubyEscape
+syn cluster rubyExtendedStringSpecial	contains=@rubyStringSpecial,rubyNestedParens,rubyNestedCurlies,rubyNestedAngles,rubyNestedBrackets
 
 " Numbers and ASCII Codes
 syn match rubyASCIICode	"\w\@[iomx]*"	 skip="\\\\\|\\>"   contains=@rubyStringSpecial fold
-syn region rubyString matchgroup=rubyStringDelimiter start="%r\["				end="\][iomx]*"	 skip="\\\\\|\\\]"  contains=@rubyStringSpecial fold
-syn region rubyString matchgroup=rubyStringDelimiter start="%r("				end=")[iomx]*"	 skip="\\\\\|\\)"   contains=@rubyStringSpecial fold
+syn region rubyString matchgroup=rubyStringDelimiter start="%r{"				end="}[iomx]*"	 skip="\\\\\|\\}"   contains=@rubyStringSpecial,rubyNestedCurlies,rubyDelimEscape fold
+syn region rubyString matchgroup=rubyStringDelimiter start="%r<"				end=">[iomx]*"	 skip="\\\\\|\\>"   contains=@rubyStringSpecial,rubyNestedAngles,rubyDelimEscape fold
+syn region rubyString matchgroup=rubyStringDelimiter start="%r\["				end="\][iomx]*"	 skip="\\\\\|\\\]"  contains=@rubyStringSpecial,rubyNestedBrackets,rubyDelimEscape fold
+syn region rubyString matchgroup=rubyStringDelimiter start="%r("				end=")[iomx]*"	 skip="\\\\\|\\)"   contains=@rubyStringSpecial,rubyNestedParens,rubyDelimEscape fold
 
 " Generalized Single Quoted String, Symbol and Array of Strings
 syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold
-syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]{"				    end="}"   skip="\\\\\|\\}"	 fold
-syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]<"				    end=">"   skip="\\\\\|\\>"	 fold
-syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]\["				    end="\]"  skip="\\\\\|\\\]"	 fold
-syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]("				    end=")"   skip="\\\\\|\\)"	 fold
+syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]{"				    end="}"   skip="\\\\\|\\}"	 fold	contains=rubyNestedCurlies,rubyDelimEscape
+syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]<"				    end=">"   skip="\\\\\|\\>"	 fold	contains=rubyNestedAngles,rubyDelimEscape
+syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]\["				    end="\]"  skip="\\\\\|\\\]"	 fold	contains=rubyNestedBrackets,rubyDelimEscape
+syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]("				    end=")"   skip="\\\\\|\\)"	 fold	contains=rubyNestedParens,rubyDelimEscape
 
 " Generalized Double Quoted String and Array of Strings and Shell Command Output
 " Note: %= is not matched here as the beginning of a double quoted string
 syn region rubyString matchgroup=rubyStringDelimiter start="%\z([~`!@#$%^&*_\-+|\:;"',.?/]\)"	    end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold
 syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold
-syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\={"				    end="}"   skip="\\\\\|\\}"	 contains=@rubyStringSpecial fold
-syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=<"				    end=">"   skip="\\\\\|\\>"	 contains=@rubyStringSpecial fold
-syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\["				    end="\]"  skip="\\\\\|\\\]"	 contains=@rubyStringSpecial fold
-syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=("				    end=")"   skip="\\\\\|\\)"	 contains=@rubyStringSpecial fold
+syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\={"				    end="}"   skip="\\\\\|\\}"	 contains=@rubyStringSpecial,rubyNestedCurlies,rubyDelimEscape fold
+syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=<"				    end=">"   skip="\\\\\|\\>"	 contains=@rubyStringSpecial,rubyNestedAngles,rubyDelimEscape fold
+syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\["				    end="\]"  skip="\\\\\|\\\]"	 contains=@rubyStringSpecial,rubyNestedBrackets,rubyDelimEscape fold
+syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=("				    end=")"   skip="\\\\\|\\)"	 contains=@rubyStringSpecial,rubyNestedParens,rubyDelimEscape fold
 
 " Here Document
 syn region rubyString matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%(\.\|::\)\)\_s*\)\@"    matchgroup=rubyDefine end="\" contains=ALLBUT,@rubyStringSpecial,rubyTodo nextgroup=rubyFunction fold
-  syn region rubyBlock start="\"  matchgroup=rubyDefine end="\" contains=ALLBUT,@rubyStringSpecial,rubyTodo nextgroup=rubyClass    fold
-  syn region rubyBlock start="\" matchgroup=rubyDefine end="\" contains=ALLBUT,@rubyStringSpecial,rubyTodo nextgroup=rubyModule   fold
+  syn region rubyBlock start="\"    matchgroup=rubyDefine end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo nextgroup=rubyFunction fold
+  syn region rubyBlock start="\"  matchgroup=rubyDefine end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo nextgroup=rubyClass    fold
+  syn region rubyBlock start="\" matchgroup=rubyDefine end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo nextgroup=rubyModule   fold
 
   " modifiers
   syn match  rubyControl "\<\%(if\|unless\|while\|until\)\>" display
 
   " *do* requiring *end*
-  syn region rubyDoBlock matchgroup=rubyControl start="\%(\<\%(for\|until\|while\)\s.*\s\)\@" end="\" contains=ALLBUT,@rubyStringSpecial,rubyTodo fold
+  syn region rubyDoBlock matchgroup=rubyControl start="\%(\<\%(for\|until\|while\)\s.*\s\)\@" end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold
 
   " *{* requiring *}*
-  syn region rubyCurlyBlock start="{" end="}" contains=ALLBUT,@rubyStringSpecial,rubyTodo fold
+  syn region rubyCurlyBlock start="{" end="}" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold
 
   " statements without *do*
-  syn region rubyNoDoBlock matchgroup=rubyControl start="\<\%(case\|begin\)\>" start="^\s*\%(if\|unless\)\>" start="[;=(]\s*\%(if\|unless\)\>"hs=s+1 end="\" contains=ALLBUT,@rubyStringSpecial,rubyTodo fold
+  syn region rubyNoDoBlock matchgroup=rubyControl start="\<\%(case\|begin\)\>" start="^\s*\%(if\|unless\)\>" start="[;=(]\s*\%(if\|unless\)\>"hs=s+1 end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold
 
   " statement with optional *do*
-  syn region rubyOptDoBlock matchgroup=rubyControl start="\" start="^\s*\%(while\|until\)\>" start=";\s*\%(while\|until\)\>"hs=s+1 end="\" contains=ALLBUT,@rubyStringSpecial,rubyTodo fold
+  syn region rubyOptDoBlock matchgroup=rubyControl start="\" start="^\s*\%(while\|until\)\>" start=";\s*\%(while\|until\)\>"hs=s+1 end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold
 
   " optional *do*
   syn match  rubyControl "\%(\<\%(for\|until\|while\)\s.*\s\)\@<=\%(do\|:\)\>"
@@ -264,6 +266,10 @@ if version >= 508 || !exists("did_ruby_syntax_inits")
   HiLink rubyEscape			Special
   HiLink rubyInterpolation		Special
   HiLink rubyNoInterpolation		rubyString
+  HiLink rubyDelimEscape		rubyString
+  HiLink rubyNestedParens		rubyString
+  HiLink rubyNestedCurlies		rubyString
+  HiLink rubyNestedAngles		rubyString
   HiLink rubyNestedBrackets		rubyString
   HiLink rubySharpBang			PreProc
   HiLink rubyStringDelimiter		Delimiter

From 4cdd50a9cde74229c8553df52c4220233297eccd Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Mon, 4 Apr 2005 14:41:13 +0000
Subject: [PATCH 113/411] add missing credit

---
 ChangeLog | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index d4e7bfc5..9f68a866 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,7 @@
 2005-04-04  Doug Kearns  
 
 	* syntax/ruby.vim: highlight nested delimiters in generalized quotes
-	(Bertram Scharpf and Ken Miller)
+	(Aaron Son, Bertram Scharpf and Ken Miller)
 
 2005-04-04  Doug Kearns  
 

From e70dfbf55fb2637de73efb13f7dbfcc3e30e48f1 Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Tue, 5 Apr 2005 07:21:39 +0000
Subject: [PATCH 114/411] match rubyNested*, and rubyDelimEscape as transparent
 items

---
 ChangeLog       |  6 ++++++
 syntax/ruby.vim | 47 ++++++++++++++++++++++-------------------------
 2 files changed, 28 insertions(+), 25 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9f68a866..43a0c889 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-04-05  Doug Kearns  
+
+	* syntax/ruby.vim: match rubyNested*, and rubyDelimEscape as
+	transparent items; add closing escaped delimiters to rubyDelimEscape
+	syntax group
+
 2005-04-04  Doug Kearns  
 
 	* syntax/ruby.vim: highlight nested delimiters in generalized quotes
diff --git a/syntax/ruby.vim b/syntax/ruby.vim
index 7993d98f..f6200d4a 100644
--- a/syntax/ruby.vim
+++ b/syntax/ruby.vim
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language:	Ruby
 " Maintainer:	Doug Kearns 
-" Info:		$Id: ruby.vim,v 1.44 2005/04/04 14:06:03 dkearns Exp $
+" Info:		$Id: ruby.vim,v 1.45 2005/04/05 07:21:39 dkearns Exp $
 " URL:		http://vim-ruby.sourceforge.net
 " Anon CVS:	See above site
 " Licence:	GPL (http://www.gnu.org)
@@ -44,14 +44,16 @@ syn match rubyInterpolation	"#{[^}]*}"				contained
 syn match rubyInterpolation	"#\%(\$\|@@\=\)\w\+"			contained display
 syn match rubyNoInterpolation	"\\#{[^}]*}"				contained
 syn match rubyNoInterpolation	"\\#\%(\$\|@@\=\)\w\+"			contained display
-syn match rubyDelimEscape	"\\[(<{\[]"	contained display
-syn region rubyNestedParens	start="("	end=")"		skip="\\\\\|\\)"	contained	contains=@rubyStringSpecial,rubyNestedParens,rubyDelimEscape
-syn region rubyNestedCurlies	start="{"	end="}"		skip="\\\\\|\\}"	contained	contains=@rubyStringSpecial,rubyNestedCurlies,rubyDelimEscape
-syn region rubyNestedAngles	start="<"	end=">"		skip="\\\\\|\\>"	contained	contains=@rubyStringSpecial,rubyNestedAngles,rubyDelimEscape
-syn region rubyNestedBrackets	start="\["	end="\]"	skip="\\\\\|\\\]"	contained	contains=@rubyStringSpecial,rubyNestedBrackets,rubyDelimEscape
+
+syn match rubyDelimEscape	"\\[(<{\[)>}\]]" transparent display contained contains=NONE
+
+syn region rubyNestedParentheses	start="("	end=")"		skip="\\\\\|\\)"	transparent contained contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimEscape
+syn region rubyNestedCurlyBraces	start="{"	end="}"		skip="\\\\\|\\}"	transparent contained contains=@rubyStringSpecial,rubyNestedCurlyBraces,rubyDelimEscape
+syn region rubyNestedAngleBrackets	start="<"	end=">"		skip="\\\\\|\\>"	transparent contained contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimEscape
+syn region rubyNestedSquareBrackets	start="\["	end="\]"	skip="\\\\\|\\\]"	transparent contained contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimEscape
 
 syn cluster rubyStringSpecial		contains=rubyInterpolation,rubyNoInterpolation,rubyEscape
-syn cluster rubyExtendedStringSpecial	contains=@rubyStringSpecial,rubyNestedParens,rubyNestedCurlies,rubyNestedAngles,rubyNestedBrackets
+syn cluster rubyExtendedStringSpecial	contains=@rubyStringSpecial,rubyNestedParentheses,rubyNestedCurlyBraces,rubyNestedAngleBrackets,rubyNestedSquareBrackets
 
 " Numbers and ASCII Codes
 syn match rubyASCIICode	"\w\@[iomx]*"	 skip="\\\\\|\\>"   contains=@rubyStringSpecial,rubyNestedAngles,rubyDelimEscape fold
-syn region rubyString matchgroup=rubyStringDelimiter start="%r\["				end="\][iomx]*"	 skip="\\\\\|\\\]"  contains=@rubyStringSpecial,rubyNestedBrackets,rubyDelimEscape fold
-syn region rubyString matchgroup=rubyStringDelimiter start="%r("				end=")[iomx]*"	 skip="\\\\\|\\)"   contains=@rubyStringSpecial,rubyNestedParens,rubyDelimEscape fold
+syn region rubyString matchgroup=rubyStringDelimiter start="%r{"				end="}[iomx]*"	 skip="\\\\\|\\}"   contains=@rubyStringSpecial,rubyNestedCurlyBraces,rubyDelimEscape fold
+syn region rubyString matchgroup=rubyStringDelimiter start="%r<"				end=">[iomx]*"	 skip="\\\\\|\\>"   contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold
+syn region rubyString matchgroup=rubyStringDelimiter start="%r\["				end="\][iomx]*"	 skip="\\\\\|\\\]"  contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimEscape fold
+syn region rubyString matchgroup=rubyStringDelimiter start="%r("				end=")[iomx]*"	 skip="\\\\\|\\)"   contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimEscape fold
 
 " Generalized Single Quoted String, Symbol and Array of Strings
 syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold
-syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]{"				    end="}"   skip="\\\\\|\\}"	 fold	contains=rubyNestedCurlies,rubyDelimEscape
-syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]<"				    end=">"   skip="\\\\\|\\>"	 fold	contains=rubyNestedAngles,rubyDelimEscape
-syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]\["				    end="\]"  skip="\\\\\|\\\]"	 fold	contains=rubyNestedBrackets,rubyDelimEscape
-syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]("				    end=")"   skip="\\\\\|\\)"	 fold	contains=rubyNestedParens,rubyDelimEscape
+syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]{"				    end="}"   skip="\\\\\|\\}"	 fold	contains=rubyNestedCurlyBraces,rubyDelimEscape
+syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]<"				    end=">"   skip="\\\\\|\\>"	 fold	contains=rubyNestedAngleBrackets,rubyDelimEscape
+syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]\["				    end="\]"  skip="\\\\\|\\\]"	 fold	contains=rubyNestedSquareBrackets,rubyDelimEscape
+syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]("				    end=")"   skip="\\\\\|\\)"	 fold	contains=rubyNestedParentheses,rubyDelimEscape
 
 " Generalized Double Quoted String and Array of Strings and Shell Command Output
 " Note: %= is not matched here as the beginning of a double quoted string
 syn region rubyString matchgroup=rubyStringDelimiter start="%\z([~`!@#$%^&*_\-+|\:;"',.?/]\)"	    end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold
 syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold
-syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\={"				    end="}"   skip="\\\\\|\\}"	 contains=@rubyStringSpecial,rubyNestedCurlies,rubyDelimEscape fold
-syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=<"				    end=">"   skip="\\\\\|\\>"	 contains=@rubyStringSpecial,rubyNestedAngles,rubyDelimEscape fold
-syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\["				    end="\]"  skip="\\\\\|\\\]"	 contains=@rubyStringSpecial,rubyNestedBrackets,rubyDelimEscape fold
-syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=("				    end=")"   skip="\\\\\|\\)"	 contains=@rubyStringSpecial,rubyNestedParens,rubyDelimEscape fold
+syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\={"				    end="}"   skip="\\\\\|\\}"	 contains=@rubyStringSpecial,rubyNestedCurlyBraces,rubyDelimEscape fold
+syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=<"				    end=">"   skip="\\\\\|\\>"	 contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold
+syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\["				    end="\]"  skip="\\\\\|\\\]"	 contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimEscape fold
+syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=("				    end=")"   skip="\\\\\|\\)"	 contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimEscape fold
 
 " Here Document
 syn region rubyString matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%(\.\|::\)\)\_s*\)\@"			transparent contains=NONE
 syn match rubyKeywordAsMethod "\%(\%(\.\@"			transparent contains=NONE
 syn match rubyKeywordAsMethod "\%(\%(\.\@"			transparent contains=NONE
@@ -266,11 +268,6 @@ if version >= 508 || !exists("did_ruby_syntax_inits")
   HiLink rubyEscape			Special
   HiLink rubyInterpolation		Special
   HiLink rubyNoInterpolation		rubyString
-  HiLink rubyDelimEscape		rubyString
-  HiLink rubyNestedParens		rubyString
-  HiLink rubyNestedCurlies		rubyString
-  HiLink rubyNestedAngles		rubyString
-  HiLink rubyNestedBrackets		rubyString
   HiLink rubySharpBang			PreProc
   HiLink rubyStringDelimiter		Delimiter
   HiLink rubyString			String

From 394045fcf3caf10560998b71099e80f2430f40aa Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Mon, 4 Jul 2005 06:39:04 +0000
Subject: [PATCH 115/411] improve the installation script's source directory
 detection (Hugh Sasse)

---
 ChangeLog               | 5 +++++
 bin/vim-ruby-install.rb | 9 ++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 43a0c889..b781b2eb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-07-04  Doug Kearns  
+
+	* bin/vim-ruby-install.rb: improve source directory detection (Hugh
+	Sasse) 
+
 2005-04-05  Doug Kearns  
 
 	* syntax/ruby.vim: match rubyNested*, and rubyDelimEscape as
diff --git a/bin/vim-ruby-install.rb b/bin/vim-ruby-install.rb
index 53654d58..48040d46 100755
--- a/bin/vim-ruby-install.rb
+++ b/bin/vim-ruby-install.rb
@@ -52,8 +52,11 @@ def Env.determine_source_directory
       # 1. Try the current directory.
     if SOURCE_FILES.all? { |path| FileTest.file?(path) }
       return '.'
+      # 2. Try the directory above this installation script.
+    elsif SOURCE_FILES.map { |f| File.join(File.dirname($0), '..', f) }.all? { |path| FileTest.file?(path) }
+      return File.join(File.dirname($0), '..')
     end
-      # 2. Try the gem 'vim-ruby'.
+      # 3. Try the gem 'vim-ruby'.
     begin
       require 'rubygems'
       raise "Need RubyGems 0.8+" if Gem::RubyGemsPackageVersion < '0.8'
@@ -231,6 +234,9 @@ class VimRubyInstaller
     # will be copied.  Both are strings.
   def initialize(source, target)
     @source_dir = source
+    unless FileTest.directory?(@source_dir)
+      raise "Automatically determined source directory ('#{@source_dir}') doesn't exist"
+    end
     unless FileTest.directory?(target)
       raise "Chosen target directory ('#{target}') doesn't exist"
     end
@@ -366,6 +372,7 @@ def path
 op.parse!(ARGV)
 
 source_dir = Env.determine_source_directory
+if source_dir.nil? then raise "Can't find source directory"; end
 target_dir = $options[:target_dir] || TargetDirectory.finder.find_target_directory
 VimRubyInstaller.new(source_dir, target_dir).install
 

From 1ce09e00c278aa7acdcdc361658fdf004bf2f47a Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Fri, 22 Jul 2005 15:06:46 +0000
Subject: [PATCH 116/411] allow strings inside interpolation regions

---
 ChangeLog       | 12 ++++++++----
 syntax/ruby.vim |  4 ++--
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b781b2eb..70f48481 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2005-07-22  Doug Kearns  
+
+	* syntax/ruby.vim: allow strings inside interpolation regions
+
 2005-07-04  Doug Kearns  
 
 	* bin/vim-ruby-install.rb: improve source directory detection (Hugh
@@ -24,7 +28,7 @@
 	ruby_no_trail_space_error and ruby_no_tab_space_error configuration
 	variables
 
-2005-03-31  Doug Kearns  
+2005-03-30  Doug Kearns  
 
 	* syntax/ruby.vim: add configurable highlighting of trailing space and
 	'space before tab' errors (Tilman Sauerbeck)
@@ -38,12 +42,12 @@
 	* syntax/ruby.vim: Corrected hilighting of |(x,y)| iterator
 	parameters (Tilman Sauerbeck).
 
-2004-11-28  Doug Kearns  
+2004-11-27  Doug Kearns  
 
 	* compiler/ruby.vim, compiler/rubyunit.vim, syntax/ruby.vim: update
 	DJK's email address
 
-2004-10-01  Doug Kearns  
+2004-09-30  Doug Kearns  
 
 	* syntax/ruby.vim: match regexp values in hash literals
 
@@ -93,7 +97,7 @@
 	* syntax/ruby.vim: add ruby_fold variable to control the setting of
 	the foldmethod option
 
-2004-04-07  Doug Kearns  
+2004-04-06  Doug Kearns  
 
 	* filetype/filetype.vim: add RubyGems specification and installation
 	files and Rakefiles
diff --git a/syntax/ruby.vim b/syntax/ruby.vim
index f6200d4a..4a10477c 100644
--- a/syntax/ruby.vim
+++ b/syntax/ruby.vim
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language:	Ruby
 " Maintainer:	Doug Kearns 
-" Info:		$Id: ruby.vim,v 1.45 2005/04/05 07:21:39 dkearns Exp $
+" Info:		$Id: ruby.vim,v 1.46 2005/07/22 15:06:46 dkearns Exp $
 " URL:		http://vim-ruby.sourceforge.net
 " Anon CVS:	See above site
 " Licence:	GPL (http://www.gnu.org)
@@ -40,7 +40,7 @@ endif
 " Expression Substitution and Backslash Notation
 syn match rubyEscape		"\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}"								contained display
 syn match rubyEscape		"\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)"	contained display
-syn match rubyInterpolation	"#{[^}]*}"				contained
+syn match rubyInterpolation	"#{[^}]*}"				contained contains=rubyString
 syn match rubyInterpolation	"#\%(\$\|@@\=\)\w\+"			contained display
 syn match rubyNoInterpolation	"\\#{[^}]*}"				contained
 syn match rubyNoInterpolation	"\\#\%(\$\|@@\=\)\w\+"			contained display

From ad8391e7522ed45741477f81c1b806080da5b8cc Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Tue, 26 Jul 2005 10:48:10 +0000
Subject: [PATCH 117/411] replace leading context 'lc' syntax offsets with the
 '\@<=' pattern construct

---
 ChangeLog       | 5 +++++
 syntax/ruby.vim | 6 +++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 70f48481..0af79fcc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-07-26  Doug Kearns  
+
+	* syntax/ruby.vim: replace leading context 'lc' offsets with the
+	'\@<=' pattern construct when matching 'normal regular expressions'
+
 2005-07-22  Doug Kearns  
 
 	* syntax/ruby.vim: allow strings inside interpolation regions
diff --git a/syntax/ruby.vim b/syntax/ruby.vim
index 4a10477c..00da0c34 100644
--- a/syntax/ruby.vim
+++ b/syntax/ruby.vim
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language:	Ruby
 " Maintainer:	Doug Kearns 
-" Info:		$Id: ruby.vim,v 1.46 2005/07/22 15:06:46 dkearns Exp $
+" Info:		$Id: ruby.vim,v 1.47 2005/07/26 10:48:10 dkearns Exp $
 " URL:		http://vim-ruby.sourceforge.net
 " Anon CVS:	See above site
 " Licence:	GPL (http://www.gnu.org)
@@ -94,8 +94,8 @@ else
 endif
 
 " Normal Regular Expression
-syn region rubyString matchgroup=rubyStringDelimiter start="^\s*/" start="\
Date: Wed, 27 Jul 2005 07:12:18 +0000
Subject: [PATCH 118/411] add missing credit to ChangeLog

---
 ChangeLog | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ChangeLog b/ChangeLog
index 0af79fcc..8955895c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
 
 	* syntax/ruby.vim: replace leading context 'lc' offsets with the
 	'\@<=' pattern construct when matching 'normal regular expressions'
+	(Aaron Son)
 
 2005-07-22  Doug Kearns  
 

From 3af447b19c32c8b88185bbe19807d4a4f8cc5585 Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Wed, 27 Jul 2005 09:49:08 +0000
Subject: [PATCH 119/411] add 'package' as the default rake target

---
 ChangeLog | 4 ++++
 Rakefile  | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 8955895c..7c6e5551 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2005-07-27  Doug Kearns  
+
+	* Rakefile: add 'package' as the default target
+
 2005-07-26  Doug Kearns  
 
 	* syntax/ruby.vim: replace leading context 'lc' offsets with the
diff --git a/Rakefile b/Rakefile
index 0116432b..c03a5ca2 100644
--- a/Rakefile
+++ b/Rakefile
@@ -8,6 +8,10 @@ RELEASE_FILES = FileList[
 ]
 PACKAGE_VERSION = Time.now.strftime('%Y.%m.%d')
 
+desc "Build all the packages"
+task :default => :package
+
+
 def gemspec
   Gem::Specification.new do |s|
     s.name                  = PACKAGE_NAME

From f4b2d9eade96b2a31909412ca46856f3ccae48f5 Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Thu, 28 Jul 2005 06:12:32 +0000
Subject: [PATCH 120/411] improve highlighting of conditional expressions

---
 ChangeLog       | 4 ++++
 syntax/ruby.vim | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7c6e5551..ffc8b13b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2005-07-28  Doug Kearns  
+
+	* syntax/ruby.vim: improve matching of conditional expressions
+
 2005-07-27  Doug Kearns  
 
 	* Rakefile: add 'package' as the default target
diff --git a/syntax/ruby.vim b/syntax/ruby.vim
index 00da0c34..0181c107 100644
--- a/syntax/ruby.vim
+++ b/syntax/ruby.vim
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language:	Ruby
 " Maintainer:	Doug Kearns 
-" Info:		$Id: ruby.vim,v 1.47 2005/07/26 10:48:10 dkearns Exp $
+" Info:		$Id: ruby.vim,v 1.48 2005/07/28 06:12:33 dkearns Exp $
 " URL:		http://vim-ruby.sourceforge.net
 " Anon CVS:	See above site
 " Licence:	GPL (http://www.gnu.org)
@@ -157,7 +157,7 @@ if !exists("ruby_no_expensive")
   syn region rubyCurlyBlock start="{" end="}" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold
 
   " statements without *do*
-  syn region rubyNoDoBlock matchgroup=rubyControl start="\<\%(case\|begin\)\>" start="^\s*\%(if\|unless\)\>" start="[;=(]\s*\%(if\|unless\)\>"hs=s+1 end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold
+  syn region rubyNoDoBlock matchgroup=rubyControl start="\<\%(case\|begin\)\>" start="\%(^\|\.\.\.\=\|[;=([<>~+-\*/]\)\s*\zs\%(if\|unless\)\>" end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold
 
   " statement with optional *do*
   syn region rubyOptDoBlock matchgroup=rubyControl start="\" start="^\s*\%(while\|until\)\>" start=";\s*\%(while\|until\)\>"hs=s+1 end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold

From 84733df6d91d422c3c13a73ea6c1061ec7d7e313 Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Sat, 30 Jul 2005 15:22:23 +0000
Subject: [PATCH 121/411] reorder identifier syntax matching

---
 ChangeLog       |  5 +++++
 syntax/ruby.vim | 24 ++++++++++++------------
 2 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ffc8b13b..48d78ff6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-07-30  Doug Kearns  
+
+	* syntax/ruby.vim: reorder identifier matching so that identifiers
+	'containing' predefined identifiers, such as $_, match properly
+
 2005-07-28  Doug Kearns  
 
 	* syntax/ruby.vim: improve matching of conditional expressions
diff --git a/syntax/ruby.vim b/syntax/ruby.vim
index 0181c107..89d7d81d 100644
--- a/syntax/ruby.vim
+++ b/syntax/ruby.vim
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language:	Ruby
 " Maintainer:	Doug Kearns 
-" Info:		$Id: ruby.vim,v 1.48 2005/07/28 06:12:33 dkearns Exp $
+" Info:		$Id: ruby.vim,v 1.49 2005/07/30 15:22:23 dkearns Exp $
 " URL:		http://vim-ruby.sourceforge.net
 " Anon CVS:	See above site
 " Licence:	GPL (http://www.gnu.org)
@@ -68,17 +68,6 @@ syn match rubyFloat	"\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE
 syn match rubyLocalVariableOrMethod "[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent
 
 if !exists("ruby_no_identifiers")
-  syn match  rubyConstant		"\%(::\)\=\zs\u\w*"	display
-  syn match  rubyClassVariable		"@@\h\w*"		display
-  syn match  rubyInstanceVariable	"@\h\w*"		display
-  syn match  rubyGlobalVariable		"$\%(\h\w*\|-.\)"
-  syn match  rubySymbol			":\@\|<=\|<\|===\|==\|=\~\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)"
-  syn match  rubySymbol			":\@_,;:!?/.'"@$*\&+0]\)"
-  syn match  rubySymbol			":\@?@\_`~1-9]#
   syn match rubyPredefinedVariable "$-[0FIKadilpvw]"									display
   syn match rubyPredefinedVariable "$\%(deferr\|defout\|stderr\|stdin\|stdout\)\>"					display
@@ -89,6 +78,17 @@ if !exists("ruby_no_identifiers")
   "Obsolete Global Constants
   "syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(PLATFORM\|RELEASE_DATE\|VERSION\)\>"
   "syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(NotImplementError\)\>"
+
+  syn match  rubyConstant		"\%(::\)\=\zs\u\w*"	display
+  syn match  rubyClassVariable		"@@\h\w*"		display
+  syn match  rubyInstanceVariable	"@\h\w*"		display
+  syn match  rubyGlobalVariable		"$\%(\h\w*\|-.\)"
+  syn match  rubySymbol			":\@\|<=\|<\|===\|==\|=\~\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)"
+  syn match  rubySymbol			":\@_,;:!?/.'"@$*\&+0]\)"
+  syn match  rubySymbol			":\@
Date: Mon, 1 Aug 2005 15:27:38 +0000
Subject: [PATCH 122/411] undo reordering of identifier matching and make $_
 special case

---
 ChangeLog       |  6 ++++++
 syntax/ruby.vim | 25 +++++++++++++------------
 2 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 48d78ff6..6b226e03 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-08-01  Doug Kearns  
+
+	* syntax/ruby.vim: undo reordering of identifier matching and make $_
+	a special case to prevent it matching against global variables with a
+	leading underscore
+
 2005-07-30  Doug Kearns  
 
 	* syntax/ruby.vim: reorder identifier matching so that identifiers
diff --git a/syntax/ruby.vim b/syntax/ruby.vim
index 89d7d81d..4909c20d 100644
--- a/syntax/ruby.vim
+++ b/syntax/ruby.vim
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language:	Ruby
 " Maintainer:	Doug Kearns 
-" Info:		$Id: ruby.vim,v 1.49 2005/07/30 15:22:23 dkearns Exp $
+" Info:		$Id: ruby.vim,v 1.50 2005/08/01 15:27:38 dkearns Exp $
 " URL:		http://vim-ruby.sourceforge.net
 " Anon CVS:	See above site
 " Licence:	GPL (http://www.gnu.org)
@@ -68,17 +68,6 @@ syn match rubyFloat	"\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE
 syn match rubyLocalVariableOrMethod "[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent
 
 if !exists("ruby_no_identifiers")
-  syn match rubyPredefinedVariable #$[!$&"'*+,./0:;<=>?@\_`~1-9]#
-  syn match rubyPredefinedVariable "$-[0FIKadilpvw]"									display
-  syn match rubyPredefinedVariable "$\%(deferr\|defout\|stderr\|stdin\|stdout\)\>"					display
-  syn match rubyPredefinedVariable "$\%(DEBUG\|FILENAME\|KCODE\|LOAD_PATH\|SAFE\|VERBOSE\)\>"				display
-  syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(MatchingData\|ARGF\|ARGV\|ENV\)\>"					display
-  syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(DATA\|FALSE\|NIL\|RUBY_PLATFORM\|RUBY_RELEASE_DATE\)\>"		display
-  syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(RUBY_VERSION\|STDERR\|STDIN\|STDOUT\|TOPLEVEL_BINDING\|TRUE\)\>"	display
-  "Obsolete Global Constants
-  "syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(PLATFORM\|RELEASE_DATE\|VERSION\)\>"
-  "syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(NotImplementError\)\>"
-
   syn match  rubyConstant		"\%(::\)\=\zs\u\w*"	display
   syn match  rubyClassVariable		"@@\h\w*"		display
   syn match  rubyInstanceVariable	"@\h\w*"		display
@@ -89,6 +78,18 @@ if !exists("ruby_no_identifiers")
   syn region rubySymbol			start=":\@?@\`~1-9]#
+  syn match rubyPredefinedVariable "$_\>"										display
+  syn match rubyPredefinedVariable "$-[0FIKadilpvw]\>"									display
+  syn match rubyPredefinedVariable "$\%(deferr\|defout\|stderr\|stdin\|stdout\)\>"					display
+  syn match rubyPredefinedVariable "$\%(DEBUG\|FILENAME\|KCODE\|LOAD_PATH\|SAFE\|VERBOSE\)\>"				display
+  syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(MatchingData\|ARGF\|ARGV\|ENV\)\>"					display
+  syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(DATA\|FALSE\|NIL\|RUBY_PLATFORM\|RUBY_RELEASE_DATE\)\>"		display
+  syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(RUBY_VERSION\|STDERR\|STDIN\|STDOUT\|TOPLEVEL_BINDING\|TRUE\)\>"	display
+  "Obsolete Global Constants
+  "syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(PLATFORM\|RELEASE_DATE\|VERSION\)\>"
+  "syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(NotImplementError\)\>"
 else
   syn match NONE +$['"]+
 endif

From 913ea12e992d84391da937a30748271e51d214c4 Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Tue, 2 Aug 2005 14:58:43 +0000
Subject: [PATCH 123/411] allow highlighting to differentiate between constants
 and capitalized class methods

---
 ChangeLog       |  5 +++++
 syntax/ruby.vim | 14 +++++++-------
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6b226e03..85222742 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-08-02  Doug Kearns  
+
+	* syntax/ruby.vim: differentiate between constants and capitalized
+	class methods invoked with the scope operator '::'
+
 2005-08-01  Doug Kearns  
 
 	* syntax/ruby.vim: undo reordering of identifier matching and make $_
diff --git a/syntax/ruby.vim b/syntax/ruby.vim
index 4909c20d..bf4f5395 100644
--- a/syntax/ruby.vim
+++ b/syntax/ruby.vim
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language:	Ruby
 " Maintainer:	Doug Kearns 
-" Info:		$Id: ruby.vim,v 1.50 2005/08/01 15:27:38 dkearns Exp $
+" Info:		$Id: ruby.vim,v 1.51 2005/08/02 14:58:43 dkearns Exp $
 " URL:		http://vim-ruby.sourceforge.net
 " Anon CVS:	See above site
 " Licence:	GPL (http://www.gnu.org)
@@ -68,7 +68,7 @@ syn match rubyFloat	"\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE
 syn match rubyLocalVariableOrMethod "[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent
 
 if !exists("ruby_no_identifiers")
-  syn match  rubyConstant		"\%(::\)\=\zs\u\w*"	display
+  syn match  rubyConstant               "\%(\%(\.\@\%(\s*(\)\@!" display
   syn match  rubyClassVariable		"@@\h\w*"		display
   syn match  rubyInstanceVariable	"@\h\w*"		display
   syn match  rubyGlobalVariable		"$\%(\h\w*\|-.\)"
@@ -84,12 +84,12 @@ if !exists("ruby_no_identifiers")
   syn match rubyPredefinedVariable "$-[0FIKadilpvw]\>"									display
   syn match rubyPredefinedVariable "$\%(deferr\|defout\|stderr\|stdin\|stdout\)\>"					display
   syn match rubyPredefinedVariable "$\%(DEBUG\|FILENAME\|KCODE\|LOAD_PATH\|SAFE\|VERBOSE\)\>"				display
-  syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(MatchingData\|ARGF\|ARGV\|ENV\)\>"					display
-  syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(DATA\|FALSE\|NIL\|RUBY_PLATFORM\|RUBY_RELEASE_DATE\)\>"		display
-  syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(RUBY_VERSION\|STDERR\|STDIN\|STDOUT\|TOPLEVEL_BINDING\|TRUE\)\>"	display
+  syn match rubyPredefinedConstant "\%(\%(\.\@\%(\s*(\)\@!"
+  syn match rubyPredefinedConstant "\%(\%(\.\@\%(\s*(\)\@!"
+  syn match rubyPredefinedConstant "\%(\%(\.\@\%(\s*(\)\@!"
   "Obsolete Global Constants
-  "syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(PLATFORM\|RELEASE_DATE\|VERSION\)\>"
-  "syn match rubyPredefinedConstant "\<\%(::\)\=\zs\%(NotImplementError\)\>"
+  "syn match rubyPredefinedConstant "\%(::\)\=\zs\%(PLATFORM\|RELEASE_DATE\|VERSION\)\>"
+  "syn match rubyPredefinedConstant "\%(::\)\=\zs\%(NotImplementError\)\>"
 else
   syn match NONE +$['"]+
 endif

From b6284a3ce9a85397951125d1afc2da2e4dc5e3b3 Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Wed, 3 Aug 2005 14:12:27 +0000
Subject: [PATCH 124/411] add new file listing project contributors

---
 CONTRIBUTORS | 15 +++++++++++++++
 ChangeLog    |  4 ++++
 2 files changed, 19 insertions(+)
 create mode 100644 CONTRIBUTORS

diff --git a/CONTRIBUTORS b/CONTRIBUTORS
new file mode 100644
index 00000000..5e3fdfd8
--- /dev/null
+++ b/CONTRIBUTORS
@@ -0,0 +1,15 @@
+Maintainers:
+	Tim Hammerquist 
+	Doug Kearns 
+	Gavin Sinclair 
+
+Developers:
+	Nikolai Weibull 
+
+Other contributors:
+	Ken Miller 
+	Hugh Sasse 
+	Tilman Sauerbeck 
+	Bertram Scharpf 
+	Aaron Son 
+	Ned Konz 
diff --git a/ChangeLog b/ChangeLog
index 85222742..f0427322 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2005-08-03  Doug Kearns  
+
+	* CONTRIBUTORS: add new file listing project contributors
+
 2005-08-02  Doug Kearns  
 
 	* syntax/ruby.vim: differentiate between constants and capitalized

From 58cfee77e1c651fd28fef89e929956698fd640c9 Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Sat, 6 Aug 2005 08:11:44 +0000
Subject: [PATCH 125/411] remove display argument from rubyConstant now that
 the syntax match is multiline

---
 ChangeLog       | 5 +++++
 syntax/ruby.vim | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f0427322..aff628e2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-08-06  Doug Kearns  
+
+	* syntax/ruby.vim: remove display argument from rubyConstant now that
+	the match is multiline
+
 2005-08-03  Doug Kearns  
 
 	* CONTRIBUTORS: add new file listing project contributors
diff --git a/syntax/ruby.vim b/syntax/ruby.vim
index bf4f5395..d1d13f9a 100644
--- a/syntax/ruby.vim
+++ b/syntax/ruby.vim
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language:	Ruby
 " Maintainer:	Doug Kearns 
-" Info:		$Id: ruby.vim,v 1.51 2005/08/02 14:58:43 dkearns Exp $
+" Info:		$Id: ruby.vim,v 1.52 2005/08/06 08:11:44 dkearns Exp $
 " URL:		http://vim-ruby.sourceforge.net
 " Anon CVS:	See above site
 " Licence:	GPL (http://www.gnu.org)
@@ -68,7 +68,7 @@ syn match rubyFloat	"\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE
 syn match rubyLocalVariableOrMethod "[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent
 
 if !exists("ruby_no_identifiers")
-  syn match  rubyConstant               "\%(\%(\.\@\%(\s*(\)\@!" display
+  syn match  rubyConstant               "\%(\%(\.\@\%(\s*(\)\@!"
   syn match  rubyClassVariable		"@@\h\w*"		display
   syn match  rubyInstanceVariable	"@\h\w*"		display
   syn match  rubyGlobalVariable		"$\%(\h\w*\|-.\)"

From 83e7b7c42d1a9be896e84c8c4fa8af9c3a0d153c Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Sat, 6 Aug 2005 12:55:44 +0000
Subject: [PATCH 126/411] move ruby_no_identifiers test to the default
 highlighting block

---
 ChangeLog       |  4 ++++
 syntax/ruby.vim | 56 ++++++++++++++++++++++++-------------------------
 2 files changed, 32 insertions(+), 28 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index aff628e2..4d3d79f5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2005-08-06  Doug Kearns  
 
+	* syntax/ruby.vim: move ruby_no_identifiers test to the default
+	highlighting block so that all identifiers are still matched when this
+	is config variable set
+
 	* syntax/ruby.vim: remove display argument from rubyConstant now that
 	the match is multiline
 
diff --git a/syntax/ruby.vim b/syntax/ruby.vim
index d1d13f9a..9ce16a5c 100644
--- a/syntax/ruby.vim
+++ b/syntax/ruby.vim
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language:	Ruby
 " Maintainer:	Doug Kearns 
-" Info:		$Id: ruby.vim,v 1.52 2005/08/06 08:11:44 dkearns Exp $
+" Info:		$Id: ruby.vim,v 1.53 2005/08/06 12:55:44 dkearns Exp $
 " URL:		http://vim-ruby.sourceforge.net
 " Anon CVS:	See above site
 " Licence:	GPL (http://www.gnu.org)
@@ -67,32 +67,28 @@ syn match rubyFloat	"\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE
 " Identifiers
 syn match rubyLocalVariableOrMethod "[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent
 
-if !exists("ruby_no_identifiers")
-  syn match  rubyConstant               "\%(\%(\.\@\%(\s*(\)\@!"
-  syn match  rubyClassVariable		"@@\h\w*"		display
-  syn match  rubyInstanceVariable	"@\h\w*"		display
-  syn match  rubyGlobalVariable		"$\%(\h\w*\|-.\)"
-  syn match  rubySymbol			":\@\|<=\|<\|===\|==\|=\~\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)"
-  syn match  rubySymbol			":\@_,;:!?/.'"@$*\&+0]\)"
-  syn match  rubySymbol			":\@?@\`~1-9]#
-  syn match rubyPredefinedVariable "$_\>"										display
-  syn match rubyPredefinedVariable "$-[0FIKadilpvw]\>"									display
-  syn match rubyPredefinedVariable "$\%(deferr\|defout\|stderr\|stdin\|stdout\)\>"					display
-  syn match rubyPredefinedVariable "$\%(DEBUG\|FILENAME\|KCODE\|LOAD_PATH\|SAFE\|VERBOSE\)\>"				display
-  syn match rubyPredefinedConstant "\%(\%(\.\@\%(\s*(\)\@!"
-  syn match rubyPredefinedConstant "\%(\%(\.\@\%(\s*(\)\@!"
-  syn match rubyPredefinedConstant "\%(\%(\.\@\%(\s*(\)\@!"
-  "Obsolete Global Constants
-  "syn match rubyPredefinedConstant "\%(::\)\=\zs\%(PLATFORM\|RELEASE_DATE\|VERSION\)\>"
-  "syn match rubyPredefinedConstant "\%(::\)\=\zs\%(NotImplementError\)\>"
-else
-  syn match NONE +$['"]+
-endif
+syn match  rubyConstant               "\%(\%(\.\@\%(\s*(\)\@!"
+syn match  rubyClassVariable		"@@\h\w*"		display
+syn match  rubyInstanceVariable	"@\h\w*"		display
+syn match  rubyGlobalVariable		"$\%(\h\w*\|-.\)"
+syn match  rubySymbol			":\@\|<=\|<\|===\|==\|=\~\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)"
+syn match  rubySymbol			":\@_,;:!?/.'"@$*\&+0]\)"
+syn match  rubySymbol			":\@?@\`~1-9]#
+syn match rubyPredefinedVariable "$_\>"										display
+syn match rubyPredefinedVariable "$-[0FIKadilpvw]\>"									display
+syn match rubyPredefinedVariable "$\%(deferr\|defout\|stderr\|stdin\|stdout\)\>"					display
+syn match rubyPredefinedVariable "$\%(DEBUG\|FILENAME\|KCODE\|LOAD_PATH\|SAFE\|VERBOSE\)\>"				display
+syn match rubyPredefinedConstant "\%(\%(\.\@\%(\s*(\)\@!"
+syn match rubyPredefinedConstant "\%(\%(\.\@\%(\s*(\)\@!"
+syn match rubyPredefinedConstant "\%(\%(\.\@\%(\s*(\)\@!"
+"Obsolete Global Constants
+"syn match rubyPredefinedConstant "\%(::\)\=\zs\%(PLATFORM\|RELEASE_DATE\|VERSION\)\>"
+"syn match rubyPredefinedConstant "\%(::\)\=\zs\%(NotImplementError\)\>"
 
 " Normal Regular Expression
 syn region rubyString matchgroup=rubyStringDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\)\|[\~=!|&(,[]\)\s*\)\@<=/" end="/[iomx]*" skip="\\\\\|\\/" contains=@rubyStringSpecial
@@ -244,7 +240,11 @@ if version >= 508 || !exists("did_ruby_syntax_inits")
   HiLink rubyException			Exception
   HiLink rubyClass			Type
   HiLink rubyModule			Type
-  HiLink rubyIdentifier			Identifier
+  if !exists("ruby_no_identifiers")
+    HiLink rubyIdentifier		Identifier
+  else
+    HiLink rubyIdentifier		NONE
+  endif
   HiLink rubyClassVariable		rubyIdentifier
   HiLink rubyConstant			rubyIdentifier
   HiLink rubyGlobalVariable		rubyIdentifier

From b72e65f9da8128bcd06624da0267e66851acdbde Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Sat, 6 Aug 2005 14:46:30 +0000
Subject: [PATCH 127/411] match rubyConstant and rubyLocalVariableOrMethod with
 a leading word boundary

---
 ChangeLog       | 3 +++
 syntax/ruby.vim | 8 ++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4d3d79f5..2a134533 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2005-08-06  Doug Kearns  
 
+	* syntax/ruby.vim: match rubyConstant and rubyLocalVariableOrMethod
+	with a leading word boundary
+
 	* syntax/ruby.vim: move ruby_no_identifiers test to the default
 	highlighting block so that all identifiers are still matched when this
 	is config variable set
diff --git a/syntax/ruby.vim b/syntax/ruby.vim
index 9ce16a5c..d24ef489 100644
--- a/syntax/ruby.vim
+++ b/syntax/ruby.vim
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language:	Ruby
 " Maintainer:	Doug Kearns 
-" Info:		$Id: ruby.vim,v 1.53 2005/08/06 12:55:44 dkearns Exp $
+" Info:		$Id: ruby.vim,v 1.54 2005/08/06 14:46:30 dkearns Exp $
 " URL:		http://vim-ruby.sourceforge.net
 " Anon CVS:	See above site
 " Licence:	GPL (http://www.gnu.org)
@@ -65,9 +65,9 @@ syn match rubyFloat	"\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\.\d\+\%(_\d\+\)*\>"					displ
 syn match rubyFloat	"\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE][-+]\=\d\+\%(_\d\+\)*\)\>"	display
 
 " Identifiers
-syn match rubyLocalVariableOrMethod "[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent
+syn match rubyLocalVariableOrMethod "\<[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent
 
-syn match  rubyConstant               "\%(\%(\.\@\%(\s*(\)\@!"
+syn match  rubyConstant               "\%(\%(\.\@\%(\s*(\)\@!"
 syn match  rubyClassVariable		"@@\h\w*"		display
 syn match  rubyInstanceVariable	"@\h\w*"		display
 syn match  rubyGlobalVariable		"$\%(\h\w*\|-.\)"
@@ -282,4 +282,4 @@ endif
 
 let b:current_syntax = "ruby"
 
-" vim: nowrap ts=8 ff=unix
+" vim: sw=2 sts=2 ts=8 ff=unix nowrap:

From 059a6057bd8e4c9c421b97e754cdc2afcf0d54f2 Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Sun, 7 Aug 2005 16:46:12 +0000
Subject: [PATCH 128/411] mv filetype/filetype.vim to filetype/ruby.vim

---
 ChangeLog                           | 5 +++++
 filetype/{filetype.vim => ruby.vim} | 2 ++
 2 files changed, 7 insertions(+)
 rename filetype/{filetype.vim => ruby.vim} (71%)

diff --git a/ChangeLog b/ChangeLog
index 2a134533..4272c75e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-08-07  Doug Kearns  
+
+	* filetype/filetype.vim, filetype/ruby.vim: move filetype.vim to
+	ruby.vim
+
 2005-08-06  Doug Kearns  
 
 	* syntax/ruby.vim: match rubyConstant and rubyLocalVariableOrMethod
diff --git a/filetype/filetype.vim b/filetype/ruby.vim
similarity index 71%
rename from filetype/filetype.vim
rename to filetype/ruby.vim
index 70a80b27..41540a8e 100644
--- a/filetype/filetype.vim
+++ b/filetype/ruby.vim
@@ -4,3 +4,5 @@ au BufNewFile,BufRead *.rb,*.rbw,*.gem,*.gemspec	setf ruby
 " Ruby Makefile
 au BufNewFile,BufRead [rR]akefile*			setf ruby
 
+" eRuby
+au BufRead,BufNewFile *.rhtml				setf eruby

From c00c472bee79d57d04a160587c374a15b4a0e7da Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Sun, 7 Aug 2005 16:57:55 +0000
Subject: [PATCH 129/411] mv filetype/ruby.vim to ftdetect/ruby.vim

---
 ChangeLog                       | 3 +++
 {filetype => ftdetect}/ruby.vim | 0
 2 files changed, 3 insertions(+)
 rename {filetype => ftdetect}/ruby.vim (100%)

diff --git a/ChangeLog b/ChangeLog
index 4272c75e..90fb029a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2005-08-07  Doug Kearns  
 
+	* filetype/ruby.vim, ftdetect/ruby.vim: move ruby.vim from filetype/
+	to ftdetect/
+
 	* filetype/filetype.vim, filetype/ruby.vim: move filetype.vim to
 	ruby.vim
 
diff --git a/filetype/ruby.vim b/ftdetect/ruby.vim
similarity index 100%
rename from filetype/ruby.vim
rename to ftdetect/ruby.vim

From 93673fee2b3cb5261b154aa1fa7f3ebb5fb87039 Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Mon, 8 Aug 2005 03:39:41 +0000
Subject: [PATCH 130/411] add ftdetect/ruby.vim to installer's list of source
 files

---
 ChangeLog               | 5 +++++
 bin/vim-ruby-install.rb | 1 +
 2 files changed, 6 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 90fb029a..5da77d5f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-08-08  Doug Kearns  
+
+	* bin/vim-ruby-install.rb: add ftdetect/ruby.vim to list of source
+	files
+
 2005-08-07  Doug Kearns  
 
 	* filetype/ruby.vim, ftdetect/ruby.vim: move ruby.vim from filetype/
diff --git a/bin/vim-ruby-install.rb b/bin/vim-ruby-install.rb
index 48040d46..40fbd69c 100755
--- a/bin/vim-ruby-install.rb
+++ b/bin/vim-ruby-install.rb
@@ -20,6 +20,7 @@
 SOURCE_FILES = %w{
   compiler/ruby.vim
   compiler/rubyunit.vim
+  ftdetect/ruby.vim
   ftplugin/ruby.vim
   indent/ruby.vim
   syntax/ruby.vim

From 0bebeabf148e4046b44f2cdf5410d5544ee47425 Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Tue, 9 Aug 2005 11:57:21 +0000
Subject: [PATCH 131/411] add missing contributor

---
 CONTRIBUTORS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 5e3fdfd8..bc21b251 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -7,6 +7,7 @@ Developers:
 	Nikolai Weibull 
 
 Other contributors:
+	Sean Flanagan 
 	Ken Miller 
 	Hugh Sasse 
 	Tilman Sauerbeck 

From d395e2d9ccff7ef5a8c1ef71581dc6ebf12c3af7 Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Thu, 11 Aug 2005 04:58:15 +0000
Subject: [PATCH 132/411] reorder autocommands for eRuby setf line

---
 ChangeLog         | 4 ++++
 ftdetect/ruby.vim | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5da77d5f..924c5775 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2005-08-11  Doug Kearns  
+
+	* ftdetect/ruby.vim: reorder autocommands for eRuby setf line
+
 2005-08-08  Doug Kearns  
 
 	* bin/vim-ruby-install.rb: add ftdetect/ruby.vim to list of source
diff --git a/ftdetect/ruby.vim b/ftdetect/ruby.vim
index 41540a8e..7498e8c8 100644
--- a/ftdetect/ruby.vim
+++ b/ftdetect/ruby.vim
@@ -1,8 +1,8 @@
 " Ruby
 au BufNewFile,BufRead *.rb,*.rbw,*.gem,*.gemspec	setf ruby
 
-" Ruby Makefile
+" Rakefile
 au BufNewFile,BufRead [rR]akefile*			setf ruby
 
 " eRuby
-au BufRead,BufNewFile *.rhtml				setf eruby
+au BufNewFile,BufRead *.rhtml				setf eruby

From 8f985d254804151759f05bb61480d556a73c7785 Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Thu, 11 Aug 2005 13:51:28 +0000
Subject: [PATCH 133/411] add syntax highlighting for eRuby files

---
 CONTRIBUTORS            |  1 +
 ChangeLog               |  5 +++-
 bin/vim-ruby-install.rb |  1 +
 syntax/eruby.vim        | 62 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 68 insertions(+), 1 deletion(-)
 create mode 100644 syntax/eruby.vim

diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index bc21b251..7b210d62 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -7,6 +7,7 @@ Developers:
 	Nikolai Weibull 
 
 Other contributors:
+	Michael Brailsford 
 	Sean Flanagan 
 	Ken Miller 
 	Hugh Sasse 
diff --git a/ChangeLog b/ChangeLog
index 924c5775..d1c88084 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2005-08-11  Doug Kearns  
 
+	* CONTRIBUTORS, bin/vim-ruby-install.rb, syntax/eruby.vim: add syntax
+	highlighting for eRuby files
+
 	* ftdetect/ruby.vim: reorder autocommands for eRuby setf line
 
 2005-08-08  Doug Kearns  
@@ -13,7 +16,7 @@
 	to ftdetect/
 
 	* filetype/filetype.vim, filetype/ruby.vim: move filetype.vim to
-	ruby.vim
+	ruby.vim; add eRuby filetype detection
 
 2005-08-06  Doug Kearns  
 
diff --git a/bin/vim-ruby-install.rb b/bin/vim-ruby-install.rb
index 40fbd69c..00518664 100755
--- a/bin/vim-ruby-install.rb
+++ b/bin/vim-ruby-install.rb
@@ -23,6 +23,7 @@
   ftdetect/ruby.vim
   ftplugin/ruby.vim
   indent/ruby.vim
+  syntax/eruby.vim
   syntax/ruby.vim
 }
 # XXX: what do we do with 'filetype/filetype.vim' ???
diff --git a/syntax/eruby.vim b/syntax/eruby.vim
new file mode 100644
index 00000000..de85d92e
--- /dev/null
+++ b/syntax/eruby.vim
@@ -0,0 +1,62 @@
+" Vim syntax file
+" Language:	eRuby
+" Maintainer:	Doug Kearns 
+" Info:		$Id: eruby.vim,v 1.1 2005/08/11 13:51:28 dkearns Exp $
+" URL:		http://vim-ruby.sourceforge.net
+" Anon CVS:	See above site
+" Licence:	GPL (http://www.gnu.org)
+" Disclaimer:
+"    This program is distributed in the hope that it will be useful,
+"    but WITHOUT ANY WARRANTY; without even the implied warranty of
+"    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+"    GNU General Public License for more details.
+" ----------------------------------------------------------------------------
+
+" For version 5.x: Clear all syntax items
+" For version 6.x: Quit when a syntax file was already loaded
+if version < 600
+  syntax clear
+elseif exists("b:current_syntax")
+  finish
+endif
+
+if !exists("main_syntax")
+  let main_syntax = 'eruby'
+endif
+
+if version < 600
+  so :p:h/html.vim
+  syn include @rubyTop :p:h/ruby.vim
+else
+  runtime! syntax/html.vim
+  unlet b:current_syntax
+  syn include @rubyTop syntax/ruby.vim
+endif
+
+syn region erubyOneLiner matchgroup=erubyDelimiter start="^\s*\zs%" end="$"  contains=@rubyTop,erubyDelimiter keepend
+syn region erubyBlock    matchgroup=erubyDelimiter start="<%=\="    end="%>" contains=@rubyTop containedin=ALLBUT,erubyComment keepend 
+syn region erubyComment  matchgroup=erubyDelimiter start="<%#"      end="%>" keepend
+
+" Define the default highlighting.
+" For version 5.7 and earlier: only when not done already
+" For version 5.8 and later: only when an item doesn't have highlighting yet
+if version >= 508 || !exists("did_eruby_syntax_inits")
+  if version < 508
+    let did_ruby_syntax_inits = 1
+    command -nargs=+ HiLink hi link 
+  else
+    command -nargs=+ HiLink hi def link 
+  endif
+
+  HiLink erubyDelimiter		Delimiter
+  HiLink erubyComment		Comment
+
+  delcommand HiLink
+endif
+let b:current_syntax = "eruby"
+
+if main_syntax == 'eruby'
+  unlet main_syntax
+endif
+
+" vim: sw=2 sts=2 ts=8 ff=unix nowrap:

From 0d134a365c5e7094d7b145ee64dba56aa41246c9 Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Mon, 15 Aug 2005 08:15:58 +0000
Subject: [PATCH 134/411] exclude leading whitespace from from the
 rubyOptDoBlock start patterns with \zs

---
 ChangeLog       | 5 +++++
 syntax/ruby.vim | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d1c88084..ffab538f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-08-15  Doug Kearns  
+
+	* syntax/ruby.vim: exclude leading whitespace from the rubyOptDoBlock
+	syntax group start patterns with \zs
+
 2005-08-11  Doug Kearns  
 
 	* CONTRIBUTORS, bin/vim-ruby-install.rb, syntax/eruby.vim: add syntax
diff --git a/syntax/ruby.vim b/syntax/ruby.vim
index d24ef489..587cb1cd 100644
--- a/syntax/ruby.vim
+++ b/syntax/ruby.vim
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language:	Ruby
 " Maintainer:	Doug Kearns 
-" Info:		$Id: ruby.vim,v 1.54 2005/08/06 14:46:30 dkearns Exp $
+" Info:		$Id: ruby.vim,v 1.55 2005/08/15 08:15:58 dkearns Exp $
 " URL:		http://vim-ruby.sourceforge.net
 " Anon CVS:	See above site
 " Licence:	GPL (http://www.gnu.org)
@@ -157,7 +157,7 @@ if !exists("ruby_no_expensive")
   syn region rubyNoDoBlock matchgroup=rubyControl start="\<\%(case\|begin\)\>" start="\%(^\|\.\.\.\=\|[;=([<>~+-\*/]\)\s*\zs\%(if\|unless\)\>" end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold
 
   " statement with optional *do*
-  syn region rubyOptDoBlock matchgroup=rubyControl start="\" start="^\s*\%(while\|until\)\>" start=";\s*\%(while\|until\)\>"hs=s+1 end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold
+  syn region rubyOptDoBlock matchgroup=rubyControl start="\" start="^\s*\zs\%(while\|until\)\>" start=";\s*\zs\%(while\|until\)\>"hs=s+1 end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold
 
   " optional *do*
   syn match  rubyControl "\%(\<\%(for\|until\|while\)\s.*\s\)\@<=\%(do\|:\)\>"

From 80ef2a1a8abbe92bbdd12d30659c9569995784d8 Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Mon, 15 Aug 2005 12:03:11 +0000
Subject: [PATCH 135/411] remove character offset 'hs' from the rubyOptDoBlock
 start match

---
 ChangeLog       | 3 +++
 syntax/ruby.vim | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ffab538f..71e4c145 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2005-08-15  Doug Kearns  
 
+	* syntax/ruby.vim: remove character offset 'hs' from the
+	rubyOptDoBlock start match
+
 	* syntax/ruby.vim: exclude leading whitespace from the rubyOptDoBlock
 	syntax group start patterns with \zs
 
diff --git a/syntax/ruby.vim b/syntax/ruby.vim
index 587cb1cd..84653866 100644
--- a/syntax/ruby.vim
+++ b/syntax/ruby.vim
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language:	Ruby
 " Maintainer:	Doug Kearns 
-" Info:		$Id: ruby.vim,v 1.55 2005/08/15 08:15:58 dkearns Exp $
+" Info:		$Id: ruby.vim,v 1.56 2005/08/15 12:03:11 dkearns Exp $
 " URL:		http://vim-ruby.sourceforge.net
 " Anon CVS:	See above site
 " Licence:	GPL (http://www.gnu.org)
@@ -157,7 +157,7 @@ if !exists("ruby_no_expensive")
   syn region rubyNoDoBlock matchgroup=rubyControl start="\<\%(case\|begin\)\>" start="\%(^\|\.\.\.\=\|[;=([<>~+-\*/]\)\s*\zs\%(if\|unless\)\>" end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold
 
   " statement with optional *do*
-  syn region rubyOptDoBlock matchgroup=rubyControl start="\" start="^\s*\zs\%(while\|until\)\>" start=";\s*\zs\%(while\|until\)\>"hs=s+1 end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold
+  syn region rubyOptDoBlock matchgroup=rubyControl start="\" start="^\s*\zs\%(while\|until\)\>" start=";\s*\zs\%(while\|until\)\>" end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold
 
   " optional *do*
   syn match  rubyControl "\%(\<\%(for\|until\|while\)\s.*\s\)\@<=\%(do\|:\)\>"

From 418ffc304dea25d8a86827ef791717d8e404f36e Mon Sep 17 00:00:00 2001
From: Doug Kearns 
Date: Tue, 16 Aug 2005 15:11:34 +0000
Subject: [PATCH 136/411] offer $VIM/vimfiles and $HOME/{.vim,vimfiles} as the
 two default installation directories

---
 ChangeLog               |   6 ++
 README                  |  16 +++--
 bin/vim-ruby-install.rb | 155 ++++++++++++++++++++++++----------------
 etc/website/index.html  |  20 +++---
 4 files changed, 119 insertions(+), 78 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 71e4c145..62bbfacf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-08-16  Doug Kearns  
+
+	* README, bin/vim-ruby-install.rb, etc/website/index.html: offer
+	$VIM/vimfiles and $HOME/{.vim,vimfiles} rather than $VIMRUNTIME as the
+	two default installation directories
+
 2005-08-15  Doug Kearns  
 
 	* syntax/ruby.vim: remove character offset 'hs' from the
diff --git a/README b/README
index ddb1ab93..d4458181 100644
--- a/README
+++ b/README
@@ -26,10 +26,10 @@ For would-be contributors:
   - Thank you very much for taking an interest.
 
 Contents of the project:
-  - The compiler, ftplugin, indent and syntax directories contain the ruby.vim
-    files that are to be copied somewhere Vim can see them.
-  - install.rb performs this copying.
-  - build.rb creates a tarball for easy distribution.
+  - The 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 anonymous CVS, you can keep
@@ -37,8 +37,9 @@ How you get these files into 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 install.rb, just Vim files.  You would typically install these
-    wherever Vim is installed, in the (for example) "vim62" directory.
+    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.
@@ -70,7 +71,8 @@ Any questions or suggestions?
     (gsinclair at soyabean.com.au).
   - 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.
+    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,
diff --git a/bin/vim-ruby-install.rb b/bin/vim-ruby-install.rb
index 00518664..f1417258 100755
--- a/bin/vim-ruby-install.rb
+++ b/bin/vim-ruby-install.rb
@@ -2,10 +2,10 @@
 
 # vim-ruby-install: install the Vim config files for Ruby editing
 #
-#  * scope out the target directry and get user to confirm
+#  * scope out the target directory and get user to confirm
 #    * if no directory found, ask user
 #    * allow user to force a search for a Windows gvim installation
-#  * find source files from gem or from current directory
+#  * find source files from gem or from top level directory
 #  * copy to target directory, taking account of
 #    * line endings (NL for Unix-ish; CRLF for Windows)
 #    * permissions (755 for directories; 644 for files)
@@ -26,11 +26,11 @@
   syntax/eruby.vim
   syntax/ruby.vim
 }
-# XXX: what do we do with 'filetype/filetype.vim' ???
-                  
+#FIXME: ftdetect/ruby.vim - vim 6.3+ only? This won't cause problems for
+#       earlier versions; it just won't work!
 
   #
-  # Miscelleneous functions in the user's environment.
+  # Miscellaneous functions in the user's environment.
   #
 class Env
     #
@@ -47,18 +47,14 @@ def Env.determine_target_os
 
     #
     # Returns the path to the directory where the vim configuration files will be copied from.
-    # The first preference is the current directory.  If that fails, we look for the RubyGems
-    # package 'vim-ruby'.  Failing that, we return +nil+.
+    # The first preference is the directory above this script.  If that fails, we look for the
+    # RubyGems package 'vim-ruby'.  Failing that, we return +nil+.
     #
   def Env.determine_source_directory
-      # 1. Try the current directory.
-    if SOURCE_FILES.all? { |path| FileTest.file?(path) }
-      return '.'
-      # 2. Try the directory above this installation script.
-    elsif SOURCE_FILES.map { |f| File.join(File.dirname($0), '..', f) }.all? { |path| FileTest.file?(path) }
-      return File.join(File.dirname($0), '..')
-    end
-      # 3. Try the gem 'vim-ruby'.
+      # 1. Try the directory above this installation script.
+    vim_ruby_source_dir = File.expand_path(File.join(File.dirname($0), '..'))
+    return vim_ruby_source_dir if _valid_vim_ruby_dir(vim_ruby_source_dir)
+      # 2. Try the gem 'vim-ruby'.
     begin
       require 'rubygems'
       raise "Need RubyGems 0.8+" if Gem::RubyGemsPackageVersion < '0.8'
@@ -67,20 +63,48 @@ def Env.determine_source_directory
     end
     #vim_ruby_gem_dir = Gem.latest_load_paths.grep(%r{gems/vim-ruby}).last
     vim_ruby_gem_dir = Gem.all_load_paths.grep(%r{gems/vim-ruby}).sort.last
-    if vim_ruby_gem_dir
-      Dir.chdir(vim_ruby_gem_dir) do
-        if SOURCE_FILES.all? { |path| FileTest.file?(path) }
-          return vim_ruby_gem_dir
-        end
-      end
+    if vim_ruby_gem_dir and _valid_vim_ruby_dir(vim_ruby_gem_dir)
+      return vim_ruby_gem_dir 
     end
     return nil
   end
 
+    # Returns the Vim installation directory ($VIM).
+    # FIXME: print warning if vim command not in PATH or appropriate key not in registry?
+  def Env.determine_vim_dir
+    installation_dir = ENV['VIM'] ||
+    case Env.determine_target_os
+    when :UNIX
+      IO.popen('vim --version 2>/dev/null') do |version|
+	dir = version.read[/fall-back for \$VIM: "(.*)"/, 1]
+      end
+    when :WINDOWS
+      require 'win32/registry'
+      path = ''
+      Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\Vim\Gvim') do |reg|
+	path = reg['path', Win32::Registry::REG_SZ]
+      end
+      # FIXME: Does Registry#[] ever return nil? Exceptions?
+      unless path.empty? or path.nil?
+	dir = path.sub(/\\vim\d\d\\gvim.exe/i, '')
+      end
+    end
+    return installation_dir
+  end
+
   def Env.ask_user(message)
     print message
     gets.strip
   end
+
+  private_class_method
+
+  def Env._valid_vim_ruby_dir(dir)
+    Dir.chdir(dir) do
+      return SOURCE_FILES.all? { |path| FileTest.file?(path) }
+    end
+  end
+ 
 end  # class Env
 
 
@@ -158,21 +182,14 @@ def path
   # user options; but is ultimately created with one in mind.
   #
 class TargetDirectory::Finder
-  POTENTIAL_DIRECTORIES = {
-    :UNIX => [
-      "/usr/local/share/vim",
-      "/usr/local/vim",
-      "/usr/share/vim",
-      "/usr/vim",
-      "/opt/share/vim",
-      "/opt/vim"
-    ],
-    :WINDOWS => [ File.join(ENV['PROGRAMFILES'], 'vim') ]
-  }
 
     # Guides the user through a selection process, ending in a chosen directory. 
   def find_target_directory
-      # 1. Try the potentials (if there are any).
+      # 1. Was a directory specified using the --directory option?
+    if option_dir = $options[:target_dir]
+      return option_dir
+    end
+      # 2. Try the potentials (if there are any).
     if dirs = _potential_directories and not dirs.empty?
       puts
       puts "Possible Vim installation directories:"
@@ -186,41 +203,40 @@ def find_target_directory
         return chosen_directory
       end
     end 
-      # 2. We didn't find any, or the user wants to enter another.
+      # 3. We didn't find any, or the user wants to enter another.
     if dirs.empty?
       puts
       puts "Couldn't find any Vim installation directories."
     end
-    loop do
-      dir = Env.ask_user "Please enter the full path to your Vim installation directory: "
-      dir = File.expand_path(dir)
-      if FileTest.directory?(dir)
-        entered_directory = dir
-        puts
-        return entered_directory
-      else
-        puts " *** That directory doesn't exist!"
-      end
-    end
-      # 3. We don't get here; every path contains a return statement.
+    entered_directory = Env.ask_user "Please enter the full path to your Vim installation directory: "
+    entered_directory = File.expand_path(entered_directory)
+    return entered_directory
   end
   
- private 
+  private 
 
     # Return an array of _potential_ directories (i.e. they exist).  Take the options into
     # account.
   def _potential_directories
-    dirs = POTENTIAL_DIRECTORIES[Env.determine_target_os].select { |d| FileTest.directory?(d) }
-    dirs.map { |d| _vim_runtime_directory(d) }
+    dirs = []
+    dirs << _vim_user_dir
+    dirs << _vim_system_dir
+    return dirs.compact.map { |dir| File.expand_path(dir) }
   end
 
-    # Given a directory like '/usr/share/vim', returns a directory like '/usr/share/vim/vim63'.
-  def _vim_runtime_directory(dir)
-    if File.basename(dir) =~ /vim\d+/
-      dir
-    else
-      Dir.glob("#{dir}/vim*").select { |d| d =~ /vim\d+/ }.sort.last
-    end
+    # Return the Vim system preferences directory
+  def _vim_system_dir
+    vim_dir = ENV['VIM'] || Env.determine_vim_dir
+    system_dir = vim_dir + "/vimfiles" if vim_dir
+    return system_dir
+  end
+
+    # Return the Vim user preferences directory
+  def _vim_user_dir
+    platform_dir = { :UNIX => "/.vim", :WINDOWS => "/vimfiles" }
+    home_dir = ENV['HOME']
+    user_dir = home_dir + platform_dir[Env.determine_target_os] if home_dir
+    return user_dir
   end
 
 end  # class TargetDirectory::Finder
@@ -331,7 +347,7 @@ def path
      vim-ruby-install.rb: Install the vim-ruby configuration files
 
       About:
-        * Detects the Vim runtime directory
+        * Detects the Vim user and system-wide preferences directories
           * User to confirm before proceeding
           * User may specify other directory
         * Takes config files from current directory or from vim-ruby gem
@@ -368,15 +384,30 @@ def path
           Cygwin or MinGW.
     
         * This installer is quite new (2004-09-20).  Please report bugs to
-          gsinclair@soyabea.com.au.
+          gsinclair@soyabean.com.au.
   }.gsub(/^    /, '')
 end
 op.parse!(ARGV)
 
 source_dir = Env.determine_source_directory
-if source_dir.nil? then raise "Can't find source directory"; end
-target_dir = $options[:target_dir] || TargetDirectory.finder.find_target_directory
-VimRubyInstaller.new(source_dir, target_dir).install
+if source_dir.nil?   
+  raise "Can't find source directory"
+end
+
+target_dir = TargetDirectory.finder.find_target_directory
+if not File.directory?(target_dir)
+  puts
+  puts "Target directory '#{target_dir}' does not exist."
+  response = Env.ask_user "Do you want to create it? [Yn] "
+  if response.strip =~ /^y(es)?$/i
+    FileUtils.mkdir_p(target_dir, :verbose => true)
+  else
+    puts
+    puts "Installation aborted."
+    exit
+  end
+end
 
-# vim: ft=ruby
+VimRubyInstaller.new(source_dir, target_dir).install
 
+# vim: ft=ruby sw=2 sts=2 ts=8:
diff --git a/etc/website/index.html b/etc/website/index.html
index 58137d85..6b077b9d 100644
--- a/etc/website/index.html
+++ b/etc/website/index.html
@@ -69,10 +69,10 @@ 

- Thank you very much for taking an interest. Contents of the project: - - The compiler, ftplugin, indent and syntax directories contain the ruby.vim - files that are to be copied somewhere Vim can see them. - - install.rb performs this copying. - - build.rb creates a tarball for easy distribution. + - The 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 anonymous CVS, you can keep @@ -80,8 +80,9 @@

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 install.rb, just Vim files. You would typically install these - wherever Vim is installed, in the (for example) "vim62" directory. + 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. @@ -91,6 +92,7 @@

- Email any one of us or ruby-talk if you want more information added to this page. + CVS topics: - 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 @@ -112,7 +114,8 @@

(gsinclair at soyabean.com.au). - 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. + 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, @@ -125,7 +128,6 @@

let us know. --= End of Document =-- - -

+
From 066fbd70248d346b23a7c51f25f864dc8bcb91a6 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 16 Aug 2005 15:20:04 +0000 Subject: [PATCH 137/411] add FIXME comment to vim-ruby-installer.rb --- ChangeLog | 2 ++ bin/vim-ruby-install.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index 62bbfacf..a05fc0f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2005-08-16 Doug Kearns + * bin/vim-ruby-install.rb: add FIXME comment (Hugh Sasse) + * README, bin/vim-ruby-install.rb, etc/website/index.html: offer $VIM/vimfiles and $HOME/{.vim,vimfiles} rather than $VIMRUNTIME as the two default installation directories diff --git a/bin/vim-ruby-install.rb b/bin/vim-ruby-install.rb index f1417258..a3ac6645 100755 --- a/bin/vim-ruby-install.rb +++ b/bin/vim-ruby-install.rb @@ -143,6 +143,8 @@ def mkpath(directory) def _ensure_directory_exists(path) dir = path.dirname unless dir.directory? + # FileUtils.mkdir_p already checks if it exists and is a + # directory. What if it exists as a file? (HGS) mkpath(dir) end end From 4c7cb8f58182049bca0575497253dff183f28101 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 16 Aug 2005 15:41:30 +0000 Subject: [PATCH 138/411] wrap installer's 'main' in a begin/end block --- ChangeLog | 2 + bin/vim-ruby-install.rb | 156 +++++++++++++++++++++------------------- 2 files changed, 86 insertions(+), 72 deletions(-) diff --git a/ChangeLog b/ChangeLog index a05fc0f1..2072bbf7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2005-08-16 Doug Kearns + * bin/vim-ruby-install.rb: wrap 'main' in a begin/end block + * bin/vim-ruby-install.rb: add FIXME comment (Hugh Sasse) * README, bin/vim-ruby-install.rb, etc/website/index.html: offer diff --git a/bin/vim-ruby-install.rb b/bin/vim-ruby-install.rb index a3ac6645..70390380 100755 --- a/bin/vim-ruby-install.rb +++ b/bin/vim-ruby-install.rb @@ -335,81 +335,93 @@ def path end # class VimRubyInstaller -# -# * * * M A I N * * * -# - -$options = { - :windows => false, - :target_dir => nil -} - -op = OptionParser.new do |p| - p.banner = %{ - vim-ruby-install.rb: Install the vim-ruby configuration files - - About: - * Detects the Vim user and system-wide preferences directories - * User to confirm before proceeding - * User may specify other directory - * Takes config files from current directory or from vim-ruby gem - * Writes files with correct permissions and line endings - - Usage: - direct: ruby bin/vim-ruby-install.rb [options] - gem: vim-ruby-install.rb [options] - - Options: - }.gsub(/^ /, '') - p.on('--windows', 'Install into Windows directories') do - $options[:windows] = true - end - p.on('-d DIR', '--directory', 'Install into given directory') do |dir| - $options[:target_dir] = dir - end - p.on('-h', '--help', 'Show this message') do - puts p - exit - end - p.on_tail %{ - Notes: - - * "Direct" usage means unpacking a vim-ruby tarball and running this - program from the vim-ruby directory. - - * The convenient alternative is to use RubyGems: - gem install vim-ruby - vim-ruby-install.rb + # + # * * * M A I N * * * + # - * The --windows option is designed for forcing an install into the - Windows (gvim) configuration directory; useful when running from - Cygwin or MinGW. +if $0 == __FILE__ + begin - * This installer is quite new (2004-09-20). Please report bugs to - gsinclair@soyabean.com.au. - }.gsub(/^ /, '') -end -op.parse!(ARGV) - -source_dir = Env.determine_source_directory -if source_dir.nil? - raise "Can't find source directory" -end - -target_dir = TargetDirectory.finder.find_target_directory -if not File.directory?(target_dir) - puts - puts "Target directory '#{target_dir}' does not exist." - response = Env.ask_user "Do you want to create it? [Yn] " - if response.strip =~ /^y(es)?$/i - FileUtils.mkdir_p(target_dir, :verbose => true) - else - puts - puts "Installation aborted." - exit + $options = { + :windows => false, + :target_dir => nil + } + + op = OptionParser.new do |p| + p.banner = %{ + vim-ruby-install.rb: Install the vim-ruby configuration files + + About: + * Detects the Vim user and system-wide preferences directories + * User to confirm before proceeding + * User may specify other directory + * Takes config files from current directory or from vim-ruby gem + * Writes files with correct permissions and line endings + + Usage: + direct: ruby bin/vim-ruby-install.rb [options] + gem: vim-ruby-install.rb [options] + + Options: + }.gsub(/^ /, '') + p.on('--windows', 'Install into Windows directories') do + $options[:windows] = true + end + p.on('-d DIR', '--directory', 'Install into given directory') do |dir| + $options[:target_dir] = dir + end + p.on('-h', '--help', 'Show this message') do + puts p + exit + end + p.on_tail %{ + Notes: + + * "Direct" usage means unpacking a vim-ruby tarball and running this + program from the vim-ruby directory. + + * The convenient alternative is to use RubyGems: + gem install vim-ruby + vim-ruby-install.rb + + * The --windows option is designed for forcing an install into the + Windows (gvim) configuration directory; useful when running from + Cygwin or MinGW. + + * This installer is quite new (2004-09-20). Please report bugs to + gsinclair@soyabean.com.au. + }.gsub(/^ /, '') + end + op.parse!(ARGV) + + source_dir = Env.determine_source_directory + if source_dir.nil? + raise "Can't find source directory" + end + + target_dir = TargetDirectory.finder.find_target_directory + if not File.directory?(target_dir) + puts + puts "Target directory '#{target_dir}' does not exist." + response = Env.ask_user "Do you want to create it? [Yn] " + if response.strip =~ /^y(es)?$/i + FileUtils.mkdir_p(target_dir, :verbose => true) + else + puts + puts "Installation aborted." + exit + end + end + + VimRubyInstaller.new(source_dir, target_dir).install + + rescue + raise if $DEBUG + $stderr.puts + $stderr.puts $!.message + $stderr.puts "Try 'ruby #{$0} --help' for detailed usage." + exit 1 end end -VimRubyInstaller.new(source_dir, target_dir).install - # vim: ft=ruby sw=2 sts=2 ts=8: From ca421c98aed9688f462b7e42d780cc826278434e Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 17 Aug 2005 12:09:26 +0000 Subject: [PATCH 139/411] merge 'while|until' start patterns of rubyOptDoBlock syntax group --- ChangeLog | 5 +++++ syntax/ruby.vim | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2072bbf7..8faafbda 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-08-17 Doug Kearns + + * syntax/ruby.vim: merge 'while|until' start patterns of + rubyOptDoBlock syntax group + 2005-08-16 Doug Kearns * bin/vim-ruby-install.rb: wrap 'main' in a begin/end block diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 84653866..0cbcaa33 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.56 2005/08/15 12:03:11 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.57 2005/08/17 12:09:26 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -157,7 +157,7 @@ if !exists("ruby_no_expensive") syn region rubyNoDoBlock matchgroup=rubyControl start="\<\%(case\|begin\)\>" start="\%(^\|\.\.\.\=\|[;=([<>~+-\*/]\)\s*\zs\%(if\|unless\)\>" end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold " statement with optional *do* - syn region rubyOptDoBlock matchgroup=rubyControl start="\" start="^\s*\zs\%(while\|until\)\>" start=";\s*\zs\%(while\|until\)\>" end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold + syn region rubyOptDoBlock matchgroup=rubyControl start="\" start="\%(^\|;\)\s*\zs\%(while\|until\)\>" end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold keepend " optional *do* syn match rubyControl "\%(\<\%(for\|until\|while\)\s.*\s\)\@<=\%(do\|:\)\>" From ccf1076f25dd22ac934b97640feb9e998c7948b7 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 17 Aug 2005 12:43:27 +0000 Subject: [PATCH 140/411] remove accidentally added 'keepend' from rubyOptDoBlock --- ChangeLog | 3 +++ syntax/ruby.vim | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8faafbda..1a42d07e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2005-08-17 Doug Kearns + * syntax/ruby.vim: remove accidentally added 'keepend' from + rubyOptDoBlock + * syntax/ruby.vim: merge 'while|until' start patterns of rubyOptDoBlock syntax group diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 0cbcaa33..bf7a511d 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.57 2005/08/17 12:09:26 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.58 2005/08/17 12:43:27 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -157,7 +157,7 @@ if !exists("ruby_no_expensive") syn region rubyNoDoBlock matchgroup=rubyControl start="\<\%(case\|begin\)\>" start="\%(^\|\.\.\.\=\|[;=([<>~+-\*/]\)\s*\zs\%(if\|unless\)\>" end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold " statement with optional *do* - syn region rubyOptDoBlock matchgroup=rubyControl start="\" start="\%(^\|;\)\s*\zs\%(while\|until\)\>" end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold keepend + syn region rubyOptDoBlock matchgroup=rubyControl start="\" start="\%(^\|;\)\s*\zs\%(while\|until\)\>" end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold " optional *do* syn match rubyControl "\%(\<\%(for\|until\|while\)\s.*\s\)\@<=\%(do\|:\)\>" From 6cdd617a7dce00ecc0dc397b82fa937b62a698b0 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 17 Aug 2005 14:26:09 +0000 Subject: [PATCH 141/411] improve highlighting of the optional 'do' in looping constructs --- ChangeLog | 3 +++ syntax/ruby.vim | 10 ++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1a42d07e..dc2c63e8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2005-08-17 Doug Kearns + * syntax/ruby.vim: improve highlighting of the optional 'do' in + looping constructs + * syntax/ruby.vim: remove accidentally added 'keepend' from rubyOptDoBlock diff --git a/syntax/ruby.vim b/syntax/ruby.vim index bf7a511d..4c962d38 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.58 2005/08/17 12:43:27 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.59 2005/08/17 14:26:09 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -148,7 +148,7 @@ if !exists("ruby_no_expensive") syn match rubyControl "\<\%(if\|unless\|while\|until\)\>" display " *do* requiring *end* - syn region rubyDoBlock matchgroup=rubyControl start="\%(\<\%(for\|until\|while\)\s.*\s\)\@" end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold + syn region rubyDoBlock matchgroup=rubyControl start="\" end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold " *{* requiring *}* syn region rubyCurlyBlock start="{" end="}" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold @@ -157,10 +157,8 @@ if !exists("ruby_no_expensive") syn region rubyNoDoBlock matchgroup=rubyControl start="\<\%(case\|begin\)\>" start="\%(^\|\.\.\.\=\|[;=([<>~+-\*/]\)\s*\zs\%(if\|unless\)\>" end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold " statement with optional *do* - syn region rubyOptDoBlock matchgroup=rubyControl start="\" start="\%(^\|;\)\s*\zs\%(while\|until\)\>" end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold - - " optional *do* - syn match rubyControl "\%(\<\%(for\|until\|while\)\s.*\s\)\@<=\%(do\|:\)\>" + syn region rubyOptDoLine matchgroup=rubyControl start="\<\%(for\|until\|while\)\>" end="\%(\\|:\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo + syn region rubyOptDoBlock start="\<\%(for\|until\|while\)\>" matchgroup=rubyControl end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo nextgroup=rubyOptDoLine fold if !exists("ruby_minlines") let ruby_minlines = 50 From d5ffb794705b7f113ad6f47f7428a70fb6164d1c Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 18 Aug 2005 09:46:16 +0000 Subject: [PATCH 142/411] improve highlighting of heredocs used as method arguments --- ChangeLog | 5 +++++ syntax/ruby.vim | 26 ++++++++++++++++---------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index dc2c63e8..c2b6528f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-08-18 Doug Kearns + + * syntax/ruby.vim: improve highlighting of heredocs used as method + arguments + 2005-08-17 Doug Kearns * syntax/ruby.vim: improve highlighting of the optional 'do' in diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 4c962d38..286421b1 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.59 2005/08/17 14:26:09 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.60 2005/08/18 09:46:16 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -123,15 +123,21 @@ syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\[" e syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=(" end=")" skip="\\\\\|\\)" contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimEscape fold " Here Document -syn region rubyString matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%(\.\|::\)\)\_s*\)\@ Date: Thu, 18 Aug 2005 13:48:07 +0000 Subject: [PATCH 143/411] explicitly match block arguments so that &keyword isn't highlighted --- ChangeLog | 3 +++ syntax/ruby.vim | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c2b6528f..827ed5e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2005-08-18 Doug Kearns + * syntax/ruby.vim: explicitly match block arguments so that &keyword + isn't highlighted as a 'keyword' prefixed with & + * syntax/ruby.vim: improve highlighting of heredocs used as method arguments diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 286421b1..cc662ca6 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.60 2005/08/18 09:46:16 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.61 2005/08/18 13:48:07 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -66,6 +66,7 @@ syn match rubyFloat "\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE " Identifiers syn match rubyLocalVariableOrMethod "\<[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent +syn match rubyBlockArgument "&[_[:lower:]][_[:alnum:]]" contains=NONE display transparent syn match rubyConstant "\%(\%(\.\@\%(\s*(\)\@!" syn match rubyClassVariable "@@\h\w*" display From b2804371be9a3185d5ae49c268c342834cacf56e Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 24 Aug 2005 13:18:58 +0000 Subject: [PATCH 144/411] remove 'contains=rubyString' from the rubyInterpolation syntax group --- ChangeLog | 5 +++++ syntax/ruby.vim | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 827ed5e7..5f2f7db2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-08-24 Doug Kearns + + * syntax/ruby.vim: remove 'contains=rubyString' from the + rubyInterpolation group until that is more comprehensively improved + 2005-08-18 Doug Kearns * syntax/ruby.vim: explicitly match block arguments so that &keyword diff --git a/syntax/ruby.vim b/syntax/ruby.vim index cc662ca6..6c1b1bf5 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.61 2005/08/18 13:48:07 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.62 2005/08/24 13:18:58 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -40,7 +40,7 @@ endif " Expression Substitution and Backslash Notation syn match rubyEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display syn match rubyEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display -syn match rubyInterpolation "#{[^}]*}" contained contains=rubyString +syn match rubyInterpolation "#{[^}]*}" contained syn match rubyInterpolation "#\%(\$\|@@\=\)\w\+" contained display syn match rubyNoInterpolation "\\#{[^}]*}" contained syn match rubyNoInterpolation "\\#\%(\$\|@@\=\)\w\+" contained display From d0203bcd00dff7d8ad3e8ef53d7deb86de877cef Mon Sep 17 00:00:00 2001 From: Nikolai Weibull Date: Wed, 24 Aug 2005 23:51:54 +0000 Subject: [PATCH 145/411] 1. resetting of cpoptions (wouldn't always be done, depending on if GetRubyIndent was defined. 2. Bugs #166, #1914, #2296 should be fixed 3. Somewhat simpler processing of the contents of the file. Most of the work was removing complexity that was trying to be clever about understanding the syntax/semantics of the file, while actually making things slow and actually not matching correctly. I also removed the disclaimer and license claims, as Bram won't accept them anyway. --- indent/ruby.vim | 127 ++++++++++++++++++++++++++++++------------------ 1 file changed, 81 insertions(+), 46 deletions(-) diff --git a/indent/ruby.vim b/indent/ruby.vim index dfcfd98d..f5ea5a5d 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -1,17 +1,10 @@ " Vim indent file -" Language: Ruby -" Maintainer: Gavin Sinclair -" Developer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.22 2005/03/23 23:35:31 gsinclair Exp $ -" URL: http://vim-ruby.rubyforge.org/ -" Anon CVS: See above site -" Licence: GPL (http://www.gnu.org/) -" Disclaimer: -" This program is distributed in the hope that it will be useful, -" but WITHOUT ANY WARRANTY; without even the implied warranty of -" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -" GNU General Public License for more details. -" ---------------------------------------------------------------------------- +" Language: Ruby +" Maintainer: Gavin Sinclair +" Developer: Nikolai Weibull +" Info: $Id: ruby.vim,v 1.23 2005/08/24 23:51:54 pcp Exp $ +" URL: http://vim-ruby.rubyforge.org/ +" Anon CVS: See above site " 0. Initialization {{{1 " ================= @@ -32,24 +25,27 @@ if exists("*GetRubyIndent") finish endif +let s:cpo_save = &cpo +set cpo&vim + " 1. Variables {{{1 " ============ " Regex of synax group names that are or delimit string or are comments. let s:syng_strcom = '\' + \ '\|Interpolation\|NoInterpolation\|Escape\|Comment\|Documentation\)\>' " Regex of syntax group names that are strings or comments. let s:syng_strcom2 = '\' + \ '\|Interpolation\|NoInterpolation\|Escape\|Comment\|Documentation\)\>' " Regex of syntax group names that are strings. let s:syng_string = - \ '\' + \ '\' " Regex of syntax group names that are strings or documentation. let s:syng_stringdoc = - \'\' + \'\' " Expression used to check whether we should skip a match with searchpair(). let s:skip_expr = @@ -65,16 +61,13 @@ let s:ruby_deindent_keywords = \ '^\s*\zs\<\%(ensure\|else\|rescue\|elsif\|when\|end\)\>' " Regex that defines the start-match for the 'end' keyword. -let s:end_start_regex = '\%(^\s*\%(\zs\<\%(module\|class\|def\|if\|for' . - \ '\|while\|until\|case\|unless\|begin\)\>' . - \ '\|\h\w*\s*=\s*\zs\<\%(if\|unless\)\>\)' . - \ '\|\\)' +let s:end_start_regex = '\<\%(module\|class\|def\|if\|for\|while\|until\|case\|unless\|begin\|do\)\>' " Regex that defines the middle-match for the 'end' keyword. let s:end_middle_regex = '\<\%(ensure\|else\|rescue\|when\|elsif\)\>' " Regex that defines the end-match for the 'end' keyword. -let s:end_end_regex = '\\s*\%(#.*\)\=$' +let s:end_end_regex = '\%(^\|[^.]\)\' " Expression used for searchpair() call for finding match for 'end' keyword. let s:end_skip_expr = s:skip_expr . @@ -85,25 +78,17 @@ let s:end_skip_expr = s:skip_expr . let s:continuation_regex = '\%([\\*+/.,=:-]\|\W[|&?]\|||\|&&\)\s*\%(#.*\)\=$' " Regex that defines continuation lines. +" TODO: this needs to deal with if ...: and so on let s:continuation_regex2 = \ '\%([\\*+/.,=:({[-]\|\W[|&?]\|||\|&&\)\s*\%(#.*\)\=$' " Regex that defines blocks. let s:block_regex = - \ '\%(\\|{\)\s*\%(|\%([*@]\=\h\w*,\=\s*\)\+|\)\=\s*\%(#.*\)\=$' + \ '\%(\\|{\)\s*\%(|\%([*@]\=\h\w*,\=\s*\)\%(,\s*[*@]\=\h\w*\)*|\)\=\s*\%(#.*\)\=$' " 2. Auxiliary Functions {{{1 " ====================== -" Move the cursor to the given line:col. -function s:GotoLineCol(line, col) - if a:col != 0 - execute 'normal! '.a:line.'G0'.a:col.'l' - else - execute 'normal! '.a:line.'G0' - endif -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, 0), 'name') =~ s:syng_strcom @@ -134,14 +119,14 @@ function s:PrevNonBlankNonString(lnum) let line = getline(lnum) if line =~ '^=begin$' if in_block - let in_block = 0 + let in_block = 0 else - break + break endif elseif !in_block && line =~ '^=end$' let in_block = 1 elseif !in_block && line !~ '^\s*#.*$' && !(s:IsInStringOrComment(lnum, 1) - \ && s:IsInStringOrComment(lnum, strlen(line))) + \ && s:IsInStringOrComment(lnum, strlen(line))) break endif let lnum = prevnonblank(lnum - 1) @@ -160,7 +145,7 @@ function s:GetMSL(lnum) let line = getline(lnum) let col = match(line, s:continuation_regex2) + 1 if (col > 0 && !s:IsInStringOrComment(lnum, col)) - \ || s:IsInString(lnum, strlen(line)) + \ || s:IsInString(lnum, strlen(line)) let msl = lnum else break @@ -181,9 +166,9 @@ function s:LineHasOpeningBrackets(lnum) if !s:IsInStringOrComment(a:lnum, pos + 1) let idx = stridx('(){}[]', line[pos]) if idx % 2 == 0 - let open_{idx} = open_{idx} + 1 + let open_{idx} = open_{idx} + 1 else - let open_{idx - 1} = open_{idx - 1} - 1 + let open_{idx - 1} = open_{idx - 1} - 1 endif endif let pos = match(line, '[][(){}]', pos + 1) @@ -196,6 +181,16 @@ function s:Match(lnum, regex) return col > 0 && !s:IsInStringOrComment(a:lnum, col) ? col : 0 endfunction +function s:MatchLast(lnum, regex) + let line = getline(a:lnum) + let col = match(line, '.*\zs' . a:regex) + while col != -1 && s:IsInStringOrComment(a:lnum, col) + let line = strpart(line, 0, col) + let col = match(line, '.*' . a:regex) + endwhile + return col + 1 +endfunction + " 3. GetRubyIndent Function {{{1 " ========================= @@ -218,7 +213,7 @@ function GetRubyIndent() " others we indent to the containing line's MSL's level. Return -1 if fail. let col = matchend(line, '^\s*[]})]') if col > 0 && !s:IsInStringOrComment(v:lnum, col) - call s:GotoLineCol(v:lnum, col - 1) + call cursor(v:lnum, col) let bs = strpart('(){}[]', stridx(')}]', line[col - 1]) * 2, 2) if searchpair(escape(bs[0], '\['), '', bs[1], 'bW', s:skip_expr) > 0 let ind = line[col-1]==')' ? virtcol('.')-1 : indent(s:GetMSL(line('.'))) @@ -232,13 +227,21 @@ function GetRubyIndent() endif " If we have a deindenting keyword, find its match and indent to its level. + " TODO: this is messy if s:Match(v:lnum, s:ruby_deindent_keywords) - call s:GotoLineCol(v:lnum, 0) - if searchpair(s:end_start_regex, s:end_middle_regex, s:end_end_regex, 'bW', - \ s:end_skip_expr) > 0 - let ind = indent('.') + let lnum = s:PrevNonBlankNonString(v:lnum - 1) + + if lnum == 0 + return 0 endif - return ind + + return indent(lnum) - &sw +" call cursor(v:lnum, 1) +" if searchpair(s:end_start_regex, s:end_middle_regex, s:end_end_regex, 'bW', +" \ s:end_skip_expr) > 0 +" let ind = indent('.') +" endif +" return ind endif " If we are in a multi-line string or line-comment, don't do anything to it. @@ -275,10 +278,41 @@ function GetRubyIndent() elseif counts[1] == '1' || counts[2] == '1' return ind + &sw else - call s:GotoLineCol(v:lnum, vcol - 1) + call cursor(v:lnum, vcol) end endif + " If the previous line ended with an "end", match that "end"s beginning's + " indent. + let col = s:Match(lnum, '\%(^\|[^.]\)\\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 +" let ind = indent(lnum) + &sw + " TODO: make this better (we need to count them) (or, if a searchpair + " fails, we know that something is lacking an end and thus we indent a + " level + if s:Match(lnum, s:end_end_regex) + let ind = indent('.') + endif + return ind + endif + " 3.4. Work on the MSL line. {{{2 " -------------------------- @@ -325,4 +359,5 @@ endfunction " }}}1 -" vim: sw=2 sts=2 ts=8 ff=unix: +let &cpo = s:cpo_save +unlet s:cpo_save From 4e50e3a91737a139d876eeb68b916ff2459e7d07 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 25 Aug 2005 13:20:47 +0000 Subject: [PATCH 146/411] fix backup writing bug in vim-ruby-install.rb and other minor improvements --- ChangeLog | 8 ++ bin/vim-ruby-install.rb | 183 ++++++++++++++++++++-------------------- 2 files changed, 101 insertions(+), 90 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5f2f7db2..b90929f4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-08-25 Doug Kearns + + * bin/vim-ruby-install.rb: don't use $0 == __FILE__ idiom to start + installer file as this will fail when running as a gem as + vim-ruby-install.rb is loaded by the gem driver; make _same_contents + a private method; fix a bug in BackupDir.backup where it was writing + the backup to an incorrect location + 2005-08-24 Doug Kearns * syntax/ruby.vim: remove 'contains=rubyString' from the diff --git a/bin/vim-ruby-install.rb b/bin/vim-ruby-install.rb index 70390380..8bca8eca 100755 --- a/bin/vim-ruby-install.rb +++ b/bin/vim-ruby-install.rb @@ -26,8 +26,10 @@ syntax/eruby.vim syntax/ruby.vim } -#FIXME: ftdetect/ruby.vim - vim 6.3+ only? This won't cause problems for -# earlier versions; it just won't work! +#FIXME: ftdetect/ruby.vim - vim 6.3+ only. This won't cause problems for +# earlier versions; it just won't work! For versions less than 6.2 we +# need to create a filetype.vim file and add it to the root of the +# runtime directory. # # Miscellaneous functions in the user's environment. @@ -70,7 +72,7 @@ def Env.determine_source_directory end # Returns the Vim installation directory ($VIM). - # FIXME: print warning if vim command not in PATH or appropriate key not in registry? + # TODO: print warning if vim command not in PATH or appropriate key not in registry? def Env.determine_vim_dir installation_dir = ENV['VIM'] || case Env.determine_target_os @@ -84,7 +86,7 @@ def Env.determine_vim_dir Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\Vim\Gvim') do |reg| path = reg['path', Win32::Registry::REG_SZ] end - # FIXME: Does Registry#[] ever return nil? Exceptions? + # TODO: Does Registry#[] ever return nil? Exceptions? unless path.empty? or path.nil? dir = path.sub(/\\vim\d\d\\gvim.exe/i, '') end @@ -160,9 +162,8 @@ def self.finder TargetDirectory::Finder.new end def initialize(directory, writer) - @directory = directory # String + @directory = Pathname.new(directory) @writer = writer # FileWriter - @directory = Pathname.new(@directory) end # Copies the given relative path from the current directory to the target. def copy(path) @@ -253,13 +254,13 @@ class VimRubyInstaller # +source+ and +target+ are the base directories from and to which the configuration files # will be copied. Both are strings. def initialize(source, target) - @source_dir = source - unless FileTest.directory?(@source_dir) - raise "Automatically determined source directory ('#{@source_dir}') doesn't exist" + unless FileTest.directory?(source) + raise "Automatically determined source directory ('#{source}') doesn't exist" end unless FileTest.directory?(target) raise "Chosen target directory ('#{target}') doesn't exist" end + @source_dir = source file_writer = FileWriter.new(Env.determine_target_os) @target_dir = TargetDirectory.new(target, file_writer) end @@ -276,7 +277,7 @@ def install if target_path.file? and target_path.mtime > source_path.mtime # We're going to overwrite a newer file; back it up, unless they're the same. unless _same_contents?(target_path, source_path) - backupdir.backup(target_path, path) + backupdir.backup(@target_dir, path) end end @target_dir.copy(path) @@ -295,6 +296,8 @@ def install end end + private + # Test two files for equality of contents, ignoring line endings. def _same_contents?(p1, p2) contents1 = p1.read.split("\n").map { |line| line.chomp } @@ -310,10 +313,10 @@ def initialize(path) # Copy basedir/path to @path/path. def backup(basedir, path) @base.mkpath unless @base.directory? - source = Pathname.new(basedir) + path + source = basedir.path + path target = @base + path target.dirname.mkpath - FileUtils.cp(source.to_s, target.to_s) + FileUtils.cp(source.to_s, target.dirname.to_s, :verbose => true) end def [](path) @base + path @@ -339,89 +342,89 @@ def path # * * * M A I N * * * # -if $0 == __FILE__ - begin - - $options = { - :windows => false, - :target_dir => nil - } - - op = OptionParser.new do |p| - p.banner = %{ - vim-ruby-install.rb: Install the vim-ruby configuration files - - About: - * Detects the Vim user and system-wide preferences directories - * User to confirm before proceeding - * User may specify other directory - * Takes config files from current directory or from vim-ruby gem - * Writes files with correct permissions and line endings - - Usage: - direct: ruby bin/vim-ruby-install.rb [options] - gem: vim-ruby-install.rb [options] - - Options: - }.gsub(/^ /, '') - p.on('--windows', 'Install into Windows directories') do - $options[:windows] = true - end - p.on('-d DIR', '--directory', 'Install into given directory') do |dir| - $options[:target_dir] = dir - end - p.on('-h', '--help', 'Show this message') do - puts p - exit - end - p.on_tail %{ - Notes: - - * "Direct" usage means unpacking a vim-ruby tarball and running this - program from the vim-ruby directory. - - * The convenient alternative is to use RubyGems: - gem install vim-ruby - vim-ruby-install.rb - - * The --windows option is designed for forcing an install into the - Windows (gvim) configuration directory; useful when running from - Cygwin or MinGW. - - * This installer is quite new (2004-09-20). Please report bugs to - gsinclair@soyabean.com.au. - }.gsub(/^ /, '') +begin + + $options = { + :windows => false, + :target_dir => nil + } + + op = OptionParser.new do |p| + p.banner = %{ + vim-ruby-install.rb: Install the vim-ruby configuration files + + About: + * Detects the Vim user and system-wide preferences directories + * User to confirm before proceeding + * User may specify other directory + * Takes config files from current directory or from vim-ruby gem + * Writes files with correct permissions and line endings + + Usage: + direct: ruby bin/vim-ruby-install.rb [options] + gem: vim-ruby-install.rb [options] + + Options: + }.gsub(/^ /, '') + p.on('--windows', 'Install into Windows directories') do + $options[:windows] = true + end + p.on('-d DIR', '--directory', 'Install into given directory') do |dir| + $options[:target_dir] = dir end - op.parse!(ARGV) - - source_dir = Env.determine_source_directory - if source_dir.nil? - raise "Can't find source directory" + p.on('-h', '--help', 'Show this message') do + puts p + exit end - - target_dir = TargetDirectory.finder.find_target_directory - if not File.directory?(target_dir) + p.on_tail %{ + Notes: + + * "Direct" usage means unpacking a vim-ruby tarball and running this + program from the vim-ruby directory. + + * The convenient alternative is to use RubyGems: + gem install vim-ruby + vim-ruby-install.rb + + * The --windows option is designed for forcing an install into the + Windows (gvim) configuration directory; useful when running from + Cygwin or MinGW. + + * This installer is quite new (2004-09-20). Please report bugs to + gsinclair@soyabean.com.au. + }.gsub(/^ /, '') + end + op.parse!(ARGV) + + source_dir = Env.determine_source_directory + if source_dir.nil? + raise "Can't find source directory." + end + + target_dir = TargetDirectory.finder.find_target_directory + if not File.directory?(target_dir) + puts + puts "Target directory '#{target_dir}' does not exist." + response = Env.ask_user "Do you want to create it? [Yn] " + if response.strip =~ /^y(es)?$/i + FileUtils.mkdir_p(target_dir, :verbose => true) + else puts - puts "Target directory '#{target_dir}' does not exist." - response = Env.ask_user "Do you want to create it? [Yn] " - if response.strip =~ /^y(es)?$/i - FileUtils.mkdir_p(target_dir, :verbose => true) - else - puts - puts "Installation aborted." - exit - end + puts "Installation aborted." + exit end - - VimRubyInstaller.new(source_dir, target_dir).install - - rescue - raise if $DEBUG - $stderr.puts - $stderr.puts $!.message - $stderr.puts "Try 'ruby #{$0} --help' for detailed usage." - exit 1 end + + VimRubyInstaller.new(source_dir, target_dir).install + +rescue + + raise if $DEBUG + $stderr.puts + $stderr.puts $!.message + $stderr.puts "Try 'ruby #{$0} --help' for detailed usage." + exit 1 + end # vim: ft=ruby sw=2 sts=2 ts=8: From e0fabf9973e050d14d3074ffc4f72b6122fd8239 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 25 Aug 2005 14:47:15 +0000 Subject: [PATCH 147/411] minor reorganisation of syntax documentation --- ChangeLog | 2 ++ syntax/doc/ruby.txt | 16 ++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index b90929f4..dbc796d2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2005-08-25 Doug Kearns + * syntax/doc/ruby.txt: minor reorganisation of options + * bin/vim-ruby-install.rb: don't use $0 == __FILE__ idiom to start installer file as this will fail when running as a gem as vim-ruby-install.rb is loaded by the gem driver; make _same_contents diff --git a/syntax/doc/ruby.txt b/syntax/doc/ruby.txt index a7979450..af856394 100644 --- a/syntax/doc/ruby.txt +++ b/syntax/doc/ruby.txt @@ -36,20 +36,20 @@ default. This can be disabled by defining "ruby_no_special_methods": > This will prevent highlighting of special methods such as "require", "private", "raise" and "proc". -Folding can be enabled by defining "ruby_fold": > - - :let ruby_fold = 1 - -This will set the 'foldmethod' option to "syntax" and allow folding of -classes, modules, methods, code blocks, heredocs and comments. - Whitespace errors can be highlighted by defining "ruby_space_errors": > - :let ruby_space_errors = 1 + :let ruby_space_errors = 1 This will highlight trailing whitespace and tabs preceded by a space character as errors. This can be refined by defining "ruby_no_trail_space_error" and "ruby_no_tab_space_error" which will ignore trailing whitespace and tabs after spaces respectively. +Folding can be enabled by defining "ruby_fold": > + + :let ruby_fold = 1 + +This will set the 'foldmethod' option to "syntax" and allow folding of +classes, modules, methods, code blocks, heredocs and comments. + vim: ts=8 tw=78 From 470d2b558edbe29f7fb06e0225851f745cbc9b15 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 25 Aug 2005 15:18:52 +0000 Subject: [PATCH 148/411] rename rubyIterator to rubyBlockParameter and match parameters in parentheses --- ChangeLog | 4 ++++ syntax/ruby.vim | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index dbc796d2..e1020be1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2005-08-25 Doug Kearns + * syntax/ruby.vim: rename rubyIterator to rubyBlockParameter; ensure + it only highlights these after a 'do' or '{'; match parameters in + parentheses + * syntax/doc/ruby.txt: minor reorganisation of options * bin/vim-ruby-install.rb: don't use $0 == __FILE__ idiom to start diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 6c1b1bf5..52795110 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.62 2005/08/24 13:18:58 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.63 2005/08/25 15:18:52 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -76,8 +76,7 @@ syn match rubySymbol ":\@\|<=\|<\|===\|==\|=\~\|>>\|>=\| syn match rubySymbol ":\@_,;:!?/.'"@$*\&+0]\)" syn match rubySymbol ":\@?@\`~1-9]# syn match rubyPredefinedVariable "$_\>" display @@ -253,7 +252,8 @@ if version >= 508 || !exists("did_ruby_syntax_inits") HiLink rubyClassVariable rubyIdentifier HiLink rubyConstant rubyIdentifier HiLink rubyGlobalVariable rubyIdentifier - HiLink rubyIterator rubyIdentifier + HiLink rubyBlockParameter rubyIdentifier + HiLink rubyIterator rubyBlockParameter " NOTE: deprecated HiLink rubyInstanceVariable rubyIdentifier HiLink rubyPredefinedIdentifier rubyIdentifier HiLink rubyPredefinedConstant rubyPredefinedIdentifier From 033a1ea49e5d7417dcf30bb4818d05db10b65543 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 25 Aug 2005 15:22:44 +0000 Subject: [PATCH 149/411] fix whitespace --- syntax/ruby.vim | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 52795110..30e9536d 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.63 2005/08/25 15:18:52 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.64 2005/08/25 15:22:44 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -138,7 +138,6 @@ syn region rubyString start=+\%(\%(class\s*\|\%(\.\|::\)\)\_s*\)\@ Date: Fri, 26 Aug 2005 05:20:15 +0000 Subject: [PATCH 150/411] minor refinement of rubyBlockParameter syntax pattern --- ChangeLog | 5 +++++ syntax/ruby.vim | 12 ++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index e1020be1..f5bb8187 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-08-26 Doug Kearns + + * syntax/ruby.vim: only match rubyBlockParameter after 'do' that is a + 'keyword' + 2005-08-25 Doug Kearns * syntax/ruby.vim: rename rubyIterator to rubyBlockParameter; ensure diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 30e9536d..604bf6c4 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.64 2005/08/25 15:22:44 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.65 2005/08/26 05:20:15 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -66,17 +66,17 @@ syn match rubyFloat "\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE " Identifiers syn match rubyLocalVariableOrMethod "\<[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent -syn match rubyBlockArgument "&[_[:lower:]][_[:alnum:]]" contains=NONE display transparent +syn match rubyBlockArgument "&[_[:lower:]][_[:alnum:]]" contains=NONE display transparent -syn match rubyConstant "\%(\%(\.\@\%(\s*(\)\@!" -syn match rubyClassVariable "@@\h\w*" display -syn match rubyInstanceVariable "@\h\w*" display +syn match rubyConstant "\%(\%(\.\@\%(\s*(\)\@!" +syn match rubyClassVariable "@@\h\w*" display +syn match rubyInstanceVariable "@\h\w*" display syn match rubyGlobalVariable "$\%(\h\w*\|-.\)" syn match rubySymbol ":\@\|<=\|<\|===\|==\|=\~\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)" syn match rubySymbol ":\@_,;:!?/.'"@$*\&+0]\)" syn match rubySymbol ":\@\|{\)\s*\)\@<=|\s*\zs[( ,a-zA-Z0-9_*)]\+\ze\s*|" display syn match rubyPredefinedVariable #$[!$&"'*+,./0:;<=>?@\`~1-9]# syn match rubyPredefinedVariable "$_\>" display From 400934679adfaf1d6edc3e18b56d02e199fa6241 Mon Sep 17 00:00:00 2001 From: Nikolai Weibull Date: Fri, 26 Aug 2005 19:48:41 +0000 Subject: [PATCH 151/411] Updated to indent correctly. There's more to be done, as a statement may be contained in other stuff than a '... = ', so that '=' should be [=+-...]. Soon to be fixed. --- indent/ruby.vim | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/indent/ruby.vim b/indent/ruby.vim index f5ea5a5d..d22644e7 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -2,7 +2,7 @@ " Language: Ruby " Maintainer: Gavin Sinclair " Developer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.23 2005/08/24 23:51:54 pcp Exp $ +" Info: $Id: ruby.vim,v 1.24 2005/08/26 19:48:41 pcp Exp $ " URL: http://vim-ruby.rubyforge.org/ " Anon CVS: See above site @@ -61,7 +61,13 @@ let s:ruby_deindent_keywords = \ '^\s*\zs\<\%(ensure\|else\|rescue\|elsif\|when\|end\)\>' " Regex that defines the start-match for the 'end' keyword. -let s:end_start_regex = '\<\%(module\|class\|def\|if\|for\|while\|until\|case\|unless\|begin\|do\)\>' +"let s:end_start_regex = '\%(^\|[^.]\)\<\%(module\|class\|def\|if\|for\|while\|until\|case\|unless\|begin\|do\)\>' +" TODO: the do here should be restricted somewhat (only at end of line)? +" TODO: how about stuff like ...; if ... (perhasp too retarded to deal with?) +let s:end_start_regex = '\%(^\s*\%(\zs\<\%(module\|class\|def\|if\|for' . + \ '\|while\|until\|case\|unless\|begin\)\>' . + \ '\|\h\w*\s*=\s*\zs\<\%(if\|for\|while\|until\|case\|unless\|begin\)\>\)' . + \ '\|\\)' " Regex that defines the middle-match for the 'end' keyword. let s:end_middle_regex = '\<\%(ensure\|else\|rescue\|when\|elsif\)\>' @@ -229,19 +235,23 @@ function GetRubyIndent() " If we have a deindenting keyword, find its match and indent to its level. " TODO: this is messy if s:Match(v:lnum, s:ruby_deindent_keywords) - let lnum = s:PrevNonBlankNonString(v:lnum - 1) - - if lnum == 0 - return 0 - endif - - return indent(lnum) - &sw -" call cursor(v:lnum, 1) -" if searchpair(s:end_start_regex, s:end_middle_regex, s:end_end_regex, 'bW', -" \ s:end_skip_expr) > 0 -" let ind = indent('.') +" let lnum = s:PrevNonBlankNonString(v:lnum - 1) +" +" if lnum == 0 +" return 0 " endif -" return ind +" +" return indent(v:lnum) - &sw + call cursor(v:lnum, 1) + if searchpair(s:end_start_regex, s:end_middle_regex, s:end_end_regex, 'bW', + \ s:end_skip_expr) > 0 + if strpart(getline('.'), 0, col('.') - 1) =~ '=\s*' + let ind = virtcol('.') - 1 + else + let ind = indent('.') + endif + endif + return ind endif " If we are in a multi-line string or line-comment, don't do anything to it. From ed107f9ed07642a689cc7e3b1398720b19a0c350 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 27 Aug 2005 12:41:50 +0000 Subject: [PATCH 152/411] fix typo in rubyBlockParameter pattern --- ChangeLog | 4 ++++ syntax/ruby.vim | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index f5bb8187..e73addb6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-08-27 Doug Kearns + + * syntax/ruby.vim: fix typo in rubyBlockParameter pattern + 2005-08-26 Doug Kearns * syntax/ruby.vim: only match rubyBlockParameter after 'do' that is a diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 604bf6c4..1cd7f60d 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.65 2005/08/26 05:20:15 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.66 2005/08/27 12:41:50 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -76,7 +76,7 @@ syn match rubySymbol ":\@\|<=\|<\|===\|==\|=\~\|>>\|>=\| syn match rubySymbol ":\@_,;:!?/.'"@$*\&+0]\)" syn match rubySymbol ":\@\|{\)\s*\)\@<=|\s*\zs[( ,a-zA-Z0-9_*)]\+\ze\s*|" display +syn match rubyBlockParameter "\%(\%(\\|{\)\s*\)\@<=|\s*\zs[( ,a-zA-Z0-9_*)]\+\ze\s*|" display syn match rubyPredefinedVariable #$[!$&"'*+,./0:;<=>?@\`~1-9]# syn match rubyPredefinedVariable "$_\>" display From eee3d01c14eba0afcc3ce1eca875d8a3ec2f0f45 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 27 Aug 2005 12:51:16 +0000 Subject: [PATCH 153/411] fix regression in rubyOptDoBlock --- ChangeLog | 2 ++ syntax/ruby.vim | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index e73addb6..8ff15af3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2005-08-27 Doug Kearns + * syntax/ruby.vim: fix regression in rubyOptDoBlock + * syntax/ruby.vim: fix typo in rubyBlockParameter pattern 2005-08-26 Doug Kearns diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 1cd7f60d..6b8640ce 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.66 2005/08/27 12:41:50 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.67 2005/08/27 12:51:16 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -162,8 +162,8 @@ if !exists("ruby_no_expensive") syn region rubyNoDoBlock matchgroup=rubyControl start="\<\%(case\|begin\)\>" start="\%(^\|\.\.\.\=\|[;=([<>~+-\*/]\)\s*\zs\%(if\|unless\)\>" end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold " statement with optional *do* - syn region rubyOptDoLine matchgroup=rubyControl start="\<\%(for\|until\|while\)\>" end="\%(\\|:\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo - syn region rubyOptDoBlock start="\<\%(for\|until\|while\)\>" matchgroup=rubyControl end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo nextgroup=rubyOptDoLine fold + syn region rubyOptDoLine matchgroup=rubyControl2 start="\" start="\%(\%(^\|;\)\s*\)\@<=\<\%(until\|while\)\>" end="\%(\\|:\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo + syn region rubyOptDoBlock start="\" start="\%(\%(^\|;\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=rubyControl2 end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo nextgroup=rubyOptDoLine fold if !exists("ruby_minlines") let ruby_minlines = 50 From 9f1b67dc1134471673bb77c11c03cb9732acc987 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 27 Aug 2005 15:05:42 +0000 Subject: [PATCH 154/411] add Env.determine_home_dir to vim-ruby-install.rb --- ChangeLog | 3 +++ bin/vim-ruby-install.rb | 40 +++++++++++++++++++++++----------------- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8ff15af3..d0d73b86 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2005-08-27 Doug Kearns + * bin/vim-ruby-install.rb: add Env.determine_home_dir using + %HOMEDRIVE%%HOMEPATH% as HOME on windows if HOME is not explicitly set + * syntax/ruby.vim: fix regression in rubyOptDoBlock * syntax/ruby.vim: fix typo in rubyBlockParameter pattern diff --git a/bin/vim-ruby-install.rb b/bin/vim-ruby-install.rb index 8bca8eca..cc69c580 100755 --- a/bin/vim-ruby-install.rb +++ b/bin/vim-ruby-install.rb @@ -75,25 +75,31 @@ def Env.determine_source_directory # TODO: print warning if vim command not in PATH or appropriate key not in registry? def Env.determine_vim_dir installation_dir = ENV['VIM'] || - case Env.determine_target_os - when :UNIX - IO.popen('vim --version 2>/dev/null') do |version| - dir = version.read[/fall-back for \$VIM: "(.*)"/, 1] + case Env.determine_target_os + when :UNIX + IO.popen('vim --version 2>/dev/null') do |version| + dir = version.read[/fall-back for \$VIM: "(.*)"/, 1] + end + when :WINDOWS + require 'win32/registry' + path = '' + Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\Vim\Gvim') do |reg| + path = reg['path', Win32::Registry::REG_SZ] + end + dir = path.sub(/\\vim\d\d\\gvim.exe/i, '') unless path.empty? or path.nil? end - when :WINDOWS - require 'win32/registry' - path = '' - Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\Vim\Gvim') do |reg| - path = reg['path', Win32::Registry::REG_SZ] - end - # TODO: Does Registry#[] ever return nil? Exceptions? - unless path.empty? or path.nil? - dir = path.sub(/\\vim\d\d\\gvim.exe/i, '') - end - end return installation_dir end + def Env.determine_home_dir + home_dir = ENV['HOME'] || + case Env.determine_target_os + when :WINDOWS + ENV['HOMEDRIVE'] + ENV['HOMEPATH'] if ENV['HOMEDRIVE'] and ENV['HOMEPATH'] + end + return home_dir + end + def Env.ask_user(message) print message gets.strip @@ -229,7 +235,7 @@ def _potential_directories # Return the Vim system preferences directory def _vim_system_dir - vim_dir = ENV['VIM'] || Env.determine_vim_dir + vim_dir = Env.determine_vim_dir system_dir = vim_dir + "/vimfiles" if vim_dir return system_dir end @@ -237,7 +243,7 @@ def _vim_system_dir # Return the Vim user preferences directory def _vim_user_dir platform_dir = { :UNIX => "/.vim", :WINDOWS => "/vimfiles" } - home_dir = ENV['HOME'] + home_dir = Env.determine_home_dir user_dir = home_dir + platform_dir[Env.determine_target_os] if home_dir return user_dir end From ed2528a616dd122379a9815a0533f1fd844fe0e3 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 30 Aug 2005 10:54:04 +0000 Subject: [PATCH 155/411] remove rubyIterator HiLink command line --- ChangeLog | 4 ++++ syntax/ruby.vim | 11 +++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index d0d73b86..29cbd888 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-08-30 Doug Kearns + + * syntax/ruby.vim: remove rubyIterator HiLink command line + 2005-08-27 Doug Kearns * bin/vim-ruby-install.rb: add Env.determine_home_dir using diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 6b8640ce..f672eab4 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.67 2005/08/27 12:51:16 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.68 2005/08/30 10:54:04 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -79,10 +79,10 @@ syn region rubySymbol start=":\@\|{\)\s*\)\@<=|\s*\zs[( ,a-zA-Z0-9_*)]\+\ze\s*|" display syn match rubyPredefinedVariable #$[!$&"'*+,./0:;<=>?@\`~1-9]# -syn match rubyPredefinedVariable "$_\>" display -syn match rubyPredefinedVariable "$-[0FIKadilpvw]\>" display -syn match rubyPredefinedVariable "$\%(deferr\|defout\|stderr\|stdin\|stdout\)\>" display -syn match rubyPredefinedVariable "$\%(DEBUG\|FILENAME\|KCODE\|LOAD_PATH\|SAFE\|VERBOSE\)\>" display +syn match rubyPredefinedVariable "$_\>" display +syn match rubyPredefinedVariable "$-[0FIKadilpvw]\>" display +syn match rubyPredefinedVariable "$\%(deferr\|defout\|stderr\|stdin\|stdout\)\>" display +syn match rubyPredefinedVariable "$\%(DEBUG\|FILENAME\|KCODE\|LOAD_PATH\|SAFE\|VERBOSE\)\>" display syn match rubyPredefinedConstant "\%(\%(\.\@\%(\s*(\)\@!" syn match rubyPredefinedConstant "\%(\%(\.\@\%(\s*(\)\@!" syn match rubyPredefinedConstant "\%(\%(\.\@\%(\s*(\)\@!" @@ -252,7 +252,6 @@ if version >= 508 || !exists("did_ruby_syntax_inits") HiLink rubyConstant rubyIdentifier HiLink rubyGlobalVariable rubyIdentifier HiLink rubyBlockParameter rubyIdentifier - HiLink rubyIterator rubyBlockParameter " NOTE: deprecated HiLink rubyInstanceVariable rubyIdentifier HiLink rubyPredefinedIdentifier rubyIdentifier HiLink rubyPredefinedConstant rubyPredefinedIdentifier From eff828c6d75200ab121ac11e5c090da4b02404ce Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 1 Sep 2005 08:11:54 +0000 Subject: [PATCH 156/411] make sure that eRubyOneLiner cannot be extended over multiple lines --- ChangeLog | 5 +++++ syntax/eruby.vim | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 29cbd888..c563220f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-09-01 Doug Kearns + + * syntax/eruby.vim: make sure that eRubyOneLiner cannot be extended + over multiple lines + 2005-08-30 Doug Kearns * syntax/ruby.vim: remove rubyIterator HiLink command line diff --git a/syntax/eruby.vim b/syntax/eruby.vim index de85d92e..3ba5c0fc 100644 --- a/syntax/eruby.vim +++ b/syntax/eruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: eRuby " Maintainer: Doug Kearns -" Info: $Id: eruby.vim,v 1.1 2005/08/11 13:51:28 dkearns Exp $ +" Info: $Id: eruby.vim,v 1.2 2005/09/01 08:11:54 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -33,7 +33,7 @@ else syn include @rubyTop syntax/ruby.vim endif -syn region erubyOneLiner matchgroup=erubyDelimiter start="^\s*\zs%" end="$" contains=@rubyTop,erubyDelimiter keepend +syn region erubyOneLiner matchgroup=erubyDelimiter start="^\s*\zs%" end="$" contains=@rubyTop,erubyDelimiter keepend oneline syn region erubyBlock matchgroup=erubyDelimiter start="<%=\=" end="%>" contains=@rubyTop containedin=ALLBUT,erubyComment keepend syn region erubyComment matchgroup=erubyDelimiter start="<%#" end="%>" keepend From 3687339eaaad6fec51a3d243585f2a54fdf6e7bb Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 1 Sep 2005 10:55:59 +0000 Subject: [PATCH 157/411] make sure that eRubyOneLiner starts at the very beginning of a line --- ChangeLog | 3 +++ syntax/eruby.vim | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c563220f..0f59c706 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2005-09-01 Doug Kearns + * syntax/eruby.vim: make sure that eRubyOneLiner starts at the + very beginning of a line + * syntax/eruby.vim: make sure that eRubyOneLiner cannot be extended over multiple lines diff --git a/syntax/eruby.vim b/syntax/eruby.vim index 3ba5c0fc..36466e18 100644 --- a/syntax/eruby.vim +++ b/syntax/eruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: eRuby " Maintainer: Doug Kearns -" Info: $Id: eruby.vim,v 1.2 2005/09/01 08:11:54 dkearns Exp $ +" Info: $Id: eruby.vim,v 1.3 2005/09/01 10:55:59 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -33,9 +33,9 @@ else syn include @rubyTop syntax/ruby.vim endif -syn region erubyOneLiner matchgroup=erubyDelimiter start="^\s*\zs%" end="$" contains=@rubyTop,erubyDelimiter keepend oneline -syn region erubyBlock matchgroup=erubyDelimiter start="<%=\=" end="%>" contains=@rubyTop containedin=ALLBUT,erubyComment keepend -syn region erubyComment matchgroup=erubyDelimiter start="<%#" end="%>" keepend +syn region erubyOneLiner matchgroup=erubyDelimiter start="^%" end="$" contains=@rubyTop,erubyDelimiter keepend oneline +syn region erubyBlock matchgroup=erubyDelimiter start="<%=\=" end="%>" contains=@rubyTop containedin=ALLBUT,erubyComment keepend +syn region erubyComment matchgroup=erubyDelimiter start="<%#" end="%>" keepend " Define the default highlighting. " For version 5.7 and earlier: only when not done already From 0f28e0def7641a98f57ecd5f285bf69cc1e61a4b Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 1 Sep 2005 15:57:11 +0000 Subject: [PATCH 158/411] general improvements to eRuby highlighting --- ChangeLog | 5 +++++ syntax/eruby.vim | 10 +++++----- syntax/ruby.vim | 6 +++++- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0f59c706..39a92bf8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2005-09-01 Doug Kearns + * syntax/eruby.vim, syntax/ruby.vim: split erubyBlock into erubyBlock + and erubyExpression; allow expressions inside blocks; set + ruby_no_expensive if highlighting eRuby; add spell checking and + rubyTodo to erubyComment + * syntax/eruby.vim: make sure that eRubyOneLiner starts at the very beginning of a line diff --git a/syntax/eruby.vim b/syntax/eruby.vim index 36466e18..ea0fe20d 100644 --- a/syntax/eruby.vim +++ b/syntax/eruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: eRuby " Maintainer: Doug Kearns -" Info: $Id: eruby.vim,v 1.3 2005/09/01 10:55:59 dkearns Exp $ +" Info: $Id: eruby.vim,v 1.4 2005/09/01 15:57:11 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -10,7 +10,6 @@ " but WITHOUT ANY WARRANTY; without even the implied warranty of " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the " GNU General Public License for more details. -" ---------------------------------------------------------------------------- " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded @@ -33,9 +32,10 @@ else syn include @rubyTop syntax/ruby.vim endif -syn region erubyOneLiner matchgroup=erubyDelimiter start="^%" end="$" contains=@rubyTop,erubyDelimiter keepend oneline -syn region erubyBlock matchgroup=erubyDelimiter start="<%=\=" end="%>" contains=@rubyTop containedin=ALLBUT,erubyComment keepend -syn region erubyComment matchgroup=erubyDelimiter start="<%#" end="%>" keepend +syn region erubyOneLiner matchgroup=erubyDelimiter start="^%" end="$" contains=@rubyTop containedin=ALLBUT,erubyBlock,erubyComment,erubyExpression keepend oneline +syn region erubyBlock matchgroup=erubyDelimiter start="<%" end="%>" contains=@rubyTop containedin=ALLBUT,erubyBlock,erubyComment,erubyExpression +syn region erubyExpression matchgroup=erubyDelimiter start="<%=" end="%>" contains=@rubyTop containedin=ALLBUT,erubyComment,erubyExpression +syn region erubyComment matchgroup=erubyDelimiter start="<%#" end="%>" contains=rubyTodo,@Spell containedin=ALLBUT,erubyBlock,erubyComment,erubyExpression keepend " Define the default highlighting. " For version 5.7 and earlier: only when not done already diff --git a/syntax/ruby.vim b/syntax/ruby.vim index f672eab4..80f966e8 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.68 2005/08/30 10:54:04 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.69 2005/09/01 15:57:11 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -138,6 +138,10 @@ syn region rubyString start=+\%(\%(class\s*\|\%(\.\|::\)\)\_s*\)\@ Date: Thu, 1 Sep 2005 16:35:57 +0000 Subject: [PATCH 159/411] add new eruby compiler plugin --- ChangeLog | 3 +++ bin/vim-ruby-install.rb | 1 + compiler/eruby.vim | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 compiler/eruby.vim diff --git a/ChangeLog b/ChangeLog index 39a92bf8..3be22bda 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2005-09-01 Doug Kearns + * bin/vim-ruby-install.rb, compiler/eruby.vim: add new eruby compiler + plugin + * syntax/eruby.vim, syntax/ruby.vim: split erubyBlock into erubyBlock and erubyExpression; allow expressions inside blocks; set ruby_no_expensive if highlighting eRuby; add spell checking and diff --git a/bin/vim-ruby-install.rb b/bin/vim-ruby-install.rb index cc69c580..8e7a3355 100755 --- a/bin/vim-ruby-install.rb +++ b/bin/vim-ruby-install.rb @@ -18,6 +18,7 @@ require 'pathname' SOURCE_FILES = %w{ + compiler/eruby.vim compiler/ruby.vim compiler/rubyunit.vim ftdetect/ruby.vim diff --git a/compiler/eruby.vim b/compiler/eruby.vim new file mode 100644 index 00000000..12873d6d --- /dev/null +++ b/compiler/eruby.vim @@ -0,0 +1,35 @@ +" Vim compiler file +" Language: eRuby +" Maintainer: Doug Kearns +" Info: $Id: eruby.vim,v 1.1 2005/09/01 16:35:57 dkearns Exp $ +" URL: http://vim-ruby.sourceforge.net +" Anon CVS: See above site +" Licence: GPL (http://www.gnu.org) +" Disclaimer: +" This program is distributed in the hope that it will be useful, +" but WITHOUT ANY WARRANTY; without even the implied warranty of +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +" GNU General Public License for more details. +" ---------------------------------------------------------------------------- + +if exists("current_compiler") + finish +endif +let current_compiler = "rubyunit" + +if exists(":CompilerSet") != 2 " older Vim always used :setlocal + command -nargs=* CompilerSet setlocal +endif + +let s:cpo_save = &cpo +set cpo-=C + +CompilerSet makeprg=eruby + +CompilerSet errorformat=%E%f:%l:%m, + \%-G%.%# + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: nowrap ts=8 ff=unix From 5d68dee7927fa4c3dbfe5f6f0f8425a6c6c4a702 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 2 Sep 2005 06:14:03 +0000 Subject: [PATCH 160/411] match eruby specific 'compiler' error messages --- ChangeLog | 5 +++++ compiler/eruby.vim | 9 ++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3be22bda..7c27c91f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-09-02 Doug Kearns + + * compiler/eruby.vim: match eruby specific error messages and parse + the error's column number when provided + 2005-09-01 Doug Kearns * bin/vim-ruby-install.rb, compiler/eruby.vim: add new eruby compiler diff --git a/compiler/eruby.vim b/compiler/eruby.vim index 12873d6d..f36f3470 100644 --- a/compiler/eruby.vim +++ b/compiler/eruby.vim @@ -1,7 +1,7 @@ " Vim compiler file " Language: eRuby " Maintainer: Doug Kearns -" Info: $Id: eruby.vim,v 1.1 2005/09/01 16:35:57 dkearns Exp $ +" Info: $Id: eruby.vim,v 1.2 2005/09/02 06:14:03 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -15,7 +15,7 @@ if exists("current_compiler") finish endif -let current_compiler = "rubyunit" +let current_compiler = "eruby" if exists(":CompilerSet") != 2 " older Vim always used :setlocal command -nargs=* CompilerSet setlocal @@ -26,7 +26,10 @@ set cpo-=C CompilerSet makeprg=eruby -CompilerSet errorformat=%E%f:%l:%m, +CompilerSet errorformat=eruby:\ %f:%l:%m, + \%E%f:%l:\ %m, + \%-Z%p^, + \%C%m, \%-G%.%# let &cpo = s:cpo_save From 4b83f9fb8cacd40609390592820a0b07a8639f21 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 2 Sep 2005 14:45:32 +0000 Subject: [PATCH 161/411] merge most features from Ned Konz's ftplugin --- ChangeLog | 2 ++ ftplugin/ruby.vim | 54 ++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 53 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7c27c91f..87c5eccd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,6 @@ 2005-09-02 Doug Kearns + + * ftplugin/ruby.vim: merge most features from Ned Konz's ftplugin * compiler/eruby.vim: match eruby specific error messages and parse the error's column number when provided diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index e220012f..f5ad144d 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,11 +1,11 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.7 2004/01/10 23:06:11 gsinclair Exp $ +" Info: $Id: ruby.vim,v 1.8 2005/09/02 14:45:32 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net -" Anon CVS: See above site +" Anon CVS: See above site " Licence: GPL (http://www.gnu.org) -" Disclaimer: +" Disclaimer: " This program is distributed in the hope that it will be useful, " but WITHOUT ANY WARRANTY; without even the implied warranty of " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -22,6 +22,9 @@ if (exists("b:did_ftplugin")) endif let b:did_ftplugin = 1 +let s:cpo_save = &cpo +set cpo&vim + " Matchit support if exists("loaded_matchit") && !exists("b:match_words") let b:match_ignorecase = 0 @@ -30,8 +33,53 @@ if exists("loaded_matchit") && !exists("b:match_words") \ '\|for\|if\|unless\|def\|case\)\|\:' . \ '\<\%(else\|elsif\|ensure\|rescue\|when\)\>:' . \ '\%(^\|[^.]\)\@<=\' + let b:match_skip = + \ "synIDattr(synID(line('.'),col('.'),0),'name') =~ '" . + \ "\'" + endif +setlocal formatoptions-=t formatoptions+=croql + +setlocal include=^\\s*\\<\\(load\\\|\w*require\\)\\> +setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'$','.rb','') +setlocal suffixesadd=.rb + +" TODO: +"setlocal define=^\\s*def + +setlocal comments=:# +setlocal commentstring=#\ %s + +if !exists("s:rubypath") + if executable("ruby") + if &shellxquote == "'" + let s:rubypath = system('ruby -e "print $:.join(%q{,})"' ) + else + let s:rubypath = system("ruby -e 'print $:.join(%q{,})'" ) + endif + let s:rubypath = substitute(s:rubypath,',.$',',,','') + else + " If we can't call ruby to get its path, just default to using the + " current directory and the directory of the current file. + let s:rubypath = ".,," + endif +endif + +let &l:path = s:rubypath + +if has("gui_win32") && !exists("b:browsefilter") + let b:browsefilter = "Ruby Source Files (*.rb)\t*.rb\n" . + \ "All Files (*.*)\t*.*\n" +endif + +let b:undo_ftplugin = "setl fo< inc< inex< sua< def< com< cms< path< " + \ "| unlet! b:browsefilter b:match_ignorecase b:match_words b:match_skip" + +let &cpo = s:cpo_save +unlet s:cpo_save + " " Instructions for enabling "matchit" support: " From 80eb62805c4a3e6e159a7dcf9ae6c438e03f16ea Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 2 Sep 2005 14:51:55 +0000 Subject: [PATCH 162/411] add new eRuby ftplugin --- ChangeLog | 2 ++ ftplugin/eruby.vim | 79 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 ftplugin/eruby.vim diff --git a/ChangeLog b/ChangeLog index 87c5eccd..2481d88c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2005-09-02 Doug Kearns + * ftplugin/eruby.vim: add new eRuby ftplugin + * ftplugin/ruby.vim: merge most features from Ned Konz's ftplugin * compiler/eruby.vim: match eruby specific error messages and parse diff --git a/ftplugin/eruby.vim b/ftplugin/eruby.vim new file mode 100644 index 00000000..4bf5adcb --- /dev/null +++ b/ftplugin/eruby.vim @@ -0,0 +1,79 @@ +" Vim filetype plugin +" Language: eRuby +" Maintainer: Doug Kearns +" Info: $Id: eruby.vim,v 1.1 2005/09/02 14:51:55 dkearns Exp $ +" URL: http://vim-ruby.sourceforge.net +" Anon CVS: See above site +" Licence: GPL (http://www.gnu.org) +" Disclaimer: +" This program is distributed in the hope that it will be useful, +" but WITHOUT ANY WARRANTY; without even the implied warranty of +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +" GNU General Public License for more details. +" ---------------------------------------------------------------------------- + +" Only do this when not done yet for this buffer +if (exists("b:did_ftplugin")) + finish +endif + +let s:save_cpo = &cpo +set cpo-=C + +" Define some defaults in case the included ftplugins don't set them. +let s:undo_ftplugin = "" +let s:browsefilter = "Ruby Files (*.rb)\t*.rb\n" . + \ "HTML Files (*.html, *.htm)\t*.html;*.htm\n" . + \ "All Files (*.*)\t*.*\n" +let s:match_words = "" + +runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim +unlet b:did_ftplugin + +" Override our defaults if these were set by an included ftplugin. +if exists("b:undo_ftplugin") + let s:undo_ftplugin = b:undo_ftplugin + unlet b:undo_ftplugin +endif +if exists("b:browsefilter") + let s:browsefilter = b:browsefilter + unlet b:browsefilter +endif +if exists("b:match_words") + let s:match_words = b:match_words + unlet b:match_words +endif + +runtime! ftplugin/ruby.vim ftplugin/ruby_*.vim ftplugin/ruby/*.vim +let b:did_ftplugin = 1 + +" Combine the new set of values with those previously included. +if exists("b:undo_ftplugin") + let s:undo_ftplugin = b:undo_ftplugin . " | " . s:undo_ftplugin +endif +if exists ("b:browsefilter") + let s:browsefilter = b:browsefilter . s:browsefilter +endif +if exists("b:match_words") + let s:match_words = b:match_words . ',' . s:match_words +endif + +" Change the browse dialog on Win32 to show mainly eRuby-related files +if has("gui_win32") + let b:browsefilter="eRuby Files (*.rhtml)\t*.rhtml\n" . s:browsefilter +endif + +" Load the combined list of match_words for matchit.vim +if exists("loaded_matchit") + let b:match_words = s:match_words +endif + +" TODO: comments= +setlocal commentstring=<%#%s%> + +let b:undo_ftplugin = "setl cms< " + \ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin + +let &cpo = s:save_cpo + +" vim: sw=2 sts=2 ts=8 ff=unix: From 58b5b8f45b235bba762e8cd1de20d487f7090f92 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 2 Sep 2005 14:55:35 +0000 Subject: [PATCH 163/411] add ftplugin/eruby.vim to installer's list of source files --- ChangeLog | 3 +++ bin/vim-ruby-install.rb | 1 + 2 files changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2481d88c..265e5a74 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2005-09-02 Doug Kearns + * bin/vim-ruby-install.rb: add ftplugin/eruby.vim to list of source + files + * ftplugin/eruby.vim: add new eRuby ftplugin * ftplugin/ruby.vim: merge most features from Ned Konz's ftplugin diff --git a/bin/vim-ruby-install.rb b/bin/vim-ruby-install.rb index 8e7a3355..67cc6bd6 100755 --- a/bin/vim-ruby-install.rb +++ b/bin/vim-ruby-install.rb @@ -22,6 +22,7 @@ compiler/ruby.vim compiler/rubyunit.vim ftdetect/ruby.vim + ftplugin/eruby.vim ftplugin/ruby.vim indent/ruby.vim syntax/eruby.vim From 9dccdbc42587709d0f371556a57e72e74c24488b Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 3 Sep 2005 14:49:11 +0000 Subject: [PATCH 164/411] highlight if/unless expressions after the %, ^, | and & operators --- ChangeLog | 5 +++++ syntax/ruby.vim | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 265e5a74..ec57332f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-09-03 Doug Kearns + + * syntax/ruby.vim: allow if/unless expressions after the %, ^, | and & + operators + 2005-09-02 Doug Kearns * bin/vim-ruby-install.rb: add ftplugin/eruby.vim to list of source diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 80f966e8..6940a4c5 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.69 2005/09/01 15:57:11 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.70 2005/09/03 14:49:11 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -163,7 +163,7 @@ if !exists("ruby_no_expensive") syn region rubyCurlyBlock start="{" end="}" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold " statements without *do* - syn region rubyNoDoBlock matchgroup=rubyControl start="\<\%(case\|begin\)\>" start="\%(^\|\.\.\.\=\|[;=([<>~+-\*/]\)\s*\zs\%(if\|unless\)\>" end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold + syn region rubyNoDoBlock matchgroup=rubyControl start="\<\%(case\|begin\)\>" start="\%(^\|\.\.\.\=\|[;=([<>~+-\*/%!&^|]\)\s*\zs\%(if\|unless\)\>" end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold " statement with optional *do* syn region rubyOptDoLine matchgroup=rubyControl2 start="\" start="\%(\%(^\|;\)\s*\)\@<=\<\%(until\|while\)\>" end="\%(\\|:\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo From 4c72c4203f64ef10f380df808977718c8a3d57fe Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 6 Sep 2005 15:16:52 +0000 Subject: [PATCH 165/411] move hyphen to end of collection in rubyNoDoBlock pattern --- ChangeLog | 5 +++++ syntax/ruby.vim | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ec57332f..e377a188 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-09-06 Doug Kearns + + * syntax/ruby.vim: move hyphen to end of collection in rubyNoDoBlock + pattern + 2005-09-03 Doug Kearns * syntax/ruby.vim: allow if/unless expressions after the %, ^, | and & diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 6940a4c5..1a2058d4 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.70 2005/09/03 14:49:11 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.71 2005/09/06 15:16:52 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -163,7 +163,7 @@ if !exists("ruby_no_expensive") syn region rubyCurlyBlock start="{" end="}" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold " statements without *do* - syn region rubyNoDoBlock matchgroup=rubyControl start="\<\%(case\|begin\)\>" start="\%(^\|\.\.\.\=\|[;=([<>~+-\*/%!&^|]\)\s*\zs\%(if\|unless\)\>" end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold + syn region rubyNoDoBlock matchgroup=rubyControl start="\<\%(case\|begin\)\>" start="\%(^\|\.\.\.\=\|[;=([<>~\*/%!&^|+-]\)\s*\zs\%(if\|unless\)\>" end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold " statement with optional *do* syn region rubyOptDoLine matchgroup=rubyControl2 start="\" start="\%(\%(^\|;\)\s*\)\@<=\<\%(until\|while\)\>" end="\%(\\|:\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo From 1cc40b3b7e1bb870e6df6e39aeccd7ef87d9e8b1 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 8 Sep 2005 07:46:02 +0000 Subject: [PATCH 166/411] update filetype/ to ftdetect/ in FileList in Rakefile --- ChangeLog | 8 ++++++++ Rakefile | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e377a188..f62c125c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-09-08 Doug Kearns + + * Rakefile: update filetype/ to ftdetect/ in FileList + +2005-09-07 Doug Kearns + + * ftplugin/ruby.vim: improve b:match_words pattern + 2005-09-06 Doug Kearns * syntax/ruby.vim: move hyphen to end of collection in rubyNoDoBlock diff --git a/Rakefile b/Rakefile index c03a5ca2..19e54f9f 100644 --- a/Rakefile +++ b/Rakefile @@ -4,7 +4,7 @@ require 'rake/gempackagetask' PACKAGE_NAME = 'vim-ruby' RELEASE_FILES = FileList[ 'README', 'ChangeLog', 'bin/*.rb', - '{compiler,filetype,ftplugin,indent,syntax}/*.vim' + '{compiler,ftdetect,ftplugin,indent,syntax}/*.vim' ] PACKAGE_VERSION = Time.now.strftime('%Y.%m.%d') From 7c1c31c6cd564d1499693d9f2b3a84dc395ed99d Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 8 Sep 2005 08:22:40 +0000 Subject: [PATCH 167/411] escape \'s in b:match_skip pattern --- ChangeLog | 2 ++ ftplugin/ruby.vim | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index f62c125c..00a17b28 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2005-09-08 Doug Kearns + * ftplugin/ruby.vim: escape \'s in b:match_skip pattern + * Rakefile: update filetype/ to ftdetect/ in FileList 2005-09-07 Doug Kearns diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index f5ad144d..a8a2f3b9 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.8 2005/09/02 14:45:32 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.9 2005/09/08 08:22:40 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -12,7 +12,7 @@ " GNU General Public License for more details. " ---------------------------------------------------------------------------- " -" Matchit support thanks to Ned Konz. See his ftplugin/ruby.vim at +" Original matchit support thanks to Ned Konz. See his ftplugin/ruby.vim at " http://bike-nomad.com/vim/ruby.vim. " ---------------------------------------------------------------------------- @@ -35,8 +35,8 @@ if exists("loaded_matchit") && !exists("b:match_words") \ '\%(^\|[^.]\)\@<=\' let b:match_skip = \ "synIDattr(synID(line('.'),col('.'),0),'name') =~ '" . - \ "\'" + \ "\\'" endif @@ -110,4 +110,4 @@ unlet s:cpo_save " differs on Windows. Email gsinclair@soyabean.com.au if you need help. " -" vim: sw=2 sts=2 ts=8 ff=unix: +" vim: nowrap sw=2 sts=2 ts=8 ff=unix: From acb3e79e3808a2923e0dbb8f89c4ca9aefd0e1ff Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 8 Sep 2005 11:09:52 +0000 Subject: [PATCH 168/411] add CONTRIBUTORS file to FileList in Rakefile --- ChangeLog | 2 ++ Rakefile | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 00a17b28..aef9fba7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2005-09-08 Doug Kearns + * Rakefile: add CONTRIBUTORS file to FileList + * ftplugin/ruby.vim: escape \'s in b:match_skip pattern * Rakefile: update filetype/ to ftdetect/ in FileList diff --git a/Rakefile b/Rakefile index 19e54f9f..f57a817d 100644 --- a/Rakefile +++ b/Rakefile @@ -3,7 +3,7 @@ require 'rake/gempackagetask' PACKAGE_NAME = 'vim-ruby' RELEASE_FILES = FileList[ - 'README', 'ChangeLog', 'bin/*.rb', + 'README', 'ChangeLog', 'CONTRIBUTORS', 'bin/*.rb', '{compiler,ftdetect,ftplugin,indent,syntax}/*.vim' ] PACKAGE_VERSION = Time.now.strftime('%Y.%m.%d') From 40c2b6491a40c408eeddca9282cd19c0e25ba876 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 8 Sep 2005 12:55:31 +0000 Subject: [PATCH 169/411] add -z option to cvsrelease call in release.sh to create a zip release file --- ChangeLog | 3 +++ etc/release/release.sh | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index aef9fba7..ed5f1bf2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2005-09-08 Doug Kearns + * etc/release/release.sh: add -z to cvsrelease call to create a zip + release file as well as a tar.gz + * Rakefile: add CONTRIBUTORS file to FileList * ftplugin/ruby.vim: escape \'s in b:match_skip pattern diff --git a/etc/release/release.sh b/etc/release/release.sh index 556cf996..e15ef4d7 100755 --- a/etc/release/release.sh +++ b/etc/release/release.sh @@ -15,5 +15,5 @@ release_tag=$1 release_number=$2 export CVSROOT=`cat CVS/Root` -cvsrelease -t $release_tag -r $release_number vim-ruby +cvsrelease -z -t $release_tag -r $release_number vim-ruby From 59c1e9d82ff278dfaded1d5eb78c1e5d9895bf02 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 8 Sep 2005 14:07:37 +0000 Subject: [PATCH 170/411] normalise vim modelines --- ChangeLog | 4 ++++ Rakefile | 2 +- compiler/eruby.vim | 4 ++-- compiler/ruby.vim | 4 ++-- compiler/rubyunit.vim | 4 ++-- ftplugin/eruby.vim | 4 ++-- indent/ruby.vim | 4 +++- syntax/eruby.vim | 4 ++-- syntax/ruby.vim | 4 ++-- 9 files changed, 20 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index ed5f1bf2..c0831830 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2005-09-08 Doug Kearns + * ChangeLog, Rakefile, compiler/eruby.vim, compiler/rubyunit.vim, + compiler/ruby.vim, ftplugin/eruby.vim, indent/ruby.vim, + syntax/eruby.vim, syntax/ruby.vim: normalise vim modelines + * etc/release/release.sh: add -z to cvsrelease call to create a zip release file as well as a tar.gz diff --git a/Rakefile b/Rakefile index f57a817d..6176f562 100644 --- a/Rakefile +++ b/Rakefile @@ -39,4 +39,4 @@ end # Supporting methods -# vim: ft=ruby +# vim: nowrap sw=2 sts=2 ts=8 ff=unix ft=ruby: diff --git a/compiler/eruby.vim b/compiler/eruby.vim index f36f3470..3ebaddad 100644 --- a/compiler/eruby.vim +++ b/compiler/eruby.vim @@ -1,7 +1,7 @@ " Vim compiler file " Language: eRuby " Maintainer: Doug Kearns -" Info: $Id: eruby.vim,v 1.2 2005/09/02 06:14:03 dkearns Exp $ +" Info: $Id: eruby.vim,v 1.3 2005/09/08 14:07:37 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -35,4 +35,4 @@ CompilerSet errorformat=eruby:\ %f:%l:%m, let &cpo = s:cpo_save unlet s:cpo_save -" vim: nowrap ts=8 ff=unix +" vim: nowrap sw=2 sts=2 ts=8 ff=unix: diff --git a/compiler/ruby.vim b/compiler/ruby.vim index b94b3232..cdcaf812 100644 --- a/compiler/ruby.vim +++ b/compiler/ruby.vim @@ -2,7 +2,7 @@ " Language: Ruby " Function: Syntax check and/or error reporting " Maintainer: Tim Hammerquist -" Info: $Id: ruby.vim,v 1.9 2004/11/27 14:44:37 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.10 2005/09/08 14:07:37 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -70,4 +70,4 @@ CompilerSet errorformat= let &cpo = s:cpo_save unlet s:cpo_save -" vim: ft=vim ff=unix +" vim: nowrap sw=2 sts=2 ts=8 ff=unix: diff --git a/compiler/rubyunit.vim b/compiler/rubyunit.vim index e55e99da..c0d81c25 100644 --- a/compiler/rubyunit.vim +++ b/compiler/rubyunit.vim @@ -1,7 +1,7 @@ " Vim compiler file " Language: Test::Unit - Ruby Unit Testing Framework " Maintainer: Doug Kearns -" Info: $Id: rubyunit.vim,v 1.5 2004/11/27 14:44:37 dkearns Exp $ +" Info: $Id: rubyunit.vim,v 1.6 2005/09/08 14:07:37 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -40,4 +40,4 @@ CompilerSet errorformat=\%Etest%[%^\ ]%#(%[%^\ ]%#)\ [%f:%l]:, let &cpo = s:cpo_save unlet s:cpo_save -" vim: nowrap ts=8 ff=unix +" vim: nowrap sw=2 sts=2 ts=8 ff=unix: diff --git a/ftplugin/eruby.vim b/ftplugin/eruby.vim index 4bf5adcb..16eb7935 100644 --- a/ftplugin/eruby.vim +++ b/ftplugin/eruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: eRuby " Maintainer: Doug Kearns -" Info: $Id: eruby.vim,v 1.1 2005/09/02 14:51:55 dkearns Exp $ +" Info: $Id: eruby.vim,v 1.2 2005/09/08 14:07:37 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -76,4 +76,4 @@ let b:undo_ftplugin = "setl cms< " let &cpo = s:save_cpo -" vim: sw=2 sts=2 ts=8 ff=unix: +" vim: nowrap sw=2 sts=2 ts=8 ff=unix: diff --git a/indent/ruby.vim b/indent/ruby.vim index d22644e7..9399a14e 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -2,7 +2,7 @@ " Language: Ruby " Maintainer: Gavin Sinclair " Developer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.24 2005/08/26 19:48:41 pcp Exp $ +" Info: $Id: ruby.vim,v 1.25 2005/09/08 14:07:37 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org/ " Anon CVS: See above site @@ -371,3 +371,5 @@ endfunction let &cpo = s:cpo_save unlet s:cpo_save + +" vim: nowrap sw=2 sts=2 ts=8 ff=unix: diff --git a/syntax/eruby.vim b/syntax/eruby.vim index ea0fe20d..89cd42bd 100644 --- a/syntax/eruby.vim +++ b/syntax/eruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: eRuby " Maintainer: Doug Kearns -" Info: $Id: eruby.vim,v 1.4 2005/09/01 15:57:11 dkearns Exp $ +" Info: $Id: eruby.vim,v 1.5 2005/09/08 14:07:37 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -59,4 +59,4 @@ if main_syntax == 'eruby' unlet main_syntax endif -" vim: sw=2 sts=2 ts=8 ff=unix nowrap: +" vim: nowrap sw=2 sts=2 ts=8 ff=unix: diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 1a2058d4..f97d2ed2 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.71 2005/09/06 15:16:52 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.72 2005/09/08 14:07:37 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -289,4 +289,4 @@ endif let b:current_syntax = "ruby" -" vim: sw=2 sts=2 ts=8 ff=unix nowrap: +" vim: nowrap sw=2 sts=2 ts=8 ff=unix: From a7213d5c0c6ff8e4e38f0bb655a18fff47a2bf59 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 8 Sep 2005 14:20:44 +0000 Subject: [PATCH 171/411] rescue Win32::Registry::Error when accessing the Windows registry when installing --- ChangeLog | 3 ++ bin/vim-ruby-install.rb | 117 ++++++++++++++++++++-------------------- 2 files changed, 63 insertions(+), 57 deletions(-) diff --git a/ChangeLog b/ChangeLog index c0831830..7d9d37d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2005-09-08 Doug Kearns + * bin/vim-ruby-install.rb: rescue Win32::Registry::Error when + accessing the Windows registry + * ChangeLog, Rakefile, compiler/eruby.vim, compiler/rubyunit.vim, compiler/ruby.vim, ftplugin/eruby.vim, indent/ruby.vim, syntax/eruby.vim, syntax/ruby.vim: normalise vim modelines diff --git a/bin/vim-ruby-install.rb b/bin/vim-ruby-install.rb index 67cc6bd6..90ab2488 100755 --- a/bin/vim-ruby-install.rb +++ b/bin/vim-ruby-install.rb @@ -29,9 +29,9 @@ syntax/ruby.vim } #FIXME: ftdetect/ruby.vim - vim 6.3+ only. This won't cause problems for -# earlier versions; it just won't work! For versions less than 6.2 we -# need to create a filetype.vim file and add it to the root of the -# runtime directory. +# earlier versions; it just won't work! For versions less than 6.2 we +# need to create a filetype.vim file and add it to the root of the +# runtime directory. # # Miscellaneous functions in the user's environment. @@ -51,7 +51,7 @@ def Env.determine_target_os # # Returns the path to the directory where the vim configuration files will be copied from. - # The first preference is the directory above this script. If that fails, we look for the + # The first preference is the directory above this script. If that fails, we look for the # RubyGems package 'vim-ruby'. Failing that, we return +nil+. # def Env.determine_source_directory @@ -68,7 +68,7 @@ def Env.determine_source_directory #vim_ruby_gem_dir = Gem.latest_load_paths.grep(%r{gems/vim-ruby}).last vim_ruby_gem_dir = Gem.all_load_paths.grep(%r{gems/vim-ruby}).sort.last if vim_ruby_gem_dir and _valid_vim_ruby_dir(vim_ruby_gem_dir) - return vim_ruby_gem_dir + return vim_ruby_gem_dir end return nil end @@ -83,12 +83,15 @@ def Env.determine_vim_dir dir = version.read[/fall-back for \$VIM: "(.*)"/, 1] end when :WINDOWS - require 'win32/registry' - path = '' - Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\Vim\Gvim') do |reg| - path = reg['path', Win32::Registry::REG_SZ] + begin + require 'win32/registry' + Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\Vim\Gvim') do |reg| + path = reg['path', Win32::Registry::REG_SZ] + dir = path.sub(/\\vim\d\d\\gvim.exe/i, '') + end + rescue Win32::Registry::Error + nil end - dir = path.sub(/\\vim\d\d\\gvim.exe/i, '') unless path.empty? or path.nil? end return installation_dir end @@ -97,7 +100,7 @@ def Env.determine_home_dir home_dir = ENV['HOME'] || case Env.determine_target_os when :WINDOWS - ENV['HOMEDRIVE'] + ENV['HOMEPATH'] if ENV['HOMEDRIVE'] and ENV['HOMEPATH'] + ENV['HOMEDRIVE'] + ENV['HOMEPATH'] if ENV['HOMEDRIVE'] and ENV['HOMEPATH'] end return home_dir end @@ -114,7 +117,7 @@ def Env._valid_vim_ruby_dir(dir) return SOURCE_FILES.all? { |path| FileTest.file?(path) } end end - + end # class Env @@ -122,11 +125,11 @@ def Env._valid_vim_ruby_dir(dir) # A FileWriter writes files with pre-selected line endings and permissions. # # writer = FileWriter.new(:UNIX, 0664) - # writer.copy(source, target) + # writer.copy(source, target) # class FileWriter LINE_ENDINGS = { :UNIX => "\n", :WINDOWS => "\r\n" } - + def initialize(ending, file_permissions=0644, directory_permissions=0755) @ending = LINE_ENDINGS[ending] or raise "No/invalid line ending given: #{ending}" @permissions = { @@ -141,7 +144,7 @@ def copy(source_path, target_path) target_path.open('wb', @permissions[:file]) do |io| lines = source_path.read.split("\n") lines.each do |line| - io.write(line.chomp + @ending) + io.write(line.chomp + @ending) end end puts "#{source_path.to_s.ljust(25)} -> #{target_path}" @@ -162,7 +165,7 @@ def _ensure_directory_exists(path) # - # Represents the target base directory for installs. Handles writing the files through a + # Represents the target base directory for installs. Handles writing the files through a # given FileWriter. # class TargetDirectory @@ -194,7 +197,7 @@ def path # class TargetDirectory::Finder - # Guides the user through a selection process, ending in a chosen directory. + # Guides the user through a selection process, ending in a chosen directory. def find_target_directory # 1. Was a directory specified using the --directory option? if option_dir = $options[:target_dir] @@ -205,15 +208,15 @@ def find_target_directory puts puts "Possible Vim installation directories:" dirs.each_with_index do |dir, idx| - puts " #{idx+1}) #{dir}" + puts " #{idx+1}) #{dir}" end - puts + puts r = Env.ask_user "Please select one (or anything else to specify another directory): " if (1..dirs.size).include? r.to_i - chosen_directory = dirs[r.to_i - 1] - return chosen_directory + chosen_directory = dirs[r.to_i - 1] + return chosen_directory end - end + end # 3. We didn't find any, or the user wants to enter another. if dirs.empty? puts @@ -223,8 +226,8 @@ def find_target_directory entered_directory = File.expand_path(entered_directory) return entered_directory end - - private + + private # Return an array of _potential_ directories (i.e. they exist). Take the options into # account. @@ -255,7 +258,7 @@ def _vim_user_dir # # VimRubyInstaller is the class that copies the files from the source directory to the target - # directory, both of which are provided. + # directory, both of which are provided. # class VimRubyInstaller @@ -280,24 +283,24 @@ def install backupdir = BackupDir.new("./vim-ruby-backup.#{Process.pid}") Dir.chdir(@source_dir) do SOURCE_FILES.each do |path| - source_path = Pathname.new(path) - target_path = @target_dir[path] - if target_path.file? and target_path.mtime > source_path.mtime - # We're going to overwrite a newer file; back it up, unless they're the same. - unless _same_contents?(target_path, source_path) - backupdir.backup(@target_dir, path) - end - end - @target_dir.copy(path) + source_path = Pathname.new(path) + target_path = @target_dir[path] + if target_path.file? and target_path.mtime > source_path.mtime + # We're going to overwrite a newer file; back it up, unless they're the same. + unless _same_contents?(target_path, source_path) + backupdir.backup(@target_dir, path) + end + end + @target_dir.copy(path) end end backups = backupdir.contents unless backups.empty? - puts + puts puts "The following backups were made as the files were newer than the ones" puts "you were installing:" backups.each do |path| - puts " * #{path}" + puts " * #{path}" end puts puts "These backups are located in this directory: #{backupdir.path}" @@ -333,9 +336,9 @@ def contents return [] unless @base.directory? results = [] Dir.chdir(@base) do - Pathname.new('.').find do |path| - results << path if path.file? - end + Pathname.new('.').find do |path| + results << path if path.file? + end end results end @@ -351,29 +354,29 @@ def path # begin - + $options = { - :windows => false, + :windows => false, :target_dir => nil } - + op = OptionParser.new do |p| p.banner = %{ vim-ruby-install.rb: Install the vim-ruby configuration files - + About: * Detects the Vim user and system-wide preferences directories * User to confirm before proceeding * User may specify other directory * Takes config files from current directory or from vim-ruby gem * Writes files with correct permissions and line endings - + Usage: direct: ruby bin/vim-ruby-install.rb [options] - gem: vim-ruby-install.rb [options] - + gem: vim-ruby-install.rb [options] + Options: - }.gsub(/^ /, '') + }.gsub(/^ /, '') p.on('--windows', 'Install into Windows directories') do $options[:windows] = true end @@ -386,29 +389,29 @@ def path end p.on_tail %{ Notes: - + * "Direct" usage means unpacking a vim-ruby tarball and running this program from the vim-ruby directory. - + * The convenient alternative is to use RubyGems: gem install vim-ruby vim-ruby-install.rb - + * The --windows option is designed for forcing an install into the Windows (gvim) configuration directory; useful when running from Cygwin or MinGW. - + * This installer is quite new (2004-09-20). Please report bugs to gsinclair@soyabean.com.au. - }.gsub(/^ /, '') + }.gsub(/^ /, '') end op.parse!(ARGV) - + source_dir = Env.determine_source_directory - if source_dir.nil? + if source_dir.nil? raise "Can't find source directory." end - + target_dir = TargetDirectory.finder.find_target_directory if not File.directory?(target_dir) puts @@ -422,7 +425,7 @@ def path exit end end - + VimRubyInstaller.new(source_dir, target_dir).install rescue @@ -435,4 +438,4 @@ def path end -# vim: ft=ruby sw=2 sts=2 ts=8: +# vim: nowrap sw=2 sts=2 ts=8 ff=unix ft=ruby: From cae16d3f4b2d8d2ceea18bde0bd95985e0effc9b Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 8 Sep 2005 14:46:56 +0000 Subject: [PATCH 172/411] allow while/until expressions to be highlighted --- ChangeLog | 2 ++ syntax/ruby.vim | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7d9d37d8..4919d84a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2005-09-08 Doug Kearns + * syntax/ruby.vim: allow while/until expressions to be highlighted + * bin/vim-ruby-install.rb: rescue Win32::Registry::Error when accessing the Windows registry diff --git a/syntax/ruby.vim b/syntax/ruby.vim index f97d2ed2..b0883535 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.72 2005/09/08 14:07:37 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.73 2005/09/08 14:46:56 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -166,8 +166,8 @@ if !exists("ruby_no_expensive") syn region rubyNoDoBlock matchgroup=rubyControl start="\<\%(case\|begin\)\>" start="\%(^\|\.\.\.\=\|[;=([<>~\*/%!&^|+-]\)\s*\zs\%(if\|unless\)\>" end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold " statement with optional *do* - syn region rubyOptDoLine matchgroup=rubyControl2 start="\" start="\%(\%(^\|;\)\s*\)\@<=\<\%(until\|while\)\>" end="\%(\\|:\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo - syn region rubyOptDoBlock start="\" start="\%(\%(^\|;\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=rubyControl2 end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo nextgroup=rubyOptDoLine fold + syn region rubyOptDoLine matchgroup=rubyControl start="\" start="\%(\%(^\|\.\.\.\=\|[;=([<>~\*/%!&^|+-]\)\s*\)\@<=\<\%(until\|while\)\>" end="\%(\\|:\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo + syn region rubyOptDoBlock start="\" start="\%(\%(^\|\.\.\.\=\|[;=([<>~\*/%!&^|+-]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=rubyControl end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo nextgroup=rubyOptDoLine fold if !exists("ruby_minlines") let ruby_minlines = 50 From b43db14658d28c19b0315e34846d39d3731be991 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 9 Sep 2005 16:41:17 +0000 Subject: [PATCH 173/411] allow if/unless/while/until expressions to be highlighted when used as method args --- ChangeLog | 5 +++++ syntax/ruby.vim | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4919d84a..48c76019 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-09-09 Doug Kearns + + * syntax/ruby: allow if/unless/while/until expressions to be + highlighted when used as method args following a ',' + 2005-09-08 Doug Kearns * syntax/ruby.vim: allow while/until expressions to be highlighted diff --git a/syntax/ruby.vim b/syntax/ruby.vim index b0883535..93a23fe8 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.73 2005/09/08 14:46:56 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.74 2005/09/09 16:41:17 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -163,11 +163,11 @@ if !exists("ruby_no_expensive") syn region rubyCurlyBlock start="{" end="}" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold " statements without *do* - syn region rubyNoDoBlock matchgroup=rubyControl start="\<\%(case\|begin\)\>" start="\%(^\|\.\.\.\=\|[;=([<>~\*/%!&^|+-]\)\s*\zs\%(if\|unless\)\>" end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold + syn region rubyNoDoBlock matchgroup=rubyControl start="\<\%(case\|begin\)\>" start="\%(^\|\.\.\.\=\|[,;=([<>~\*/%!&^|+-]\)\s*\zs\%(if\|unless\)\>" end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold " statement with optional *do* - syn region rubyOptDoLine matchgroup=rubyControl start="\" start="\%(\%(^\|\.\.\.\=\|[;=([<>~\*/%!&^|+-]\)\s*\)\@<=\<\%(until\|while\)\>" end="\%(\\|:\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo - syn region rubyOptDoBlock start="\" start="\%(\%(^\|\.\.\.\=\|[;=([<>~\*/%!&^|+-]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=rubyControl end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo nextgroup=rubyOptDoLine fold + syn region rubyOptDoLine matchgroup=rubyControl start="\" start="\%(\%(^\|\.\.\.\=\|[,;=([<>~\*/%!&^|+-]\)\s*\)\@<=\<\%(until\|while\)\>" end="\%(\\|:\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo + syn region rubyOptDoBlock start="\" start="\%(\%(^\|\.\.\.\=\|[,;=([<>~\*/%!&^|+-]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=rubyControl end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo nextgroup=rubyOptDoLine fold if !exists("ruby_minlines") let ruby_minlines = 50 From 1e7ea655dbabc52cf70f5db58130f01cdaedc666 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 10 Sep 2005 07:46:45 +0000 Subject: [PATCH 174/411] remove 'multiline' patterns from b:match_words --- ChangeLog | 4 ++++ ftplugin/ruby.vim | 24 ++++++++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 48c76019..73c2dda4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-09-10 Doug Kearns + + * ftplugin/ruby.vim: remove 'multiline' patterns from b:match_words + 2005-09-09 Doug Kearns * syntax/ruby: allow if/unless/while/until expressions to be diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index a8a2f3b9..fe9477e4 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.9 2005/09/08 08:22:40 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.10 2005/09/10 07:46:45 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -28,11 +28,23 @@ set cpo&vim " Matchit support if exists("loaded_matchit") && !exists("b:match_words") let b:match_ignorecase = 0 - let b:match_words = - \ '\%(\%(\%(^\|[;=]\)\s*\)\@<=\%(class\|module\|while\|begin\|until' . - \ '\|for\|if\|unless\|def\|case\)\|\:' . - \ '\<\%(else\|elsif\|ensure\|rescue\|when\)\>:' . - \ '\%(^\|[^.]\)\@<=\' + + " TODO: improve optional do loops + let b:match_words = + \ '\%(' . + \ '\%(\%(\.\|\:\:\)\s*\)\@' . + \ '\|' . + \ '\%(\%(^\|\.\.\.\=\|[\,;=([<>~\*/%!&^|+-]\)\s*\)\@<=\%(if\|unless\|until\|while\)\>' . + \ '\)' . + \ ':' . + \ '\%(' . + \ '\%(\%(\.\|\:\:\)\s*\)\@' . + \ '\|' . + \ '\%(\%(^\|;\)\s*\)\@<=\' . + \ '\)' . + \ ':' . + \ '\%(\%(\.\|\:\:\)\s*\)\@' + let b:match_skip = \ "synIDattr(synID(line('.'),col('.'),0),'name') =~ '" . \ "\\ Date: Sat, 10 Sep 2005 13:38:33 +0000 Subject: [PATCH 175/411] set the rake package task's need_zip attribute to create zip package archives --- ChangeLog | 3 +++ Rakefile | 1 + 2 files changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index 73c2dda4..01e28280 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,7 @@ 2005-09-10 Doug Kearns + + * Rakefile: set the package task's need_zip attribute so that zip + package archives are also created * ftplugin/ruby.vim: remove 'multiline' patterns from b:match_words diff --git a/Rakefile b/Rakefile index 6176f562..a67a6781 100644 --- a/Rakefile +++ b/Rakefile @@ -35,6 +35,7 @@ end Rake::GemPackageTask.new(gemspec) do |t| t.package_dir = 'etc/package' t.need_tar = true + t.need_zip = true end # Supporting methods From 495956f429bdea2f406f4d5b5c47a0a992bd342e Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 10 Sep 2005 13:42:47 +0000 Subject: [PATCH 176/411] update the package naming description in README --- ChangeLog | 3 +++ README | 8 ++++---- etc/website/index.html | 8 ++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 01e28280..9948f628 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2005-09-10 Doug Kearns + * README, etc/website/index.html: update the package naming + description + * Rakefile: set the package task's need_zip attribute so that zip package archives are also created diff --git a/README b/README index d4458181..595be8ee 100644 --- a/README +++ b/README @@ -12,8 +12,9 @@ Web links: For regular users: - The project page should have two tarballs for download: - - vim-ruby-stable.tar.gz (the files ready for the next Vim release) - - vim-ruby-devel.tar.gz (cutting-edge features we'd like you to test) + - 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. @@ -49,7 +50,6 @@ Understanding the configuration files: - Email any one of us or ruby-talk if you want more information added to this page. - CVS topics: - 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 @@ -58,7 +58,7 @@ CVS topics: be tested by interested users. They therefore (probably) don't have a tag, and are available via "cvs update -A", or a development snapshot. - When a modification is considered stable, it is tagged "stable". - Everything that is stable gets released in vim-ruby-stable.tar.gz files. + 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. diff --git a/etc/website/index.html b/etc/website/index.html index 6b077b9d..372a167b 100644 --- a/etc/website/index.html +++ b/etc/website/index.html @@ -55,8 +55,9 @@

For regular users: - The project page should have two tarballs for download: - - vim-ruby-stable.tar.gz (the files ready for the next Vim release) - - vim-ruby-devel.tar.gz (cutting-edge features we'd like you to test) + - 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. @@ -92,7 +93,6 @@

- Email any one of us or ruby-talk if you want more information added to this page. - CVS topics: - 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 @@ -101,7 +101,7 @@

be tested by interested users. They therefore (probably) don't have a tag, and are available via "cvs update -A", or a development snapshot. - When a modification is considered stable, it is tagged "stable". - Everything that is stable gets released in vim-ruby-stable.tar.gz files. + 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. From c56644a0146929ecb3fbc77ad3d0dac26c808dda Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 10 Sep 2005 14:51:02 +0000 Subject: [PATCH 177/411] save each message from error backtraces for Test::Unit compiler --- ChangeLog | 2 ++ compiler/rubyunit.vim | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9948f628..81bab98d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2005-09-10 Doug Kearns + * compiler/rubyunit.vim: save each message from error backtraces + * README, etc/website/index.html: update the package naming description diff --git a/compiler/rubyunit.vim b/compiler/rubyunit.vim index c0d81c25..e277dd85 100644 --- a/compiler/rubyunit.vim +++ b/compiler/rubyunit.vim @@ -1,7 +1,7 @@ " Vim compiler file " Language: Test::Unit - Ruby Unit Testing Framework " Maintainer: Doug Kearns -" Info: $Id: rubyunit.vim,v 1.6 2005/09/08 14:07:37 dkearns Exp $ +" Info: $Id: rubyunit.vim,v 1.7 2005/09/10 14:51:02 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -27,7 +27,7 @@ set cpo-=C CompilerSet makeprg=ruby CompilerSet errorformat=\%Etest%[%^\ ]%#(%[%^\ ]%#)\ [%f:%l]:, - \%E\ %\\+%f:%l:in\ %.%#, + \%E\ %\\+%f:%l:%m, \%Z%m%\\%., \%C%m%\\%., \%-GLoaded%.%#, From f80a8301d8942d3423df4df5deefa2ce49ffe7c5 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 10 Sep 2005 15:21:06 +0000 Subject: [PATCH 178/411] use GMT time in the rake package version string --- ChangeLog | 2 ++ Rakefile | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 81bab98d..b0001d5f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2005-09-10 Doug Kearns + * Rakefile: use GMT time in the version string + * compiler/rubyunit.vim: save each message from error backtraces * README, etc/website/index.html: update the package naming diff --git a/Rakefile b/Rakefile index a67a6781..59b1381b 100644 --- a/Rakefile +++ b/Rakefile @@ -6,7 +6,7 @@ RELEASE_FILES = FileList[ 'README', 'ChangeLog', 'CONTRIBUTORS', 'bin/*.rb', '{compiler,ftdetect,ftplugin,indent,syntax}/*.vim' ] -PACKAGE_VERSION = Time.now.strftime('%Y.%m.%d') +PACKAGE_VERSION = Time.now.gmtime.strftime('%Y.%m.%d') desc "Build all the packages" task :default => :package From 233518f1316f66ac8bd43ba2ce4b7d667da3960e Mon Sep 17 00:00:00 2001 From: Nikolai Weibull Date: Sat, 10 Sep 2005 19:29:59 +0000 Subject: [PATCH 179/411] Fixes bugs introduced in earlier commits. Been running without fault for two-three weeks now. It's about as good as it gets without a major reworking. Enjoy! --- indent/ruby.vim | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/indent/ruby.vim b/indent/ruby.vim index 9399a14e..f01f8e2f 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -2,7 +2,7 @@ " Language: Ruby " Maintainer: Gavin Sinclair " Developer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.25 2005/09/08 14:07:37 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.26 2005/09/10 19:29:59 pcp Exp $ " URL: http://vim-ruby.rubyforge.org/ " Anon CVS: See above site @@ -52,9 +52,11 @@ let s:skip_expr = \ "synIDattr(synID(line('.'),col('.'),0),'name') =~ '".s:syng_strcom."'" " Regex used for words that, at the start of a line, add a level of indent. -let s:ruby_indent_keywords = '^\s*\%(\zs\<\%(module\|class\|def\|if\|for' . +let s:ruby_indent_keywords = '^\s*\zs\<\%(module\|class\|def\|if\|for' . \ '\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure' . - \ '\|rescue\)\>\|\h\w*\s*=\s*\zs\<\%(if\|unless\)\>\)' + \ '\|rescue\)\>' . + \ '\|\%([*+/,=:-]\|<<\|>>\)\s*\zs' . + \ '\<\%(if\|for\|while\|until\|case\|unless\|begin\)\>' " Regex used for words that, at the start of a line, remove a level of indent. let s:ruby_deindent_keywords = @@ -63,17 +65,17 @@ let s:ruby_deindent_keywords = " Regex that defines the start-match for the 'end' keyword. "let s:end_start_regex = '\%(^\|[^.]\)\<\%(module\|class\|def\|if\|for\|while\|until\|case\|unless\|begin\|do\)\>' " TODO: the do here should be restricted somewhat (only at end of line)? -" TODO: how about stuff like ...; if ... (perhasp too retarded to deal with?) -let s:end_start_regex = '\%(^\s*\%(\zs\<\%(module\|class\|def\|if\|for' . +let s:end_start_regex = '^\s*\zs\<\%(module\|class\|def\|if\|for' . \ '\|while\|until\|case\|unless\|begin\)\>' . - \ '\|\h\w*\s*=\s*\zs\<\%(if\|for\|while\|until\|case\|unless\|begin\)\>\)' . - \ '\|\\)' + \ '\|\%([*+/,=:-]\|<<\|>>\)\s*\zs' . + \ '\<\%(if\|for\|while\|until\|case\|unless\|begin\)\>' . + \ '\|\' " Regex that defines the middle-match for the 'end' keyword. let s:end_middle_regex = '\<\%(ensure\|else\|rescue\|when\|elsif\)\>' " Regex that defines the end-match for the 'end' keyword. -let s:end_end_regex = '\%(^\|[^.]\)\' +let s:end_end_regex = '\%(^\|[^.]\)\@<=\' " Expression used for searchpair() call for finding match for 'end' keyword. let s:end_skip_expr = s:skip_expr . From 63074cf5c4b4bb1b9381e9e21a78bda293cf8799 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sun, 11 Sep 2005 06:55:38 +0000 Subject: [PATCH 180/411] fix comment typo --- ChangeLog | 16 ++++++++++------ indent/ruby.vim | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index b0001d5f..7240a8a8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ +2005-09-11 Doug Kearns + + * indent/ruby.vim: fix comment typo + 2005-09-10 Doug Kearns - + * Rakefile: use GMT time in the version string * compiler/rubyunit.vim: save each message from error backtraces @@ -22,14 +26,14 @@ * syntax/ruby.vim: allow while/until expressions to be highlighted * bin/vim-ruby-install.rb: rescue Win32::Registry::Error when - accessing the Windows registry + accessing the Windows registry * ChangeLog, Rakefile, compiler/eruby.vim, compiler/rubyunit.vim, compiler/ruby.vim, ftplugin/eruby.vim, indent/ruby.vim, syntax/eruby.vim, syntax/ruby.vim: normalise vim modelines * etc/release/release.sh: add -z to cvsrelease call to create a zip - release file as well as a tar.gz + release file as well as a tar.gz * Rakefile: add CONTRIBUTORS file to FileList @@ -52,7 +56,7 @@ operators 2005-09-02 Doug Kearns - + * bin/vim-ruby-install.rb: add ftplugin/eruby.vim to list of source files @@ -226,7 +230,7 @@ 2005-07-04 Doug Kearns * bin/vim-ruby-install.rb: improve source directory detection (Hugh - Sasse) + Sasse) 2005-04-05 Doug Kearns @@ -313,7 +317,7 @@ * filetype/filetype.vim: match 'rakefile' as a Rakefile -2004-04-23 Ward Wouts +2004-04-23 Ward Wouts * syntax/ruby.vim: add ruby_fold variable to control the setting of the foldmethod option diff --git a/indent/ruby.vim b/indent/ruby.vim index f01f8e2f..801dbb54 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -2,7 +2,7 @@ " Language: Ruby " Maintainer: Gavin Sinclair " Developer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.26 2005/09/10 19:29:59 pcp Exp $ +" Info: $Id: ruby.vim,v 1.27 2005/09/11 06:55:38 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org/ " Anon CVS: See above site @@ -31,7 +31,7 @@ set cpo&vim " 1. Variables {{{1 " ============ -" Regex of synax group names that are or delimit string or are comments. +" Regex of syntax group names that are or delimit string or are comments. let s:syng_strcom = '\' From f3379583ca6903fc33dfb00e8aa3dc5be72f7368 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sun, 11 Sep 2005 11:52:59 +0000 Subject: [PATCH 181/411] ignore the rescue 'modifier' when indenting (#2296) --- ChangeLog | 2 ++ indent/ruby.vim | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7240a8a8..4b7d2d92 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2005-09-11 Doug Kearns + * indent/ruby.vim: ignore the rescue 'modifier' when indenting (#2296) + * indent/ruby.vim: fix comment typo 2005-09-10 Doug Kearns diff --git a/indent/ruby.vim b/indent/ruby.vim index 801dbb54..d218b941 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -2,7 +2,7 @@ " Language: Ruby " Maintainer: Gavin Sinclair " Developer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.27 2005/09/11 06:55:38 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.28 2005/09/11 11:52:59 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org/ " Anon CVS: See above site @@ -72,7 +72,7 @@ let s:end_start_regex = '^\s*\zs\<\%(module\|class\|def\|if\|for' . \ '\|\' " Regex that defines the middle-match for the 'end' keyword. -let s:end_middle_regex = '\<\%(ensure\|else\|rescue\|when\|elsif\)\>' +let s:end_middle_regex = '\<\%(ensure\|else\|\%(\%(^\|;\)\s*\)\@<=\\|when\|elsif\)\>' " Regex that defines the end-match for the 'end' keyword. let s:end_end_regex = '\%(^\|[^.]\)\@<=\' From d5d0c4af4807df9cb8c724a0b97196d15324ba0a Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sun, 11 Sep 2005 12:02:53 +0000 Subject: [PATCH 182/411] include gems load path when setting vim 'path' option --- ChangeLog | 2 ++ ftplugin/ruby.vim | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4b7d2d92..e4e7f798 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2005-09-11 Doug Kearns + * ftplugin/ruby.vim: include gems load path in 'path' option + * indent/ruby.vim: ignore the rescue 'modifier' when indenting (#2296) * indent/ruby.vim: fix comment typo diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index fe9477e4..81c23cfe 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.10 2005/09/10 07:46:45 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.11 2005/09/11 12:02:53 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -67,9 +67,9 @@ setlocal commentstring=#\ %s if !exists("s:rubypath") if executable("ruby") if &shellxquote == "'" - let s:rubypath = system('ruby -e "print $:.join(%q{,})"' ) + let s:rubypath = system('ruby -e "puts (begin; require %q{rubygems}; Gem.all_load_paths; rescue LoadError; []; end + $:).join(%q{,})"') else - let s:rubypath = system("ruby -e 'print $:.join(%q{,})'" ) + let s:rubypath = system("ruby -e 'puts (begin; require %q{rubygems}; Gem.all_load_paths; rescue LoadError; []; end + $:).join(%q{,})'") endif let s:rubypath = substitute(s:rubypath,',.$',',,','') else From 124ecb3cbb760453ffb427e5226c2278a0ee7f41 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sun, 11 Sep 2005 14:43:40 +0000 Subject: [PATCH 183/411] add pcp's missing ChangeLog entries --- ChangeLog | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/ChangeLog b/ChangeLog index e4e7f798..50cf92f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,12 @@ * indent/ruby.vim: fix comment typo +2005-09-10 Nikolai Weibull + + * indent/ruby.vim: Fixes bugs introduced in earlier commits. Been + running without fault for two-three weeks now. It's about as good as + it gets without a major reworking. Enjoy! + 2005-09-10 Doug Kearns * Rakefile: use GMT time in the version string @@ -100,6 +106,12 @@ * syntax/ruby.vim: fix typo in rubyBlockParameter pattern +2005-08-26 Nikolai Weibull + + * indent/ruby.vim: Updated to indent correctly. There's more to be + done, as a statement may be contained in other stuff than a '... = ', + so that '=' should be [=+-...]. Soon to be fixed. + 2005-08-26 Doug Kearns * syntax/ruby.vim: only match rubyBlockParameter after 'do' that is a @@ -119,6 +131,20 @@ a private method; fix a bug in BackupDir.backup where it was writing the backup to an incorrect location +2005-08-24 Nikolai Weibull + + * indent/ruby.vim: + 1. resetting of cpoptions (wouldn't always be done, depending on if + GetRubyIndent was defined. + + 2. Bugs #166, #1914, #2296 should be fixed + + 3. Somewhat simpler processing of the contents of the file. + + Most of the work was removing complexity that was trying to be clever + about understanding the syntax/semantics of the file, while actually + making things slow and actually not matching correctly. + 2005-08-24 Doug Kearns * syntax/ruby.vim: remove 'contains=rubyString' from the From 8cd50f3f9a6d626220d89fe960be67d2ce4719c6 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sun, 11 Sep 2005 14:54:58 +0000 Subject: [PATCH 184/411] reinsert license in header of indent script --- ChangeLog | 2 ++ indent/ruby.vim | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 50cf92f9..0f3d9f8e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2005-09-11 Doug Kearns + * indent/ruby.vim: reinsert license in header + * ftplugin/ruby.vim: include gems load path in 'path' option * indent/ruby.vim: ignore the rescue 'modifier' when indenting (#2296) diff --git a/indent/ruby.vim b/indent/ruby.vim index d218b941..954104ff 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -2,9 +2,16 @@ " Language: Ruby " Maintainer: Gavin Sinclair " Developer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.28 2005/09/11 11:52:59 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.29 2005/09/11 14:54:58 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org/ " Anon CVS: See above site +" Licence: GPL (http://www.gnu.org) +" Disclaimer: +" This program is distributed in the hope that it will be useful, +" but WITHOUT ANY WARRANTY; without even the implied warranty of +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +" GNU General Public License for more details. +" ---------------------------------------------------------------------------- " 0. Initialization {{{1 " ================= From 07e42b9a55f5e5901a1b037bd8b0faeac4da1021 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sun, 11 Sep 2005 14:58:44 +0000 Subject: [PATCH 185/411] update pcp's email address --- CONTRIBUTORS | 2 +- ChangeLog | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 7b210d62..f8f7fd81 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -4,7 +4,7 @@ Maintainers: Gavin Sinclair Developers: - Nikolai Weibull + Nikolai Weibull Other contributors: Michael Brailsford diff --git a/ChangeLog b/ChangeLog index 0f3d9f8e..23d920ac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2005-09-11 Doug Kearns + * CONTRIBUTORS: update pcp's email address + * indent/ruby.vim: reinsert license in header * ftplugin/ruby.vim: include gems load path in 'path' option From a4481dfae58ea311b179c91e273b2e0898a7b8cf Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 13 Sep 2005 04:26:56 +0000 Subject: [PATCH 186/411] make sure escaped eRuby tags aren't highlighted as block delimiters with a trailing '%' --- ChangeLog | 5 +++++ syntax/eruby.vim | 12 +++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 23d920ac..3eeb4c55 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-09-13 Doug Kearns + + * syntax/eruby.vim: make sure escaped eRuby tags aren't highlighted as + block delimiters with a trailing '%' + 2005-09-11 Doug Kearns * CONTRIBUTORS: update pcp's email address diff --git a/syntax/eruby.vim b/syntax/eruby.vim index 89cd42bd..cd59e187 100644 --- a/syntax/eruby.vim +++ b/syntax/eruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: eRuby " Maintainer: Doug Kearns -" Info: $Id: eruby.vim,v 1.5 2005/09/08 14:07:37 dkearns Exp $ +" Info: $Id: eruby.vim,v 1.6 2005/09/13 04:26:56 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -32,10 +32,12 @@ else syn include @rubyTop syntax/ruby.vim endif -syn region erubyOneLiner matchgroup=erubyDelimiter start="^%" end="$" contains=@rubyTop containedin=ALLBUT,erubyBlock,erubyComment,erubyExpression keepend oneline -syn region erubyBlock matchgroup=erubyDelimiter start="<%" end="%>" contains=@rubyTop containedin=ALLBUT,erubyBlock,erubyComment,erubyExpression -syn region erubyExpression matchgroup=erubyDelimiter start="<%=" end="%>" contains=@rubyTop containedin=ALLBUT,erubyComment,erubyExpression -syn region erubyComment matchgroup=erubyDelimiter start="<%#" end="%>" contains=rubyTodo,@Spell containedin=ALLBUT,erubyBlock,erubyComment,erubyExpression keepend +syn cluster erubyRegions contains=erubyOneLiner,erubyBlock,erubyExpression,erubyComment + +syn region erubyOneLiner matchgroup=erubyDelimiter start="^%%\@!" end="$" contains=@rubyTop containedin=ALLBUT,@erubyRegions keepend oneline +syn region erubyBlock matchgroup=erubyDelimiter start="<%%\@!" end="%>" contains=@rubyTop containedin=ALLBUT,@erubyRegions +syn region erubyExpression matchgroup=erubyDelimiter start="<%=" end="%>" contains=@rubyTop containedin=ALLBUT,@erubyRegions +syn region erubyComment matchgroup=erubyDelimiter start="<%#" end="%>" contains=rubyTodo,@Spell containedin=ALLBUT,@erubyRegions keepend " Define the default highlighting. " For version 5.7 and earlier: only when not done already From 58f8a0cc6b8628bc6e1dc6f366ba7aa4615a1356 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 14 Sep 2005 17:26:21 +0000 Subject: [PATCH 187/411] add INSTALL and NEWS files --- ChangeLog | 4 ++++ INSTALL | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ NEWS | 30 ++++++++++++++++++++++++++ 3 files changed, 98 insertions(+) create mode 100644 INSTALL create mode 100644 NEWS diff --git a/ChangeLog b/ChangeLog index 3eeb4c55..c1609d50 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-09-14 Doug Kearns + + * INSTALL, NEWS, Rakefile: add INSTALL and NEWS files + 2005-09-13 Doug Kearns * syntax/eruby.vim: make sure escaped eRuby tags aren't highlighted as diff --git a/INSTALL b/INSTALL new file mode 100644 index 00000000..b15e2aab --- /dev/null +++ b/INSTALL @@ -0,0 +1,64 @@ += Installing Vim-Ruby + +The Vim-Ruby runtime files may be installed via the vim-ruby gem or by +downloading an archive file from http://rubyforge.org/frs/?group_id=16 + +NOTE: the installer vim-ruby-install.rb currently only supports Unix and +Windows systems. Other platforms may require a manual install. + +== Prerequisites + +1. Vim 6.x (6.3 recommended) + http://www.vim.org/ + +2. Ruby 1.8.x + http://www.ruby-lang.org/ + +== Gem Installation + +Install the gem and run the installer which will automatically determine the +two recommended installation locations and prompt you to select one, or allow +you to specify a directory of your own choosing. + +$ gem install vim-ruby --remote +$ vim-ruby-install.rb + +== Archive File Installation + +Unpack the archive file and run the installer which will automatically +determine the two recommended installation locations or allow you to specify +one. + +Unix + +$ tar -xzf vim-ruby.YYYY.MM.DD.tgz +$ ./vim-ruby.YYY.MM.DD/bin/vim-ruby-install.rb + +Windows + +C:\tmp> [unzip] vim-ruby.YYYY.MM.DD.tgz +C:\tmp> ruby vim-ruby.YYY.MM.DD\bin\vim-ruby-install.rb + +=== Manual Installation + +Alternatively, you can simply copy the desired files to an appropriate +directory in your runtime path. For single user use this would typically be +$HOME/.vim on Unix systems and $HOME/vimfiles on Windows and for system-wide +use these would be installed in $VIM/vimfiles. + +== Vim versions < 6.3 + +For versions of Vim less than 6.3 the supplied ftdetect/ruby.vim file, used for +filetype detection, will be ignored. In order for the filetype detection to +operate correctly the autocommands specified in ftdetect/ruby.vim need to be +executed. See :help new-filetype, in Vim, for a mechanism to achieve this +which is appropriate for your version of Vim. + +Again, we recommend you use the latest version of Vim at all times, where +possible. + += Problems + +If you have any problems installing the Vim-Ruby configuration files please +send a message to the mailing list (http://rubyforge.org/mail/?group_id=16) or +post an item to the tracker (http://rubyforge.org/tracker/?group_id=16). diff --git a/NEWS b/NEWS new file mode 100644 index 00000000..8e0cd36c --- /dev/null +++ b/NEWS @@ -0,0 +1,30 @@ += 2005.09.14 + +== eRuby Support + +There are new syntax, compiler, and ftplugin files for eRuby. This support is +incomplete and we're keen to hear of any problems or suggestions you may have +to improve it. + +== Ruby Filetype Support + +The Ruby filetype plugin has been improved to include as many useful settings +as possible without intruding too much on an individual user's preferences. +Matchit support has been improved, and the following options are now set to +appropriate values: comments, commentstring, formatoptions, include, +includeexpr, path, and suffixesadd + +== Filetype Detection + +The new ftdetect mechanism of Vim 6.3 is being utilized to enable filetype +detection of eRuby files until this is officially added to the next release of +Vim. + +== Installation Directories + +The installer script now, where possible, automatically determines both the +user and system-wide preferences directory. + +== Bug Fixes + +A large number of bugs have been fixed in the Ruby syntax and indent files. From dc20be97101c623eddd5c8c67248b01e75c2f0c1 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 14 Sep 2005 17:37:44 +0000 Subject: [PATCH 188/411] add INSTALL and NEWS files to FileList --- ChangeLog | 4 +++- Rakefile | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c1609d50..a693df1a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 2005-09-14 Doug Kearns - * INSTALL, NEWS, Rakefile: add INSTALL and NEWS files + * Rakefile: add INSTALL and NEWS files to FileList + + * INSTALL, NEWS: add INSTALL and NEWS files 2005-09-13 Doug Kearns diff --git a/Rakefile b/Rakefile index 59b1381b..f2fce485 100644 --- a/Rakefile +++ b/Rakefile @@ -3,7 +3,7 @@ require 'rake/gempackagetask' PACKAGE_NAME = 'vim-ruby' RELEASE_FILES = FileList[ - 'README', 'ChangeLog', 'CONTRIBUTORS', 'bin/*.rb', + 'ChangeLog', 'CONTRIBUTORS', 'INSTALL', 'NEWS', 'README', 'bin/*.rb', '{compiler,ftdetect,ftplugin,indent,syntax}/*.vim' ] PACKAGE_VERSION = Time.now.gmtime.strftime('%Y.%m.%d') From 7b695b242e63e031aac16d324f5da28650621370 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 15 Sep 2005 05:26:27 +0000 Subject: [PATCH 189/411] add a precautionary note about backing up files prior to using the installer --- ChangeLog | 5 +++++ INSTALL | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a693df1a..ab4191f6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-09-15 Doug Kearns + + * INSTALL: add a precautionary note about backing up files prior to + using the installer + 2005-09-14 Doug Kearns * Rakefile: add INSTALL and NEWS files to FileList diff --git a/INSTALL b/INSTALL index b15e2aab..22f1cc3a 100644 --- a/INSTALL +++ b/INSTALL @@ -4,7 +4,9 @@ The Vim-Ruby runtime files may be installed via the vim-ruby gem or by downloading an archive file from http://rubyforge.org/frs/?group_id=16 NOTE: the installer vim-ruby-install.rb currently only supports Unix and -Windows systems. Other platforms may require a manual install. +Windows systems; other platforms may require a manual install. This installer +is new and users with significant local modifications to their vim-ruby files +are encouraged to make a manual backup of each prior to installation. == Prerequisites From 4ac0077258eafc8e3c40759967666ae631a10750 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 15 Sep 2005 05:27:29 +0000 Subject: [PATCH 190/411] correct release number in NEWS --- ChangeLog | 2 ++ NEWS | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ab4191f6..9956aa6f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2005-09-15 Doug Kearns + * NEWS: correct release number + * INSTALL: add a precautionary note about backing up files prior to using the installer diff --git a/NEWS b/NEWS index 8e0cd36c..925684d2 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -= 2005.09.14 += 2005.09.15 == eRuby Support From 5410f2d877a515919295906c4175cba958177314 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 15 Sep 2005 05:28:48 +0000 Subject: [PATCH 191/411] fix typo --- INSTALL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INSTALL b/INSTALL index 22f1cc3a..1132b9ee 100644 --- a/INSTALL +++ b/INSTALL @@ -59,7 +59,7 @@ which is appropriate for your version of Vim. Again, we recommend you use the latest version of Vim at all times, where possible. -= Problems +== Problems If you have any problems installing the Vim-Ruby configuration files please send a message to the mailing list (http://rubyforge.org/mail/?group_id=16) or From 0056370801d0521816a2d37108ed8ee3a64f024f Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 15 Sep 2005 15:06:54 +0000 Subject: [PATCH 192/411] add $LOADED_FEATURES and $PROGRAM_NAME to rubyPredefinedVariable --- ChangeLog | 3 +++ syntax/ruby.vim | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9956aa6f..82a8bf5c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2005-09-15 Doug Kearns + * syntax/ruby.vim: add $LOADED_FEATURES and $PROGRAM_NAME to + rubyPredefinedVariable + * NEWS: correct release number * INSTALL: add a precautionary note about backing up files prior to diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 93a23fe8..f61216f8 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.74 2005/09/09 16:41:17 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.75 2005/09/15 15:06:54 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -79,10 +79,10 @@ syn region rubySymbol start=":\@\|{\)\s*\)\@<=|\s*\zs[( ,a-zA-Z0-9_*)]\+\ze\s*|" display syn match rubyPredefinedVariable #$[!$&"'*+,./0:;<=>?@\`~1-9]# -syn match rubyPredefinedVariable "$_\>" display -syn match rubyPredefinedVariable "$-[0FIKadilpvw]\>" display -syn match rubyPredefinedVariable "$\%(deferr\|defout\|stderr\|stdin\|stdout\)\>" display -syn match rubyPredefinedVariable "$\%(DEBUG\|FILENAME\|KCODE\|LOAD_PATH\|SAFE\|VERBOSE\)\>" display +syn match rubyPredefinedVariable "$_\>" display +syn match rubyPredefinedVariable "$-[0FIKadilpvw]\>" display +syn match rubyPredefinedVariable "$\%(deferr\|defout\|stderr\|stdin\|stdout\)\>" display +syn match rubyPredefinedVariable "$\%(DEBUG\|FILENAME\|KCODE\|LOADED_FEATURES\|LOAD_PATH\|PROGRAM_NAME\|SAFE\|VERBOSE\)\>" display syn match rubyPredefinedConstant "\%(\%(\.\@\%(\s*(\)\@!" syn match rubyPredefinedConstant "\%(\%(\.\@\%(\s*(\)\@!" syn match rubyPredefinedConstant "\%(\%(\.\@\%(\s*(\)\@!" From b4fd77da75a62f58eb03ee32926f2717bac0c480 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 16 Sep 2005 15:56:13 +0000 Subject: [PATCH 193/411] use 'set filetype' rather than 'setfiletype' to override any previously set filetype --- ChangeLog | 5 +++++ ftdetect/ruby.vim | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 82a8bf5c..b0c41b58 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-09-16 Doug Kearns + + * ftdetect/ruby.vim: use 'set filetype' rather than 'setfiletype' to + override any previously set filetype + 2005-09-15 Doug Kearns * syntax/ruby.vim: add $LOADED_FEATURES and $PROGRAM_NAME to diff --git a/ftdetect/ruby.vim b/ftdetect/ruby.vim index 7498e8c8..9723fe15 100644 --- a/ftdetect/ruby.vim +++ b/ftdetect/ruby.vim @@ -1,8 +1,8 @@ " Ruby -au BufNewFile,BufRead *.rb,*.rbw,*.gem,*.gemspec setf ruby +au BufNewFile,BufRead *.rb,*.rbw,*.gem,*.gemspec set filetype=ruby " Rakefile -au BufNewFile,BufRead [rR]akefile* setf ruby +au BufNewFile,BufRead [rR]akefile* set filetype=ruby " eRuby -au BufNewFile,BufRead *.rhtml setf eruby +au BufNewFile,BufRead *.rhtml set filetype=eruby From 32b794e272a4431a550fa56ac31541d62d73fc43 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sun, 18 Sep 2005 08:02:33 +0000 Subject: [PATCH 194/411] make sure that the latest vim-ruby, rather than vim-ruby-devel, gem is being used --- ChangeLog | 5 +++++ bin/vim-ruby-install.rb | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b0c41b58..8aed5b53 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-09-18 Doug Kearns + + * bin/vim-ruby-install.rb: make sure that the latest vim-ruby, rather + than vim-ruby-devel, gem is being used + 2005-09-16 Doug Kearns * ftdetect/ruby.vim: use 'set filetype' rather than 'setfiletype' to diff --git a/bin/vim-ruby-install.rb b/bin/vim-ruby-install.rb index 90ab2488..b8ec9c8a 100755 --- a/bin/vim-ruby-install.rb +++ b/bin/vim-ruby-install.rb @@ -65,8 +65,8 @@ def Env.determine_source_directory rescue LoadError return nil end - #vim_ruby_gem_dir = Gem.latest_load_paths.grep(%r{gems/vim-ruby}).last - vim_ruby_gem_dir = Gem.all_load_paths.grep(%r{gems/vim-ruby}).sort.last + #vim_ruby_gem_dir = Gem.latest_load_paths.grep(%r{gems/vim-ruby-\d{4}\.\d{2}\.\d{2}}).last + vim_ruby_gem_dir = Gem.all_load_paths.grep(%r{gems/vim-ruby-\d{4}\.\d{2}\.\d{2}}).sort.last if vim_ruby_gem_dir and _valid_vim_ruby_dir(vim_ruby_gem_dir) return vim_ruby_gem_dir end From 5baeb5b3779b88a1b51e51ad2cf01f2d5af683b5 Mon Sep 17 00:00:00 2001 From: Nikolai Weibull Date: Sun, 18 Sep 2005 13:13:22 +0000 Subject: [PATCH 195/411] Fix for #2473. --- indent/ruby.vim | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/indent/ruby.vim b/indent/ruby.vim index 954104ff..f57c50a8 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -2,7 +2,7 @@ " Language: Ruby " Maintainer: Gavin Sinclair " Developer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.29 2005/09/11 14:54:58 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.30 2005/09/18 13:13:22 pcp Exp $ " URL: http://vim-ruby.rubyforge.org/ " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -244,17 +244,12 @@ function GetRubyIndent() " If we have a deindenting keyword, find its match and indent to its level. " TODO: this is messy if s:Match(v:lnum, s:ruby_deindent_keywords) -" let lnum = s:PrevNonBlankNonString(v:lnum - 1) -" -" if lnum == 0 -" return 0 -" endif -" -" return indent(v:lnum) - &sw call cursor(v:lnum, 1) if searchpair(s:end_start_regex, s:end_middle_regex, s:end_end_regex, 'bW', \ s:end_skip_expr) > 0 - if strpart(getline('.'), 0, col('.') - 1) =~ '=\s*' + let line = getline('.') + if strpart(line, 0, col('.') - 1) =~ '=\s*$' && + \ strpart(line, col('.') - 1, 2) !~ 'do' let ind = virtcol('.') - 1 else let ind = indent('.') @@ -380,5 +375,3 @@ endfunction let &cpo = s:cpo_save unlet s:cpo_save - -" vim: nowrap sw=2 sts=2 ts=8 ff=unix: From 87b5584352c44183892374bfdca546def2dd2cd9 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Mon, 19 Sep 2005 07:01:12 +0000 Subject: [PATCH 196/411] add missing ChangeLog entry --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8aed5b53..82f52d8b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-09-18 Nikolai Weibull + + * indent/ruby.vim: Fix for #2473 + 2005-09-18 Doug Kearns * bin/vim-ruby-install.rb: make sure that the latest vim-ruby, rather From 434d04f5c90fee4270a00859a2acd14644174633 Mon Sep 17 00:00:00 2001 From: Nikolai Weibull Date: Mon, 19 Sep 2005 09:09:04 +0000 Subject: [PATCH 197/411] Fix bug #2481. --- indent/ruby.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indent/ruby.vim b/indent/ruby.vim index f57c50a8..19b409d6 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -2,7 +2,7 @@ " Language: Ruby " Maintainer: Gavin Sinclair " Developer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.30 2005/09/18 13:13:22 pcp Exp $ +" Info: $Id: ruby.vim,v 1.31 2005/09/19 09:09:04 pcp Exp $ " URL: http://vim-ruby.rubyforge.org/ " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -82,7 +82,7 @@ let s:end_start_regex = '^\s*\zs\<\%(module\|class\|def\|if\|for' . let s:end_middle_regex = '\<\%(ensure\|else\|\%(\%(^\|;\)\s*\)\@<=\\|when\|elsif\)\>' " Regex that defines the end-match for the 'end' keyword. -let s:end_end_regex = '\%(^\|[^.]\)\@<=\' +let s:end_end_regex = '\%(^\|[^.:]\)\@<=\' " Expression used for searchpair() call for finding match for 'end' keyword. let s:end_skip_expr = s:skip_expr . From 6f8b54fe65ef62eaf0fc082f61cd52f6fcfd1a18 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Mon, 19 Sep 2005 12:18:28 +0000 Subject: [PATCH 198/411] add missing ChangeLog entry --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index 82f52d8b..25d84e7f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-09-18 Nikolai Weibull + + * indent/ruby.vim: Fix bug #2481 + 2005-09-18 Nikolai Weibull * indent/ruby.vim: Fix for #2473 From 3e1f4c482bf8913620fe17de339aea54b4571fa6 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 20 Sep 2005 06:03:54 +0000 Subject: [PATCH 199/411] match and highlight exit! as a 'special' method --- ChangeLog | 4 ++++ syntax/ruby.vim | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 25d84e7f..e9da07fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-09-20 Doug Kearns + + * syntax/ruby.vim: match and highlight exit! as a 'special' method + 2005-09-18 Nikolai Weibull * indent/ruby.vim: Fix bug #2481 diff --git a/syntax/ruby.vim b/syntax/ruby.vim index f61216f8..2e25f7d7 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.75 2005/09/15 15:06:54 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.76 2005/09/20 06:03:54 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -196,7 +196,7 @@ syn keyword rubyBeginEnd BEGIN END if !exists("ruby_no_special_methods") syn keyword rubyAccess public protected private syn keyword rubyAttribute attr attr_accessor attr_reader attr_writer - syn keyword rubyControl abort at_exit exit fork loop trap + 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 syn keyword rubyInclude autoload extend include load require From f038ee0e640b4fef69ce4e5c0a93b48d4981d507 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 21 Sep 2005 13:43:54 +0000 Subject: [PATCH 200/411] use the ruby compiler plugin 'efm' for eruby and add a ruby_compiler config variable --- ChangeLog | 6 ++++++ compiler/eruby.vim | 23 ++++++++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index e9da07fa..f171b75f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-09-21 Doug Kearns + + * compiler/eruby.vim: use the ruby compiler plugin 'efm' and add a + ruby_compiler config variable to allow for using eruby as the + 'makeprg' rather than the default erb + 2005-09-20 Doug Kearns * syntax/ruby.vim: match and highlight exit! as a 'special' method diff --git a/compiler/eruby.vim b/compiler/eruby.vim index 3ebaddad..592f6dcb 100644 --- a/compiler/eruby.vim +++ b/compiler/eruby.vim @@ -1,7 +1,7 @@ " Vim compiler file " Language: eRuby " Maintainer: Doug Kearns -" Info: $Id: eruby.vim,v 1.3 2005/09/08 14:07:37 dkearns Exp $ +" Info: $Id: eruby.vim,v 1.4 2005/09/21 13:43:54 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -24,13 +24,22 @@ endif let s:cpo_save = &cpo set cpo-=C -CompilerSet makeprg=eruby +if exists("eruby_compiler") && eruby_compiler == "eruby" + CompilerSet makeprg=eruby +else + CompilerSet makeprg=erb +endif -CompilerSet errorformat=eruby:\ %f:%l:%m, - \%E%f:%l:\ %m, - \%-Z%p^, - \%C%m, - \%-G%.%# +CompilerSet errorformat= + \eruby:\ %f:%l:%m, + \%+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, + \%-Z%p^, + \%-G%.%# let &cpo = s:cpo_save unlet s:cpo_save From 583d91e560c216efad22beae5891186103d88c55 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 21 Sep 2005 14:24:56 +0000 Subject: [PATCH 201/411] add a new indent file for eRuby --- ChangeLog | 3 +++ bin/vim-ruby-install.rb | 1 + indent/eruby.vim | 20 ++++++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 indent/eruby.vim diff --git a/ChangeLog b/ChangeLog index f171b75f..b2d5d4c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2005-09-21 Doug Kearns + * bin/vim-ruby-install.rb, indent/eruby.vim: add a new indent file for + eRuby; just use the html indent file for now + * compiler/eruby.vim: use the ruby compiler plugin 'efm' and add a ruby_compiler config variable to allow for using eruby as the 'makeprg' rather than the default erb diff --git a/bin/vim-ruby-install.rb b/bin/vim-ruby-install.rb index b8ec9c8a..522bf35d 100755 --- a/bin/vim-ruby-install.rb +++ b/bin/vim-ruby-install.rb @@ -24,6 +24,7 @@ ftdetect/ruby.vim ftplugin/eruby.vim ftplugin/ruby.vim + indent/eruby.vim indent/ruby.vim syntax/eruby.vim syntax/ruby.vim diff --git a/indent/eruby.vim b/indent/eruby.vim new file mode 100644 index 00000000..c80181bf --- /dev/null +++ b/indent/eruby.vim @@ -0,0 +1,20 @@ +" Vim indent file +" Language: Ruby +" Maintainer: Doug Kearns +" Info: $Id: eruby.vim,v 1.1 2005/09/21 14:24:56 dkearns Exp $ +" URL: http://vim-ruby.rubyforge.org/ +" Anon CVS: See above site +" Licence: GPL (http://www.gnu.org) +" Disclaimer: +" This program is distributed in the hope that it will be useful, +" but WITHOUT ANY WARRANTY; without even the implied warranty of +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +" GNU General Public License for more details. +" ---------------------------------------------------------------------------- + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish +endif + +runtime! indent/html.vim From 3c5e4a6b1039e5c88e8556357debed67148431df Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 22 Sep 2005 14:43:08 +0000 Subject: [PATCH 202/411] =?UTF-8?q?allow=20while/until=20modifiers=20after?= =?UTF-8?q?=20methods=20with=20names=20ending=20in=20[!=3D=3F]=20to=20be?= =?UTF-8?q?=20highlighted?= --- ChangeLog | 6 ++++++ syntax/ruby.vim | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index b2d5d4c2..51a7a238 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-09-22 Doug Kearns + + * syntax/ruby: allow while/until modifiers after methods with names + ending in [!=?]; assume (for now) that while/until expressions used as + args will be specified with parentheses + 2005-09-21 Doug Kearns * bin/vim-ruby-install.rb, indent/eruby.vim: add a new indent file for diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 2e25f7d7..341804c8 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.76 2005/09/20 06:03:54 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.77 2005/09/22 14:43:08 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -166,8 +166,8 @@ if !exists("ruby_no_expensive") syn region rubyNoDoBlock matchgroup=rubyControl start="\<\%(case\|begin\)\>" start="\%(^\|\.\.\.\=\|[,;=([<>~\*/%!&^|+-]\)\s*\zs\%(if\|unless\)\>" end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold " statement with optional *do* - syn region rubyOptDoLine matchgroup=rubyControl start="\" start="\%(\%(^\|\.\.\.\=\|[,;=([<>~\*/%!&^|+-]\)\s*\)\@<=\<\%(until\|while\)\>" end="\%(\\|:\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo - syn region rubyOptDoBlock start="\" start="\%(\%(^\|\.\.\.\=\|[,;=([<>~\*/%!&^|+-]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=rubyControl end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo nextgroup=rubyOptDoLine fold + syn region rubyOptDoLine matchgroup=rubyControl2 start="\" start="\%(\%(^\|\.\.\.\=\|[?:,;=([<>~\*/%!&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\%(\\|:\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo + syn region rubyOptDoBlock start="\" start="\%(\%(^\|\.\.\.\=\|[:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" matchgroup=rubyControl2 end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo nextgroup=rubyOptDoLine fold if !exists("ruby_minlines") let ruby_minlines = 50 From 1f605b784a40c6b216e034f64eb07b0c3448370f Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 22 Sep 2005 15:51:48 +0000 Subject: [PATCH 203/411] improve compiler message output and behaviour to match that of the GUI test runners --- ChangeLog | 3 +++ compiler/rubyunit.vim | 22 ++++++++++------------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 51a7a238..677ea6a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2005-09-22 Doug Kearns + * compiler/rubyunit.vim: improve compiler message output and behaviour + to match that of the GUI test runners + * syntax/ruby: allow while/until modifiers after methods with names ending in [!=?]; assume (for now) that while/until expressions used as args will be specified with parentheses diff --git a/compiler/rubyunit.vim b/compiler/rubyunit.vim index e277dd85..5da23604 100644 --- a/compiler/rubyunit.vim +++ b/compiler/rubyunit.vim @@ -1,7 +1,7 @@ " Vim compiler file " Language: Test::Unit - Ruby Unit Testing Framework " Maintainer: Doug Kearns -" Info: $Id: rubyunit.vim,v 1.7 2005/09/10 14:51:02 dkearns Exp $ +" Info: $Id: rubyunit.vim,v 1.8 2005/09/22 15:51:48 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -24,18 +24,16 @@ endif let s:cpo_save = &cpo set cpo-=C -CompilerSet makeprg=ruby +CompilerSet makeprg=testrb -CompilerSet errorformat=\%Etest%[%^\ ]%#(%[%^\ ]%#)\ [%f:%l]:, - \%E\ %\\+%f:%l:%m, - \%Z%m%\\%., - \%C%m%\\%., - \%-GLoaded%.%#, - \%-GStarted%.%#, - \%-G%[EF%.]%.%#, - \%-GFinished\ in%.%#, - \%-G\ %\\+%\\d%\\+)\ Failure:, - \%-G\ %\\+%\\d%\\+)\ Error: +CompilerSet errorformat=\%W\ %\\+%\\d%\\+)\ Failure:, + \%C%m\ [%f:%l]:, + \%E\ %\\+%\\d%\\+)\ Error:, + \%C%m:, + \%C\ \ \ \ %f:%l:%.%#, + \%C%m, + \%Z\ %#, + \%-G%.%# let &cpo = s:cpo_save unlet s:cpo_save From 9c63656f8f2f85bff2606fdcfbd42083d8308685 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 24 Sep 2005 11:27:35 +0000 Subject: [PATCH 204/411] add --backup option and include short options for it and --windows --- ChangeLog | 6 ++++++ bin/vim-ruby-install.rb | 27 +++++++++++++++++---------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 677ea6a4..8357d591 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-09-24 Doug Kearns + + * bin/vim-ruby-install.rb: add --backup option and include short + options for it and --windows; make sure the backup directory is + written to CWD + 2005-09-22 Doug Kearns * compiler/rubyunit.vim: improve compiler message output and behaviour diff --git a/bin/vim-ruby-install.rb b/bin/vim-ruby-install.rb index 522bf35d..92f0379d 100755 --- a/bin/vim-ruby-install.rb +++ b/bin/vim-ruby-install.rb @@ -278,15 +278,19 @@ def initialize(source, target) end # Since we know the source and target directories, all we have to do is copy the files - # across. If the target file is _newer_ than the source file, we make a backup of it and - # report that to the user. + # across. If the --backup option was specified or the target file is + # _newer_ than the source file, we make a backup of it and report that to + # the user. def install backupdir = BackupDir.new("./vim-ruby-backup.#{Process.pid}") Dir.chdir(@source_dir) do SOURCE_FILES.each do |path| source_path = Pathname.new(path) target_path = @target_dir[path] - if target_path.file? and target_path.mtime > source_path.mtime + # FIXME: Backup everything for now + if $options[:backup] and target_path.file? + backupdir.backup(@target_dir, path) + elsif target_path.file? and target_path.mtime > source_path.mtime # We're going to overwrite a newer file; back it up, unless they're the same. unless _same_contents?(target_path, source_path) backupdir.backup(@target_dir, path) @@ -298,8 +302,7 @@ def install backups = backupdir.contents unless backups.empty? puts - puts "The following backups were made as the files were newer than the ones" - puts "you were installing:" + puts "The following backups were made:" backups.each do |path| puts " * #{path}" end @@ -320,7 +323,7 @@ def _same_contents?(p1, p2) # A directory for holding backups of configuration files. class BackupDir def initialize(path) - @base = Pathname.new(path) + @base = Pathname.new(path).expand_path end # Copy basedir/path to @path/path. def backup(basedir, path) @@ -357,8 +360,9 @@ def path begin $options = { - :windows => false, - :target_dir => nil + :backup => false, + :target_dir => nil, + :windows => false } op = OptionParser.new do |p| @@ -378,12 +382,15 @@ def path Options: }.gsub(/^ /, '') - p.on('--windows', 'Install into Windows directories') do - $options[:windows] = true + p.on('-b', '--backup', 'Backup existing runtime files') do |value| + $options[:backup] = value end p.on('-d DIR', '--directory', 'Install into given directory') do |dir| $options[:target_dir] = dir end + p.on('-w', '--windows', 'Install into Windows directories') do |value| + $options[:windows] = value + end p.on('-h', '--help', 'Show this message') do puts p exit From 1aeef316632ff2051e4dee77be9752e732d9f4bb Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 24 Sep 2005 12:20:16 +0000 Subject: [PATCH 205/411] fix typo in rubyControl highlight group name --- ChangeLog | 4 +++- syntax/ruby.vim | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8357d591..ece24d77 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2005-09-24 Doug Kearns + * syntax/ruby.vim: fix typo in rubyControl highlight group name + * bin/vim-ruby-install.rb: add --backup option and include short options for it and --windows; make sure the backup directory is written to CWD @@ -19,7 +21,7 @@ eRuby; just use the html indent file for now * compiler/eruby.vim: use the ruby compiler plugin 'efm' and add a - ruby_compiler config variable to allow for using eruby as the + eruby_compiler config variable to allow for using eruby as the 'makeprg' rather than the default erb 2005-09-20 Doug Kearns diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 341804c8..fabda424 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.77 2005/09/22 14:43:08 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.78 2005/09/24 12:20:16 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -166,8 +166,8 @@ if !exists("ruby_no_expensive") syn region rubyNoDoBlock matchgroup=rubyControl start="\<\%(case\|begin\)\>" start="\%(^\|\.\.\.\=\|[,;=([<>~\*/%!&^|+-]\)\s*\zs\%(if\|unless\)\>" end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold " statement with optional *do* - syn region rubyOptDoLine matchgroup=rubyControl2 start="\" start="\%(\%(^\|\.\.\.\=\|[?:,;=([<>~\*/%!&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\%(\\|:\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo - syn region rubyOptDoBlock start="\" start="\%(\%(^\|\.\.\.\=\|[:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" matchgroup=rubyControl2 end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo nextgroup=rubyOptDoLine fold + syn region rubyOptDoLine matchgroup=rubyControl start="\" start="\%(\%(^\|\.\.\.\=\|[?:,;=([<>~\*/%!&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\%(\\|:\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo + syn region rubyOptDoBlock start="\" start="\%(\%(^\|\.\.\.\=\|[:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" matchgroup=rubyControl end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo nextgroup=rubyOptDoLine fold if !exists("ruby_minlines") let ruby_minlines = 50 From 2d37bd1dc4be706a76c32a7b8d58170f0825e926 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 24 Sep 2005 12:38:00 +0000 Subject: [PATCH 206/411] update NEWS for new release --- ChangeLog | 2 ++ NEWS | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/ChangeLog b/ChangeLog index ece24d77..a68b31ef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2005-09-24 Doug Kearns + * NEWS: updated for new release + * syntax/ruby.vim: fix typo in rubyControl highlight group name * bin/vim-ruby-install.rb: add --backup option and include short diff --git a/NEWS b/NEWS index 925684d2..efcb2cda 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,34 @@ += 2005.09.24 + +== Filetype detection + +The eruby filetype is now detected solely based on the file's extension. This +was being overridden by the scripts.vim detection script. + +Note: Only files ending in *.rhtml are detected as filetype eruby since these +are currently assumed to be Ruby embedded in (X)HTML only. Other filetypes +could be supported if requested. + +== eRuby indent file + +There is a new eRuby indent file which simply sources the HTML indent file for +now. + +== eRuby compiler plugin + +This now supports erb as the default 'makeprg'. To use eruby set the +eruby_compiler variable to "eruby" in your .vimrc + +== Test::Unit compiler plugin + +This has been improved and should now display messages similar to, though more +detailed than, the GUI test runners. + +== Bug Fixes + +A few minor bugs have been fixed in the Ruby syntax and indent files. + + = 2005.09.15 == eRuby Support From 14d49908f94a224e0ac6a5f5edf6a0de2c19da9d Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 24 Sep 2005 16:39:19 +0000 Subject: [PATCH 207/411] allow regexp's as hash values and after a ';' --- ChangeLog | 2 ++ syntax/ruby.vim | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a68b31ef..531e0691 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2005-09-24 Doug Kearns + * syntax/ruby.vim: allow regexp's as hash values and after a ';' + * NEWS: updated for new release * syntax/ruby.vim: fix typo in rubyControl highlight group name diff --git a/syntax/ruby.vim b/syntax/ruby.vim index fabda424..0a5ec0b5 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.78 2005/09/24 12:20:16 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.79 2005/09/24 16:39:19 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -91,7 +91,7 @@ syn match rubyPredefinedConstant "\%(\%(\.\@" " Normal Regular Expression -syn region rubyString matchgroup=rubyStringDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\)\|[\~=!|&(,[]\)\s*\)\@<=/" end="/[iomx]*" skip="\\\\\|\\/" contains=@rubyStringSpecial +syn region rubyString matchgroup=rubyStringDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\)\|[;\~=!|&(,[>]\)\s*\)\@<=/" end="/[iomx]*" skip="\\\\\|\\/" contains=@rubyStringSpecial syn region rubyString matchgroup=rubyStringDelimiter start="\%(\<\%(split\|scan\|gsub\|sub\)\s*\)\@<=/" end="/[iomx]*" skip="\\\\\|\\/" contains=@rubyStringSpecial " Normal String and Shell Command Output From c67d32d5764e914ca3a92c4dbd018b5ae94d00de Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sun, 25 Sep 2005 10:59:54 +0000 Subject: [PATCH 208/411] allow comments to be highlighted directly after module/class/method definitions --- ChangeLog | 5 +++++ syntax/ruby.vim | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 531e0691..2ecb3ef1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-09-25 Doug Kearns + + * syntax/ruby.vim: allow comments to be highlighted directly after + module/class/method definitions without intervening whitespace + 2005-09-24 Doug Kearns * syntax/ruby.vim: allow regexp's as hash values and after a ';' diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 0a5ec0b5..4756a4e0 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.79 2005/09/24 16:39:19 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.80 2005/09/25 10:59:54 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -144,10 +144,10 @@ end " Expensive Mode - colorize *end* according to opening statement if !exists("ruby_no_expensive") - syn region rubyFunction matchgroup=rubyDefine start="\ Date: Mon, 26 Sep 2005 14:59:06 +0000 Subject: [PATCH 209/411] use print instead of puts to generate s:rubypath --- ChangeLog | 4 ++++ ftplugin/ruby.vim | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2ecb3ef1..714ef9fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-09-26 Doug Kearns + + * ftplugin/ruby.vim: use print instead of puts to generate s:rubypath + 2005-09-25 Doug Kearns * syntax/ruby.vim: allow comments to be highlighted directly after diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index 81c23cfe..815e1273 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.11 2005/09/11 12:02:53 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.12 2005/09/26 14:59:06 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -67,9 +67,9 @@ setlocal commentstring=#\ %s if !exists("s:rubypath") if executable("ruby") if &shellxquote == "'" - let s:rubypath = system('ruby -e "puts (begin; require %q{rubygems}; Gem.all_load_paths; rescue LoadError; []; end + $:).join(%q{,})"') + let s:rubypath = system('ruby -e "print (begin; require %q{rubygems}; Gem.all_load_paths; rescue LoadError; []; end + $:).join(%q{,})"') else - let s:rubypath = system("ruby -e 'puts (begin; require %q{rubygems}; Gem.all_load_paths; rescue LoadError; []; end + $:).join(%q{,})'") + let s:rubypath = system("ruby -e 'print (begin; require %q{rubygems}; Gem.all_load_paths; rescue LoadError; []; end + $:).join(%q{,})'") endif let s:rubypath = substitute(s:rubypath,',.$',',,','') else From 2494c737fa7227d6376e0169403be7c80eefc1a9 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 27 Sep 2005 05:08:01 +0000 Subject: [PATCH 210/411] replace a single '.' with ',,' in all locations in 'path' --- ChangeLog | 5 +++++ ftplugin/ruby.vim | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 714ef9fc..6bd11779 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-09-27 Doug Kearns + + * ftplugin/ruby.vim: replace a single '.' with ',,' in all locations + in 'path' + 2005-09-26 Doug Kearns * ftplugin/ruby.vim: use print instead of puts to generate s:rubypath diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index 815e1273..a075378f 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.12 2005/09/26 14:59:06 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.13 2005/09/27 05:08:01 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -71,7 +71,7 @@ if !exists("s:rubypath") else let s:rubypath = system("ruby -e 'print (begin; require %q{rubygems}; Gem.all_load_paths; rescue LoadError; []; end + $:).join(%q{,})'") endif - let s:rubypath = substitute(s:rubypath,',.$',',,','') + let s:rubypath = substitute(s:rubypath, '\%(^\|,\)\.\%(,\|$\)', ',,', '') else " If we can't call ruby to get its path, just default to using the " current directory and the directory of the current file. From 164065256fe8a215fb56f5ab59a41cc4bfb1220a Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 30 Sep 2005 10:56:19 +0000 Subject: [PATCH 211/411] place Gems after the standard $LOAD_PATH in 'path' --- ChangeLog | 5 +++++ ftplugin/ruby.vim | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6bd11779..8aa6a1cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-09-30 Doug Kearns + + * ftplugin/ruby.vim: place Gems after the standard $LOAD_PATH in + 'path' + 2005-09-27 Doug Kearns * ftplugin/ruby.vim: replace a single '.' with ',,' in all locations diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index a075378f..ae5c1da9 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.13 2005/09/27 05:08:01 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.14 2005/09/30 10:56:19 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -66,10 +66,11 @@ setlocal commentstring=#\ %s if !exists("s:rubypath") if executable("ruby") + let s:code = "print ($: + begin; require %q{rubygems}; Gem.all_load_paths.sort.uniq; rescue LoadError; []; end).join(%q{,})" if &shellxquote == "'" - let s:rubypath = system('ruby -e "print (begin; require %q{rubygems}; Gem.all_load_paths; rescue LoadError; []; end + $:).join(%q{,})"') + let s:rubypath = system('ruby -e "' . s:code . '"') else - let s:rubypath = system("ruby -e 'print (begin; require %q{rubygems}; Gem.all_load_paths; rescue LoadError; []; end + $:).join(%q{,})'") + let s:rubypath = system("ruby -e '" . s:code . "'") endif let s:rubypath = substitute(s:rubypath, '\%(^\|,\)\.\%(,\|$\)', ',,', '') else From 486b230a10210a8fbf895578e95ed5457af3f61f Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 4 Oct 2005 11:11:34 +0000 Subject: [PATCH 212/411] replace spaces with tabs, where possible, to reduce file sizes as requested by BM --- ChangeLog | 8 ++++++++ compiler/ruby.vim | 8 ++++---- compiler/rubyunit.vim | 4 ++-- ftplugin/eruby.vim | 8 ++++---- ftplugin/ruby.vim | 34 +++++++++++++++++----------------- indent/eruby.vim | 10 +++++----- indent/ruby.vim | 36 ++++++++++++++++++------------------ syntax/ruby.vim | 22 +++++++++++----------- 8 files changed, 69 insertions(+), 61 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8aa6a1cd..77d729d2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-10-04 Doug Kearns + + * compiler/eruby.vim, compiler/rubyunit.vim, compiler/ruby.vim, + ftdetect/ruby.vim, ftplugin/eruby.vim, ftplugin/ruby.vim, + indent/eruby.vim, indent/ruby.vim, syntax/eruby.vim, syntax/ruby.vim: + replace spaces with tabs, where possible, to reduce file sizes as + requested by BM + 2005-09-30 Doug Kearns * ftplugin/ruby.vim: place Gems after the standard $LOAD_PATH in diff --git a/compiler/ruby.vim b/compiler/ruby.vim index cdcaf812..c26d9a22 100644 --- a/compiler/ruby.vim +++ b/compiler/ruby.vim @@ -2,7 +2,7 @@ " Language: Ruby " Function: Syntax check and/or error reporting " Maintainer: Tim Hammerquist -" Info: $Id: ruby.vim,v 1.10 2005/09/08 14:07:37 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.11 2005/10/04 11:11:34 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -14,9 +14,9 @@ " ---------------------------------------------------------------------------- " " Changelog: -" 0.2: script saves and restores 'cpoptions' value to prevent problems with -" line continuations -" 0.1: initial release +" 0.2: script saves and restores 'cpoptions' value to prevent problems with +" line continuations +" 0.1: initial release " " Contributors: " Hugh Sasse diff --git a/compiler/rubyunit.vim b/compiler/rubyunit.vim index 5da23604..4fdb3ed3 100644 --- a/compiler/rubyunit.vim +++ b/compiler/rubyunit.vim @@ -1,7 +1,7 @@ " Vim compiler file " Language: Test::Unit - Ruby Unit Testing Framework " Maintainer: Doug Kearns -" Info: $Id: rubyunit.vim,v 1.8 2005/09/22 15:51:48 dkearns Exp $ +" Info: $Id: rubyunit.vim,v 1.9 2005/10/04 11:11:34 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -28,7 +28,7 @@ CompilerSet makeprg=testrb CompilerSet errorformat=\%W\ %\\+%\\d%\\+)\ Failure:, \%C%m\ [%f:%l]:, - \%E\ %\\+%\\d%\\+)\ Error:, + \%E\ %\\+%\\d%\\+)\ Error:, \%C%m:, \%C\ \ \ \ %f:%l:%.%#, \%C%m, diff --git a/ftplugin/eruby.vim b/ftplugin/eruby.vim index 16eb7935..88cbc83f 100644 --- a/ftplugin/eruby.vim +++ b/ftplugin/eruby.vim @@ -1,10 +1,10 @@ " Vim filetype plugin " Language: eRuby " Maintainer: Doug Kearns -" Info: $Id: eruby.vim,v 1.2 2005/09/08 14:07:37 dkearns Exp $ -" URL: http://vim-ruby.sourceforge.net -" Anon CVS: See above site -" Licence: GPL (http://www.gnu.org) +" Info: $Id: eruby.vim,v 1.3 2005/10/04 11:11:34 dkearns Exp $ +" URL: http://vim-ruby.sourceforge.net +" Anon CVS: See above site +" Licence: GPL (http://www.gnu.org) " Disclaimer: " This program is distributed in the hope that it will be useful, " but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index ae5c1da9..b7cff753 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,10 +1,10 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.14 2005/09/30 10:56:19 dkearns Exp $ -" URL: http://vim-ruby.sourceforge.net -" Anon CVS: See above site -" Licence: GPL (http://www.gnu.org) +" Info: $Id: ruby.vim,v 1.15 2005/10/04 11:11:34 dkearns Exp $ +" URL: http://vim-ruby.sourceforge.net +" Anon CVS: See above site +" Licence: GPL (http://www.gnu.org) " Disclaimer: " This program is distributed in the hope that it will be useful, " but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -12,7 +12,7 @@ " GNU General Public License for more details. " ---------------------------------------------------------------------------- " -" Original matchit support thanks to Ned Konz. See his ftplugin/ruby.vim at +" Original matchit support thanks to Ned Konz. See his ftplugin/ruby.vim at " http://bike-nomad.com/vim/ruby.vim. " ---------------------------------------------------------------------------- @@ -32,15 +32,15 @@ if exists("loaded_matchit") && !exists("b:match_words") " TODO: improve optional do loops let b:match_words = \ '\%(' . - \ '\%(\%(\.\|\:\:\)\s*\)\@' . - \ '\|' . - \ '\%(\%(^\|\.\.\.\=\|[\,;=([<>~\*/%!&^|+-]\)\s*\)\@<=\%(if\|unless\|until\|while\)\>' . + \ '\%(\%(\.\|\:\:\)\s*\)\@' . + \ '\|' . + \ '\%(\%(^\|\.\.\.\=\|[\,;=([<>~\*/%!&^|+-]\)\s*\)\@<=\%(if\|unless\|until\|while\)\>' . \ '\)' . \ ':' . \ '\%(' . - \ '\%(\%(\.\|\:\:\)\s*\)\@' . - \ '\|' . - \ '\%(\%(^\|;\)\s*\)\@<=\' . + \ '\%(\%(\.\|\:\:\)\s*\)\@' . + \ '\|' . + \ '\%(\%(^\|;\)\s*\)\@<=\' . \ '\)' . \ ':' . \ '\%(\%(\.\|\:\:\)\s*\)\@' @@ -84,7 +84,7 @@ let &l:path = s:rubypath if has("gui_win32") && !exists("b:browsefilter") let b:browsefilter = "Ruby Source Files (*.rb)\t*.rb\n" . - \ "All Files (*.*)\t*.*\n" + \ "All Files (*.*)\t*.*\n" endif let b:undo_ftplugin = "setl fo< inc< inex< sua< def< com< cms< path< " @@ -98,7 +98,7 @@ unlet s:cpo_save " " 1. Look for the latest "matchit" plugin at " -" http://www.vim.org/scripts/script.php?script_id=39 +" http://www.vim.org/scripts/script.php?script_id=39 " " It is also packaged with Vim, in the $VIMRUNTIME/macros directory. " @@ -109,16 +109,16 @@ unlet s:cpo_save " 4. Ensure this file (ftplugin/ruby.vim) is installed. " " 5. Ensure you have this line in your $HOME/.vimrc: -" filetype plugin on +" filetype plugin on " " 6. Restart Vim and create the matchit documentation: " -" :helptags ~/.vim/doc +" :helptags ~/.vim/doc " " Now you can do ":help matchit", and you should be able to use "%" on Ruby -" keywords. Try ":echo b:match_words" to be sure. +" keywords. Try ":echo b:match_words" to be sure. " -" Thanks to Mark J. Reed for the instructions. See ":help vimrc" for the +" Thanks to Mark J. Reed for the instructions. See ":help vimrc" for the " locations of plugin directories, etc., as there are several options, and it " differs on Windows. Email gsinclair@soyabean.com.au if you need help. " diff --git a/indent/eruby.vim b/indent/eruby.vim index c80181bf..93e89402 100644 --- a/indent/eruby.vim +++ b/indent/eruby.vim @@ -1,10 +1,10 @@ " Vim indent file -" Language: Ruby +" Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: eruby.vim,v 1.1 2005/09/21 14:24:56 dkearns Exp $ -" URL: http://vim-ruby.rubyforge.org/ -" Anon CVS: See above site -" Licence: GPL (http://www.gnu.org) +" Info: $Id: eruby.vim,v 1.2 2005/10/04 11:11:34 dkearns Exp $ +" URL: http://vim-ruby.rubyforge.org/ +" Anon CVS: See above site +" Licence: GPL (http://www.gnu.org) " Disclaimer: " This program is distributed in the hope that it will be useful, " but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/indent/ruby.vim b/indent/ruby.vim index 19b409d6..8d868392 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -1,11 +1,11 @@ " Vim indent file -" Language: Ruby -" Maintainer: Gavin Sinclair -" Developer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.31 2005/09/19 09:09:04 pcp Exp $ -" URL: http://vim-ruby.rubyforge.org/ -" Anon CVS: See above site -" Licence: GPL (http://www.gnu.org) +" Language: Ruby +" Maintainer: Gavin Sinclair +" Developer: Nikolai Weibull +" Info: $Id: ruby.vim,v 1.32 2005/10/04 11:11:34 dkearns Exp $ +" URL: http://vim-ruby.rubyforge.org/ +" Anon CVS: See above site +" Licence: GPL (http://www.gnu.org) " Disclaimer: " This program is distributed in the hope that it will be useful, " but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -134,14 +134,14 @@ function s:PrevNonBlankNonString(lnum) let line = getline(lnum) if line =~ '^=begin$' if in_block - let in_block = 0 + let in_block = 0 else - break + break endif elseif !in_block && line =~ '^=end$' let in_block = 1 elseif !in_block && line !~ '^\s*#.*$' && !(s:IsInStringOrComment(lnum, 1) - \ && s:IsInStringOrComment(lnum, strlen(line))) + \ && s:IsInStringOrComment(lnum, strlen(line))) break endif let lnum = prevnonblank(lnum - 1) @@ -160,7 +160,7 @@ function s:GetMSL(lnum) let line = getline(lnum) let col = match(line, s:continuation_regex2) + 1 if (col > 0 && !s:IsInStringOrComment(lnum, col)) - \ || s:IsInString(lnum, strlen(line)) + \ || s:IsInString(lnum, strlen(line)) let msl = lnum else break @@ -181,9 +181,9 @@ function s:LineHasOpeningBrackets(lnum) if !s:IsInStringOrComment(a:lnum, pos + 1) let idx = stridx('(){}[]', line[pos]) if idx % 2 == 0 - let open_{idx} = open_{idx} + 1 + let open_{idx} = open_{idx} + 1 else - let open_{idx - 1} = open_{idx - 1} - 1 + let open_{idx - 1} = open_{idx - 1} - 1 endif endif let pos = match(line, '[][(){}]', pos + 1) @@ -246,13 +246,13 @@ function GetRubyIndent() if s:Match(v:lnum, s:ruby_deindent_keywords) call cursor(v:lnum, 1) if searchpair(s:end_start_regex, s:end_middle_regex, s:end_end_regex, 'bW', - \ s:end_skip_expr) > 0 + \ s:end_skip_expr) > 0 let line = getline('.') if strpart(line, 0, col('.') - 1) =~ '=\s*$' && \ strpart(line, col('.') - 1, 2) !~ 'do' - let ind = virtcol('.') - 1 + let ind = virtcol('.') - 1 else - let ind = indent('.') + let ind = indent('.') endif endif return ind @@ -302,12 +302,12 @@ function GetRubyIndent() if col > 0 call cursor(lnum, col) if searchpair(s:end_start_regex, '', s:end_end_regex, 'bW', - \ s:end_skip_expr) > 0 + \ s:end_skip_expr) > 0 let n = line('.') let ind = indent('.') let msl = s:GetMSL(n) if msl != n - let ind = indent(msl) + let ind = indent(msl) end return ind endif diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 4756a4e0..0afdf3e4 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.80 2005/09/25 10:59:54 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.81 2005/10/04 11:11:34 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -96,8 +96,8 @@ syn region rubyString matchgroup=rubyStringDelimiter start="\%(\<\%(split\|scan\ " Normal String and Shell Command Output syn region rubyString matchgroup=rubyStringDelimiter start="\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial -syn region rubyString matchgroup=rubyStringDelimiter start="'" end="'" skip="\\\\\|\\'" -syn region rubyString matchgroup=rubyStringDelimiter start="`" end="`" skip="\\\\\|\\`" contains=@rubyStringSpecial +syn region rubyString matchgroup=rubyStringDelimiter start="'" end="'" skip="\\\\\|\\'" +syn region rubyString matchgroup=rubyStringDelimiter start="`" end="`" skip="\\\\\|\\`" contains=@rubyStringSpecial " Generalized Regular Expression syn region rubyString matchgroup=rubyStringDelimiter start="%r\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1[iomx]*" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold @@ -145,13 +145,13 @@ end " Expensive Mode - colorize *end* according to opening statement if !exists("ruby_no_expensive") syn region rubyFunction matchgroup=rubyDefine start="\" display @@ -178,7 +178,7 @@ else syn region rubyFunction matchgroup=rubyControl start="\\)" - syn keyword rubyEval eval class_eval instance_eval module_eval + syn keyword rubyEval eval class_eval instance_eval module_eval syn keyword rubyException raise fail catch throw syn keyword rubyInclude autoload extend include load require syn keyword rubyKeyword callcc caller lambda proc @@ -205,7 +205,7 @@ endif " Comments and Documentation syn match rubySharpBang "\%^#!.*" display -syn keyword rubyTodo FIXME NOTE TODO XXX contained +syn keyword rubyTodo FIXME NOTE TODO XXX contained syn match rubyComment "#.*" contains=rubySharpBang,rubySpaceError,rubyTodo,@Spell syn region rubyDocumentation start="^=begin" end="^=end.*$" contains=rubySpaceError,rubyTodo,@Spell fold From 431f4eb207033705b2ba83c55c23f1f74e7de3b2 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 4 Oct 2005 11:26:30 +0000 Subject: [PATCH 213/411] make the use of 'ruby_no_expensive' local to the buffer for eruby files --- ChangeLog | 3 +++ syntax/ruby.vim | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 77d729d2..290f5fd5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2005-10-04 Doug Kearns + * syntax/ruby.vim: make the use of 'ruby_no_expensive' local to the + buffer for eruby files + * compiler/eruby.vim, compiler/rubyunit.vim, compiler/ruby.vim, ftdetect/ruby.vim, ftplugin/eruby.vim, ftplugin/ruby.vim, indent/eruby.vim, indent/ruby.vim, syntax/eruby.vim, syntax/ruby.vim: diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 0afdf3e4..8d88fbd9 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.81 2005/10/04 11:11:34 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.82 2005/10/04 11:26:30 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -139,11 +139,11 @@ syn region rubyString start=+\%(\%(class\s*\|\%(\.\|::\)\)\_s*\)\@ Date: Wed, 5 Oct 2005 05:31:29 +0000 Subject: [PATCH 214/411] add '.' to the head of 'path' so that files relative to the directory of the current file are found first --- ChangeLog | 5 +++++ ftplugin/ruby.vim | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 290f5fd5..f2e60313 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-10-05 Doug Kearns + + * ftplugin/ruby.vim: add '.' to the head of 'path' so that files + relative to the directory of the current file are found first + 2005-10-04 Doug Kearns * syntax/ruby.vim: make the use of 'ruby_no_expensive' local to the diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index b7cff753..fbf4f81b 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.15 2005/10/04 11:11:34 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.16 2005/10/05 05:31:29 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -72,7 +72,7 @@ if !exists("s:rubypath") else let s:rubypath = system("ruby -e '" . s:code . "'") endif - let s:rubypath = substitute(s:rubypath, '\%(^\|,\)\.\%(,\|$\)', ',,', '') + let s:rubypath = '.,' . substitute(s:rubypath, '\%(^\|,\)\.\%(,\|$\)', ',,', '') else " If we can't call ruby to get its path, just default to using the " current directory and the directory of the current file. From a573242043a521bd72ec3d69ef4592275312aba0 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 5 Oct 2005 12:01:16 +0000 Subject: [PATCH 215/411] raise an exception if there are unknown args passed to the install script --- ChangeLog | 3 +++ bin/vim-ruby-install.rb | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f2e60313..ec6eab62 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2005-10-05 Doug Kearns + * bin/vim-ruby-install.rb: raise an exception if there are unknown + args passed to the script + * ftplugin/ruby.vim: add '.' to the head of 'path' so that files relative to the directory of the current file are found first diff --git a/bin/vim-ruby-install.rb b/bin/vim-ruby-install.rb index 92f0379d..11cdc105 100755 --- a/bin/vim-ruby-install.rb +++ b/bin/vim-ruby-install.rb @@ -152,7 +152,7 @@ def copy(source_path, target_path) end # Create the given directory with the correct directory permissions. def mkpath(directory) - FileUtils.mkdir_p directory.to_s, :mode => @permissions[:dir], :verbose => true + FileUtils.mkdir_p(directory.to_s, :mode => @permissions[:dir], :verbose => true) end def _ensure_directory_exists(path) dir = path.dirname @@ -415,6 +415,10 @@ def path end op.parse!(ARGV) + if not ARGV.empty? + raise "invalid argument: #{ARGV[0]}" + end + source_dir = Env.determine_source_directory if source_dir.nil? raise "Can't find source directory." From 294295edddab88a48430a0ba80e3667bb1b96bb6 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 5 Oct 2005 12:18:00 +0000 Subject: [PATCH 216/411] update NEWS for new release --- ChangeLog | 2 ++ NEWS | 20 ++++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index ec6eab62..dd0bac23 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2005-10-05 Doug Kearns + * NEWS: updated for new release + * bin/vim-ruby-install.rb: raise an exception if there are unknown args passed to the script diff --git a/NEWS b/NEWS index efcb2cda..d8e4c034 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,18 @@ += 2005.10.05 + +== Bug Fixes + +Ruby syntax file - allow for comments directly after module/class/def lines +without intervening whitespace (fold markers were breaking syntax highlighting). + +Ruby filetype plugin - improve ordering of 'path' elements. + +eRuby syntax file - make use of ruby_no_expensive local to the buffer. + + = 2005.09.24 -== Filetype detection +== Filetype Detection The eruby filetype is now detected solely based on the file's extension. This was being overridden by the scripts.vim detection script. @@ -9,17 +21,17 @@ Note: Only files ending in *.rhtml are detected as filetype eruby since these are currently assumed to be Ruby embedded in (X)HTML only. Other filetypes could be supported if requested. -== eRuby indent file +== eRuby Indent File There is a new eRuby indent file which simply sources the HTML indent file for now. -== eRuby compiler plugin +== eRuby Compiler Plugin This now supports erb as the default 'makeprg'. To use eruby set the eruby_compiler variable to "eruby" in your .vimrc -== Test::Unit compiler plugin +== Test::Unit Compiler Plugin This has been improved and should now display messages similar to, though more detailed than, the GUI test runners. From a207ace159f850a85ebc108f8a77307091d3e9cf Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 6 Oct 2005 07:13:52 +0000 Subject: [PATCH 217/411] prevent symbols from matching as matchit match_words --- ChangeLog | 5 +++++ ftplugin/ruby.vim | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index dd0bac23..916cc4e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-10-06 Doug Kearns + + * ftplugin/ruby.vim: prevent symbols from matching as matchit + match_words + 2005-10-05 Doug Kearns * NEWS: updated for new release diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index fbf4f81b..dd2de33a 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.16 2005/10/05 05:31:29 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.17 2005/10/06 07:13:52 dkearns Exp $ " URL: http://vim-ruby.sourceforge.net " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -32,18 +32,18 @@ if exists("loaded_matchit") && !exists("b:match_words") " TODO: improve optional do loops let b:match_words = \ '\%(' . - \ '\%(\%(\.\|\:\:\)\s*\)\@' . + \ '\%(\%(\.\|\:\:\)\s*\|\:\)\@' . \ '\|' . \ '\%(\%(^\|\.\.\.\=\|[\,;=([<>~\*/%!&^|+-]\)\s*\)\@<=\%(if\|unless\|until\|while\)\>' . \ '\)' . \ ':' . \ '\%(' . - \ '\%(\%(\.\|\:\:\)\s*\)\@' . + \ '\%(\%(\.\|\:\:\)\s*\|\:\)\@' . \ '\|' . \ '\%(\%(^\|;\)\s*\)\@<=\' . \ '\)' . \ ':' . - \ '\%(\%(\.\|\:\:\)\s*\)\@' + \ '\%(\%(\.\|\:\:\)\s*\|\:\)\@' let b:match_skip = \ "synIDattr(synID(line('.'),col('.'),0),'name') =~ '" . From 2b9991a9ca0be1ee3b894b9f17c91406a97770db Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 7 Oct 2005 07:31:44 +0000 Subject: [PATCH 218/411] update syntax documentation formatting for Vim 6.4 release --- ChangeLog | 4 ++++ syntax/doc/ruby.txt | 29 +++++++++++++++-------------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 916cc4e7..b4ca9fa5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-10-07 Doug Kearns + + * syntax/doc/ruby.txt: update formatting for Vim 6.4 release + 2005-10-06 Doug Kearns * ftplugin/ruby.vim: prevent symbols from matching as matchit diff --git a/syntax/doc/ruby.txt b/syntax/doc/ruby.txt index af856394..0d8a8b12 100644 --- a/syntax/doc/ruby.txt +++ b/syntax/doc/ruby.txt @@ -1,13 +1,13 @@ -RUBY *ruby.vim* *ruby-syntax* +RUBY *ruby.vim* *ruby-syntax* There are a number of options to the Ruby syntax highlighting. By default, the "end" keyword is colorized according to the opening statement -of the block it closes. While useful, this feature can be expensive: if you +of the block it closes. While useful, this feature can be expensive; if you experience slow redrawing (or you are on a terminal with poor color support) you may want to turn it off by defining the "ruby_no_expensive" variable: > - :let ruby_no_expensive = 1 + :let ruby_no_expensive = 1 In this case the same color will be used for all control keywords. @@ -15,7 +15,7 @@ If you do want this feature enabled, but notice highlighting errors while scrolling backwards, which are fixed when redrawing with CTRL-L, try setting the "ruby_minlines" variable to a value larger than 50: > - :let ruby_minlines = 100 + :let ruby_minlines = 100 Ideally, this value should be a number of lines large enough to embrace your largest class or module. @@ -23,33 +23,34 @@ largest class or module. Highlighting of special identifiers can be disabled by defining "ruby_no_identifiers": > - :let ruby_no_identifiers = 1 + :let ruby_no_identifiers = 1 This will prevent highlighting of special identifiers like "ConstantName", -"$global_var", "@@class_var", "@instance_var", "| iterator |", and ":symbol". +"$global_var", "@@class_var", "@instance_var", "| block_param |", and +":symbol". -Significant methods of Class, Object, Module and Kernel are highlighted by -default. This can be disabled by defining "ruby_no_special_methods": > +Significant methods of Kernel, Module and Object are highlighted by default. +This can be disabled by defining "ruby_no_special_methods": > - :let ruby_no_special_methods = 1 + :let ruby_no_special_methods = 1 -This will prevent highlighting of special methods such as "require", +This will prevent highlighting of important methods such as "require", "attr", "private", "raise" and "proc". Whitespace errors can be highlighted by defining "ruby_space_errors": > - :let ruby_space_errors = 1 + :let ruby_space_errors = 1 This will highlight trailing whitespace and tabs preceded by a space character -as errors. This can be refined by defining "ruby_no_trail_space_error" and +as errors. This can be refined by defining "ruby_no_trail_space_error" and "ruby_no_tab_space_error" which will ignore trailing whitespace and tabs after spaces respectively. Folding can be enabled by defining "ruby_fold": > - :let ruby_fold = 1 + :let ruby_fold = 1 This will set the 'foldmethod' option to "syntax" and allow folding of classes, modules, methods, code blocks, heredocs and comments. -vim: ts=8 tw=78 + vim:tw=78:sw=4:ts=8:ft=help:norl: From 8383896e4e30252ae4a8b7d84c6d6fbf1d6c1179 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 7 Oct 2005 07:51:28 +0000 Subject: [PATCH 219/411] updated NEWS for new release --- ChangeLog | 2 ++ NEWS | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/ChangeLog b/ChangeLog index b4ca9fa5..22d4333e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2005-10-07 Doug Kearns + * NEWS: updated for new release + * syntax/doc/ruby.txt: update formatting for Vim 6.4 release 2005-10-06 Doug Kearns diff --git a/NEWS b/NEWS index d8e4c034..b16a3606 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,16 @@ += 2005.10.07 + +== Vim 6.4 + +This release is included in Vim 6.4. + +== Bug Fixes + +Ruby filetype plugin - symbols were incorrectly being matched as match_words +causing the matchit motion command to jump to an incorrect location in some +circumstances. + + = 2005.10.05 == Bug Fixes From bff1bd8fda24954502daf75db5564f04e19d83fd Mon Sep 17 00:00:00 2001 From: Nikolai Weibull Date: Wed, 12 Oct 2005 11:47:48 +0000 Subject: [PATCH 220/411] Fixed problem with here-documents and removed some unused code. --- indent/ruby.vim | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/indent/ruby.vim b/indent/ruby.vim index 8d868392..707b5010 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -2,7 +2,7 @@ " Language: Ruby " Maintainer: Gavin Sinclair " Developer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.32 2005/10/04 11:11:34 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.33 2005/10/12 11:47:48 pcp Exp $ " URL: http://vim-ruby.rubyforge.org/ " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -42,17 +42,13 @@ set cpo&vim let s:syng_strcom = '\' -" Regex of syntax group names that are strings or comments. -let s:syng_strcom2 = '\' - " Regex of syntax group names that are strings. let s:syng_string = - \ '\' + \ '\' " Regex of syntax group names that are strings or documentation. let s:syng_stringdoc = - \'\' + \'\' " Expression used to check whether we should skip a match with searchpair(). let s:skip_expr = @@ -109,11 +105,6 @@ function s:IsInStringOrComment(lnum, col) return synIDattr(synID(a:lnum, a:col, 0), 'name') =~ s:syng_strcom endfunction -" Check if the character at lnum:col is inside a string or comment. -function s:IsInStringOrComment2(lnum, col) - return synIDattr(synID(a:lnum, a:col, 0), 'name') =~ s:syng_strcom2 -endfunction - " Check if the character at lnum:col is inside a string. function s:IsInString(lnum, col) return synIDattr(synID(a:lnum, a:col, 0), 'name') =~ s:syng_string From 2fc3e4163946c3e4ccb81b0b90dbb8766fbcb651 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 13 Oct 2005 02:48:52 +0000 Subject: [PATCH 221/411] add filetype detection for Rantfiles --- ChangeLog | 4 ++++ ftdetect/ruby.vim | 3 +++ 2 files changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index 22d4333e..e275cee7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-10-13 Doug Kearns + + * ftdetect/ruby.vim: add filetype detection for Rantfiles + 2005-10-07 Doug Kearns * NEWS: updated for new release diff --git a/ftdetect/ruby.vim b/ftdetect/ruby.vim index 9723fe15..e2dad832 100644 --- a/ftdetect/ruby.vim +++ b/ftdetect/ruby.vim @@ -4,5 +4,8 @@ au BufNewFile,BufRead *.rb,*.rbw,*.gem,*.gemspec set filetype=ruby " Rakefile au BufNewFile,BufRead [rR]akefile* set filetype=ruby +" Rantfile +au BufNewFile,BufRead [rR]antfile,*.rant set filetype=ruby + " eRuby au BufNewFile,BufRead *.rhtml set filetype=eruby From b958c02eaf8839a4fd21d4d4b583bd6d793514e0 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 13 Oct 2005 16:41:44 +0000 Subject: [PATCH 222/411] fix typo in URL header --- ChangeLog | 4 ++++ compiler/eruby.vim | 4 ++-- compiler/rubyunit.vim | 4 ++-- ftplugin/eruby.vim | 4 ++-- ftplugin/ruby.vim | 4 ++-- indent/eruby.vim | 4 ++-- indent/ruby.vim | 4 ++-- syntax/eruby.vim | 4 ++-- syntax/ruby.vim | 4 ++-- 9 files changed, 20 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index e275cee7..f57341b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2005-10-13 Doug Kearns + * compiler/eruby.vim, compiler/rubyunit.vim, ftplugin/eruby.vim, + ftplugin/ruby.vim, indent/eruby.vim, indent/ruby.vim, + syntax/eruby.vim, syntax/ruby.vim: fix typo in URL header + * ftdetect/ruby.vim: add filetype detection for Rantfiles 2005-10-07 Doug Kearns diff --git a/compiler/eruby.vim b/compiler/eruby.vim index 592f6dcb..906da136 100644 --- a/compiler/eruby.vim +++ b/compiler/eruby.vim @@ -1,8 +1,8 @@ " Vim compiler file " Language: eRuby " Maintainer: Doug Kearns -" Info: $Id: eruby.vim,v 1.4 2005/09/21 13:43:54 dkearns Exp $ -" URL: http://vim-ruby.sourceforge.net +" Info: $Id: eruby.vim,v 1.5 2005/10/13 16:41:44 dkearns Exp $ +" URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) " Disclaimer: diff --git a/compiler/rubyunit.vim b/compiler/rubyunit.vim index 4fdb3ed3..fe8a0c0d 100644 --- a/compiler/rubyunit.vim +++ b/compiler/rubyunit.vim @@ -1,8 +1,8 @@ " Vim compiler file " Language: Test::Unit - Ruby Unit Testing Framework " Maintainer: Doug Kearns -" Info: $Id: rubyunit.vim,v 1.9 2005/10/04 11:11:34 dkearns Exp $ -" URL: http://vim-ruby.sourceforge.net +" Info: $Id: rubyunit.vim,v 1.10 2005/10/13 16:41:44 dkearns Exp $ +" URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) " Disclaimer: diff --git a/ftplugin/eruby.vim b/ftplugin/eruby.vim index 88cbc83f..f0bd6cec 100644 --- a/ftplugin/eruby.vim +++ b/ftplugin/eruby.vim @@ -1,8 +1,8 @@ " Vim filetype plugin " Language: eRuby " Maintainer: Doug Kearns -" Info: $Id: eruby.vim,v 1.3 2005/10/04 11:11:34 dkearns Exp $ -" URL: http://vim-ruby.sourceforge.net +" Info: $Id: eruby.vim,v 1.4 2005/10/13 16:41:44 dkearns Exp $ +" URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) " Disclaimer: diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index dd2de33a..e532c8ad 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,8 +1,8 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.17 2005/10/06 07:13:52 dkearns Exp $ -" URL: http://vim-ruby.sourceforge.net +" Info: $Id: ruby.vim,v 1.18 2005/10/13 16:41:44 dkearns Exp $ +" URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) " Disclaimer: diff --git a/indent/eruby.vim b/indent/eruby.vim index 93e89402..703e56f9 100644 --- a/indent/eruby.vim +++ b/indent/eruby.vim @@ -1,8 +1,8 @@ " Vim indent file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: eruby.vim,v 1.2 2005/10/04 11:11:34 dkearns Exp $ -" URL: http://vim-ruby.rubyforge.org/ +" Info: $Id: eruby.vim,v 1.3 2005/10/13 16:41:44 dkearns Exp $ +" URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) " Disclaimer: diff --git a/indent/ruby.vim b/indent/ruby.vim index 707b5010..2cab2f94 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -2,8 +2,8 @@ " Language: Ruby " Maintainer: Gavin Sinclair " Developer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.33 2005/10/12 11:47:48 pcp Exp $ -" URL: http://vim-ruby.rubyforge.org/ +" Info: $Id: ruby.vim,v 1.34 2005/10/13 16:41:44 dkearns Exp $ +" URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) " Disclaimer: diff --git a/syntax/eruby.vim b/syntax/eruby.vim index cd59e187..fcdd0308 100644 --- a/syntax/eruby.vim +++ b/syntax/eruby.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: eRuby " Maintainer: Doug Kearns -" Info: $Id: eruby.vim,v 1.6 2005/09/13 04:26:56 dkearns Exp $ -" URL: http://vim-ruby.sourceforge.net +" Info: $Id: eruby.vim,v 1.7 2005/10/13 16:41:44 dkearns Exp $ +" URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) " Disclaimer: diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 8d88fbd9..425f2c69 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.82 2005/10/04 11:26:30 dkearns Exp $ -" URL: http://vim-ruby.sourceforge.net +" Info: $Id: ruby.vim,v 1.83 2005/10/13 16:41:44 dkearns Exp $ +" URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) " Disclaimer: From acacc72edc5e13f4a1946df28f5da338a77c8a77 Mon Sep 17 00:00:00 2001 From: Gavin Sinclair Date: Fri, 14 Oct 2005 13:11:04 +0000 Subject: [PATCH 223/411] Changed maintainer to Nikolai. --- indent/ruby.vim | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/indent/ruby.vim b/indent/ruby.vim index 2cab2f94..51c99130 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -1,8 +1,7 @@ " Vim indent file " Language: Ruby -" Maintainer: Gavin Sinclair " Developer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.34 2005/10/13 16:41:44 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.35 2005/10/14 13:11:04 gsinclair Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) From b08daa2cd2fbee7b57d6f6185822f6cad0b08bf8 Mon Sep 17 00:00:00 2001 From: Gavin Sinclair Date: Fri, 14 Oct 2005 13:20:26 +0000 Subject: [PATCH 224/411] Made Nikolai maintainer of indent/ruby.vim. --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index f57341b0..9c6a266d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-10-14 Gavin Sinclair + + * indent/ruby.vim: Changed maintainer to Nikolai. + 2005-10-13 Doug Kearns * compiler/eruby.vim, compiler/rubyunit.vim, ftplugin/eruby.vim, From f5447cf810b89bf15911e3779bb73b35faf62723 Mon Sep 17 00:00:00 2001 From: Gavin Sinclair Date: Fri, 14 Oct 2005 16:22:24 +0000 Subject: [PATCH 225/411] First draft. --- FAQ | 244 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 244 insertions(+) create mode 100644 FAQ diff --git a/FAQ b/FAQ new file mode 100644 index 00000000..4e9a40a2 --- /dev/null +++ b/FAQ @@ -0,0 +1,244 @@ +*vim-ruby.txt* *vim-ruby* *vim-ruby-faq* + + VIM/RUBY CONFIGURATION FILES + + The vim-ruby Project FAQ + + http://vim-ruby.rubyforge.org + +The vim-ruby project maintains Ruby-related configuration files for Vim. This +FAQ contains all you need to know about it. + +*** TOC *** + +============================================================================== + +*vim-ruby-faq-X* What is the vim-ruby project? + +It maintains all the configuration files that help Vim edit Ruby code. By +installing these files, Vim will properly highlight and indent Ruby files, and +will be able to run them and go directly to the location of any errors. +Rakefiles, ERB files, and unit tests are also identified and supported. + +If you make use of this project, make sure you read the installation and +configuration instructions in this FAQ. + + +*vim-ruby-faq-X* Doesn't Vim include these files? + +Yes it does. You should only want to download and install this project if it +has changed since you last installed your version of Vim. Read the "News" +section of the homepage to see when the most recent release was made. + + +*vim-ruby-faq-X* How do you get it? + +The easiest way is to run: > + + gem install vim-ruby + +(This really only downloads it. See installation instructions below.) + +If you don't have RubyGems, download a tarball from: > + + http://rubyforge.org/projects/vim-ruby/ + +Again, see installation instructions below. + + +*vim-ruby-faq-X* How do you install it? + +If you obtained the vim-ruby files via RubyGems, run: > + + vim-ruby-install.rb + +If you downloaded a tarball, unpack it, change to the created directory, and +run: > + + ruby bin/vim-ruby-install.rb + +Whichever way you run it, the effect is the same. The installer will: + - Search for a Vim config directory to put its files and ask you to confirm. + - Copy the configuration files to the appropriate places underneath the + directory you selected. + +Here is an example installation transcript: + + Possible Vim installation directories: ~ + 1) D:/Gavin/vimfiles ~ + 2) E:/Vim/vimfiles ~ + ~ + Please select one (or anything else to specify another directory): 2 ~ + compiler/eruby.vim -> E:/Vim/vimfiles/compiler/eruby.vim ~ + compiler/ruby.vim -> E:/Vim/vimfiles/compiler/ruby.vim ~ + compiler/rubyunit.vim -> E:/Vim/vimfiles/compiler/rubyunit.vim ~ + ftdetect/ruby.vim -> E:/Vim/vimfiles/ftdetect/ruby.vim ~ + ftplugin/eruby.vim -> E:/Vim/vimfiles/ftplugin/eruby.vim ~ + ftplugin/ruby.vim -> E:/Vim/vimfiles/ftplugin/ruby.vim ~ + indent/eruby.vim -> E:/Vim/vimfiles/indent/eruby.vim ~ + indent/ruby.vim -> E:/Vim/vimfiles/indent/ruby.vim ~ + syntax/eruby.vim -> E:/Vim/vimfiles/syntax/eruby.vim ~ + syntax/ruby.vim -> E:/Vim/vimfiles/syntax/ruby.vim ~ + +Existing files are overwritten. This is safe, because it's a slow-maturing +project, so new files are better than old ones. However, if you had edited the +files, you will have lost your changes. Better make your changes in, for +instance: + + ~/.vim/after/ftplugin/ruby.vim ~ + +This file will be loaded _after_ the regular config files are loaded, so your +customisations will definitely take effect. + + +*vim-ruby-faq-X* What Vim config do I need? + +Without the following lines in your .vimrc, _vimrc, or other startup file, the +files in the vim-ruby project will be largely useless. > + + set nocompatible " We're running Vim, not Vi! + syntax on " Enable syntax highlighting + filetype on " Enable filetype detection + filetype indent on " Enable filetype-specific indenting + filetype plugin on " Enable filetype-specific plugins + + TODO: matchit support + TODO: anything needed for compiler support? + +See |.vimrc| for more information about this important Vim configuration file. + + +*vim-ruby-faq-X* How do I know that everything's working? + +If you've run the installer and added the configuration above, everything should +be fine when you restart Vim. To test this: + - Edit a Ruby file with Vim (make sure it has a .rb extension). + - The code should be syntax highlighted. + - Type in some code. When you start a new line, it should be automatically + indented to the correct spot. + - Add or remove some space from the beginning of a line of code and hit ==. + That line should be reindented. + - Put the cursor on a "class" or "def" keyword and hit %. The cursor should + now be on the matching "end" keyword. + - TODO: what else? + + +*vim-ruby-faq-X* How do I use it? + +TODO: write. + + +*vim-ruby-faq-X* How do I customise it? + +The most important customisation for editing Ruby code is the amount of space to +indent. The following is a typical setup. Look up the various options to read +about them. > + + set expandtab + set tabstop=2 shiftwidth=2 softtabstop=2 + set autoindent + +TODO: is autoindent necessary? What other options should go here? What about +Ruby comments? + + +*vim-ruby-faq-X* I want feature X. Will you include it? + +The idea of the vim-ruby project is to maintain configuration files that are +actually distributed with Vim. Therefore all functionality should be helpful to +all Vim/Ruby users. So the project does not deal with people's individual +tastes. + +That said, we are considering creating a separate configuration file for less +universal features, whose features users can pick and choose. So don't hesitate +to send us your suggestions. + + +*vim-ruby-faq-X* What are some other cool Ruby-related Vim tricks I can use? + +An example is the following (put it in ~/.vimrc/ftplugin/ruby_extra.vim or +similar): > + + if !exists( "*EndToken" ) + function EndToken() + let current_line = getline( '.' ) + let braces_at_end = '{\s*\(|\(,\|\s\|\w\)*|\s*\)\?$' + if match( current_line, braces_at_end ) >= 0 + return '}' + else + return 'end' + endif + endfunction + endif + + imap :execute 'normal o' . EndToken()O + +This will help you create ruby blocks of code, by inserting "}" or "end" as +appropriate. Try creating these lines of code and hitting SHIFT-ENTER: + + array.map { |elem| ~ + + def fibonacci(n) ~ + +For other suggestions, search the web or look at: > + + http://rubygarden.org/ruby?VimRubySupport + + +*vim-ruby-faq-X* How can I report a bug? + +Bug reports are most welcome. In order or preference: + - submit a bug at http://rubyforge.org/tracker/?group_id=16 + - send an email to the mailing list (see below) + - email the maintainer (email address appears in each configuration file) + + +*vim-ruby-faq-X* Does the project have a mailing list? + +Yes: vim-ruby-devel@rubyforge.org. Only subscribers can post. To join, visit: +> + http://rubyforge.org/mailman/listinfo/vim-ruby-devel + +The list is mirrored at: > + + http://news.gmane.org/gmane.comp.editors.vim.vim%2druby.devel + + +*vim-ruby-faq-X* Why is this project separate from Vim? + +We can't use Vim's CVS to keep track of these files, so we organise it ourselves +and give Bram the latest files in time for each release of Vim. By keeping the +Ruby stuff together, we can release it all at once and people can update it +independently of Vim. + + +*vim-ruby-faq-X* I have another question... + +The mailing list or the file maintainer is a good place to ask. Or perhaps +comp.lang.ruby, but please make sure you've read the FAQ thoroughly before +asking there. + + +*vim-ruby-faq-X* Can you repeat all the web pages listed in this FAQ? + +Homepage: > + http://vim-ruby.rubyforge.org + +Project page: > + http://rubyforge.org/projects/vim-ruby/ + +Bug tracker: > + http://rubyforge.org/tracker/?group_id=16 + +Relevant Wiki page: > + http://rubygarden.org/ruby?VimRubySupport + +Mailing list archives: > + http://news.gmane.org/gmane.comp.editors.vim.vim%2druby.devel + http://rubyforge.org/pipermail/vim-ruby-devel/ + +Mailing list join: > + http://rubyforge.org/mailman/listinfo/vim-ruby-devel + + +vim: ft=help From f6042b73e07d55ef0c8d17751e1b11dd3866f41a Mon Sep 17 00:00:00 2001 From: Gavin Sinclair Date: Sat, 15 Oct 2005 12:59:59 +0000 Subject: [PATCH 226/411] Added Hugh Sasse's contribution (matchit instructions, more tags, ...). --- FAQ | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/FAQ b/FAQ index 4e9a40a2..1644829d 100644 --- a/FAQ +++ b/FAQ @@ -28,7 +28,8 @@ configuration instructions in this FAQ. Yes it does. You should only want to download and install this project if it has changed since you last installed your version of Vim. Read the "News" -section of the homepage to see when the most recent release was made. +section of the |vim-ruby-homepage| to see when the most recent release was +made. *vim-ruby-faq-X* How do you get it? @@ -37,7 +38,8 @@ The easiest way is to run: > gem install vim-ruby -(This really only downloads it. See installation instructions below.) +(This really only downloads it. See installation instructions +|vim-ruby-install| below.) If you don't have RubyGems, download a tarball from: > @@ -46,7 +48,7 @@ If you don't have RubyGems, download a tarball from: > Again, see installation instructions below. -*vim-ruby-faq-X* How do you install it? +*vim-ruby-faq-X* How do you install it? *vim-ruby-install* If you obtained the vim-ruby files via RubyGems, run: > @@ -91,7 +93,7 @@ This file will be loaded _after_ the regular config files are loaded, so your customisations will definitely take effect. -*vim-ruby-faq-X* What Vim config do I need? +*vim-ruby-faq-X* What Vim config do I need? *vim-ruby-config* Without the following lines in your .vimrc, _vimrc, or other startup file, the files in the vim-ruby project will be largely useless. > @@ -101,17 +103,19 @@ files in the vim-ruby project will be largely useless. > filetype on " Enable filetype detection filetype indent on " Enable filetype-specific indenting filetype plugin on " Enable filetype-specific plugins - - TODO: matchit support - TODO: anything needed for compiler support? + compiler ruby " Enable compiler support for ruby See |.vimrc| for more information about this important Vim configuration file. +See |matchit-install| for instructions on installing "matchit", which will +allow you to use |%| to bounce between Ruby keywords (class, def, while, ...) +and their respective "end" keywords. + *vim-ruby-faq-X* How do I know that everything's working? -If you've run the installer and added the configuration above, everything should -be fine when you restart Vim. To test this: +If you've run the installer and added the configuration |vim-ruby-config| +above, everything should be fine when you restart Vim. To test this: - Edit a Ruby file with Vim (make sure it has a .rb extension). - The code should be syntax highlighted. - Type in some code. When you start a new line, it should be automatically @@ -128,7 +132,7 @@ be fine when you restart Vim. To test this: TODO: write. -*vim-ruby-faq-X* How do I customise it? +*vim-ruby-faq-X* How do I customise it? *vim-ruby-customize* The most important customisation for editing Ruby code is the amount of space to indent. The following is a typical setup. Look up the various options to read @@ -140,6 +144,10 @@ about them. > TODO: is autoindent necessary? What other options should go here? What about Ruby comments? +FIXME: Autoindent is good. maybe mention |i_CTRL_D| and |i_CTRL_T| for +moving lines about in this context? +COMMENT: I never use ^D and ^T in insert mode, though I always knew what they +do. Might try them! *vim-ruby-faq-X* I want feature X. Will you include it? @@ -157,7 +165,7 @@ to send us your suggestions. *vim-ruby-faq-X* What are some other cool Ruby-related Vim tricks I can use? An example is the following (put it in ~/.vimrc/ftplugin/ruby_extra.vim or -similar): > +similar): [similar? |$VIMRUNTIME| or what?] > if !exists( "*EndToken" ) function EndToken() @@ -185,14 +193,15 @@ For other suggestions, search the web or look at: > http://rubygarden.org/ruby?VimRubySupport -*vim-ruby-faq-X* How can I report a bug? +*vim-ruby-faq-X* How can I report a bug? *vim-ruby-bug-reporting* -Bug reports are most welcome. In order or preference: +Bug reports are most welcome. In order of preference: - submit a bug at http://rubyforge.org/tracker/?group_id=16 - send an email to the mailing list (see below) - email the maintainer (email address appears in each configuration file) + *vim-ruby-list* *vim-ruby-faq-X* Does the project have a mailing list? Yes: vim-ruby-devel@rubyforge.org. Only subscribers can post. To join, visit: @@ -221,7 +230,7 @@ asking there. *vim-ruby-faq-X* Can you repeat all the web pages listed in this FAQ? -Homepage: > +Homepage *vim-ruby-homepage* : > http://vim-ruby.rubyforge.org Project page: > @@ -241,4 +250,4 @@ Mailing list join: > http://rubyforge.org/mailman/listinfo/vim-ruby-devel -vim: ft=help +vim: ft=help tw=78 noet : From e239b68ad66ca3c284b8a24fa485b01dddb764dd Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Fri, 14 Apr 2006 16:44:32 +0000 Subject: [PATCH 227/411] added ruby omni-completion files modified the ftplugin to set the omnifunc --- autoload/rubycomplete.vim | 305 ++++++++++++++++++++++++++++++++++++++ ftplugin/ruby.vim | 6 +- 2 files changed, 310 insertions(+), 1 deletion(-) create mode 100644 autoload/rubycomplete.vim diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim new file mode 100644 index 00000000..15c09f3f --- /dev/null +++ b/autoload/rubycomplete.vim @@ -0,0 +1,305 @@ +" Vim completion script +" Language: Ruby +" Maintainer: Mark Guzman ( segfault AT hasno DOT info ) +" Info: $Id: rubycomplete.vim,v 1.1 2006/04/14 16:44:32 segy Exp $ +" URL: http://vim-ruby.rubyforge.org +" Anon CVS: See above site +" Ruby IRB/Complete author: Keiju ISHITSUKA(keiju@ishitsuka.com) +" Last Change: 2006 Apr 14 +" +if !has('ruby') + echo "Error: Required vim compiled with +ruby" + finish +endif + +if version < 700 + echo "Error: Required vim >= 7.0" + finish +endif + +func! GetRubyVarType(v) + let stopline = 1 + let vtp = '' + let pos = getpos('.') + let [lnum,lcol] = searchpos('^\s*#\s*@var\s*'.a:v.'\>\s\+[^ \t]\+\s*$','nb',stopline) + if lnum != 0 && lcol != 0 + call setpos('.',pos) + let str = getline(lnum) + let vtp = substitute(str,'^\s*#\s*@var\s*'.a:v.'\>\s\+\([^ \t]\+\)\s*$','\1','') + return vtp + endif + call setpos('.',pos) + let [lnum,lcol] = searchpos(''.a:v.'\>\s*[+\-*/]*=\s*\([^ \t]\+.\(now\|new\|open\|get_instance\)\>\|[\[{"'']\)','nb',stopline) + if lnum != 0 && lcol != 0 + let str = matchstr(getline(lnum),'=\s*\([^ \t]\+.\(now\|new\|open\|get_instance\)\>\|[\[{"'']\)',lcol) + let str = substitute(str,'^=\s*','','') + call setpos('.',pos) + if str == '"' || str == '''' + return 'String' + elseif str == '[' + return 'Array' + elseif str == '{' + return 'Hash' + elseif strlen(str) > 4 + let l = stridx(str,'.') + return str[0:l-1] + end + return '' + endif + call setpos('.',pos) + return '' +endf + +function! rbcomplete#Complete(findstart, base) + "findstart = 1 when we need to get the text length + if a:findstart + let line = getline('.') + let idx = col('.') + while idx > 0 + let idx -= 1 + let c = line[idx-1] + if c =~ '\w' + continue + elseif ! c =~ '\.' + idx = -1 + break + else + break + endif + endwhile + + return idx + "findstart = 0 when we need to return the list of completions + else + execute "ruby get_completions('" . a:base . "')" + return g:rbcomplete_completions + endif +endfunction + + +function! s:DefRuby() +ruby << RUBYEOF +ReservedWords = [ + "BEGIN", "END", + "alias", "and", + "begin", "break", + "case", "class", + "def", "defined", "do", + "else", "elsif", "end", "ensure", + "false", "for", + "if", "in", + "module", + "next", "nil", "not", + "or", + "redo", "rescue", "retry", "return", + "self", "super", + "then", "true", + "undef", "unless", "until", + "when", "while", + "yield", + ] + +Operators = [ "%", "&", "*", "**", "+", "-", "/", + "<", "<<", "<=", "<=>", "==", "===", "=~", ">", ">=", ">>", + "[]", "[]=", "^", ] + +def identify_type(var) + @buf = VIM::Buffer.current + enum = @buf.line_number + snum = (enum-10).abs + nums = Range.new( snum, enum ) + regxs = '/.*(%s)\s*=(.*)/' % var + regx = Regexp.new( regxs ) + nums.each do |x| + ln = @buf[x] + #print $~ if regx.match( ln ) + end +end + +def load_requires + @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? + end + end +end + +def get_completions(base) + load_requires + input = VIM::evaluate('expand("")') + input += base + message = nil + + + case input + when /^(\/[^\/]*\/)\.([^.]*)$/ + # Regexp + receiver = $1 + message = Regexp.quote($2) + + candidates = Regexp.instance_methods(true) + select_message(receiver, message, candidates) + + when /^([^\]]*\])\.([^.]*)$/ + # Array + receiver = $1 + message = Regexp.quote($2) + + candidates = Array.instance_methods(true) + select_message(receiver, message, candidates) + + when /^([^\}]*\})\.([^.]*)$/ + # Proc or Hash + receiver = $1 + message = Regexp.quote($2) + + candidates = Proc.instance_methods(true) | Hash.instance_methods(true) + select_message(receiver, message, candidates) + + when /^(:[^:.]*)$/ + # Symbol + if Symbol.respond_to?(:all_symbols) + sym = $1 + candidates = Symbol.all_symbols.collect{|s| ":" + s.id2name} + candidates.grep(/^#{sym}/) + else + [] + end + + when /^::([A-Z][^:\.\(]*)$/ + # Absolute Constant or class methods + receiver = $1 + candidates = Object.constants + candidates.grep(/^#{receiver}/).collect{|e| "::" + e} + + when /^(((::)?[A-Z][^:.\(]*)+)::?([^:.]*)$/ + # Constant or class methods + receiver = $1 + message = Regexp.quote($4) + begin + candidates = eval("#{receiver}.constants | #{receiver}.methods") + rescue Exception + candidates = [] + end + candidates.grep(/^#{message}/).collect{|e| receiver + "::" + e} + + when /^(:[^:.]+)\.([^.]*)$/ + # Symbol + receiver = $1 + message = Regexp.quote($2) + + candidates = Symbol.instance_methods(true) + select_message(receiver, message, candidates) + + when /^([0-9_]+(\.[0-9_]+)?(e[0-9]+)?)\.([^.]*)$/ + # Numeric + receiver = $1 + message = Regexp.quote($4) + + begin + candidates = eval(receiver).methods + rescue Exception + candidates + end + select_message(receiver, message, candidates) + + when /^(\$[^.]*)$/ + candidates = global_variables.grep(Regexp.new(Regexp.quote($1))) + +# when /^(\$?(\.?[^.]+)+)\.([^.]*)$/ + when /^((\.?[^.]+)+)\.([^.]*)$/ + # variable + receiver = $1 + message = Regexp.quote($3) + + cv = eval("self.class.constants") + + vartype = VIM::evaluate("GetRubyVarType('%s')" % receiver) + if vartype != '' + candidates = eval("#{vartype}.instance_methods") + elsif (cv).include?(receiver) + # foo.func and foo is local var. + candidates = eval("#{receiver}.methods") + elsif /^[A-Z]/ =~ receiver and /\./ !~ receiver + # Foo::Bar.func + begin + candidates = eval("#{receiver}.methods") + rescue Exception + candidates = [] + end + else + # func1.func2 + candidates = [] + ObjectSpace.each_object(Module){|m| + next if m.name != "IRB::Context" and + /^(IRB|SLex|RubyLex|RubyToken)/ =~ m.name + candidates.concat m.instance_methods(false) + } + candidates.sort! + candidates.uniq! + end + #identify_type( receiver ) + select_message(receiver, message, candidates) + + #when /^((\.?[^.]+)+)\.([^.]*)\(\s*\)*$/ + #function call + #obj = $1 + #func = $3 + + when /^\.([^.]*)$/ + # unknown(maybe String) + + receiver = "" + message = Regexp.quote($1) + + candidates = String.instance_methods(true) + select_message(receiver, message, candidates) + + else + candidates = eval("self.class.constants") + + (candidates|ReservedWords).grep(/^#{Regexp.quote(input)}/) + end + + #print candidates + if message != nil && message.length > 0 + rexp = '^%s' % message.downcase + candidates.delete_if do |c| + c.downcase.match( rexp ) + $~ == nil + end + end + + outp = "" + # tags = VIM::evaluate("taglist('^%s$')" % + (candidates-Object.instance_methods).each { |c| outp += "{'word':'%s','item':'%s'}," % [ c, c ] } + outp.sub!(/,$/, '') + VIM::command("let g:rbcomplete_completions = [%s]" % outp) +end + + +def select_message(receiver, message, candidates) + candidates.grep(/^#{message}/).collect do |e| + case e + when /^[a-zA-Z_]/ + receiver + "." + e + when /^[0-9]/ + when *Operators + #receiver + " " + e + end + end + candidates.delete_if { |x| x == nil } + candidates.uniq! + candidates.sort! +end +RUBYEOF +endfunction + +call s:DefRuby() +" vim: set et ts=4: diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index e532c8ad..820cc146 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.18 2005/10/13 16:41:44 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.19 2006/04/14 16:44:32 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Licence: GPL (http://www.gnu.org) @@ -58,6 +58,10 @@ setlocal include=^\\s*\\<\\(load\\\|\w*require\\)\\> setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'$','.rb','') setlocal suffixesadd=.rb +if version >= 700 + setlocal omnifunc=rubycomplete#Complete +endif + " TODO: "setlocal define=^\\s*def From e74c0b23f43feeb108e24e3e6bbbb7935bd29eac Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 15 Apr 2006 11:14:40 +0000 Subject: [PATCH 228/411] add Mark to the list of maintainers; add rubycomplete.vim to the installer --- CONTRIBUTORS | 3 ++- ChangeLog | 6 ++++++ bin/vim-ruby-install.rb | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index f8f7fd81..d98d119a 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1,10 +1,11 @@ Maintainers: + Mark Guzman Tim Hammerquist Doug Kearns Gavin Sinclair + Nikolai Weibull Developers: - Nikolai Weibull Other contributors: Michael Brailsford diff --git a/ChangeLog b/ChangeLog index 9c6a266d..f2c8f927 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-04-15 Doug Kearns + + * CONTRIBUTORS, bin/vim-ruby-install.rb: add Mark to the list of + maintainers; add rubycomplete.vim to the installer script's list of + files + 2005-10-14 Gavin Sinclair * indent/ruby.vim: Changed maintainer to Nikolai. diff --git a/bin/vim-ruby-install.rb b/bin/vim-ruby-install.rb index 11cdc105..ea7cd1d6 100755 --- a/bin/vim-ruby-install.rb +++ b/bin/vim-ruby-install.rb @@ -18,6 +18,7 @@ require 'pathname' SOURCE_FILES = %w{ + autoload/rubycomplete.vim compiler/eruby.vim compiler/ruby.vim compiler/rubyunit.vim From 0df89c2f92ddb34442c740342ef800be757c69c6 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 15 Apr 2006 12:01:17 +0000 Subject: [PATCH 229/411] add Release-Coordinator header line and remove GPL license --- ChangeLog | 6 ++++ autoload/rubycomplete.vim | 59 ++++++++++++++++++++------------------- compiler/eruby.vim | 18 ++++-------- compiler/ruby.vim | 19 +++++-------- compiler/rubyunit.vim | 18 ++++-------- ftplugin/eruby.vim | 18 ++++-------- ftplugin/ruby.vim | 17 ++++------- indent/eruby.vim | 20 ++++++------- indent/ruby.vim | 18 ++++-------- syntax/eruby.vim | 17 ++++------- syntax/ruby.vim | 17 ++++------- 11 files changed, 94 insertions(+), 133 deletions(-) diff --git a/ChangeLog b/ChangeLog index f2c8f927..d585bdf9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2006-04-15 Doug Kearns + * autoload/rubycomplete.vim, compiler/rubyunit.vim, ftdetect/ruby.vim, + ftplugin/ruby.vim, indent/ruby.vim, syntax/ruby.vim, + compiler/eruby.vim, compiler/ruby.vim, ftplugin/eruby.vim, + indent/eruby.vim, syntax/eruby.vim: add Release-Coordinator header + line and remove GPL license + * CONTRIBUTORS, bin/vim-ruby-install.rb: add Mark to the list of maintainers; add rubycomplete.vim to the installer script's list of files diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 15c09f3f..4c289d57 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,12 +1,15 @@ " Vim completion script -" Language: Ruby -" Maintainer: Mark Guzman ( segfault AT hasno DOT info ) -" Info: $Id: rubycomplete.vim,v 1.1 2006/04/14 16:44:32 segy Exp $ -" URL: http://vim-ruby.rubyforge.org -" Anon CVS: See above site -" Ruby IRB/Complete author: Keiju ISHITSUKA(keiju@ishitsuka.com) -" Last Change: 2006 Apr 14 +" Language: Ruby +" Maintainer: Mark Guzman ( segfault AT hasno DOT info ) +" Info: $Id: rubycomplete.vim,v 1.2 2006/04/15 12:01:18 dkearns Exp $ +" URL: http://vim-ruby.rubyforge.org +" Anon CVS: See above site +" Release Coordinator: Doug Kearns +" ---------------------------------------------------------------------------- " +" Ruby IRB/Complete author: Keiju ISHITSUKA(keiju@ishitsuka.com) +" ---------------------------------------------------------------------------- + if !has('ruby') echo "Error: Required vim compiled with +ruby" finish @@ -16,7 +19,7 @@ if version < 700 echo "Error: Required vim >= 7.0" finish endif - + func! GetRubyVarType(v) let stopline = 1 let vtp = '' @@ -73,7 +76,7 @@ function! rbcomplete#Complete(findstart, base) else execute "ruby get_completions('" . a:base . "')" return g:rbcomplete_completions - endif + endif endfunction @@ -81,16 +84,16 @@ function! s:DefRuby() ruby << RUBYEOF ReservedWords = [ "BEGIN", "END", - "alias", "and", - "begin", "break", + "alias", "and", + "begin", "break", "case", "class", "def", "defined", "do", "else", "elsif", "end", "ensure", - "false", "for", - "if", "in", - "module", + "false", "for", + "if", "in", + "module", "next", "nil", "not", - "or", + "or", "redo", "rescue", "retry", "return", "self", "super", "then", "true", @@ -98,7 +101,7 @@ ReservedWords = [ "when", "while", "yield", ] - + Operators = [ "%", "&", "*", "**", "+", "-", "/", "<", "<<", "<=", "<=>", "==", "===", "=~", ">", ">=", ">>", "[]", "[]=", "^", ] @@ -107,7 +110,7 @@ def identify_type(var) @buf = VIM::Buffer.current enum = @buf.line_number snum = (enum-10).abs - nums = Range.new( snum, enum ) + nums = Range.new( snum, enum ) regxs = '/.*(%s)\s*=(.*)/' % var regx = Regexp.new( regxs ) nums.each do |x| @@ -119,7 +122,7 @@ end def load_requires @buf = VIM::Buffer.current enum = @buf.line_number - nums = Range.new( 1, enum ) + nums = Range.new( 1, enum ) nums.each do |x| ln = @buf[x] begin @@ -130,7 +133,7 @@ def load_requires end end -def get_completions(base) +def get_completions(base) load_requires input = VIM::evaluate('expand("")') input += base @@ -161,7 +164,7 @@ def get_completions(base) candidates = Proc.instance_methods(true) | Hash.instance_methods(true) select_message(receiver, message, candidates) - + when /^(:[^:.]*)$/ # Symbol if Symbol.respond_to?(:all_symbols) @@ -219,7 +222,7 @@ def get_completions(base) message = Regexp.quote($3) cv = eval("self.class.constants") - + vartype = VIM::evaluate("GetRubyVarType('%s')" % receiver) if vartype != '' candidates = eval("#{vartype}.instance_methods") @@ -237,7 +240,7 @@ def get_completions(base) # func1.func2 candidates = [] ObjectSpace.each_object(Module){|m| - next if m.name != "IRB::Context" and + next if m.name != "IRB::Context" and /^(IRB|SLex|RubyLex|RubyToken)/ =~ m.name candidates.concat m.instance_methods(false) } @@ -251,7 +254,7 @@ def get_completions(base) #function call #obj = $1 #func = $3 - + when /^\.([^.]*)$/ # unknown(maybe String) @@ -263,21 +266,21 @@ def get_completions(base) else candidates = eval("self.class.constants") - + (candidates|ReservedWords).grep(/^#{Regexp.quote(input)}/) end #print candidates if message != nil && message.length > 0 rexp = '^%s' % message.downcase - candidates.delete_if do |c| + candidates.delete_if do |c| c.downcase.match( rexp ) - $~ == nil + $~ == nil end end outp = "" - # tags = VIM::evaluate("taglist('^%s$')" % + # tags = VIM::evaluate("taglist('^%s$')" % (candidates-Object.instance_methods).each { |c| outp += "{'word':'%s','item':'%s'}," % [ c, c ] } outp.sub!(/,$/, '') VIM::command("let g:rbcomplete_completions = [%s]" % outp) @@ -297,7 +300,7 @@ def select_message(receiver, message, candidates) candidates.delete_if { |x| x == nil } candidates.uniq! candidates.sort! -end +end RUBYEOF endfunction diff --git a/compiler/eruby.vim b/compiler/eruby.vim index 906da136..928ace37 100644 --- a/compiler/eruby.vim +++ b/compiler/eruby.vim @@ -1,16 +1,10 @@ " Vim compiler file -" Language: eRuby -" Maintainer: Doug Kearns -" Info: $Id: eruby.vim,v 1.5 2005/10/13 16:41:44 dkearns Exp $ -" URL: http://vim-ruby.rubyforge.org -" Anon CVS: See above site -" Licence: GPL (http://www.gnu.org) -" Disclaimer: -" This program is distributed in the hope that it will be useful, -" but WITHOUT ANY WARRANTY; without even the implied warranty of -" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -" GNU General Public License for more details. -" ---------------------------------------------------------------------------- +" Language: eRuby +" Maintainer: Doug Kearns +" Info: $Id: eruby.vim,v 1.6 2006/04/15 12:01:18 dkearns Exp $ +" URL: http://vim-ruby.rubyforge.org +" Anon CVS: See above site +" Release Coordinator: Doug Kearns if exists("current_compiler") finish diff --git a/compiler/ruby.vim b/compiler/ruby.vim index c26d9a22..467de776 100644 --- a/compiler/ruby.vim +++ b/compiler/ruby.vim @@ -1,16 +1,11 @@ " Vim compiler file -" Language: Ruby -" Function: Syntax check and/or error reporting -" Maintainer: Tim Hammerquist -" Info: $Id: ruby.vim,v 1.11 2005/10/04 11:11:34 dkearns Exp $ -" URL: http://vim-ruby.rubyforge.org -" Anon CVS: See above site -" Licence: GPL (http://www.gnu.org) -" Disclaimer: -" This program is distributed in the hope that it will be useful, -" but WITHOUT ANY WARRANTY; without even the implied warranty of -" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -" GNU General Public License for more details. +" Language: Ruby +" Function: Syntax check and/or error reporting +" Maintainer: Tim Hammerquist +" Info: $Id: ruby.vim,v 1.12 2006/04/15 12:01:18 dkearns Exp $ +" URL: http://vim-ruby.rubyforge.org +" Anon CVS: See above site +" Release Coordinator: Doug Kearns " ---------------------------------------------------------------------------- " " Changelog: diff --git a/compiler/rubyunit.vim b/compiler/rubyunit.vim index fe8a0c0d..9ccaf533 100644 --- a/compiler/rubyunit.vim +++ b/compiler/rubyunit.vim @@ -1,16 +1,10 @@ " Vim compiler file -" Language: Test::Unit - Ruby Unit Testing Framework -" Maintainer: Doug Kearns -" Info: $Id: rubyunit.vim,v 1.10 2005/10/13 16:41:44 dkearns Exp $ -" URL: http://vim-ruby.rubyforge.org -" Anon CVS: See above site -" Licence: GPL (http://www.gnu.org) -" Disclaimer: -" This program is distributed in the hope that it will be useful, -" but WITHOUT ANY WARRANTY; without even the implied warranty of -" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -" GNU General Public License for more details. -" ---------------------------------------------------------------------------- +" Language: Test::Unit - Ruby Unit Testing Framework +" Maintainer: Doug Kearns +" Info: $Id: rubyunit.vim,v 1.11 2006/04/15 12:01:18 dkearns Exp $ +" URL: http://vim-ruby.rubyforge.org +" Anon CVS: See above site +" Release Coordinator: Doug Kearns if exists("current_compiler") finish diff --git a/ftplugin/eruby.vim b/ftplugin/eruby.vim index f0bd6cec..3d5eceb6 100644 --- a/ftplugin/eruby.vim +++ b/ftplugin/eruby.vim @@ -1,16 +1,10 @@ " Vim filetype plugin -" Language: eRuby -" Maintainer: Doug Kearns -" Info: $Id: eruby.vim,v 1.4 2005/10/13 16:41:44 dkearns Exp $ -" URL: http://vim-ruby.rubyforge.org -" Anon CVS: See above site -" Licence: GPL (http://www.gnu.org) -" Disclaimer: -" This program is distributed in the hope that it will be useful, -" but WITHOUT ANY WARRANTY; without even the implied warranty of -" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -" GNU General Public License for more details. -" ---------------------------------------------------------------------------- +" Language: eRuby +" Maintainer: Doug Kearns +" Info: $Id: eruby.vim,v 1.5 2006/04/15 12:01:18 dkearns Exp $ +" URL: http://vim-ruby.rubyforge.org +" Anon CVS: See above site +" Release Coordinator: Doug Kearns " Only do this when not done yet for this buffer if (exists("b:did_ftplugin")) diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index 820cc146..6033faf5 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,15 +1,10 @@ " Vim filetype plugin -" Language: Ruby -" Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.19 2006/04/14 16:44:32 segy Exp $ -" URL: http://vim-ruby.rubyforge.org -" Anon CVS: See above site -" Licence: GPL (http://www.gnu.org) -" Disclaimer: -" This program is distributed in the hope that it will be useful, -" but WITHOUT ANY WARRANTY; without even the implied warranty of -" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -" GNU General Public License for more details. +" Language: Ruby +" Maintainer: Gavin Sinclair +" Info: $Id: ruby.vim,v 1.20 2006/04/15 12:01:18 dkearns Exp $ +" URL: http://vim-ruby.rubyforge.org +" Anon CVS: See above site +" Release Coordinator: Doug Kearns " ---------------------------------------------------------------------------- " " Original matchit support thanks to Ned Konz. See his ftplugin/ruby.vim at diff --git a/indent/eruby.vim b/indent/eruby.vim index 703e56f9..987c8cf6 100644 --- a/indent/eruby.vim +++ b/indent/eruby.vim @@ -1,16 +1,10 @@ " Vim indent file -" Language: Ruby -" Maintainer: Doug Kearns -" Info: $Id: eruby.vim,v 1.3 2005/10/13 16:41:44 dkearns Exp $ -" URL: http://vim-ruby.rubyforge.org -" Anon CVS: See above site -" Licence: GPL (http://www.gnu.org) -" Disclaimer: -" This program is distributed in the hope that it will be useful, -" but WITHOUT ANY WARRANTY; without even the implied warranty of -" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -" GNU General Public License for more details. -" ---------------------------------------------------------------------------- +" Language: Ruby +" Maintainer: Doug Kearns +" Info: $Id: eruby.vim,v 1.4 2006/04/15 12:01:18 dkearns Exp $ +" URL: http://vim-ruby.rubyforge.org +" Anon CVS: See above site +" Release Coordinator: Doug Kearns " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -18,3 +12,5 @@ if exists("b:did_indent") endif runtime! indent/html.vim + +" vim: nowrap sw=2 sts=2 ts=8 ff=unix: diff --git a/indent/ruby.vim b/indent/ruby.vim index 51c99130..499a8e4a 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -1,16 +1,10 @@ " Vim indent file -" Language: Ruby -" Developer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.35 2005/10/14 13:11:04 gsinclair Exp $ -" URL: http://vim-ruby.rubyforge.org -" Anon CVS: See above site -" Licence: GPL (http://www.gnu.org) -" Disclaimer: -" This program is distributed in the hope that it will be useful, -" but WITHOUT ANY WARRANTY; without even the implied warranty of -" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -" GNU General Public License for more details. -" ---------------------------------------------------------------------------- +" Language: Ruby +" Maintainer: Nikolai Weibull +" Info: $Id: ruby.vim,v 1.36 2006/04/15 12:01:18 dkearns Exp $ +" URL: http://vim-ruby.rubyforge.org +" Anon CVS: See above site +" Release Coordinator: Doug Kearns " 0. Initialization {{{1 " ================= diff --git a/syntax/eruby.vim b/syntax/eruby.vim index fcdd0308..a8219f40 100644 --- a/syntax/eruby.vim +++ b/syntax/eruby.vim @@ -1,15 +1,10 @@ " Vim syntax file -" Language: eRuby -" Maintainer: Doug Kearns -" Info: $Id: eruby.vim,v 1.7 2005/10/13 16:41:44 dkearns Exp $ -" URL: http://vim-ruby.rubyforge.org -" Anon CVS: See above site -" Licence: GPL (http://www.gnu.org) -" Disclaimer: -" This program is distributed in the hope that it will be useful, -" but WITHOUT ANY WARRANTY; without even the implied warranty of -" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -" GNU General Public License for more details. +" Language: eRuby +" Maintainer: Doug Kearns +" Info: $Id: eruby.vim,v 1.8 2006/04/15 12:01:18 dkearns Exp $ +" URL: http://vim-ruby.rubyforge.org +" Anon CVS: See above site +" Release Coordinator: Doug Kearns " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 425f2c69..0a48f293 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,15 +1,10 @@ " Vim syntax file -" Language: Ruby -" Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.83 2005/10/13 16:41:44 dkearns Exp $ -" URL: http://vim-ruby.rubyforge.org -" Anon CVS: See above site -" Licence: GPL (http://www.gnu.org) -" Disclaimer: -" This program is distributed in the hope that it will be useful, -" but WITHOUT ANY WARRANTY; without even the implied warranty of -" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -" GNU General Public License for more details. +" Language: Ruby +" Maintainer: Doug Kearns +" Info: $Id: ruby.vim,v 1.84 2006/04/15 12:01:18 dkearns Exp $ +" URL: http://vim-ruby.rubyforge.org +" Anon CVS: See above site +" Release Coordinator: Doug Kearns " ---------------------------------------------------------------------------- " " Previous Maintainer: Mirko Nasato From 000ea5a27ddaa1eb0acba736f5abebee80153c5a Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 15 Apr 2006 12:28:26 +0000 Subject: [PATCH 230/411] rename rbcomplete#Complete to match script file name --- ChangeLog | 3 +++ autoload/rubycomplete.vim | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index d585bdf9..aa500ef7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2006-04-15 Doug Kearns + * autoload/rubycomplete.vim: rename rbcomplete#Complete to match + script file name + * autoload/rubycomplete.vim, compiler/rubyunit.vim, ftdetect/ruby.vim, ftplugin/ruby.vim, indent/ruby.vim, syntax/ruby.vim, compiler/eruby.vim, compiler/ruby.vim, ftplugin/eruby.vim, diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 4c289d57..14adb3a3 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman ( segfault AT hasno DOT info ) -" Info: $Id: rubycomplete.vim,v 1.2 2006/04/15 12:01:18 dkearns Exp $ +" Info: $Id: rubycomplete.vim,v 1.3 2006/04/15 12:28:26 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -53,7 +53,7 @@ func! GetRubyVarType(v) return '' endf -function! rbcomplete#Complete(findstart, base) +function! rubycomplete#Complete(findstart, base) "findstart = 1 when we need to get the text length if a:findstart let line = getline('.') From 6ba79575b57184c1511ba34104211c3528034210 Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Sun, 16 Apr 2006 21:35:43 +0000 Subject: [PATCH 231/411] added a work-around for the cWORD bug found by dkearns added support for completion of in-buffer classes switched return-type over to a dictionary --- autoload/rubycomplete.vim | 340 +++++++++++++++++++++----------------- 1 file changed, 190 insertions(+), 150 deletions(-) diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 14adb3a3..d897cb72 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby -" Maintainer: Mark Guzman ( segfault AT hasno DOT info ) -" Info: $Id: rubycomplete.vim,v 1.3 2006/04/15 12:28:26 dkearns Exp $ +" Maintainer: Mark Guzman +" Info: $Id: rubycomplete.vim,v 1.4 2006/04/16 21:35:43 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -20,7 +20,18 @@ if version < 700 finish endif -func! GetRubyVarType(v) +function! GetBufferRubyClass(name) + let stopline = 1 + let [lnum,lcol] = searchpos('^\s*class\s*' . a:name . '\s*\n*\(\s*def\s*.*\n.*\s*\n\s*end\s*\n*\)*\n*\s*end\s*\n*$', 'nb', stopline) + if lnum == 0 && lcol == 0 + return '0..0' + endif + let [enum,ecol] = searchpos('^\s*class\s*' . a:name . '\s*\n*\(\s*def\s*.*\n.*\s*\n\s*end\s*\n*\)*\n*\s*end\s*\n*$', 'neb', lnum) + " we found a the class def + return lnum . '..' . enum +endfunction + +function! GetRubyVarType(v) let stopline = 1 let vtp = '' let pos = getpos('.') @@ -51,7 +62,7 @@ func! GetRubyVarType(v) endif call setpos('.',pos) return '' -endf +endfunction function! rubycomplete#Complete(findstart, base) "findstart = 1 when we need to get the text length @@ -107,187 +118,216 @@ Operators = [ "%", "&", "*", "**", "+", "-", "/", "[]", "[]=", "^", ] def identify_type(var) - @buf = VIM::Buffer.current - enum = @buf.line_number - snum = (enum-10).abs - nums = Range.new( snum, enum ) - regxs = '/.*(%s)\s*=(.*)/' % var - regx = Regexp.new( regxs ) - nums.each do |x| - ln = @buf[x] - #print $~ if regx.match( ln ) - end + @buf = VIM::Buffer.current + enum = @buf.line_number + snum = (enum-10).abs + nums = Range.new( snum, enum ) + regxs = '/.*(%s)\s*=(.*)/' % var + regx = Regexp.new( regxs ) + nums.each do |x| + ln = @buf[x] + #print $~ if regx.match( ln ) + end end def load_requires - @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? - 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? end + end end -def get_completions(base) - load_requires - input = VIM::evaluate('expand("")') - input += base - message = nil - - - case input - when /^(\/[^\/]*\/)\.([^.]*)$/ - # Regexp - receiver = $1 - message = Regexp.quote($2) - - candidates = Regexp.instance_methods(true) - select_message(receiver, message, candidates) - - when /^([^\]]*\])\.([^.]*)$/ - # Array - receiver = $1 - message = Regexp.quote($2) - - candidates = Array.instance_methods(true) - select_message(receiver, message, candidates) - - when /^([^\}]*\})\.([^.]*)$/ - # Proc or Hash - receiver = $1 - message = Regexp.quote($2) - - candidates = Proc.instance_methods(true) | Hash.instance_methods(true) - select_message(receiver, message, candidates) - - when /^(:[^:.]*)$/ - # Symbol - if Symbol.respond_to?(:all_symbols) - sym = $1 - candidates = Symbol.all_symbols.collect{|s| ":" + s.id2name} - candidates.grep(/^#{sym}/) - else - [] - end +def load_buffer_class(name) + @buf = VIM::Buffer.current + nums = eval( VIM::evaluate( 'GetBufferRubyClass("%s")' % name ) ) + #print "%s %s" % [ nums, nums.class ] + return if nums == nil + return if nums.min == nums.max && nums.min == 0 + classdef = "" + nums.each do |x| + ln = @buf[x] + classdef += "%s\n" % ln + end + #print classdef + eval classdef +end - when /^::([A-Z][^:\.\(]*)$/ - # Absolute Constant or class methods - receiver = $1 - candidates = Object.constants - candidates.grep(/^#{receiver}/).collect{|e| "::" + e} +def get_completions(base) + load_requires + input = VIM::evaluate('expand("")') + input += base + input.lstrip! + if input.length == 0 + input = VIM::Buffer.current.line.lstrip! + end + #print "have: %s" % input + message = nil + + + case input + when /^(\/[^\/]*\/)\.([^.]*)$/ + # Regexp + receiver = $1 + message = Regexp.quote($2) + + candidates = Regexp.instance_methods(true) + select_message(receiver, message, candidates) + + when /^([^\]]*\])\.([^.]*)$/ + # Array + receiver = $1 + message = Regexp.quote($2) + + candidates = Array.instance_methods(true) + select_message(receiver, message, candidates) + + when /^([^\}]*\})\.([^.]*)$/ + # Proc or Hash + receiver = $1 + message = Regexp.quote($2) + + candidates = Proc.instance_methods(true) | Hash.instance_methods(true) + select_message(receiver, message, candidates) + + when /^(:[^:.]*)$/ + # Symbol + if Symbol.respond_to?(:all_symbols) + sym = $1 + candidates = Symbol.all_symbols.collect{|s| ":" + s.id2name} + candidates.grep(/^#{sym}/) + else + [] + end + + when /^::([A-Z][^:\.\(]*)$/ + # Absolute Constant or class methods + receiver = $1 + candidates = Object.constants + candidates.grep(/^#{receiver}/).collect{|e| "::" + e} + + when /^(((::)?[A-Z][^:.\(]*)+)::?([^:.]*)$/ + # Constant or class methods + receiver = $1 + message = Regexp.quote($4) + begin + candidates = eval("#{receiver}.constants | #{receiver}.methods") + rescue Exception + candidates = [] + end + candidates.grep(/^#{message}/).collect{|e| receiver + "::" + e} + + when /^(:[^:.]+)\.([^.]*)$/ + # Symbol + receiver = $1 + message = Regexp.quote($2) + + candidates = Symbol.instance_methods(true) + select_message(receiver, message, candidates) + + when /^([0-9_]+(\.[0-9_]+)?(e[0-9]+)?)\.([^.]*)$/ + # Numeric + receiver = $1 + message = Regexp.quote($4) + + begin + candidates = eval(receiver).methods + rescue Exception + candidates + end + select_message(receiver, message, candidates) + + when /^(\$[^.]*)$/ + candidates = global_variables.grep(Regexp.new(Regexp.quote($1))) + +# when /^(\$?(\.?[^.]+)+)\.([^.]*)$/ + when /^((\.?[^.]+)+)\.([^.]*)$/ + # variable + receiver = $1 + message = Regexp.quote($3) + load_buffer_class( receiver ) + + cv = eval("self.class.constants") + + vartype = VIM::evaluate("GetRubyVarType('%s')" % receiver) + if vartype != '' + load_buffer_class( vartype ) - when /^(((::)?[A-Z][^:.\(]*)+)::?([^:.]*)$/ - # Constant or class methods - receiver = $1 - message = Regexp.quote($4) begin - candidates = eval("#{receiver}.constants | #{receiver}.methods") + candidates = eval("#{vartype}.instance_methods") rescue Exception candidates = [] end - candidates.grep(/^#{message}/).collect{|e| receiver + "::" + e} - - when /^(:[^:.]+)\.([^.]*)$/ - # Symbol - receiver = $1 - message = Regexp.quote($2) - - candidates = Symbol.instance_methods(true) - select_message(receiver, message, candidates) - - when /^([0-9_]+(\.[0-9_]+)?(e[0-9]+)?)\.([^.]*)$/ - # Numeric - receiver = $1 - message = Regexp.quote($4) - + elsif (cv).include?(receiver) + # foo.func and foo is local var. + candidates = eval("#{receiver}.methods") + elsif /^[A-Z]/ =~ receiver and /\./ !~ receiver + # Foo::Bar.func begin - candidates = eval(receiver).methods - rescue Exception - candidates - end - select_message(receiver, message, candidates) - - when /^(\$[^.]*)$/ - candidates = global_variables.grep(Regexp.new(Regexp.quote($1))) - -# when /^(\$?(\.?[^.]+)+)\.([^.]*)$/ - when /^((\.?[^.]+)+)\.([^.]*)$/ - # variable - receiver = $1 - message = Regexp.quote($3) - - cv = eval("self.class.constants") - - vartype = VIM::evaluate("GetRubyVarType('%s')" % receiver) - if vartype != '' - candidates = eval("#{vartype}.instance_methods") - elsif (cv).include?(receiver) - # foo.func and foo is local var. candidates = eval("#{receiver}.methods") - elsif /^[A-Z]/ =~ receiver and /\./ !~ receiver - # Foo::Bar.func - begin - candidates = eval("#{receiver}.methods") - rescue Exception - candidates = [] - end - else - # func1.func2 + rescue Exception candidates = [] - ObjectSpace.each_object(Module){|m| - next if m.name != "IRB::Context" and - /^(IRB|SLex|RubyLex|RubyToken)/ =~ m.name - candidates.concat m.instance_methods(false) - } - candidates.sort! - candidates.uniq! end - #identify_type( receiver ) - select_message(receiver, message, candidates) + else + # func1.func2 + candidates = [] + ObjectSpace.each_object(Module){|m| + next if m.name != "IRB::Context" and + /^(IRB|SLex|RubyLex|RubyToken)/ =~ m.name + candidates.concat m.instance_methods(false) + } + candidates.sort! + candidates.uniq! + end + #identify_type( receiver ) + select_message(receiver, message, candidates) #when /^((\.?[^.]+)+)\.([^.]*)\(\s*\)*$/ #function call #obj = $1 #func = $3 - when /^\.([^.]*)$/ + when /^\.([^.]*)$/ # unknown(maybe String) - receiver = "" - message = Regexp.quote($1) + receiver = "" + message = Regexp.quote($1) - candidates = String.instance_methods(true) - select_message(receiver, message, candidates) + candidates = String.instance_methods(true) + select_message(receiver, message, candidates) - else - candidates = eval("self.class.constants") + else + candidates = eval("self.class.constants") - (candidates|ReservedWords).grep(/^#{Regexp.quote(input)}/) - end + (candidates|ReservedWords).grep(/^#{Regexp.quote(input)}/) + end #print candidates - if message != nil && message.length > 0 - rexp = '^%s' % message.downcase - candidates.delete_if do |c| - c.downcase.match( rexp ) - $~ == nil - end + if message != nil && message.length > 0 + rexp = '^%s' % message.downcase + candidates.delete_if do |c| + c.downcase.match( rexp ) + $~ == nil end + end - outp = "" - # tags = VIM::evaluate("taglist('^%s$')" % - (candidates-Object.instance_methods).each { |c| outp += "{'word':'%s','item':'%s'}," % [ c, c ] } - outp.sub!(/,$/, '') - VIM::command("let g:rbcomplete_completions = [%s]" % outp) + outp = "" + # tags = VIM::evaluate("taglist('^%s$')" % + (candidates-Object.instance_methods).each { |c| outp += "{'word':'%s','item':'%s'}," % [ c, c ] } + outp.sub!(/,$/, '') + VIM::command("let g:rbcomplete_completions = [%s]" % outp) end def select_message(receiver, message, candidates) + #tags = VIM::evaluate("taglist('%s')" % receiver) + #print tags candidates.grep(/^#{message}/).collect do |e| case e when /^[a-zA-Z_]/ From eebf63236afa0e0b0c160f2e54342ce8ca4032a5 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Mon, 17 Apr 2006 14:11:51 +0000 Subject: [PATCH 232/411] update Nikolai's email address --- CONTRIBUTORS | 2 +- ChangeLog | 4 ++++ indent/ruby.vim | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index d98d119a..9aa4b951 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -3,7 +3,7 @@ Maintainers: Tim Hammerquist Doug Kearns Gavin Sinclair - Nikolai Weibull + Nikolai Weibull Developers: diff --git a/ChangeLog b/ChangeLog index aa500ef7..f9b4ffa5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-04-17 Doug Kearns + + * CONTRIBUTORS, indent/ruby.vim: update Nikolai's email address + 2006-04-15 Doug Kearns * autoload/rubycomplete.vim: rename rbcomplete#Complete to match diff --git a/indent/ruby.vim b/indent/ruby.vim index 499a8e4a..bba14994 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Ruby -" Maintainer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.36 2006/04/15 12:01:18 dkearns Exp $ +" Maintainer: Nikolai Weibull +" Info: $Id: ruby.vim,v 1.37 2006/04/17 14:11:52 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns From 0634ff09bcb28a8814a0378ad233963ecaca49ca Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Tue, 18 Apr 2006 21:19:59 +0000 Subject: [PATCH 233/411] revised the in-buffer class loading, needs a little more work but its testable --- autoload/rubycomplete.vim | 55 +++++++++++++++++++++++++++++++++------ 1 file changed, 47 insertions(+), 8 deletions(-) diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index d897cb72..b768c3d8 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.4 2006/04/16 21:35:43 segy Exp $ +" Info: $Id: rubycomplete.vim,v 1.5 2006/04/18 21:19:59 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -20,13 +20,27 @@ if version < 700 finish endif + +function! GetBufferRubyModule(name) + return GetBufferRubyEntity(a:name, "module") +endfunction + function! GetBufferRubyClass(name) + return GetBufferRubyEntity(a:name, "class") +endfunction + +function! GetBufferRubySingletonMethods(name) +endfunction + +function! GetBufferRubyEntity( name, type ) let stopline = 1 - let [lnum,lcol] = searchpos('^\s*class\s*' . a:name . '\s*\n*\(\s*def\s*.*\n.*\s*\n\s*end\s*\n*\)*\n*\s*end\s*\n*$', 'nb', stopline) + "let crex = '^\s*' . a:type . '\s*' . a:name . '\s*\(<\s*.*\)\?\n*\(\(\s*.*\s*\n*\)*\|\(\s*def\s*.*\n.*\s*\n\s*end\s*\n*\)*\)*\n*\s*end\s*\n*$' + let crex = '^\s*' . a:type . '\s*' . a:name . '\s*\(<\s*.*\s*\)\?\n*\(\(\s\|#\).*\n*\)*\n*\s*end\s*\n*$' + let [lnum,lcol] = searchpos( crex, 'nbw') if lnum == 0 && lcol == 0 return '0..0' endif - let [enum,ecol] = searchpos('^\s*class\s*' . a:name . '\s*\n*\(\s*def\s*.*\n.*\s*\n\s*end\s*\n*\)*\n*\s*end\s*\n*$', 'neb', lnum) + let [enum,ecol] = searchpos( crex, 'nebw') " we found a the class def return lnum . '..' . enum endfunction @@ -145,18 +159,43 @@ def load_requires end def load_buffer_class(name) + #print "got: %s" % name + classdef = get_buffer_entity(name, 'GetBufferRubyClass("%s")') + return if classdef == nil + + pare = /^\s*class\s*(.*)\s*<\s*(.*)\s*\n/.match( classdef ) + #print "class: %s" % $2 if pare != nil + load_buffer_class( $2 ) if pare != nil + mixre = /.*\n\s*include\s*(.*)\s*\n/.match( classdef ) + #print "module: %s" % $2 if mixre != nil + load_buffer_module( $2 ) if mixre != nil + + #print classdef + eval classdef +end + +def load_buffer_module(name) + classdef = get_buffer_entity(name, 'GetBufferRubyModule("%s")') + return if classdef == nil + + #print classdef + eval classdef +end + +def get_buffer_entity(name, vimfun) @buf = VIM::Buffer.current - nums = eval( VIM::evaluate( 'GetBufferRubyClass("%s")' % name ) ) + nums = eval( VIM::evaluate( vimfun % name ) ) #print "%s %s" % [ nums, nums.class ] - return if nums == nil - return if nums.min == nums.max && nums.min == 0 + return nil if nums == nil + return nil if nums.min == nums.max && nums.min == 0 + classdef = "" nums.each do |x| ln = @buf[x] classdef += "%s\n" % ln end - #print classdef - eval classdef + + return classdef end def get_completions(base) From e6080ea0a576e7ea78b467a4fb94f9ad623e3112 Mon Sep 17 00:00:00 2001 From: Gavin Sinclair Date: Wed, 19 Apr 2006 05:50:12 +0000 Subject: [PATCH 234/411] * CONTRIBUTORS, ftplugin/ruby.vim: update Gavin's email address --- CONTRIBUTORS | 2 +- ChangeLog | 4 ++++ ftplugin/ruby.vim | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 9aa4b951..27d7743b 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2,7 +2,7 @@ Maintainers: Mark Guzman Tim Hammerquist Doug Kearns - Gavin Sinclair + Gavin Sinclair Nikolai Weibull Developers: diff --git a/ChangeLog b/ChangeLog index f9b4ffa5..c3d53399 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-04-19 Gavin Sinclair + + * CONTRIBUTORS, ftplugin/ruby.vim: update Gavin's email address + 2006-04-17 Doug Kearns * CONTRIBUTORS, indent/ruby.vim: update Nikolai's email address diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index 6033faf5..6389bccd 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Ruby -" Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.20 2006/04/15 12:01:18 dkearns Exp $ +" Maintainer: Gavin Sinclair +" Info: $Id: ruby.vim,v 1.21 2006/04/19 05:50:12 gsinclair Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns From d694cad57f09ca7e5229a6989e6091e7b8d32813 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 19 Apr 2006 12:38:58 +0000 Subject: [PATCH 235/411] add RJS and RXML template file detection --- ChangeLog | 4 ++++ ftdetect/ruby.vim | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c3d53399..0c9e3e2c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-04-19 Doug Kearns + + * ftdetect/ruby.vim: add RJS and RXML template file detection + 2006-04-19 Gavin Sinclair * CONTRIBUTORS, ftplugin/ruby.vim: update Gavin's email address diff --git a/ftdetect/ruby.vim b/ftdetect/ruby.vim index e2dad832..4fa8f461 100644 --- a/ftdetect/ruby.vim +++ b/ftdetect/ruby.vim @@ -1,11 +1,11 @@ " Ruby -au BufNewFile,BufRead *.rb,*.rbw,*.gem,*.gemspec set filetype=ruby +au BufNewFile,BufRead *.rb,*.rbw,*.rjs,*.rxml,*.gem,*.gemspec set filetype=ruby " Rakefile -au BufNewFile,BufRead [rR]akefile* set filetype=ruby +au BufNewFile,BufRead [rR]akefile* set filetype=ruby " Rantfile -au BufNewFile,BufRead [rR]antfile,*.rant set filetype=ruby +au BufNewFile,BufRead [rR]antfile,*.rant set filetype=ruby " eRuby -au BufNewFile,BufRead *.rhtml set filetype=eruby +au BufNewFile,BufRead *.rhtml set filetype=eruby From 0590319dae3f894530d6b427d5c8152b78053ea8 Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Wed, 19 Apr 2006 18:31:34 +0000 Subject: [PATCH 236/411] in-buffer class completion seems to work properly in my test cases added range variable detection - contributed --- autoload/rubycomplete.vim | 83 ++++++++++++++++++++++++++++++++------- 1 file changed, 68 insertions(+), 15 deletions(-) diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index b768c3d8..822b9591 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.5 2006/04/18 21:19:59 segy Exp $ +" Info: $Id: rubycomplete.vim,v 1.6 2006/04/19 18:31:34 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -11,22 +11,28 @@ " ---------------------------------------------------------------------------- if !has('ruby') + echohl ErrorMsg echo "Error: Required vim compiled with +ruby" + echohl None finish endif if version < 700 + echohl ErrorMsg echo "Error: Required vim >= 7.0" + echohl None finish endif function! GetBufferRubyModule(name) - return GetBufferRubyEntity(a:name, "module") + let [snum,enum] = GetBufferRubyEntity(a:name, "module") + return snum . '..' . enum endfunction function! GetBufferRubyClass(name) - return GetBufferRubyEntity(a:name, "class") + let [snum,enum] = GetBufferRubyEntity(a:name, "class") + return snum . '..' . enum endfunction function! GetBufferRubySingletonMethods(name) @@ -35,14 +41,39 @@ endfunction function! GetBufferRubyEntity( name, type ) let stopline = 1 "let crex = '^\s*' . a:type . '\s*' . a:name . '\s*\(<\s*.*\)\?\n*\(\(\s*.*\s*\n*\)*\|\(\s*def\s*.*\n.*\s*\n\s*end\s*\n*\)*\)*\n*\s*end\s*\n*$' - let crex = '^\s*' . a:type . '\s*' . a:name . '\s*\(<\s*.*\s*\)\?\n*\(\(\s\|#\).*\n*\)*\n*\s*end\s*\n*$' + let crex = '^\s*' . a:type . '\s*' . a:name . '\s*\(<\s*.*\s*\)\?\n*\(\(\s\|#\).*\n*\)*\n*\s*end$' let [lnum,lcol] = searchpos( crex, 'nbw') if lnum == 0 && lcol == 0 - return '0..0' + return [0,0] endif let [enum,ecol] = searchpos( crex, 'nebw') + if lnum > enum + echo "HERE UGH: " . lnum + let realdef = getline( lnum ) + echo "PAST GETLINE" + let crexb = '^' . realdef . '\n*\(\(\s\|#\).*\n*\)*\n*\s*end$' + echo "RE: " . crexb + let [enum,ecol] = searchpos( crexb, 'necw' ) + echo "enumb: " . enum + endif " we found a the class def - return lnum . '..' . enum + return [lnum,enum] +endfunction + +function! IsInClassDef() + let [snum,enum] = GetBufferRubyEntity( '.*', "class" ) + let ret = 'nil' + let pos = line('.') + + echo "pos: " . pos + echo "snum: " . snum + echo "enum: " . enum + if snum < pos && pos < enum + print "LIVE" + let ret = snum . '..' . enum + endif + + return ret endfunction function! GetRubyVarType(v) @@ -57,9 +88,9 @@ function! GetRubyVarType(v) return vtp endif call setpos('.',pos) - let [lnum,lcol] = searchpos(''.a:v.'\>\s*[+\-*/]*=\s*\([^ \t]\+.\(now\|new\|open\|get_instance\)\>\|[\[{"'']\)','nb',stopline) + let [lnum,lcol] = searchpos(''.a:v.'\>\s*[+\-*/]*=\s*\([^ \t]\+.\(now\|new\|open\|get_instance\)\>\|[\[{"''/]\|%r{\)','nb',stopline) if lnum != 0 && lcol != 0 - let str = matchstr(getline(lnum),'=\s*\([^ \t]\+.\(now\|new\|open\|get_instance\)\>\|[\[{"'']\)',lcol) + let str = matchstr(getline(lnum),'=\s*\([^ \t]\+.\(now\|new\|open\|get_instance\)\>\|[\[{"''/]\|%r{\)',lcol) let str = substitute(str,'^=\s*','','') call setpos('.',pos) if str == '"' || str == '''' @@ -68,6 +99,8 @@ function! GetRubyVarType(v) return 'Array' elseif str == '{' return 'Hash' + elseif str == '/' || str == '%r{' + return 'Regexp' elseif strlen(str) > 4 let l = stridx(str,'.') return str[0:l-1] @@ -100,7 +133,7 @@ function! rubycomplete#Complete(findstart, base) "findstart = 0 when we need to return the list of completions else execute "ruby get_completions('" . a:base . "')" - return g:rbcomplete_completions + return g:rubycomplete_completions endif endfunction @@ -204,9 +237,9 @@ def get_completions(base) input += base input.lstrip! if input.length == 0 - input = VIM::Buffer.current.line.lstrip! + input = VIM::Buffer.current.line + input.strip! end - #print "have: %s" % input message = nil @@ -342,9 +375,29 @@ def get_completions(base) select_message(receiver, message, candidates) else - candidates = eval("self.class.constants") - - (candidates|ReservedWords).grep(/^#{Regexp.quote(input)}/) + print "HERE" + inclass = eval( VIM::evaluate("IsInClassDef()") ) + print "inclass %s" % inclass + + if inclass != nil + classdef = "%s\n" % VIM::Buffer.current[ inclass.min ] + print "line: %s" % classdef + found = /^\s*class\s*([A-Za-z0-9]*)(\s*<\s*([A-Za-z0-9]*))?\s*\n$/.match( classdef ) + print "restat: %s" % found.class + if found != nil + print "rematch: %s" % $1 + receiver = $1 + message = input + load_buffer_class( receiver ) + candidates = eval( "#{receiver}.instance_methods" ) + select_message(receiver, message, candidates) + end + end + + if inclass == nil || found == nil + candidates = eval("self.class.constants") + (candidates|ReservedWords).grep(/^#{Regexp.quote(input)}/) + end end #print candidates @@ -360,7 +413,7 @@ def get_completions(base) # tags = VIM::evaluate("taglist('^%s$')" % (candidates-Object.instance_methods).each { |c| outp += "{'word':'%s','item':'%s'}," % [ c, c ] } outp.sub!(/,$/, '') - VIM::command("let g:rbcomplete_completions = [%s]" % outp) + VIM::command("let g:rubycomplete_completions = [%s]" % outp) end From c66769d622adaa1aa86aea758a29d9936d16171e Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Thu, 20 Apr 2006 04:07:02 +0000 Subject: [PATCH 237/411] removed left over debug prints --- autoload/rubycomplete.vim | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 822b9591..29d4c2e4 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.6 2006/04/19 18:31:34 segy Exp $ +" Info: $Id: rubycomplete.vim,v 1.7 2006/04/20 04:07:02 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -48,13 +48,9 @@ function! GetBufferRubyEntity( name, type ) endif let [enum,ecol] = searchpos( crex, 'nebw') if lnum > enum - echo "HERE UGH: " . lnum let realdef = getline( lnum ) - echo "PAST GETLINE" let crexb = '^' . realdef . '\n*\(\(\s\|#\).*\n*\)*\n*\s*end$' - echo "RE: " . crexb let [enum,ecol] = searchpos( crexb, 'necw' ) - echo "enumb: " . enum endif " we found a the class def return [lnum,enum] @@ -65,11 +61,7 @@ function! IsInClassDef() let ret = 'nil' let pos = line('.') - echo "pos: " . pos - echo "snum: " . snum - echo "enum: " . enum if snum < pos && pos < enum - print "LIVE" let ret = snum . '..' . enum endif @@ -375,17 +367,12 @@ def get_completions(base) select_message(receiver, message, candidates) else - print "HERE" inclass = eval( VIM::evaluate("IsInClassDef()") ) - print "inclass %s" % inclass if inclass != nil classdef = "%s\n" % VIM::Buffer.current[ inclass.min ] - print "line: %s" % classdef found = /^\s*class\s*([A-Za-z0-9]*)(\s*<\s*([A-Za-z0-9]*))?\s*\n$/.match( classdef ) - print "restat: %s" % found.class if found != nil - print "rematch: %s" % $1 receiver = $1 message = input load_buffer_class( receiver ) From 799addbc883bc570a56f19758c50dc52dea6abdc Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Thu, 20 Apr 2006 05:24:27 +0000 Subject: [PATCH 238/411] it will now complete rails classes --- autoload/rubycomplete.vim | 72 ++++++++++++++++++++++++++------------- 1 file changed, 49 insertions(+), 23 deletions(-) diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 29d4c2e4..722fa788 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.7 2006/04/20 04:07:02 segy Exp $ +" Info: $Id: rubycomplete.vim,v 1.8 2006/04/20 05:24:27 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -40,12 +40,12 @@ endfunction function! GetBufferRubyEntity( name, type ) let stopline = 1 - "let crex = '^\s*' . a:type . '\s*' . a:name . '\s*\(<\s*.*\)\?\n*\(\(\s*.*\s*\n*\)*\|\(\s*def\s*.*\n.*\s*\n\s*end\s*\n*\)*\)*\n*\s*end\s*\n*$' let crex = '^\s*' . a:type . '\s*' . a:name . '\s*\(<\s*.*\s*\)\?\n*\(\(\s\|#\).*\n*\)*\n*\s*end$' let [lnum,lcol] = searchpos( crex, 'nbw') if lnum == 0 && lcol == 0 return [0,0] endif + let [enum,ecol] = searchpos( crex, 'nebw') if lnum > enum let realdef = getline( lnum ) @@ -124,6 +124,7 @@ function! rubycomplete#Complete(findstart, base) return idx "findstart = 0 when we need to return the list of completions else + let g:rubycomplete_completions = [] execute "ruby get_completions('" . a:base . "')" return g:rubycomplete_completions endif @@ -132,6 +133,11 @@ endfunction function! s:DefRuby() ruby << RUBYEOF +RailsWords = [ + "has_many", "has_one", + "belongs_to", + ] + ReservedWords = [ "BEGIN", "END", "alias", "and", @@ -156,18 +162,6 @@ Operators = [ "%", "&", "*", "**", "+", "-", "/", "<", "<<", "<=", "<=>", "==", "===", "=~", ">", ">=", ">>", "[]", "[]=", "^", ] -def identify_type(var) - @buf = VIM::Buffer.current - enum = @buf.line_number - snum = (enum-10).abs - nums = Range.new( snum, enum ) - regxs = '/.*(%s)\s*=(.*)/' % var - regx = Regexp.new( regxs ) - nums.each do |x| - ln = @buf[x] - #print $~ if regx.match( ln ) - end -end def load_requires @buf = VIM::Buffer.current @@ -184,18 +178,15 @@ def load_requires end def load_buffer_class(name) - #print "got: %s" % name classdef = get_buffer_entity(name, 'GetBufferRubyClass("%s")') return if classdef == nil pare = /^\s*class\s*(.*)\s*<\s*(.*)\s*\n/.match( classdef ) - #print "class: %s" % $2 if pare != nil load_buffer_class( $2 ) if pare != nil + mixre = /.*\n\s*include\s*(.*)\s*\n/.match( classdef ) - #print "module: %s" % $2 if mixre != nil load_buffer_module( $2 ) if mixre != nil - #print classdef eval classdef end @@ -203,28 +194,59 @@ def load_buffer_module(name) classdef = get_buffer_entity(name, 'GetBufferRubyModule("%s")') return if classdef == nil - #print classdef eval classdef end def get_buffer_entity(name, vimfun) @buf = VIM::Buffer.current nums = eval( VIM::evaluate( vimfun % name ) ) - #print "%s %s" % [ nums, nums.class ] return nil if nums == nil return nil if nums.min == nums.max && nums.min == 0 + cur_line = VIM::Buffer.current.line_number classdef = "" nums.each do |x| - ln = @buf[x] - classdef += "%s\n" % ln + if x != cur_line + ln = @buf[x] + classdef += "%s\n" % ln + end end return classdef end +def load_rails() + allow_rails = VIM::evaluate('g:rubycomplete_rails') + return if allow_rails != '1' + + buf_path = VIM::evaluate('expand("%:p")') + file_name = VIM::evaluate('expand("%:t")') + path = buf_path.gsub( file_name, '' ) + path.gsub!( /\\/, "/" ) + pup = [ "../", "../../", "../../../", "../../../../" ] + pok = nil + + pup.each do |sup| + tpok = "%s%sconfig" % [ path, sup ] + if File.exists?( tpok ) + pok = tpok + break + end + end + bootfile = pok + "/boot.rb" + require bootfile if pok != nil && File.exists?( bootfile ) +end + +def get_rails_helpers + allow_rails = VIM::evaluate('g:rubycomplete_rails') + return [] if allow_rails != '1' + return RailsWords +end + def get_completions(base) load_requires + load_rails + input = VIM::evaluate('expand("")') input += base input.lstrip! @@ -371,12 +393,14 @@ def get_completions(base) if inclass != nil classdef = "%s\n" % VIM::Buffer.current[ inclass.min ] - found = /^\s*class\s*([A-Za-z0-9]*)(\s*<\s*([A-Za-z0-9]*))?\s*\n$/.match( classdef ) + found = /^\s*class\s*([A-Za-z0-9_-]*)(\s*<\s*([A-Za-z0-9_:-]*))?\s*\n$/.match( classdef ) + if found != nil receiver = $1 message = input load_buffer_class( receiver ) candidates = eval( "#{receiver}.instance_methods" ) + candidates += get_rails_helpers select_message(receiver, message, candidates) end end @@ -423,5 +447,7 @@ end RUBYEOF endfunction + +let g:rubycomplete_rails = 0 call s:DefRuby() " vim: set et ts=4: From 42ec568b3270c945ba08712b35ce92b670caf73b Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Thu, 20 Apr 2006 06:06:55 +0000 Subject: [PATCH 239/411] fixed a completion hang/crash when completing symbols globally switched to smaller chunks being added to the dictionary. --- autoload/rubycomplete.vim | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 722fa788..1e13447d 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.8 2006/04/20 05:24:27 segy Exp $ +" Info: $Id: rubycomplete.vim,v 1.9 2006/04/20 06:06:55 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -288,6 +288,11 @@ def get_completions(base) sym = $1 candidates = Symbol.all_symbols.collect{|s| ":" + s.id2name} candidates.grep(/^#{sym}/) + candidates.delete_if do |c| + c.match( /'/ ) + end + candidates.uniq! + candidates.sort! else [] end @@ -421,10 +426,20 @@ def get_completions(base) end outp = "" + # tags = VIM::evaluate("taglist('^%s$')" % - (candidates-Object.instance_methods).each { |c| outp += "{'word':'%s','item':'%s'}," % [ c, c ] } - outp.sub!(/,$/, '') - VIM::command("let g:rubycomplete_completions = [%s]" % outp) + valid = (candidates-Object.instance_methods) + + rg = 0..valid.length + rg.step(150) do |x| + stpos = 0+x + enpos = 150+x + valid[stpos..enpos].each { |c| outp += "{'word':'%s','item':'%s'}," % [ c, c ] } + outp.sub!(/,$/, '') + + VIM::command("call extend(g:rubycomplete_completions, [%s])" % outp) + outp = "" + end end From ae955512b0545e48a6192cb6f2442980a793ffc7 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 20 Apr 2006 10:13:21 +0000 Subject: [PATCH 240/411] move syntax documentation to ft-ruby-syntax.txt --- ChangeLog | 5 +++++ syntax/doc/ruby.txt => doc/ft-ruby-syntax.txt | 0 2 files changed, 5 insertions(+) rename syntax/doc/ruby.txt => doc/ft-ruby-syntax.txt (100%) diff --git a/ChangeLog b/ChangeLog index 0c9e3e2c..6a506936 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-04-20 Doug Kearns + + * doc/ft-ruby-syntax.txt, syntax/doc/ruby.txt: move syntax + documentation to ft-ruby-syntax.txt + 2006-04-19 Doug Kearns * ftdetect/ruby.vim: add RJS and RXML template file detection diff --git a/syntax/doc/ruby.txt b/doc/ft-ruby-syntax.txt similarity index 100% rename from syntax/doc/ruby.txt rename to doc/ft-ruby-syntax.txt From c4bc154e18f81dc1e1b7d49a0b487be8a8944d37 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 20 Apr 2006 10:19:09 +0000 Subject: [PATCH 241/411] add new omni completion documentation --- ChangeLog | 2 ++ doc/ft-ruby-omni.txt | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 doc/ft-ruby-omni.txt diff --git a/ChangeLog b/ChangeLog index 6a506936..49cdf0e3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2006-04-20 Doug Kearns + * doc/ft-ruby-omni.txt: add new omni completion documentation + * doc/ft-ruby-syntax.txt, syntax/doc/ruby.txt: move syntax documentation to ft-ruby-syntax.txt diff --git a/doc/ft-ruby-omni.txt b/doc/ft-ruby-omni.txt new file mode 100644 index 00000000..b5039912 --- /dev/null +++ b/doc/ft-ruby-omni.txt @@ -0,0 +1,33 @@ +RUBY *ft-ruby-omni* + +Completion of Ruby code requires that vim be built with |+ruby|. + +Ruby completion will parse your buffer on demand in order to provide a list of +completions. These completions will be drawn from modules loaded by 'require' +and modules defined in the current buffer. + +The completions provided by CTRL-X CTRL-O are sensitive to the context: + + CONTEXT COMPLETIONS PROVIDED ~ + + 1. Not inside a class definition Classes, constants and globals + + 2. Inside a class definition Methods or constants defined in the class + + 3. After '.', '::' or ':' Methods applicable to the object being + dereferenced + + 4. After ':' or ':foo' Symbol name (beginning with 'foo') + +Notes: + - Vim will load/evaluate code in order to provide completions. This may + cause some code execution, which may be a concern. + - In context 2 above, anonymous classes are not supported. + - In context 3 above, Vim will attempt to determine the methods supported by + the object. + - Vim can detect and load the Rails environment for files within a rails + project. The feature is disabled by default, to enable it add + let g:rubycomplete_rails = 1 + to your vimrc + + vim:tw=78:sw=4:ts=8:ft=help:norl: From ddda22f9674923758e24b52d9d1613f1292e5dd1 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 20 Apr 2006 12:34:44 +0000 Subject: [PATCH 242/411] add Mark's missing ChangeLog entries --- ChangeLog | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/ChangeLog b/ChangeLog index 49cdf0e3..fe2c0199 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,21 @@ * doc/ft-ruby-syntax.txt, syntax/doc/ruby.txt: move syntax documentation to ft-ruby-syntax.txt +2006-04-20 Mark Guzman + + * autoload/rubycomplete.vim: fixed a completion hang/crash when + completing symbols globally switched to smaller chunks being added to + the dictionary + + * autoload/rubycomplete.vim: it will now complete rails classes + + * autoload/rubycomplete.vim: removed left over debug prints + +2006-04-19 Mark Guzman + + * autoload/rubycomplete.vim: in-buffer class completion seems to work + properly in my test cases added range variable detection - contributed + 2006-04-19 Doug Kearns * ftdetect/ruby.vim: add RJS and RXML template file detection @@ -13,10 +28,21 @@ * CONTRIBUTORS, ftplugin/ruby.vim: update Gavin's email address +2006-04-18 Mark Guzman + + * autoload/rubycomplete.vim: revised the in-buffer class loading, + needs a little more work but its testable + 2006-04-17 Doug Kearns * CONTRIBUTORS, indent/ruby.vim: update Nikolai's email address +2006-04-16 Mark Guzman + + * autoload/rubycomplete.vim: added a work-around for the cWORD bug + found by dkearns; added support for completion of in-buffer classes; + switched return-type over to a dictionary + 2006-04-15 Doug Kearns * autoload/rubycomplete.vim: rename rbcomplete#Complete to match @@ -32,6 +58,11 @@ maintainers; add rubycomplete.vim to the installer script's list of files +2006-04-14 Mark Guzman + + * autoload/rubycomplete.vim, ftplugin/ruby.vim: added ruby + omni-completion files; modified the ftplugin to set the omnifunc + 2005-10-14 Gavin Sinclair * indent/ruby.vim: Changed maintainer to Nikolai. From fc7f94ad79a5e2452d3b29a76465c9203d84b64f Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Fri, 21 Apr 2006 04:30:18 +0000 Subject: [PATCH 243/411] added support for adding classes defined in the current buffer to the global completion list - when completing with no text outside of a class definition --- autoload/rubycomplete.vim | 62 ++++++++++++++++++++++++++++++++------- 1 file changed, 51 insertions(+), 11 deletions(-) diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 1e13447d..98e1d0ef 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.9 2006/04/20 06:06:55 segy Exp $ +" Info: $Id: rubycomplete.vim,v 1.10 2006/04/21 04:30:18 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -10,6 +10,7 @@ " Ruby IRB/Complete author: Keiju ISHITSUKA(keiju@ishitsuka.com) " ---------------------------------------------------------------------------- +" {{{ requirement checks if !has('ruby') echohl ErrorMsg echo "Error: Required vim compiled with +ruby" @@ -23,8 +24,17 @@ if version < 700 echohl None finish endif +" }}} requirement checks +if !exists("g:rubycomplete_rails") + let g:rubycomplete_rails = 0 +endif + +if !exists("g:rubycomplete_load_on_global") + let g:rubycomplete_load_on_global = 0 +endif +" {{{ vim-side support functions function! GetBufferRubyModule(name) let [snum,enum] = GetBufferRubyEntity(a:name, "module") return snum . '..' . enum @@ -103,6 +113,8 @@ function! GetRubyVarType(v) return '' endfunction +"}}} vim-side support functions + function! rubycomplete#Complete(findstart, base) "findstart = 1 when we need to get the text length if a:findstart @@ -133,6 +145,7 @@ endfunction function! s:DefRuby() ruby << RUBYEOF +# {{{ ruby completion RailsWords = [ "has_many", "has_one", "belongs_to", @@ -164,11 +177,11 @@ Operators = [ "%", "&", "*", "**", "+", "-", "/", def load_requires - @buf = VIM::Buffer.current - enum = @buf.line_number + buf = VIM::Buffer.current + enum = buf.line_number nums = Range.new( 1, enum ) nums.each do |x| - ln = @buf[x] + ln = buf[x] begin eval( "require %s" % $1 ) if /.*require\s*(.*)$/.match( ln ) rescue Exception @@ -198,7 +211,7 @@ def load_buffer_module(name) end def get_buffer_entity(name, vimfun) - @buf = VIM::Buffer.current + buf = VIM::Buffer.current nums = eval( VIM::evaluate( vimfun % name ) ) return nil if nums == nil return nil if nums.min == nums.max && nums.min == 0 @@ -207,7 +220,7 @@ def get_buffer_entity(name, vimfun) classdef = "" nums.each do |x| if x != cur_line - ln = @buf[x] + ln = buf[x] classdef += "%s\n" % ln end end @@ -215,6 +228,25 @@ def get_buffer_entity(name, vimfun) return classdef end +def get_buffer_classes() + # this will be a little expensive. + allow_aggressive_load = VIM::evaluate('g:rubycomplete_load_on_global') + return if allow_aggressive_load != '1' + + buf = VIM::Buffer.current + eob = buf.length + ret = [] + rg = 1..eob + + rg.each do |x| + if /^\s*class\s*([A-Za-z0-9_-]*)(\s*<\s*([A-Za-z0-9_:-]*))?\s*/.match( buf[x] ) + ret.push $1 + end + end + + return ret +end + def load_rails() allow_rails = VIM::evaluate('g:rubycomplete_rails') return if allow_rails != '1' @@ -233,8 +265,10 @@ def load_rails() break end end + + return if pok == nil bootfile = pok + "/boot.rb" - require bootfile if pok != nil && File.exists?( bootfile ) + require bootfile if File.exists?( bootfile ) end def get_rails_helpers @@ -404,14 +438,19 @@ def get_completions(base) receiver = $1 message = input load_buffer_class( receiver ) - candidates = eval( "#{receiver}.instance_methods" ) - candidates += get_rails_helpers - select_message(receiver, message, candidates) + begin + candidates = eval( "#{receiver}.instance_methods" ) + candidates += get_rails_helpers + select_message(receiver, message, candidates) + rescue Exception + found = nil + end end end if inclass == nil || found == nil candidates = eval("self.class.constants") + candidates += get_buffer_classes (candidates|ReservedWords).grep(/^#{Regexp.quote(input)}/) end end @@ -459,10 +498,11 @@ def select_message(receiver, message, candidates) candidates.uniq! candidates.sort! end + +# }}} ruby completion RUBYEOF endfunction -let g:rubycomplete_rails = 0 call s:DefRuby() " vim: set et ts=4: From 49b5c3b5188bf75e25f4b3ce411862e214f05a76 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 21 Apr 2006 06:08:45 +0000 Subject: [PATCH 244/411] add missing ChangeLog entry --- ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index fe2c0199..67c0ef81 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-04-21 Mark Guzman + + * autoload/rubycomplete.vim: added support for adding classes defined + in the current buffer to the global completion list - when completing + with no text outside of a class definition + 2006-04-20 Doug Kearns * doc/ft-ruby-omni.txt: add new omni completion documentation From 59b39803ab01bd7ac8f8a079ffafcf385e8fd978 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 21 Apr 2006 07:02:18 +0000 Subject: [PATCH 245/411] add highlighting to example setting of g:rubycomplete_rails variable --- ChangeLog | 5 +++++ doc/ft-ruby-omni.txt | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 67c0ef81..3f22daf7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-04-21 Doug Kearns + + * doc/ft-ruby-omni.txt: add highlighting to example setting of + g:rubycomplete_rails variable + 2006-04-21 Mark Guzman * autoload/rubycomplete.vim: added support for adding classes defined diff --git a/doc/ft-ruby-omni.txt b/doc/ft-ruby-omni.txt index b5039912..ac6aec38 100644 --- a/doc/ft-ruby-omni.txt +++ b/doc/ft-ruby-omni.txt @@ -26,8 +26,8 @@ Notes: - In context 3 above, Vim will attempt to determine the methods supported by the object. - Vim can detect and load the Rails environment for files within a rails - project. The feature is disabled by default, to enable it add + project. The feature is disabled by default, to enable it add > let g:rubycomplete_rails = 1 - to your vimrc +< to your vimrc vim:tw=78:sw=4:ts=8:ft=help:norl: From 7342c00cca8ec0d7ba408b828d502dd2ab42cfa0 Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Fri, 21 Apr 2006 13:39:58 +0000 Subject: [PATCH 246/411] fixed a bug, where i was returning nil when the caller was expecting an empty array renamed g:rubycomplete_load_on_global -> g:rubycomplete_classes_in_global --- autoload/rubycomplete.vim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 98e1d0ef..1165aab7 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.10 2006/04/21 04:30:18 segy Exp $ +" Info: $Id: rubycomplete.vim,v 1.11 2006/04/21 13:39:58 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -30,8 +30,8 @@ if !exists("g:rubycomplete_rails") let g:rubycomplete_rails = 0 endif -if !exists("g:rubycomplete_load_on_global") - let g:rubycomplete_load_on_global = 0 +if !exists("g:rubycomplete_classes_in_global") + let g:rubycomplete_classes_in_global = 0 endif " {{{ vim-side support functions @@ -230,8 +230,8 @@ end def get_buffer_classes() # this will be a little expensive. - allow_aggressive_load = VIM::evaluate('g:rubycomplete_load_on_global') - return if allow_aggressive_load != '1' + allow_aggressive_load = VIM::evaluate('g:rubycomplete_classes_in_global') + return [] if allow_aggressive_load != '1' buf = VIM::Buffer.current eob = buf.length From c253a7997855495a72c22b1c25533b632a594a6a Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Fri, 21 Apr 2006 13:47:59 +0000 Subject: [PATCH 247/411] switched format to unix switched to the standard vim ts line --- autoload/rubycomplete.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 1165aab7..6d7a260f 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.11 2006/04/21 13:39:58 segy Exp $ +" Info: $Id: rubycomplete.vim,v 1.12 2006/04/21 13:47:59 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -505,4 +505,4 @@ endfunction call s:DefRuby() -" vim: set et ts=4: +" vim:tw=78:sw=4:ts=8:ft=vim:norl: From 09fdef9ba37ea497a16d58663c85df70abef3a61 Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Fri, 21 Apr 2006 13:57:39 +0000 Subject: [PATCH 248/411] added some info about g:rubycomplete_classes_in_global --- doc/ft-ruby-omni.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/ft-ruby-omni.txt b/doc/ft-ruby-omni.txt index ac6aec38..443b1318 100644 --- a/doc/ft-ruby-omni.txt +++ b/doc/ft-ruby-omni.txt @@ -22,6 +22,11 @@ The completions provided by CTRL-X CTRL-O are sensitive to the context: Notes: - Vim will load/evaluate code in order to provide completions. This may cause some code execution, which may be a concern. + - In context 1 above, Vim can parse the entire buffer to add a list of + classes to the completion results. This feature is turned off by default, + to enable it add + let g:rubycomplete_classes_in_global = 1 + to your vimrc - In context 2 above, anonymous classes are not supported. - In context 3 above, Vim will attempt to determine the methods supported by the object. From dc1edefc0a63e83cbb338f9fb701134bd68c6fe4 Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Fri, 21 Apr 2006 15:01:11 +0000 Subject: [PATCH 249/411] added highlighting for the g:rubycomplete_classes_in_global example --- doc/ft-ruby-omni.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/ft-ruby-omni.txt b/doc/ft-ruby-omni.txt index 443b1318..54485989 100644 --- a/doc/ft-ruby-omni.txt +++ b/doc/ft-ruby-omni.txt @@ -24,9 +24,9 @@ Notes: cause some code execution, which may be a concern. - In context 1 above, Vim can parse the entire buffer to add a list of classes to the completion results. This feature is turned off by default, - to enable it add + to enable it add > let g:rubycomplete_classes_in_global = 1 - to your vimrc +< to your vimrc - In context 2 above, anonymous classes are not supported. - In context 3 above, Vim will attempt to determine the methods supported by the object. From e5b8a18b2ef4bd7c446d89b2805c5375e94498ec Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Fri, 21 Apr 2006 15:02:15 +0000 Subject: [PATCH 250/411] Added entries for today's checkins, so far. --- ChangeLog | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index 3f22daf7..c0406402 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-04-21 Mark Guzman + * autoload/rubycomplete.vim: renamed the vim global variable + controlling the addition of classes defined in the current buffer to + the global completion list + + * doc/ft-ruby-omni.txt: added information about the classes in global + completion option + 2006-04-21 Doug Kearns * doc/ft-ruby-omni.txt: add highlighting to example setting of From d6d481df44ea412d1ea331998f837965381c3a54 Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Fri, 21 Apr 2006 21:21:19 +0000 Subject: [PATCH 251/411] added sorting to the global's completion. will need to revisit sorting when we start using the dictionaries fully --- autoload/rubycomplete.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 6d7a260f..99749328 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.12 2006/04/21 13:47:59 segy Exp $ +" Info: $Id: rubycomplete.vim,v 1.13 2006/04/21 21:21:19 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -451,6 +451,8 @@ def get_completions(base) if inclass == nil || found == nil candidates = eval("self.class.constants") candidates += get_buffer_classes + candidates.uniq! + candidates.sort! (candidates|ReservedWords).grep(/^#{Regexp.quote(input)}/) end end From 858b8f0401eba3049ab4a42a15b924e1c82f9275 Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Fri, 21 Apr 2006 21:22:03 +0000 Subject: [PATCH 252/411] added a line for the addition of sorting to globals completion --- ChangeLog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index c0406402..2f7cf4fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,9 @@ controlling the addition of classes defined in the current buffer to the global completion list + * autoload/rubycomplete.vim: the global variable list is now sorted + and dups are removed + * doc/ft-ruby-omni.txt: added information about the classes in global completion option From fc5f22633b9d7d4a0b9d014dd3c850e013a45123 Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Fri, 21 Apr 2006 21:31:53 +0000 Subject: [PATCH 253/411] fixed a bug involving rails methods being added to in-class completions when not in a rails project --- autoload/rubycomplete.vim | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 99749328..55c367ec 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.13 2006/04/21 21:21:19 segy Exp $ +" Info: $Id: rubycomplete.vim,v 1.14 2006/04/21 21:31:53 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -268,12 +268,16 @@ def load_rails() return if pok == nil bootfile = pok + "/boot.rb" - require bootfile if File.exists?( bootfile ) + if File.exists?( bootfile ) + require bootfile + VIM::evaluate('let g:rubycomplete_rails_loaded = 1') + end end def get_rails_helpers allow_rails = VIM::evaluate('g:rubycomplete_rails') - return [] if allow_rails != '1' + rails_loaded = VIM::evaluate('g:rubycomplete_rails_loaded') + return [] if allow_rails != '1' || rails_loaded != '1' return RailsWords end @@ -505,6 +509,7 @@ end RUBYEOF endfunction +let g:rubycomplete_rails_loaded = 0 call s:DefRuby() " vim:tw=78:sw=4:ts=8:ft=vim:norl: From a6d589a5f289dc028ef1d44070464ea08bbc3f20 Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Fri, 21 Apr 2006 21:32:31 +0000 Subject: [PATCH 254/411] updated for bugfix in rubycomplete.vim --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2f7cf4fc..373d7ffb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,10 @@ * autoload/rubycomplete.vim: the global variable list is now sorted and dups are removed + * autoload/rubycomplete.vim: fixed a bug with rails support, where + rails standard methods would be added to a completion list when not + in a rails project + * doc/ft-ruby-omni.txt: added information about the classes in global completion option From 9ac5626d15361cafd9f60e68b6690b702829a456 Mon Sep 17 00:00:00 2001 From: Gavin Sinclair Date: Sat, 22 Apr 2006 01:31:30 +0000 Subject: [PATCH 255/411] Slight readability improvement --- doc/ft-ruby-omni.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/ft-ruby-omni.txt b/doc/ft-ruby-omni.txt index 54485989..98cdab17 100644 --- a/doc/ft-ruby-omni.txt +++ b/doc/ft-ruby-omni.txt @@ -25,14 +25,14 @@ Notes: - In context 1 above, Vim can parse the entire buffer to add a list of classes to the completion results. This feature is turned off by default, to enable it add > - let g:rubycomplete_classes_in_global = 1 + let g:rubycomplete_classes_in_global = 1 < to your vimrc - In context 2 above, anonymous classes are not supported. - In context 3 above, Vim will attempt to determine the methods supported by the object. - Vim can detect and load the Rails environment for files within a rails project. The feature is disabled by default, to enable it add > - let g:rubycomplete_rails = 1 + let g:rubycomplete_rails = 1 < to your vimrc vim:tw=78:sw=4:ts=8:ft=help:norl: From f27486dc50a116f78dce794c015db11c52877a6d Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Sat, 22 Apr 2006 05:49:11 +0000 Subject: [PATCH 256/411] changed the rails load code to match the console load, we're now pulling everything in. completion of class members from within the class definition now works properly. --- autoload/rubycomplete.vim | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 55c367ec..81a181fc 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.14 2006/04/21 21:31:53 segy Exp $ +" Info: $Id: rubycomplete.vim,v 1.15 2006/04/22 05:49:11 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -90,9 +90,15 @@ function! GetRubyVarType(v) return vtp endif call setpos('.',pos) - let [lnum,lcol] = searchpos(''.a:v.'\>\s*[+\-*/]*=\s*\([^ \t]\+.\(now\|new\|open\|get_instance\)\>\|[\[{"''/]\|%r{\)','nb',stopline) + if g:rubycomplete_rails == 1 && g:rubycomplete_rails_loaded == 1 + let ctors = '\(now\|new\|open\|get_instance\|find\|create\)' + else + let ctors = '\(now\|new\|open\|get_instance\)' + endif + + let [lnum,lcol] = searchpos(''.a:v.'\>\s*[+\-*/]*=\s*\([^ \t]\+.' . ctors .'\>\|[\[{"''/]\|%r{\)','nb',stopline) if lnum != 0 && lcol != 0 - let str = matchstr(getline(lnum),'=\s*\([^ \t]\+.\(now\|new\|open\|get_instance\)\>\|[\[{"''/]\|%r{\)',lcol) + let str = matchstr(getline(lnum),'=\s*\([^ \t]\+.' . ctors . '\>\|[\[{"''/]\|%r{\)',lcol) let str = substitute(str,'^=\s*','','') call setpos('.',pos) if str == '"' || str == '''' @@ -255,7 +261,7 @@ def load_rails() file_name = VIM::evaluate('expand("%:t")') path = buf_path.gsub( file_name, '' ) path.gsub!( /\\/, "/" ) - pup = [ "../", "../../", "../../../", "../../../../" ] + pup = [ "./", "../", "../../", "../../../", "../../../../" ] pok = nil pup.each do |sup| @@ -267,10 +273,19 @@ def load_rails() end return if pok == nil + bootfile = pok + "/boot.rb" - if File.exists?( bootfile ) - require bootfile - VIM::evaluate('let g:rubycomplete_rails_loaded = 1') + envfile = pok + "/environment.rb" + if File.exists?( bootfile ) && File.exists?( envfile ) + begin + require bootfile + require envfile + require 'console_app' + require 'console_with_helpers' + VIM::command('let g:rubycomplete_rails_loaded = 1') + rescue + print "Error loading rails environment" + end end end From 3312dfed9b38f4d0fc2a171b848d2e9a778a1102 Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Sat, 22 Apr 2006 05:49:55 +0000 Subject: [PATCH 257/411] updated to match latest checkin --- ChangeLog | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 373d7ffb..76fd8029 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,9 @@ -2006-04-21 Mark Guzman +2006-04-22 Mark Guzman + * autoload/rubycomplete.vim: changed the rails load code to match the + console load, we're now pulling everything in. completion of class + members from within the class definition now works properly. + +2006-04-21 Mark Guzman * autoload/rubycomplete.vim: renamed the vim global variable controlling the addition of classes defined in the current buffer to the global completion list From b201bb1c63d06dba51e03f3b17ec88634313573a Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Mon, 24 Apr 2006 12:57:15 +0000 Subject: [PATCH 258/411] add vim help files, the new FAQ and rubycomplete.vim to the gemspec file list --- ChangeLog | 7 +++++++ Rakefile | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 76fd8029..ba23244e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,16 @@ +2006-04-24 Doug Kearns + + * Rakefile: add vim help files, the new FAQ and rubycomplete.vim to + the gemspec file list + 2006-04-22 Mark Guzman + * autoload/rubycomplete.vim: changed the rails load code to match the console load, we're now pulling everything in. completion of class members from within the class definition now works properly. 2006-04-21 Mark Guzman + * autoload/rubycomplete.vim: renamed the vim global variable controlling the addition of classes defined in the current buffer to the global completion list diff --git a/Rakefile b/Rakefile index f2fce485..d6625231 100644 --- a/Rakefile +++ b/Rakefile @@ -3,8 +3,8 @@ require 'rake/gempackagetask' PACKAGE_NAME = 'vim-ruby' RELEASE_FILES = FileList[ - 'ChangeLog', 'CONTRIBUTORS', 'INSTALL', 'NEWS', 'README', 'bin/*.rb', - '{compiler,ftdetect,ftplugin,indent,syntax}/*.vim' + 'ChangeLog', 'CONTRIBUTORS', 'FAQ', 'INSTALL', 'NEWS', 'README', 'bin/*.rb', + 'doc/*.txt','{autoload,compiler,ftdetect,ftplugin,indent,syntax}/*.vim' ] PACKAGE_VERSION = Time.now.gmtime.strftime('%Y.%m.%d') From a20a8fe174fa66038c7c873730a58a427ac5ef67 Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Mon, 24 Apr 2006 17:50:42 +0000 Subject: [PATCH 259/411] fixed a completion bug where, the entered text was not taken into account --- autoload/rubycomplete.vim | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 81a181fc..70033898 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.15 2006/04/22 05:49:11 segy Exp $ +" Info: $Id: rubycomplete.vim,v 1.16 2006/04/24 17:50:42 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -303,8 +303,9 @@ def get_completions(base) input = VIM::evaluate('expand("")') input += base input.lstrip! - if input.length == 0 + if (input.length == 0) || (input == base) input = VIM::Buffer.current.line + input += base input.strip! end message = nil @@ -472,7 +473,7 @@ def get_completions(base) candidates += get_buffer_classes candidates.uniq! candidates.sort! - (candidates|ReservedWords).grep(/^#{Regexp.quote(input)}/) + candidates = candidates.grep(/^#{Regexp.quote(input)}/) end end From 97388f15f418603cd89df158ea2312824211780d Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Mon, 24 Apr 2006 17:53:18 +0000 Subject: [PATCH 260/411] updated for last checkin --- ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index ba23244e..b356c5a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-04-24 Mark Guzman + * autoload/rubycomplete.vim: fixed a completion bug where the entered + text was not taken to account. it will now be used to limit the entries + returned + 2006-04-24 Doug Kearns * Rakefile: add vim help files, the new FAQ and rubycomplete.vim to From 07ea5c14e820671dc30322d54773d6a043874e85 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 25 Apr 2006 07:05:42 +0000 Subject: [PATCH 261/411] make sure 'smartindent' is disabled --- ChangeLog | 5 +++++ indent/ruby.vim | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b356c5a9..eddb25d4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,9 @@ +2006-04-25 Doug Kearns + + * indent/ruby.vim: make sure 'smartindent' is disabled + 2006-04-24 Mark Guzman + * autoload/rubycomplete.vim: fixed a completion bug where the entered text was not taken to account. it will now be used to limit the entries returned diff --git a/indent/ruby.vim b/indent/ruby.vim index bba14994..217cb2eb 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Ruby " Maintainer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.37 2006/04/17 14:11:52 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.38 2006/04/25 07:05:42 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -15,6 +15,8 @@ if exists("b:did_indent") endif let b:did_indent = 1 +setlocal nosmartindent + " Now, set up our indentation expression and keys that trigger it. setlocal indentexpr=GetRubyIndent() setlocal indentkeys=0{,0},0),0],!^F,o,O,e From dd54a4429de0f95b75eb4979d330c47b618bbca4 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 25 Apr 2006 14:31:53 +0000 Subject: [PATCH 262/411] remove excess whitespace in rubycomplete.vim --- ChangeLog | 2 + autoload/rubycomplete.vim | 217 +++++++++++++++++++------------------- 2 files changed, 111 insertions(+), 108 deletions(-) diff --git a/ChangeLog b/ChangeLog index eddb25d4..19440e94 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2006-04-25 Doug Kearns + * autoload/rubycomplete.vim: remove excess whitespace + * indent/ruby.vim: make sure 'smartindent' is disabled 2006-04-24 Mark Guzman diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 70033898..936dd356 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,9 +1,9 @@ " Vim completion script -" Language: Ruby -" Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.16 2006/04/24 17:50:42 segy Exp $ -" URL: http://vim-ruby.rubyforge.org -" Anon CVS: See above site +" Language: Ruby +" Maintainer: Mark Guzman +" Info: $Id: rubycomplete.vim,v 1.17 2006/04/25 14:31:53 dkearns Exp $ +" URL: http://vim-ruby.rubyforge.org +" Anon CVS: See above site " Release Coordinator: Doug Kearns " ---------------------------------------------------------------------------- " @@ -53,14 +53,14 @@ function! GetBufferRubyEntity( name, type ) let crex = '^\s*' . a:type . '\s*' . a:name . '\s*\(<\s*.*\s*\)\?\n*\(\(\s\|#\).*\n*\)*\n*\s*end$' let [lnum,lcol] = searchpos( crex, 'nbw') if lnum == 0 && lcol == 0 - return [0,0] + return [0,0] endif let [enum,ecol] = searchpos( crex, 'nebw') if lnum > enum - let realdef = getline( lnum ) - let crexb = '^' . realdef . '\n*\(\(\s\|#\).*\n*\)*\n*\s*end$' - let [enum,ecol] = searchpos( crexb, 'necw' ) + let realdef = getline( lnum ) + let crexb = '^' . realdef . '\n*\(\(\s\|#\).*\n*\)*\n*\s*end$' + let [enum,ecol] = searchpos( crexb, 'necw' ) endif " we found a the class def return [lnum,enum] @@ -71,8 +71,8 @@ function! IsInClassDef() let ret = 'nil' let pos = line('.') - if snum < pos && pos < enum - let ret = snum . '..' . enum + if snum < pos && pos < enum + let ret = snum . '..' . enum endif return ret @@ -91,14 +91,14 @@ function! GetRubyVarType(v) endif call setpos('.',pos) if g:rubycomplete_rails == 1 && g:rubycomplete_rails_loaded == 1 - let ctors = '\(now\|new\|open\|get_instance\|find\|create\)' + let ctors = '\(now\|new\|open\|get_instance\|find\|create\)' else - let ctors = '\(now\|new\|open\|get_instance\)' + let ctors = '\(now\|new\|open\|get_instance\)' endif let [lnum,lcol] = searchpos(''.a:v.'\>\s*[+\-*/]*=\s*\([^ \t]\+.' . ctors .'\>\|[\[{"''/]\|%r{\)','nb',stopline) if lnum != 0 && lcol != 0 - let str = matchstr(getline(lnum),'=\s*\([^ \t]\+.' . ctors . '\>\|[\[{"''/]\|%r{\)',lcol) + let str = matchstr(getline(lnum),'=\s*\([^ \t]\+.' . ctors . '\>\|[\[{"''/]\|%r{\)',lcol) let str = substitute(str,'^=\s*','','') call setpos('.',pos) if str == '"' || str == '''' @@ -107,10 +107,10 @@ function! GetRubyVarType(v) return 'Array' elseif str == '{' return 'Hash' - elseif str == '/' || str == '%r{' - return 'Regexp' + elseif str == '/' || str == '%r{' + return 'Regexp' elseif strlen(str) > 4 - let l = stridx(str,'.') + let l = stridx(str,'.') return str[0:l-1] end return '' @@ -124,27 +124,27 @@ endfunction function! rubycomplete#Complete(findstart, base) "findstart = 1 when we need to get the text length if a:findstart - let line = getline('.') - let idx = col('.') - while idx > 0 - let idx -= 1 - let c = line[idx-1] - if c =~ '\w' - continue - elseif ! c =~ '\.' - idx = -1 - break - else - break - endif - endwhile - - return idx + let line = getline('.') + let idx = col('.') + while idx > 0 + let idx -= 1 + let c = line[idx-1] + if c =~ '\w' + continue + elseif ! c =~ '\.' + idx = -1 + break + else + break + endif + endwhile + + return idx "findstart = 0 when we need to return the list of completions else - let g:rubycomplete_completions = [] - execute "ruby get_completions('" . a:base . "')" - return g:rubycomplete_completions + let g:rubycomplete_completions = [] + execute "ruby get_completions('" . a:base . "')" + return g:rubycomplete_completions endif endfunction @@ -206,31 +206,31 @@ def load_buffer_class(name) mixre = /.*\n\s*include\s*(.*)\s*\n/.match( classdef ) load_buffer_module( $2 ) if mixre != nil - eval classdef + eval classdef end def load_buffer_module(name) classdef = get_buffer_entity(name, 'GetBufferRubyModule("%s")') return if classdef == nil - eval classdef + eval classdef end def get_buffer_entity(name, vimfun) buf = VIM::Buffer.current nums = eval( VIM::evaluate( vimfun % name ) ) - return nil if nums == nil + return nil if nums == nil return nil if nums.min == nums.max && nums.min == 0 - + cur_line = VIM::Buffer.current.line_number classdef = "" nums.each do |x| if x != cur_line - ln = buf[x] + ln = buf[x] classdef += "%s\n" % ln end end - + return classdef end @@ -246,7 +246,7 @@ def get_buffer_classes() rg.each do |x| if /^\s*class\s*([A-Za-z0-9_-]*)(\s*<\s*([A-Za-z0-9_:-]*))?\s*/.match( buf[x] ) - ret.push $1 + ret.push $1 end end @@ -256,10 +256,10 @@ end def load_rails() allow_rails = VIM::evaluate('g:rubycomplete_rails') return if allow_rails != '1' - + buf_path = VIM::evaluate('expand("%:p")') file_name = VIM::evaluate('expand("%:t")') - path = buf_path.gsub( file_name, '' ) + path = buf_path.gsub( file_name, '' ) path.gsub!( /\\/, "/" ) pup = [ "./", "../", "../../", "../../../", "../../../../" ] pok = nil @@ -267,25 +267,25 @@ def load_rails() pup.each do |sup| tpok = "%s%sconfig" % [ path, sup ] if File.exists?( tpok ) - pok = tpok - break + pok = tpok + break end end - + return if pok == nil bootfile = pok + "/boot.rb" envfile = pok + "/environment.rb" if File.exists?( bootfile ) && File.exists?( envfile ) begin - require bootfile + require bootfile require envfile require 'console_app' require 'console_with_helpers' - VIM::command('let g:rubycomplete_rails_loaded = 1') + VIM::command('let g:rubycomplete_rails_loaded = 1') rescue print "Error loading rails environment" - end + end end end @@ -293,7 +293,7 @@ def get_rails_helpers allow_rails = VIM::evaluate('g:rubycomplete_rails') rails_loaded = VIM::evaluate('g:rubycomplete_rails_loaded') return [] if allow_rails != '1' || rails_loaded != '1' - return RailsWords + return RailsWords end def get_completions(base) @@ -339,16 +339,16 @@ def get_completions(base) when /^(:[^:.]*)$/ # Symbol if Symbol.respond_to?(:all_symbols) - sym = $1 - candidates = Symbol.all_symbols.collect{|s| ":" + s.id2name} - candidates.grep(/^#{sym}/) - candidates.delete_if do |c| - c.match( /'/ ) - end - candidates.uniq! - candidates.sort! + sym = $1 + candidates = Symbol.all_symbols.collect{|s| ":" + s.id2name} + candidates.grep(/^#{sym}/) + candidates.delete_if do |c| + c.match( /'/ ) + end + candidates.uniq! + candidates.sort! else - [] + [] end when /^::([A-Z][^:\.\(]*)$/ @@ -362,9 +362,9 @@ def get_completions(base) receiver = $1 message = Regexp.quote($4) begin - candidates = eval("#{receiver}.constants | #{receiver}.methods") + candidates = eval("#{receiver}.constants | #{receiver}.methods") rescue Exception - candidates = [] + candidates = [] end candidates.grep(/^#{message}/).collect{|e| receiver + "::" + e} @@ -382,9 +382,9 @@ def get_completions(base) message = Regexp.quote($4) begin - candidates = eval(receiver).methods + candidates = eval(receiver).methods rescue Exception - candidates + candidates end select_message(receiver, message, candidates) @@ -402,41 +402,41 @@ def get_completions(base) vartype = VIM::evaluate("GetRubyVarType('%s')" % receiver) if vartype != '' - load_buffer_class( vartype ) + load_buffer_class( vartype ) - begin - candidates = eval("#{vartype}.instance_methods") - rescue Exception - candidates = [] - end + begin + candidates = eval("#{vartype}.instance_methods") + rescue Exception + candidates = [] + end elsif (cv).include?(receiver) - # foo.func and foo is local var. - candidates = eval("#{receiver}.methods") + # foo.func and foo is local var. + candidates = eval("#{receiver}.methods") elsif /^[A-Z]/ =~ receiver and /\./ !~ receiver - # Foo::Bar.func - begin - candidates = eval("#{receiver}.methods") - rescue Exception - candidates = [] - end + # Foo::Bar.func + begin + candidates = eval("#{receiver}.methods") + rescue Exception + candidates = [] + end else - # func1.func2 - candidates = [] - ObjectSpace.each_object(Module){|m| - next if m.name != "IRB::Context" and - /^(IRB|SLex|RubyLex|RubyToken)/ =~ m.name - candidates.concat m.instance_methods(false) - } - candidates.sort! - candidates.uniq! + # func1.func2 + candidates = [] + ObjectSpace.each_object(Module){|m| + next if m.name != "IRB::Context" and + /^(IRB|SLex|RubyLex|RubyToken)/ =~ m.name + candidates.concat m.instance_methods(false) + } + candidates.sort! + candidates.uniq! end #identify_type( receiver ) select_message(receiver, message, candidates) #when /^((\.?[^.]+)+)\.([^.]*)\(\s*\)*$/ - #function call - #obj = $1 - #func = $3 + #function call + #obj = $1 + #func = $3 when /^\.([^.]*)$/ # unknown(maybe String) @@ -451,23 +451,23 @@ def get_completions(base) inclass = eval( VIM::evaluate("IsInClassDef()") ) if inclass != nil - classdef = "%s\n" % VIM::Buffer.current[ inclass.min ] + classdef = "%s\n" % VIM::Buffer.current[ inclass.min ] found = /^\s*class\s*([A-Za-z0-9_-]*)(\s*<\s*([A-Za-z0-9_:-]*))?\s*\n$/.match( classdef ) if found != nil - receiver = $1 - message = input - load_buffer_class( receiver ) - begin - candidates = eval( "#{receiver}.instance_methods" ) - candidates += get_rails_helpers - select_message(receiver, message, candidates) - rescue Exception - found = nil - end + receiver = $1 + message = input + load_buffer_class( receiver ) + begin + candidates = eval( "#{receiver}.instance_methods" ) + candidates += get_rails_helpers + select_message(receiver, message, candidates) + rescue Exception + found = nil + end end end - + if inclass == nil || found == nil candidates = eval("self.class.constants") candidates += get_buffer_classes @@ -481,8 +481,8 @@ def get_completions(base) if message != nil && message.length > 0 rexp = '^%s' % message.downcase candidates.delete_if do |c| - c.downcase.match( rexp ) - $~ == nil + c.downcase.match( rexp ) + $~ == nil end end @@ -490,7 +490,7 @@ def get_completions(base) # tags = VIM::evaluate("taglist('^%s$')" % valid = (candidates-Object.instance_methods) - + rg = 0..valid.length rg.step(150) do |x| stpos = 0+x @@ -510,10 +510,10 @@ def select_message(receiver, message, candidates) candidates.grep(/^#{message}/).collect do |e| case e when /^[a-zA-Z_]/ - receiver + "." + e + receiver + "." + e when /^[0-9]/ when *Operators - #receiver + " " + e + #receiver + " " + e end end candidates.delete_if { |x| x == nil } @@ -528,4 +528,5 @@ endfunction let g:rubycomplete_rails_loaded = 0 call s:DefRuby() + " vim:tw=78:sw=4:ts=8:ft=vim:norl: From 7650c7072d329c657a6cd9ef083b666dca292906 Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Tue, 25 Apr 2006 15:47:39 +0000 Subject: [PATCH 263/411] Started stripping out preceding assigment operation stuff. "x = A", would attempt to complete A using the global list. I've started removing old/commented code in an effort to slim down the file --- autoload/rubycomplete.vim | 241 +++++++++++++++++++------------------- 1 file changed, 119 insertions(+), 122 deletions(-) diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 936dd356..6e496f40 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,10 +1,10 @@ " Vim completion script -" Language: Ruby -" Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.17 2006/04/25 14:31:53 dkearns Exp $ -" URL: http://vim-ruby.rubyforge.org -" Anon CVS: See above site -" Release Coordinator: Doug Kearns +" Language: Ruby +" Maintainer: Mark Guzman +" Info: $Id: rubycomplete.vim,v 1.18 2006/04/25 15:47:39 segy Exp $ +" URL: http://vim-ruby.rubyforge.org +" Anon CVS: See above site +" Release Coordinator: Doug Kearns " ---------------------------------------------------------------------------- " " Ruby IRB/Complete author: Keiju ISHITSUKA(keiju@ishitsuka.com) @@ -53,14 +53,14 @@ function! GetBufferRubyEntity( name, type ) let crex = '^\s*' . a:type . '\s*' . a:name . '\s*\(<\s*.*\s*\)\?\n*\(\(\s\|#\).*\n*\)*\n*\s*end$' let [lnum,lcol] = searchpos( crex, 'nbw') if lnum == 0 && lcol == 0 - return [0,0] + return [0,0] endif let [enum,ecol] = searchpos( crex, 'nebw') if lnum > enum - let realdef = getline( lnum ) - let crexb = '^' . realdef . '\n*\(\(\s\|#\).*\n*\)*\n*\s*end$' - let [enum,ecol] = searchpos( crexb, 'necw' ) + let realdef = getline( lnum ) + let crexb = '^' . realdef . '\n*\(\(\s\|#\).*\n*\)*\n*\s*end$' + let [enum,ecol] = searchpos( crexb, 'necw' ) endif " we found a the class def return [lnum,enum] @@ -72,50 +72,50 @@ function! IsInClassDef() let pos = line('.') if snum < pos && pos < enum - let ret = snum . '..' . enum + let ret = snum . '..' . enum endif return ret endfunction function! GetRubyVarType(v) - let stopline = 1 - let vtp = '' - let pos = getpos('.') - let [lnum,lcol] = searchpos('^\s*#\s*@var\s*'.a:v.'\>\s\+[^ \t]\+\s*$','nb',stopline) - if lnum != 0 && lcol != 0 - call setpos('.',pos) - let str = getline(lnum) - let vtp = substitute(str,'^\s*#\s*@var\s*'.a:v.'\>\s\+\([^ \t]\+\)\s*$','\1','') - return vtp - endif - call setpos('.',pos) + let stopline = 1 + let vtp = '' + let pos = getpos('.') + let [lnum,lcol] = searchpos('^\s*#\s*@var\s*'.a:v.'\>\s\+[^ \t]\+\s*$','nb',stopline) + if lnum != 0 && lcol != 0 + call setpos('.',pos) + let str = getline(lnum) + let vtp = substitute(str,'^\s*#\s*@var\s*'.a:v.'\>\s\+\([^ \t]\+\)\s*$','\1','') + return vtp + endif + call setpos('.',pos) if g:rubycomplete_rails == 1 && g:rubycomplete_rails_loaded == 1 - let ctors = '\(now\|new\|open\|get_instance\|find\|create\)' + let ctors = '\(now\|new\|open\|get_instance\|find\|create\)' else - let ctors = '\(now\|new\|open\|get_instance\)' + let ctors = '\(now\|new\|open\|get_instance\)' endif let [lnum,lcol] = searchpos(''.a:v.'\>\s*[+\-*/]*=\s*\([^ \t]\+.' . ctors .'\>\|[\[{"''/]\|%r{\)','nb',stopline) - if lnum != 0 && lcol != 0 - let str = matchstr(getline(lnum),'=\s*\([^ \t]\+.' . ctors . '\>\|[\[{"''/]\|%r{\)',lcol) - let str = substitute(str,'^=\s*','','') - call setpos('.',pos) - if str == '"' || str == '''' - return 'String' - elseif str == '[' - return 'Array' - elseif str == '{' - return 'Hash' - elseif str == '/' || str == '%r{' - return 'Regexp' - elseif strlen(str) > 4 - let l = stridx(str,'.') - return str[0:l-1] - end - return '' - endif - call setpos('.',pos) + if lnum != 0 && lcol != 0 + let str = matchstr(getline(lnum),'=\s*\([^ \t]\+.' . ctors . '\>\|[\[{"''/]\|%r{\)',lcol) + let str = substitute(str,'^=\s*','','') + call setpos('.',pos) + if str == '"' || str == '''' + return 'String' + elseif str == '[' + return 'Array' + elseif str == '{' + return 'Hash' + elseif str == '/' || str == '%r{' + return 'Regexp' + elseif strlen(str) > 4 + let l = stridx(str,'.') + return str[0:l-1] + end + return '' + endif + call setpos('.',pos) return '' endfunction @@ -124,27 +124,27 @@ endfunction function! rubycomplete#Complete(findstart, base) "findstart = 1 when we need to get the text length if a:findstart - let line = getline('.') - let idx = col('.') - while idx > 0 - let idx -= 1 - let c = line[idx-1] - if c =~ '\w' - continue - elseif ! c =~ '\.' - idx = -1 - break - else - break - endif - endwhile - - return idx + let line = getline('.') + let idx = col('.') + while idx > 0 + let idx -= 1 + let c = line[idx-1] + if c =~ '\w' + continue + elseif ! c =~ '\.' + idx = -1 + break + else + break + endif + endwhile + + return idx "findstart = 0 when we need to return the list of completions else - let g:rubycomplete_completions = [] - execute "ruby get_completions('" . a:base . "')" - return g:rubycomplete_completions + let g:rubycomplete_completions = [] + execute "ruby get_completions('" . a:base . "')" + return g:rubycomplete_completions endif endfunction @@ -217,6 +217,7 @@ def load_buffer_module(name) end def get_buffer_entity(name, vimfun) + return nil if name == '""' buf = VIM::Buffer.current nums = eval( VIM::evaluate( vimfun % name ) ) return nil if nums == nil @@ -306,6 +307,9 @@ def get_completions(base) if (input.length == 0) || (input == base) input = VIM::Buffer.current.line input += base + if /^.*=\s*(.*)/.match(input) != nil + input = $1 + end input.strip! end message = nil @@ -339,16 +343,16 @@ def get_completions(base) when /^(:[^:.]*)$/ # Symbol if Symbol.respond_to?(:all_symbols) - sym = $1 - candidates = Symbol.all_symbols.collect{|s| ":" + s.id2name} - candidates.grep(/^#{sym}/) - candidates.delete_if do |c| - c.match( /'/ ) - end - candidates.uniq! - candidates.sort! + sym = $1 + candidates = Symbol.all_symbols.collect{|s| ":" + s.id2name} + candidates.grep(/^#{sym}/) + candidates.delete_if do |c| + c.match( /'/ ) + end + candidates.uniq! + candidates.sort! else - [] + [] end when /^::([A-Z][^:\.\(]*)$/ @@ -362,9 +366,9 @@ def get_completions(base) receiver = $1 message = Regexp.quote($4) begin - candidates = eval("#{receiver}.constants | #{receiver}.methods") + candidates = eval("#{receiver}.constants | #{receiver}.methods") rescue Exception - candidates = [] + candidates = [] end candidates.grep(/^#{message}/).collect{|e| receiver + "::" + e} @@ -382,14 +386,14 @@ def get_completions(base) message = Regexp.quote($4) begin - candidates = eval(receiver).methods + candidates = eval(receiver).methods rescue Exception - candidates + candidates end select_message(receiver, message, candidates) when /^(\$[^.]*)$/ - candidates = global_variables.grep(Regexp.new(Regexp.quote($1))) + candidates = global_variables.grep(Regexp.new(Regexp.quote($1))) # when /^(\$?(\.?[^.]+)+)\.([^.]*)$/ when /^((\.?[^.]+)+)\.([^.]*)$/ @@ -402,44 +406,38 @@ def get_completions(base) vartype = VIM::evaluate("GetRubyVarType('%s')" % receiver) if vartype != '' - load_buffer_class( vartype ) + load_buffer_class( vartype ) - begin - candidates = eval("#{vartype}.instance_methods") - rescue Exception - candidates = [] - end + begin + candidates = eval("#{vartype}.instance_methods") + rescue Exception + candidates = [] + end elsif (cv).include?(receiver) - # foo.func and foo is local var. - candidates = eval("#{receiver}.methods") + # foo.func and foo is local var. + candidates = eval("#{receiver}.methods") elsif /^[A-Z]/ =~ receiver and /\./ !~ receiver - # Foo::Bar.func - begin - candidates = eval("#{receiver}.methods") - rescue Exception - candidates = [] - end + # Foo::Bar.func + begin + candidates = eval("#{receiver}.methods") + rescue Exception + candidates = [] + end else - # func1.func2 - candidates = [] - ObjectSpace.each_object(Module){|m| - next if m.name != "IRB::Context" and - /^(IRB|SLex|RubyLex|RubyToken)/ =~ m.name - candidates.concat m.instance_methods(false) - } - candidates.sort! - candidates.uniq! + # func1.func2 + candidates = [] + ObjectSpace.each_object(Module){|m| + next if m.name != "IRB::Context" and + /^(IRB|SLex|RubyLex|RubyToken)/ =~ m.name + candidates.concat m.instance_methods(false) + } + candidates.sort! + candidates.uniq! end - #identify_type( receiver ) select_message(receiver, message, candidates) - #when /^((\.?[^.]+)+)\.([^.]*)\(\s*\)*$/ - #function call - #obj = $1 - #func = $3 - when /^\.([^.]*)$/ - # unknown(maybe String) + # unknown(maybe String) receiver = "" message = Regexp.quote($1) @@ -455,16 +453,16 @@ def get_completions(base) found = /^\s*class\s*([A-Za-z0-9_-]*)(\s*<\s*([A-Za-z0-9_:-]*))?\s*\n$/.match( classdef ) if found != nil - receiver = $1 - message = input - load_buffer_class( receiver ) - begin - candidates = eval( "#{receiver}.instance_methods" ) - candidates += get_rails_helpers - select_message(receiver, message, candidates) - rescue Exception - found = nil - end + receiver = $1 + message = input + load_buffer_class( receiver ) + begin + candidates = eval( "#{receiver}.instance_methods" ) + candidates += get_rails_helpers + select_message(receiver, message, candidates) + rescue Exception + found = nil + end end end @@ -481,8 +479,8 @@ def get_completions(base) if message != nil && message.length > 0 rexp = '^%s' % message.downcase candidates.delete_if do |c| - c.downcase.match( rexp ) - $~ == nil + c.downcase.match( rexp ) + $~ == nil end end @@ -510,10 +508,10 @@ def select_message(receiver, message, candidates) candidates.grep(/^#{message}/).collect do |e| case e when /^[a-zA-Z_]/ - receiver + "." + e + receiver + "." + e when /^[0-9]/ when *Operators - #receiver + " " + e + #receiver + " " + e end end candidates.delete_if { |x| x == nil } @@ -528,5 +526,4 @@ endfunction let g:rubycomplete_rails_loaded = 0 call s:DefRuby() - -" vim:tw=78:sw=4:ts=8:ft=vim:norl: +" vim:tw=78:sw=4:ts=8:et=1:ft=vim:norl: From e348ffe491d6c745ccde5bb9a78f6a753a73229f Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Tue, 25 Apr 2006 15:55:26 +0000 Subject: [PATCH 264/411] started stripping out preceding assigment operation stuff. "x = A", would attempt to complete A using the global list. I've started removing old/commented code in an effort to slim down the file --- ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index 19440e94..a298ede6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-04-25 Mark Guzman + * autoload/rubycomplete.vim: started stripping out preceding + assigment operation stuff. "x = A", would attempt to complete + A using the global list. I've started removing old/commented + code in an effort to slim down the file. + 2006-04-25 Doug Kearns * autoload/rubycomplete.vim: remove excess whitespace From cd635fcb94f3eb58d08846479ee49552ab1ec592 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 26 Apr 2006 07:22:56 +0000 Subject: [PATCH 265/411] set 'expandtab' properly in rubycomplete.vim --- ChangeLog | 5 +++++ autoload/rubycomplete.vim | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a298ede6..1e397433 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,9 @@ +2006-04-26 Doug Kearns + + * autoload/rubycomplete.vim: set 'expandtab' properly + 2006-04-25 Mark Guzman + * autoload/rubycomplete.vim: started stripping out preceding assigment operation stuff. "x = A", would attempt to complete A using the global list. I've started removing old/commented diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 6e496f40..0fb12e85 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.18 2006/04/25 15:47:39 segy Exp $ +" Info: $Id: rubycomplete.vim,v 1.19 2006/04/26 07:22:56 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -526,4 +526,4 @@ endfunction let g:rubycomplete_rails_loaded = 0 call s:DefRuby() -" vim:tw=78:sw=4:ts=8:et=1:ft=vim:norl: +" vim:tw=78:sw=4:ts=8:et:ft=vim:norl: From 42123f6b1c60569dd857a9756563a3eda9b8f40d Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Wed, 26 Apr 2006 14:37:11 +0000 Subject: [PATCH 266/411] removed cWORD expansion in favor of grabbing the whole line added support for completing variables inside operations and parameter lists removed excess cruft code removed commented code --- ChangeLog | 6 ++ autoload/rubycomplete.vim | 122 +++++++++++--------------------------- 2 files changed, 40 insertions(+), 88 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1e397433..12a14563 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-04-26 Mark Guzman + * autoload/rubycomplete.vim: removed cWORD expansion in favor of + grabbing the whole line. added support for completing variables + inside operations and parameter lists. removed excess cruft code. + removed commented code. + 2006-04-26 Doug Kearns * autoload/rubycomplete.vim: set 'expandtab' properly diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 0fb12e85..8fe6772e 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.19 2006/04/26 07:22:56 dkearns Exp $ +" Info: $Id: rubycomplete.vim,v 1.20 2006/04/26 14:37:11 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -301,68 +301,55 @@ def get_completions(base) load_requires load_rails - input = VIM::evaluate('expand("")') + input = VIM::Buffer.current.line + cpos = VIM::Window.current.cursor[1] - 1 + input = input[0..cpos] if cpos != 0 input += base - input.lstrip! - if (input.length == 0) || (input == base) - input = VIM::Buffer.current.line - input += base - if /^.*=\s*(.*)/.match(input) != nil - input = $1 - end - input.strip! + + rip = input.rindex(/\s*/) + if rip && rip != input.length + input = input[rip..input.length] + end + + if /^.*(\+|\-|\*|=|\(|\[)=?(\s*[A-Za-z0-9_:@.-]*)(\s*(\{|\+|\-|\*|\%|\/)?\s*).*/.match(input) + input = $2 end + + input.strip! message = nil + receiver = nil + candidates = [] case input - when /^(\/[^\/]*\/)\.([^.]*)$/ - # Regexp + when /^(\/[^\/]*\/)\.([^.]*)$/ # Regexp receiver = $1 message = Regexp.quote($2) - candidates = Regexp.instance_methods(true) - select_message(receiver, message, candidates) - when /^([^\]]*\])\.([^.]*)$/ - # Array + when /^([^\]]*\])\.([^.]*)$/ # Array receiver = $1 message = Regexp.quote($2) - candidates = Array.instance_methods(true) - select_message(receiver, message, candidates) - when /^([^\}]*\})\.([^.]*)$/ - # Proc or Hash + when /^([^\}]*\})\.([^.]*)$/ # Proc or Hash receiver = $1 message = Regexp.quote($2) - candidates = Proc.instance_methods(true) | Hash.instance_methods(true) - select_message(receiver, message, candidates) - when /^(:[^:.]*)$/ - # Symbol + when /^(:[^:.]*)$/ # Symbol if Symbol.respond_to?(:all_symbols) - sym = $1 + receiver = $1 candidates = Symbol.all_symbols.collect{|s| ":" + s.id2name} - candidates.grep(/^#{sym}/) - candidates.delete_if do |c| - c.match( /'/ ) - end - candidates.uniq! - candidates.sort! - else - [] + candidates.delete_if { |c| c.match( /'/ ) } end - when /^::([A-Z][^:\.\(]*)$/ - # Absolute Constant or class methods + when /^::([A-Z][^:\.\(]*)$/ # Absolute Constant or class methods receiver = $1 candidates = Object.constants candidates.grep(/^#{receiver}/).collect{|e| "::" + e} - when /^(((::)?[A-Z][^:.\(]*)+)::?([^:.]*)$/ - # Constant or class methods + when /^(((::)?[A-Z][^:.\(]*)+)::?([^:.]*)$/ # Constant or class methods receiver = $1 message = Regexp.quote($4) begin @@ -372,16 +359,12 @@ def get_completions(base) end candidates.grep(/^#{message}/).collect{|e| receiver + "::" + e} - when /^(:[^:.]+)\.([^.]*)$/ - # Symbol + when /^(:[^:.]+)\.([^.]*)$/ # Symbol receiver = $1 message = Regexp.quote($2) - candidates = Symbol.instance_methods(true) - select_message(receiver, message, candidates) - when /^([0-9_]+(\.[0-9_]+)?(e[0-9]+)?)\.([^.]*)$/ - # Numeric + when /^([0-9_]+(\.[0-9_]+)?(e[0-9]+)?)\.([^.]*)$/ # Numeric receiver = $1 message = Regexp.quote($4) @@ -390,14 +373,11 @@ def get_completions(base) rescue Exception candidates end - select_message(receiver, message, candidates) - when /^(\$[^.]*)$/ + when /^(\$[^.]*)$/ #global candidates = global_variables.grep(Regexp.new(Regexp.quote($1))) -# when /^(\$?(\.?[^.]+)+)\.([^.]*)$/ - when /^((\.?[^.]+)+)\.([^.]*)$/ - # variable + when /^((\.?[^.]+)+)\.([^.]*)$/ # variable receiver = $1 message = Regexp.quote($3) load_buffer_class( receiver ) @@ -431,19 +411,12 @@ def get_completions(base) /^(IRB|SLex|RubyLex|RubyToken)/ =~ m.name candidates.concat m.instance_methods(false) } - candidates.sort! - candidates.uniq! end - select_message(receiver, message, candidates) - - when /^\.([^.]*)$/ - # unknown(maybe String) + when /^\.([^.]*)$/ # unknown(maybe String) receiver = "" message = Regexp.quote($1) - candidates = String.instance_methods(true) - select_message(receiver, message, candidates) else inclass = eval( VIM::evaluate("IsInClassDef()") ) @@ -459,7 +432,6 @@ def get_completions(base) begin candidates = eval( "#{receiver}.instance_methods" ) candidates += get_rails_helpers - select_message(receiver, message, candidates) rescue Exception found = nil end @@ -469,24 +441,16 @@ def get_completions(base) if inclass == nil || found == nil candidates = eval("self.class.constants") candidates += get_buffer_classes - candidates.uniq! - candidates.sort! - candidates = candidates.grep(/^#{Regexp.quote(input)}/) + message = receiver = input end end - #print candidates - if message != nil && message.length > 0 - rexp = '^%s' % message.downcase - candidates.delete_if do |c| - c.downcase.match( rexp ) - $~ == nil - end - end + candidates.delete_if { |x| x == nil } + candidates.uniq! + candidates.sort! + candidates = candidates.grep(/^#{Regexp.quote(message)}/) if message != nil outp = "" - - # tags = VIM::evaluate("taglist('^%s$')" % valid = (candidates-Object.instance_methods) rg = 0..valid.length @@ -501,24 +465,6 @@ def get_completions(base) end end - -def select_message(receiver, message, candidates) - #tags = VIM::evaluate("taglist('%s')" % receiver) - #print tags - candidates.grep(/^#{message}/).collect do |e| - case e - when /^[a-zA-Z_]/ - receiver + "." + e - when /^[0-9]/ - when *Operators - #receiver + " " + e - end - end - candidates.delete_if { |x| x == nil } - candidates.uniq! - candidates.sort! -end - # }}} ruby completion RUBYEOF endfunction From b5bfd0af7caf094cf10a99afdd815dc0c53274ec Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Wed, 26 Apr 2006 15:54:27 +0000 Subject: [PATCH 267/411] fixed the truncation code. this fixes f.chomp! returning chomp! again, where it should provide the global list. It also fixes f.foo( a.B, b. returning a's list when it should return b's. --- ChangeLog | 7 ++++++- autoload/rubycomplete.vim | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 12a14563..e164d12e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,7 +2,12 @@ * autoload/rubycomplete.vim: removed cWORD expansion in favor of grabbing the whole line. added support for completing variables inside operations and parameter lists. removed excess cruft code. - removed commented code. + removed commented code. + + * autoload/rubycomplete.vim: fixed the truncation code. this fixes + f.chomp! returning chomp! again, where it should provide + the global list. It also fixes f.foo( a.B, b. returning a's + list when it should return b's. 2006-04-26 Doug Kearns diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 8fe6772e..11d8aade 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.20 2006/04/26 14:37:11 segy Exp $ +" Info: $Id: rubycomplete.vim,v 1.21 2006/04/26 15:54:27 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -306,8 +306,8 @@ def get_completions(base) input = input[0..cpos] if cpos != 0 input += base - rip = input.rindex(/\s*/) - if rip && rip != input.length + rip = input.rindex(/\s/,cpos) + if rip input = input[rip..input.length] end From dcd021d6778d7d6b05a5f64abdb00655f9425793 Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Thu, 27 Apr 2006 16:23:40 +0000 Subject: [PATCH 268/411] added variable type detection for Ranges added handlers for string completion: "test". --- autoload/rubycomplete.vim | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 11d8aade..2c20cf5d 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.21 2006/04/26 15:54:27 segy Exp $ +" Info: $Id: rubycomplete.vim,v 1.22 2006/04/27 16:23:40 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -96,9 +96,9 @@ function! GetRubyVarType(v) let ctors = '\(now\|new\|open\|get_instance\)' endif - let [lnum,lcol] = searchpos(''.a:v.'\>\s*[+\-*/]*=\s*\([^ \t]\+.' . ctors .'\>\|[\[{"''/]\|%r{\)','nb',stopline) + let [lnum,lcol] = searchpos(''.a:v.'\>\s*[+\-*/]*=\s*\([^ \t]\+.' . ctors .'\>\|[\[{"''/]\|%r{\|[A-Za-z0-9@:\-()]\+...\?\)','nb',stopline) if lnum != 0 && lcol != 0 - let str = matchstr(getline(lnum),'=\s*\([^ \t]\+.' . ctors . '\>\|[\[{"''/]\|%r{\)',lcol) + let str = matchstr(getline(lnum),'=\s*\([^ \t]\+.' . ctors . '\>\|[\[{"''/]\|%r{\|[A-Za-z0-9@:\-()]\+...\?\)',lcol) let str = substitute(str,'^=\s*','','') call setpos('.',pos) if str == '"' || str == '''' @@ -109,6 +109,8 @@ function! GetRubyVarType(v) return 'Hash' elseif str == '/' || str == '%r{' return 'Regexp' + elseif strlen(str) >= 4 && stridx(str,'..') != -1 + return 'Range' elseif strlen(str) > 4 let l = stridx(str,'.') return str[0:l-1] @@ -217,7 +219,7 @@ def load_buffer_module(name) end def get_buffer_entity(name, vimfun) - return nil if name == '""' + return nil if /(\"|\')+/.match( name ) buf = VIM::Buffer.current nums = eval( VIM::evaluate( vimfun % name ) ) return nil if nums == nil @@ -235,6 +237,14 @@ def get_buffer_entity(name, vimfun) return classdef end +def get_var_type( receiver ) + if /(\"|\')+/.match( receiver ) + "String" + else + VIM::evaluate("GetRubyVarType('%s')" % receiver) + end +end + def get_buffer_classes() # this will be a little expensive. allow_aggressive_load = VIM::evaluate('g:rubycomplete_classes_in_global') @@ -383,8 +393,8 @@ def get_completions(base) load_buffer_class( receiver ) cv = eval("self.class.constants") - - vartype = VIM::evaluate("GetRubyVarType('%s')" % receiver) + vartype = get_var_type( receiver ) + print "vartype: %s receiver: %s" % [ vartype, receiver ] if vartype != '' load_buffer_class( vartype ) From 70014ec4f58359b5ad442e4c92fbb1f1438834ab Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Thu, 27 Apr 2006 18:24:42 +0000 Subject: [PATCH 269/411] added variable type detection for Ranges added handlers for string completion: "test". --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index e164d12e..274b4a0f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-04-27 Mark Guzman + * autoload/rubycomplete.vim: added variable type detection for + Ranges. added handlers for string completion: "test". + 2006-04-26 Mark Guzman * autoload/rubycomplete.vim: removed cWORD expansion in favor of grabbing the whole line. added support for completing variables From fe332001a390602af331954616e45259cb6978f2 Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Fri, 28 Apr 2006 16:57:48 +0000 Subject: [PATCH 270/411] started adding raw range support 1..2. fixed the symbol completion bug, where you would end up with a double colon --- autoload/rubycomplete.vim | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 2c20cf5d..f1459151 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.22 2006/04/27 16:23:40 segy Exp $ +" Info: $Id: rubycomplete.vim,v 1.23 2006/04/28 16:57:48 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -321,7 +321,8 @@ def get_completions(base) input = input[rip..input.length] end - if /^.*(\+|\-|\*|=|\(|\[)=?(\s*[A-Za-z0-9_:@.-]*)(\s*(\{|\+|\-|\*|\%|\/)?\s*).*/.match(input) + asn = /^.*(\+|\-|\*|=|\(|\[)=?(\s*[A-Za-z0-9_:@.-]*)(\s*(\{|\+|\-|\*|\%|\/)?\s*).*/ + if asn.match(input) input = $2 end @@ -330,7 +331,6 @@ def get_completions(base) receiver = nil candidates = [] - case input when /^(\/[^\/]*\/)\.([^.]*)$/ # Regexp receiver = $1 @@ -350,7 +350,7 @@ def get_completions(base) when /^(:[^:.]*)$/ # Symbol if Symbol.respond_to?(:all_symbols) receiver = $1 - candidates = Symbol.all_symbols.collect{|s| ":" + s.id2name} + candidates = Symbol.all_symbols.collect{|s| s.id2name} candidates.delete_if { |c| c.match( /'/ ) } end @@ -377,7 +377,6 @@ def get_completions(base) when /^([0-9_]+(\.[0-9_]+)?(e[0-9]+)?)\.([^.]*)$/ # Numeric receiver = $1 message = Regexp.quote($4) - begin candidates = eval(receiver).methods rescue Exception @@ -394,7 +393,6 @@ def get_completions(base) cv = eval("self.class.constants") vartype = get_var_type( receiver ) - print "vartype: %s receiver: %s" % [ vartype, receiver ] if vartype != '' load_buffer_class( vartype ) @@ -423,8 +421,15 @@ def get_completions(base) } end + when /^\(?\s*[A-Za-z0-9:^@.%\/+*\(\)]+\.\.\.?[A-Za-z0-9:^@.%\/+*\(\)]+\s*\)?\.([^.]*)/ + message = $1 + candidates = Range.instance_methods(true) + + when /^\[(\s*[A-Za-z0-9:^@.%\/+*\(\)\[\]\{\}.\'\"],?)*\].([^.]*)/ + message = $2 + candidates = Array.instance_methods(true) + when /^\.([^.]*)$/ # unknown(maybe String) - receiver = "" message = Regexp.quote($1) candidates = String.instance_methods(true) From ec281e5c6167429b5a5ef8e632f28f5918a7b315 Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Fri, 28 Apr 2006 17:04:28 +0000 Subject: [PATCH 271/411] started adding raw range support 1..2. fixed the symbol completion bug, where you would end up with a double colon --- ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index 274b4a0f..55a782c9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-04-28 Mark Guzman + * autoload/rubycomplete.vim: started adding raw range support + 1..2.. fixed the symbol completion bug, where you + would end up with a double colon. + 2006-04-27 Mark Guzman * autoload/rubycomplete.vim: added variable type detection for Ranges. added handlers for string completion: "test". From 3b2abe2ce16b9d94350d4987765d701a87869bc1 Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Tue, 2 May 2006 03:32:11 +0000 Subject: [PATCH 272/411] Added error trapping and messages for class import errors --- ChangeLog | 4 ++++ autoload/rubycomplete.vim | 14 +++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 55a782c9..960515d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-05-01 Mark Guzman + * autoload/rubycomplete.vim: Added error trapping and messages + for class import errors + 2006-04-28 Mark Guzman * autoload/rubycomplete.vim: started adding raw range support 1..2.. fixed the symbol completion bug, where you diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index f1459151..60a22913 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.23 2006/04/28 16:57:48 segy Exp $ +" Info: $Id: rubycomplete.vim,v 1.24 2006/05/02 03:32:11 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -208,14 +208,22 @@ def load_buffer_class(name) mixre = /.*\n\s*include\s*(.*)\s*\n/.match( classdef ) load_buffer_module( $2 ) if mixre != nil - eval classdef + begin + eval classdef + rescue + print "Problem loading class '%s', was it already completed?" % name + end end def load_buffer_module(name) classdef = get_buffer_entity(name, 'GetBufferRubyModule("%s")') return if classdef == nil - eval classdef + begin + eval classdef + rescue + print "Problem loading module '%s', was it already completed?" % name + end end def get_buffer_entity(name, vimfun) From 9c76e64212f1f2aa64323f4bff693bffa49b887d Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 5 May 2006 07:14:42 +0000 Subject: [PATCH 273/411] add patterns for braces, brackets and parentheses to b:match_words --- ChangeLog | 9 +++++++++ ftplugin/ruby.vim | 5 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 960515d0..c8ec7812 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,17 +1,26 @@ +2006-05-03 Doug Kearns + + * ftplugin/ruby.vim: add patterns for braces, brackets and parentheses + to b:match_words + 2006-05-01 Mark Guzman + * autoload/rubycomplete.vim: Added error trapping and messages for class import errors 2006-04-28 Mark Guzman + * autoload/rubycomplete.vim: started adding raw range support 1..2.. fixed the symbol completion bug, where you would end up with a double colon. 2006-04-27 Mark Guzman + * autoload/rubycomplete.vim: added variable type detection for Ranges. added handlers for string completion: "test". 2006-04-26 Mark Guzman + * autoload/rubycomplete.vim: removed cWORD expansion in favor of grabbing the whole line. added support for completing variables inside operations and parameter lists. removed excess cruft code. diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index 6389bccd..e14e5a64 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.21 2006/04/19 05:50:12 gsinclair Exp $ +" Info: $Id: ruby.vim,v 1.22 2006/05/05 07:14:42 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -38,7 +38,8 @@ if exists("loaded_matchit") && !exists("b:match_words") \ '\%(\%(^\|;\)\s*\)\@<=\' . \ '\)' . \ ':' . - \ '\%(\%(\.\|\:\:\)\s*\|\:\)\@' + \ '\%(\%(\.\|\:\:\)\s*\|\:\)\@' . + \ ',{:},\[:\],(:)' let b:match_skip = \ "synIDattr(synID(line('.'),col('.'),0),'name') =~ '" . From 0f683dbe276e032a2409383c8cf6bfacc87f262b Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sun, 7 May 2006 07:48:11 +0000 Subject: [PATCH 274/411] set 'foldmethod' to marker in the modeline of completion script --- ChangeLog | 5 +++++ autoload/rubycomplete.vim | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c8ec7812..87427cb6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-05-07 Doug Kearns + + * autoload/rubycomplete.vim: set 'foldmethod' to marker in the + modeline + 2006-05-03 Doug Kearns * ftplugin/ruby.vim: add patterns for braces, brackets and parentheses diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 60a22913..d195ad0d 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.24 2006/05/02 03:32:11 segy Exp $ +" Info: $Id: rubycomplete.vim,v 1.25 2006/05/07 07:48:11 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -495,4 +495,4 @@ endfunction let g:rubycomplete_rails_loaded = 0 call s:DefRuby() -" vim:tw=78:sw=4:ts=8:et:ft=vim:norl: +" vim:tw=78:sw=4:ts=8:et:fdm=marker:ft=vim:norl: From 2dfdc6b7f644c73bc42648298196a06e919116ad Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Sun, 7 May 2006 20:30:02 +0000 Subject: [PATCH 275/411] Switched to script local vars, per patch from dkearns --- autoload/rubycomplete.vim | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index d195ad0d..dffdeda8 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.25 2006/05/07 07:48:11 dkearns Exp $ +" Info: $Id: rubycomplete.vim,v 1.26 2006/05/07 20:30:02 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -35,20 +35,20 @@ if !exists("g:rubycomplete_classes_in_global") endif " {{{ vim-side support functions -function! GetBufferRubyModule(name) - let [snum,enum] = GetBufferRubyEntity(a:name, "module") +function! s:GetBufferRubyModule(name) + let [snum,enum] = s:GetBufferRubyEntity(a:name, "module") return snum . '..' . enum endfunction -function! GetBufferRubyClass(name) - let [snum,enum] = GetBufferRubyEntity(a:name, "class") +function! s:GetBufferRubyClass(name) + let [snum,enum] = s:GetBufferRubyEntity(a:name, "class") return snum . '..' . enum endfunction -function! GetBufferRubySingletonMethods(name) +function! s:GetBufferRubySingletonMethods(name) endfunction -function! GetBufferRubyEntity( name, type ) +function! s:GetBufferRubyEntity( name, type ) let stopline = 1 let crex = '^\s*' . a:type . '\s*' . a:name . '\s*\(<\s*.*\s*\)\?\n*\(\(\s\|#\).*\n*\)*\n*\s*end$' let [lnum,lcol] = searchpos( crex, 'nbw') @@ -66,8 +66,8 @@ function! GetBufferRubyEntity( name, type ) return [lnum,enum] endfunction -function! IsInClassDef() - let [snum,enum] = GetBufferRubyEntity( '.*', "class" ) +function! s:IsInClassDef() + let [snum,enum] = s:GetBufferRubyEntity( '.*', "class" ) let ret = 'nil' let pos = line('.') @@ -78,7 +78,7 @@ function! IsInClassDef() return ret endfunction -function! GetRubyVarType(v) +function! s:GetRubyVarType(v) let stopline = 1 let vtp = '' let pos = getpos('.') @@ -90,7 +90,7 @@ function! GetRubyVarType(v) return vtp endif call setpos('.',pos) - if g:rubycomplete_rails == 1 && g:rubycomplete_rails_loaded == 1 + if g:rubycomplete_rails == 1 && s:rubycomplete_rails_loaded == 1 let ctors = '\(now\|new\|open\|get_instance\|find\|create\)' else let ctors = '\(now\|new\|open\|get_instance\)' @@ -199,7 +199,7 @@ def load_requires end def load_buffer_class(name) - classdef = get_buffer_entity(name, 'GetBufferRubyClass("%s")') + classdef = get_buffer_entity(name, 's:GetBufferRubyClass("%s")') return if classdef == nil pare = /^\s*class\s*(.*)\s*<\s*(.*)\s*\n/.match( classdef ) @@ -216,7 +216,7 @@ def load_buffer_class(name) end def load_buffer_module(name) - classdef = get_buffer_entity(name, 'GetBufferRubyModule("%s")') + classdef = get_buffer_entity(name, 's:GetBufferRubyModule("%s")') return if classdef == nil begin @@ -249,7 +249,7 @@ def get_var_type( receiver ) if /(\"|\')+/.match( receiver ) "String" else - VIM::evaluate("GetRubyVarType('%s')" % receiver) + VIM::evaluate("s:GetRubyVarType('%s')" % receiver) end end @@ -301,7 +301,7 @@ def load_rails() require envfile require 'console_app' require 'console_with_helpers' - VIM::command('let g:rubycomplete_rails_loaded = 1') + VIM::command('let s:rubycomplete_rails_loaded = 1') rescue print "Error loading rails environment" end @@ -310,7 +310,7 @@ end def get_rails_helpers allow_rails = VIM::evaluate('g:rubycomplete_rails') - rails_loaded = VIM::evaluate('g:rubycomplete_rails_loaded') + rails_loaded = VIM::evaluate('s:rubycomplete_rails_loaded') return [] if allow_rails != '1' || rails_loaded != '1' return RailsWords end @@ -442,7 +442,7 @@ def get_completions(base) candidates = String.instance_methods(true) else - inclass = eval( VIM::evaluate("IsInClassDef()") ) + inclass = eval( VIM::evaluate("s:IsInClassDef()") ) if inclass != nil classdef = "%s\n" % VIM::Buffer.current[ inclass.min ] @@ -492,7 +492,7 @@ end RUBYEOF endfunction -let g:rubycomplete_rails_loaded = 0 +let s:rubycomplete_rails_loaded = 0 call s:DefRuby() " vim:tw=78:sw=4:ts=8:et:fdm=marker:ft=vim:norl: From 98691f82c89c13d6c81c4fa521d339fe91ac484f Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Sun, 7 May 2006 20:58:32 +0000 Subject: [PATCH 276/411] removed secondary array clause --- autoload/rubycomplete.vim | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index dffdeda8..14cf4469 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.26 2006/05/07 20:30:02 segy Exp $ +" Info: $Id: rubycomplete.vim,v 1.27 2006/05/07 20:58:32 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -433,10 +433,6 @@ def get_completions(base) message = $1 candidates = Range.instance_methods(true) - when /^\[(\s*[A-Za-z0-9:^@.%\/+*\(\)\[\]\{\}.\'\"],?)*\].([^.]*)/ - message = $2 - candidates = Array.instance_methods(true) - when /^\.([^.]*)$/ # unknown(maybe String) message = Regexp.quote($1) candidates = String.instance_methods(true) From 6655902983a1c487683f4bd5dd81544afda5c517 Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Sun, 7 May 2006 21:04:09 +0000 Subject: [PATCH 277/411] applied patch provided by dkearns, fixes input handling --- autoload/rubycomplete.vim | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 14cf4469..5ab5e858 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.27 2006/05/07 20:58:32 segy Exp $ +" Info: $Id: rubycomplete.vim,v 1.28 2006/05/07 21:04:09 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -321,20 +321,10 @@ def get_completions(base) input = VIM::Buffer.current.line cpos = VIM::Window.current.cursor[1] - 1 - input = input[0..cpos] if cpos != 0 + input = input[0..cpos] input += base + input = input.sub(/.*[ \t\n\"\\'`><=;|&{(]/, '') # Readline.basic_word_break_characters - rip = input.rindex(/\s/,cpos) - if rip - input = input[rip..input.length] - end - - asn = /^.*(\+|\-|\*|=|\(|\[)=?(\s*[A-Za-z0-9_:@.-]*)(\s*(\{|\+|\-|\*|\%|\/)?\s*).*/ - if asn.match(input) - input = $2 - end - - input.strip! message = nil receiver = nil candidates = [] From aa4c7e6cb4c1316b7b529d2c833b2abd9ba7b9d0 Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Sun, 7 May 2006 21:06:01 +0000 Subject: [PATCH 278/411] Switched to script local vars, per patch from dkearns removed secondary array clause applied patch provided by dkearns, fixes input handling --- ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index 87427cb6..bab30a5d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-05-07 Mark Guzman + * autoload/rubycomplete.vim: Switched to script local vars, + per patch from dkearns. removed secondary array clause. applied + patch provided by dkearns, fixes input handling. + 2006-05-07 Doug Kearns * autoload/rubycomplete.vim: set 'foldmethod' to marker in the From d95331773ec3975dd3ba7cd60648c45525d8244c Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Mon, 8 May 2006 06:53:23 +0000 Subject: [PATCH 279/411] if/unless immediately following a method name should always be highlighted as modifiers and not the beginning of an expression --- ChangeLog | 7 +++++++ syntax/ruby.vim | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index bab30a5d..9c824e7d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,11 @@ +2006-05-08 Doug Kearns + + * syntax/ruby.vim: if/unless immediately following a method name + should always be highlighted as modifiers and not the beginning of an + expression + 2006-05-07 Mark Guzman + * autoload/rubycomplete.vim: Switched to script local vars, per patch from dkearns. removed secondary array clause. applied patch provided by dkearns, fixes input handling. diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 0a48f293..d40e32ed 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.84 2006/04/15 12:01:18 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.85 2006/05/08 06:53:23 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -158,7 +158,7 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") syn region rubyCurlyBlock start="{" end="}" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold " statements without *do* - syn region rubyNoDoBlock matchgroup=rubyControl start="\<\%(case\|begin\)\>" start="\%(^\|\.\.\.\=\|[,;=([<>~\*/%!&^|+-]\)\s*\zs\%(if\|unless\)\>" end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold + syn region rubyNoDoBlock matchgroup=rubyControl start="\<\%(case\|begin\)\>" start="\%(^\|\.\.\.\=\|[,;=([<>~\*/%!&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold " statement with optional *do* syn region rubyOptDoLine matchgroup=rubyControl start="\" start="\%(\%(^\|\.\.\.\=\|[?:,;=([<>~\*/%!&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\%(\\|:\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo From e18ac657b9333fad3f648f45f2f9a4a2056a0ad1 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Mon, 8 May 2006 11:07:59 +0000 Subject: [PATCH 280/411] add initial support for highlighting 'operators' --- ChangeLog | 4 ++++ syntax/ruby.vim | 13 +++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9c824e7d..3d66feb8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2006-05-08 Doug Kearns + * syntax/ruby.vim: add initial support for highlighting 'operators'. + This is off by default and enabled by defining the ruby_operators + variable + * syntax/ruby.vim: if/unless immediately following a method name should always be highlighted as modifiers and not the beginning of an expression diff --git a/syntax/ruby.vim b/syntax/ruby.vim index d40e32ed..2705f0eb 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.85 2006/05/08 06:53:23 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.86 2006/05/08 11:07:59 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -32,6 +32,11 @@ if exists("ruby_space_errors") endif endif +if exists("ruby_operators") + syn match rubyOperator "\%(\^\|\~\|\%(class\s*\)\@\|<=\|\%(<\|\>\|>=\|>\||\|-\|/\|\*\*\|\*\|&\|%\|+\)" + syn region rubyBracketOperator matchgroup=rubyOperator start="\%([_[:lower:]]\w*[?!=]\=\|}\)\@<=\[\s*" end="\s*]" +endif + " Expression Substitution and Backslash Notation syn match rubyEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display syn match rubyEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display @@ -71,7 +76,11 @@ syn match rubySymbol ":\@\|<=\|<\|===\|==\|=\~\|>>\|>=\| syn match rubySymbol ":\@_,;:!?/.'"@$*\&+0]\)" syn match rubySymbol ":\@\|{\)\s*\)\@<=|\s*\zs[( ,a-zA-Z0-9_*)]\+\ze\s*|" display +if exists("ruby_operators") + syn match rubyBlockParameter "\%(\%(\%(\\|{\)\s*\)|\s*\)\@<=[( ,a-zA-Z0-9_*)]\+\%(\s*|\)\@=" display +else + syn match rubyBlockParameter "\%(\%(\\|{\)\s*\)\@<=|\s*\zs[( ,a-zA-Z0-9_*)]\+\ze\s*|" display +endif syn match rubyPredefinedVariable #$[!$&"'*+,./0:;<=>?@\`~1-9]# syn match rubyPredefinedVariable "$_\>" display From 40efc93b4ceb839da0a2cb0c7f91d010c852c2ae Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Mon, 8 May 2006 15:25:57 +0000 Subject: [PATCH 281/411] simplify rubyNoDoBlock, rubyOptDoLine match patterns --- ChangeLog | 3 +++ syntax/ruby.vim | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3d66feb8..feafc9bc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2006-05-08 Doug Kearns + * syntax/ruby.vim: simplify rubyNoDoBlock, rubyOptDoLine match + patterns + * syntax/ruby.vim: add initial support for highlighting 'operators'. This is off by default and enabled by defining the ruby_operators variable diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 2705f0eb..d9a2961e 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.86 2006/05/08 11:07:59 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.87 2006/05/08 15:25:57 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -167,10 +167,10 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") syn region rubyCurlyBlock start="{" end="}" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold " statements without *do* - syn region rubyNoDoBlock matchgroup=rubyControl start="\<\%(case\|begin\)\>" start="\%(^\|\.\.\.\=\|[,;=([<>~\*/%!&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold + syn region rubyNoDoBlock matchgroup=rubyControl start="\<\%(case\|begin\)\>" start="\%(^\|\.\.\.\=\|[,;=([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold " statement with optional *do* - syn region rubyOptDoLine matchgroup=rubyControl start="\" start="\%(\%(^\|\.\.\.\=\|[?:,;=([<>~\*/%!&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\%(\\|:\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo + syn region rubyOptDoLine matchgroup=rubyControl start="\" start="\%(\%(^\|\.\.\.\=\|[?:,;=([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\%(\\|:\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo syn region rubyOptDoBlock start="\" start="\%(\%(^\|\.\.\.\=\|[:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" matchgroup=rubyControl end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo nextgroup=rubyOptDoLine fold if !exists("ruby_minlines") From 052e293b99cf0ea14f961d3b71ed91fa65deafc2 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 9 May 2006 11:12:01 +0000 Subject: [PATCH 282/411] add rubyMultiLineComment syntax group to allow folding of comment blocks --- ChangeLog | 5 +++++ syntax/ruby.vim | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index feafc9bc..cd543b14 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-05-09 Doug Kearns + + * syntax/ruby.vim: add rubyMultiLineComment syntax group to allow + folding of comment blocks + 2006-05-08 Doug Kearns * syntax/ruby.vim: simplify rubyNoDoBlock, rubyOptDoLine match diff --git a/syntax/ruby.vim b/syntax/ruby.vim index d9a2961e..f916620c 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.87 2006/05/08 15:25:57 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.88 2006/05/09 11:12:02 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -211,6 +211,7 @@ endif syn match rubySharpBang "\%^#!.*" display syn keyword rubyTodo FIXME NOTE TODO XXX contained syn match rubyComment "#.*" contains=rubySharpBang,rubySpaceError,rubyTodo,@Spell +syn match rubyMultiLineComment "\(^\s*#.*\n\)\{2,}" contains=rubyComment transparent fold syn region rubyDocumentation start="^=begin" end="^=end.*$" contains=rubySpaceError,rubyTodo,@Spell fold " Note: this is a hack to prevent 'keywords' being highlighted as such when called as methods with an explicit receiver From b82ecc132314f7e72739f89c3c382dd49a0ff3fc Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 9 May 2006 11:39:41 +0000 Subject: [PATCH 283/411] make folding of comments configurable via the ruby_no_comment_fold variable --- ChangeLog | 3 +++ syntax/ruby.vim | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index cd543b14..27bfea9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2006-05-09 Doug Kearns + * syntax/ruby.vim: make folding of comments configurable via the + ruby_no_comment_fold variable + * syntax/ruby.vim: add rubyMultiLineComment syntax group to allow folding of comment blocks diff --git a/syntax/ruby.vim b/syntax/ruby.vim index f916620c..2777eabf 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.88 2006/05/09 11:12:02 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.89 2006/05/09 11:39:41 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -211,8 +211,10 @@ endif syn match rubySharpBang "\%^#!.*" display syn keyword rubyTodo FIXME NOTE TODO XXX contained syn match rubyComment "#.*" contains=rubySharpBang,rubySpaceError,rubyTodo,@Spell -syn match rubyMultiLineComment "\(^\s*#.*\n\)\{2,}" contains=rubyComment transparent fold -syn region rubyDocumentation start="^=begin" end="^=end.*$" contains=rubySpaceError,rubyTodo,@Spell fold +if !exists("ruby_no_comment_fold") + syn match rubyMultiLineComment "\(^\s*#.*\n\)\{2,}" contains=rubyComment transparent fold + syn region rubyDocumentation start="^=begin" end="^=end.*$" contains=rubySpaceError,rubyTodo,@Spell fold +endif " Note: this is a hack to prevent 'keywords' being highlighted as such when called as methods with an explicit receiver syn match rubyKeywordAsMethod "\%(\%(\.\@" transparent contains=NONE From acb7d9c9d18af4e4a0fd5eaed452c01a5642e9b2 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 11 May 2006 05:50:35 +0000 Subject: [PATCH 284/411] make sure rubyDocumentation is highlighted even if ruby_no_comment_fold is defined; improve rubyDocumentation match --- ChangeLog | 6 ++++++ syntax/ruby.vim | 8 +++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 27bfea9a..6a23194a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-05-11 Doug Kearns + + * syntax/ruby.vim: make sure rubyDocumentation is highlighted even if + ruby_no_comment_fold is defined; improve rubyDocumentation match + patterns + 2006-05-09 Doug Kearns * syntax/ruby.vim: make folding of comments configurable via the diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 2777eabf..7ff322fc 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.89 2006/05/09 11:39:41 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.90 2006/05/11 05:50:35 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -212,8 +212,10 @@ syn match rubySharpBang "\%^#!.*" display syn keyword rubyTodo FIXME NOTE TODO XXX contained syn match rubyComment "#.*" contains=rubySharpBang,rubySpaceError,rubyTodo,@Spell if !exists("ruby_no_comment_fold") - syn match rubyMultiLineComment "\(^\s*#.*\n\)\{2,}" contains=rubyComment transparent fold - syn region rubyDocumentation start="^=begin" end="^=end.*$" contains=rubySpaceError,rubyTodo,@Spell fold + syn match rubyMultiLineComment "\(^\s*#.*\n\)\{2,}" contains=rubyComment transparent fold + syn region rubyDocumentation start="^=begin\s*$" end="^=end\s*$" contains=rubySpaceError,rubyTodo,@Spell fold +else + syn region rubyDocumentation start="^=begin\s*$" end="^=end\s*$" contains=rubySpaceError,rubyTodo,@Spell endif " Note: this is a hack to prevent 'keywords' being highlighted as such when called as methods with an explicit receiver From 019429cda310930a6c0bc113a67dd5121e6cf5d8 Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Thu, 11 May 2006 16:28:37 +0000 Subject: [PATCH 285/411] added checks for the existance of global config variables per dkearns' patch refined error messages to use vim error style --- autoload/rubycomplete.vim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 5ab5e858..a9dee224 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.28 2006/05/07 21:04:09 segy Exp $ +" Info: $Id: rubycomplete.vim,v 1.29 2006/05/11 16:28:37 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -90,7 +90,7 @@ function! s:GetRubyVarType(v) return vtp endif call setpos('.',pos) - if g:rubycomplete_rails == 1 && s:rubycomplete_rails_loaded == 1 + if exists('g:rubycomplete_rails') && g:rubycomplete_rails == 1 && s:rubycomplete_rails_loaded == 1 let ctors = '\(now\|new\|open\|get_instance\|find\|create\)' else let ctors = '\(now\|new\|open\|get_instance\)' @@ -255,7 +255,7 @@ end def get_buffer_classes() # this will be a little expensive. - allow_aggressive_load = VIM::evaluate('g:rubycomplete_classes_in_global') + allow_aggressive_load = VIM::evaluate("exists('g:rubycomplete_classes_in_global') && g:rubycomplete_classes_in_global") return [] if allow_aggressive_load != '1' buf = VIM::Buffer.current @@ -273,7 +273,7 @@ def get_buffer_classes() end def load_rails() - allow_rails = VIM::evaluate('g:rubycomplete_rails') + allow_rails = VIM::evaluate("exists('g:rubycomplete_rails') && g:rubycomplete_rails") return if allow_rails != '1' buf_path = VIM::evaluate('expand("%:p")') @@ -309,7 +309,7 @@ def load_rails() end def get_rails_helpers - allow_rails = VIM::evaluate('g:rubycomplete_rails') + allow_rails = VIM::evaluate("exists('g:rubycomplete_rails') && g:rubycomplete_rails") rails_loaded = VIM::evaluate('s:rubycomplete_rails_loaded') return [] if allow_rails != '1' || rails_loaded != '1' return RailsWords From 57e0a7dceb3923b6fd5625f93d199f93e4a6711b Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Thu, 11 May 2006 16:29:23 +0000 Subject: [PATCH 286/411] added checks for the existance of global config variables per dkearns' patch refined error messages to use vim error style --- ChangeLog | 5 +++++ autoload/rubycomplete.vim | 22 ++++++++++++---------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6a23194a..74f6b3bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-05-11 Mark Guzman + * autoload/rubycomplete.vim: added checks for the existance of + global config variables per dkearns' patch. refined error messages + to use vim error style + 2006-05-11 Doug Kearns * syntax/ruby.vim: make sure rubyDocumentation is highlighted even if diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index a9dee224..07400ea0 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.29 2006/05/11 16:28:37 segy Exp $ +" Info: $Id: rubycomplete.vim,v 1.30 2006/05/11 16:29:23 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -12,16 +12,12 @@ " {{{ requirement checks if !has('ruby') - echohl ErrorMsg - echo "Error: Required vim compiled with +ruby" - echohl None + s:ErrMsg( "Error: Required vim compiled with +ruby" ) finish endif if version < 700 - echohl ErrorMsg - echo "Error: Required vim >= 7.0" - echohl None + s:ErrMsg( "Error: Required vim >= 7.0" ) finish endif " }}} requirement checks @@ -35,6 +31,12 @@ if !exists("g:rubycomplete_classes_in_global") endif " {{{ vim-side support functions +function! s:ErrMsg(msg) + echohl ErrorMsg + echo a:msg + echohl None +endfunction + function! s:GetBufferRubyModule(name) let [snum,enum] = s:GetBufferRubyEntity(a:name, "module") return snum . '..' . enum @@ -211,7 +213,7 @@ def load_buffer_class(name) begin eval classdef rescue - print "Problem loading class '%s', was it already completed?" % name + VIM::evaluate( "s:ErrMsg( 'Problem loading class \"%s\", was it already completed?' )" % name ) end end @@ -222,7 +224,7 @@ def load_buffer_module(name) begin eval classdef rescue - print "Problem loading module '%s', was it already completed?" % name + VIM::evaluate( "s:ErrMsg( 'Problem loading module \"%s\", was it already completed?' )" % name ) end end @@ -303,7 +305,7 @@ def load_rails() require 'console_with_helpers' VIM::command('let s:rubycomplete_rails_loaded = 1') rescue - print "Error loading rails environment" + VIM::evaluate( "s:ErrMsg('Error loading rails environment')" ) end end end From a6c2fd81dba0bd272bdab36d1d8ee5ee22d24cf1 Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Thu, 11 May 2006 16:32:06 +0000 Subject: [PATCH 287/411] retab --- autoload/rubycomplete.vim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 07400ea0..0ecb935c 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.30 2006/05/11 16:29:23 segy Exp $ +" Info: $Id: rubycomplete.vim,v 1.31 2006/05/11 16:32:06 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -34,7 +34,7 @@ endif function! s:ErrMsg(msg) echohl ErrorMsg echo a:msg - echohl None + echohl None endfunction function! s:GetBufferRubyModule(name) @@ -257,7 +257,7 @@ end def get_buffer_classes() # this will be a little expensive. - allow_aggressive_load = VIM::evaluate("exists('g:rubycomplete_classes_in_global') && g:rubycomplete_classes_in_global") + allow_aggressive_load = VIM::evaluate("exists('g:rubycomplete_classes_in_global') && g:rubycomplete_classes_in_global") return [] if allow_aggressive_load != '1' buf = VIM::Buffer.current @@ -323,7 +323,7 @@ def get_completions(base) input = VIM::Buffer.current.line cpos = VIM::Window.current.cursor[1] - 1 - input = input[0..cpos] + input = input[0..cpos] input += base input = input.sub(/.*[ \t\n\"\\'`><=;|&{(]/, '') # Readline.basic_word_break_characters From 3af7d5931ee5618e17ef7f5e86460ea32c4d5c06 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 12 May 2006 08:50:01 +0000 Subject: [PATCH 288/411] match the pseudo operators such as '+=' when ruby_operators is defined --- ChangeLog | 6 ++++++ syntax/ruby.vim | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 74f6b3bb..4f043af9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,10 @@ +2006-05-12 Doug Kearns + + * syntax/ruby.vim: match the pseudo operators such as '+=' when + ruby_operators is defined + 2006-05-11 Mark Guzman + * autoload/rubycomplete.vim: added checks for the existance of global config variables per dkearns' patch. refined error messages to use vim error style diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 7ff322fc..5daf50f0 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.90 2006/05/11 05:50:35 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.91 2006/05/12 08:50:01 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -33,7 +33,8 @@ if exists("ruby_space_errors") endif if exists("ruby_operators") - syn match rubyOperator "\%(\^\|\~\|\%(class\s*\)\@\|<=\|\%(<\|\>\|>=\|>\||\|-\|/\|\*\*\|\*\|&\|%\|+\)" + syn match rubyOperator "\%(\^\|\~\|\%(class\s*\)\@\|<=\|\%(<\|\>\|>=\|>\||\|-\|/\|\*\*\|\*\|&\|%\|+\)" + syn match rubyPseudoOperator "\%(-=\|/=\|\*\*=\|\*=\|&&\|&=\|&&=\|||\||=\|||=\|%=\|+=\|!\~\|!=\)" syn region rubyBracketOperator matchgroup=rubyOperator start="\%([_[:lower:]]\w*[?!=]\=\|}\)\@<=\[\s*" end="\s*]" endif @@ -272,6 +273,7 @@ if version >= 508 || !exists("did_ruby_syntax_inits") HiLink rubySymbol rubyIdentifier HiLink rubyKeyword Keyword HiLink rubyOperator Operator + HiLink rubyPseudoOperator rubyOperator HiLink rubyBeginEnd Statement HiLink rubyAccess Statement HiLink rubyAttribute Statement From 855e2b5d7b9182673fd1792a7d08d4aaf227be19 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 13 May 2006 15:34:51 +0000 Subject: [PATCH 289/411] test for '&omnifunc', rather than the Vim version, before setting it --- ChangeLog | 5 +++++ ftplugin/ruby.vim | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4f043af9..8d26deb6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-05-13 Doug Kearns + + * ftplugin/ruby.vim: test for '&omnifunc', rather than the Vim + version, before setting it; add omnifunc to b:undo_ftplugin + 2006-05-12 Doug Kearns * syntax/ruby.vim: match the pseudo operators such as '+=' when diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index e14e5a64..9e2a38ec 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.22 2006/05/05 07:14:42 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.23 2006/05/13 15:34:51 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -55,6 +55,7 @@ setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'$','.rb','') setlocal suffixesadd=.rb if version >= 700 +if exists('&ofu') setlocal omnifunc=rubycomplete#Complete endif @@ -87,7 +88,7 @@ if has("gui_win32") && !exists("b:browsefilter") \ "All Files (*.*)\t*.*\n" endif -let b:undo_ftplugin = "setl fo< inc< inex< sua< def< com< cms< path< " +let b:undo_ftplugin = "setl fo< inc< inex< sua< def< com< cms< path< ofu<" \ "| unlet! b:browsefilter b:match_ignorecase b:match_words b:match_skip" let &cpo = s:cpo_save From 2a71de918bd89f4151d4956a0442c6c8070f2b26 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 25 May 2006 07:46:57 +0000 Subject: [PATCH 290/411] use a region for the rubyMultiLineComment syntax group instead of a multiline match pattern as it is faster --- ChangeLog | 6 ++++++ syntax/ruby.vim | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8d26deb6..dd96a6d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-05-25 Doug Kearns + + * syntax/ruby.vim: use a region for the rubyMultiLineComment syntax + group instead of a multiline match pattern as it is faster; rename + rubyMultiLineComment to rubyMultilineComment + 2006-05-13 Doug Kearns * ftplugin/ruby.vim: test for '&omnifunc', rather than the Vim diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 5daf50f0..17c9ae80 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.91 2006/05/12 08:50:01 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.92 2006/05/25 07:46:57 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -213,7 +213,7 @@ syn match rubySharpBang "\%^#!.*" display syn keyword rubyTodo FIXME NOTE TODO XXX contained syn match rubyComment "#.*" contains=rubySharpBang,rubySpaceError,rubyTodo,@Spell if !exists("ruby_no_comment_fold") - syn match rubyMultiLineComment "\(^\s*#.*\n\)\{2,}" contains=rubyComment transparent fold + syn region rubyMultilineComment start="\%(\%(^\s*#.*\n\)\@ Date: Thu, 25 May 2006 21:40:44 +0000 Subject: [PATCH 291/411] added rails column support switched to dictionary with type specifiers for methods,classes,variables started/added rails 1.0 support added rails database connection support --- ChangeLog | 7 +++ autoload/rubycomplete.vim | 108 ++++++++++++++++++++++++-------------- 2 files changed, 77 insertions(+), 38 deletions(-) diff --git a/ChangeLog b/ChangeLog index dd96a6d3..564409da 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-05-25 Mark Guzman + + * autoload/rubycomplete.vim: added rails column support. + switched to dictionary with type specifiers for methods, + classes, and variables. started/added rails 1.0 support. + added rails database connection support. + 2006-05-25 Doug Kearns * syntax/ruby.vim: use a region for the rubyMultiLineComment syntax diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 0ecb935c..156de2d1 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.31 2006/05/11 16:32:06 segy Exp $ +" Info: $Id: rubycomplete.vim,v 1.32 2006/05/25 21:40:44 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -301,8 +301,13 @@ def load_rails() begin require bootfile require envfile - require 'console_app' - require 'console_with_helpers' + begin + require 'console_app' + require 'console_with_helpers' + rescue + # 1.0 + end + Rails::Initializer.run VIM::command('let s:rubycomplete_rails_loaded = 1') rescue VIM::evaluate( "s:ErrMsg('Error loading rails environment')" ) @@ -317,6 +322,23 @@ def get_rails_helpers return RailsWords end +def add_rails_columns( cls ) + allow_rails = VIM::evaluate("exists('g:rubycomplete_rails') && g:rubycomplete_rails") + rails_loaded = VIM::evaluate('s:rubycomplete_rails_loaded') + return [] if allow_rails != '1' || rails_loaded != '1' + eval( "#{cls}.establish_connection" ) + return [] unless eval( "#{cls}.ancestors.include?(ActiveRecord::Base).to_s" ) + col = eval( "#{cls}.column_names" ) + return col if col + return [] +end + +def clean_sel(sel, msg) + sel.delete_if { |x| x == nil } + sel.uniq! + sel.grep(/^#{Regexp.quote(msg)}/) if msg != nil +end + def get_completions(base) load_requires load_rails @@ -325,66 +347,70 @@ def get_completions(base) cpos = VIM::Window.current.cursor[1] - 1 input = input[0..cpos] input += base - input = input.sub(/.*[ \t\n\"\\'`><=;|&{(]/, '') # Readline.basic_word_break_characters + input.sub!(/.*[ \t\n\"\\'`><=;|&{(]/, '') # Readline.basic_word_break_characters + input.sub!(/self\./, '') + message = nil receiver = nil - candidates = [] + methods = [] + variables = [] + classes = [] case input when /^(\/[^\/]*\/)\.([^.]*)$/ # Regexp receiver = $1 message = Regexp.quote($2) - candidates = Regexp.instance_methods(true) + methods = Regexp.instance_methods(true) when /^([^\]]*\])\.([^.]*)$/ # Array receiver = $1 message = Regexp.quote($2) - candidates = Array.instance_methods(true) + methods = Array.instance_methods(true) when /^([^\}]*\})\.([^.]*)$/ # Proc or Hash receiver = $1 message = Regexp.quote($2) - candidates = Proc.instance_methods(true) | Hash.instance_methods(true) + methods = Proc.instance_methods(true) | Hash.instance_methods(true) when /^(:[^:.]*)$/ # Symbol if Symbol.respond_to?(:all_symbols) receiver = $1 - candidates = Symbol.all_symbols.collect{|s| s.id2name} - candidates.delete_if { |c| c.match( /'/ ) } + methods = Symbol.all_symbols.collect{|s| s.id2name} + methods.delete_if { |c| c.match( /'/ ) } end when /^::([A-Z][^:\.\(]*)$/ # Absolute Constant or class methods receiver = $1 - candidates = Object.constants - candidates.grep(/^#{receiver}/).collect{|e| "::" + e} + methods = Object.constants + methods.grep(/^#{receiver}/).collect{|e| "::" + e} when /^(((::)?[A-Z][^:.\(]*)+)::?([^:.]*)$/ # Constant or class methods receiver = $1 message = Regexp.quote($4) begin - candidates = eval("#{receiver}.constants | #{receiver}.methods") + methods = eval("#{receiver}.constants | #{receiver}.methods") rescue Exception - candidates = [] + methods = [] end - candidates.grep(/^#{message}/).collect{|e| receiver + "::" + e} + methods.grep(/^#{message}/).collect{|e| receiver + "::" + e} when /^(:[^:.]+)\.([^.]*)$/ # Symbol receiver = $1 message = Regexp.quote($2) - candidates = Symbol.instance_methods(true) + methods = Symbol.instance_methods(true) when /^([0-9_]+(\.[0-9_]+)?(e[0-9]+)?)\.([^.]*)$/ # Numeric receiver = $1 message = Regexp.quote($4) begin - candidates = eval(receiver).methods + methods = eval(receiver).methods rescue Exception - candidates + methods = [] end when /^(\$[^.]*)$/ #global - candidates = global_variables.grep(Regexp.new(Regexp.quote($1))) + methods = global_variables.grep(Regexp.new(Regexp.quote($1))) when /^((\.?[^.]+)+)\.([^.]*)$/ # variable receiver = $1 @@ -397,37 +423,38 @@ def get_completions(base) load_buffer_class( vartype ) begin - candidates = eval("#{vartype}.instance_methods") + methods = eval("#{vartype}.instance_methods") + variables = eval("#{vartype}.instance_variables") rescue Exception - candidates = [] end elsif (cv).include?(receiver) # foo.func and foo is local var. - candidates = eval("#{receiver}.methods") + methods = eval("#{receiver}.methods") + vartype = receiver elsif /^[A-Z]/ =~ receiver and /\./ !~ receiver + vartype = receiver # Foo::Bar.func begin - candidates = eval("#{receiver}.methods") + methods = eval("#{receiver}.methods") rescue Exception - candidates = [] end else # func1.func2 - candidates = [] ObjectSpace.each_object(Module){|m| next if m.name != "IRB::Context" and /^(IRB|SLex|RubyLex|RubyToken)/ =~ m.name - candidates.concat m.instance_methods(false) + methods.concat m.instance_methods(false) } end + variables += add_rails_columns( "#{vartype}" ) if vartype && vartype.length > 0 when /^\(?\s*[A-Za-z0-9:^@.%\/+*\(\)]+\.\.\.?[A-Za-z0-9:^@.%\/+*\(\)]+\s*\)?\.([^.]*)/ message = $1 - candidates = Range.instance_methods(true) + methods = Range.instance_methods(true) when /^\.([^.]*)$/ # unknown(maybe String) message = Regexp.quote($1) - candidates = String.instance_methods(true) + methods = String.instance_methods(true) else inclass = eval( VIM::evaluate("s:IsInClassDef()") ) @@ -441,8 +468,9 @@ def get_completions(base) message = input load_buffer_class( receiver ) begin - candidates = eval( "#{receiver}.instance_methods" ) - candidates += get_rails_helpers + methods = eval( "#{receiver}.instance_methods" ) + methods += get_rails_helpers + variables += add_rails_columns( "#{receiver}" ) rescue Exception found = nil end @@ -450,25 +478,29 @@ def get_completions(base) end if inclass == nil || found == nil - candidates = eval("self.class.constants") - candidates += get_buffer_classes + classes = eval("self.class.constants") + classes += get_buffer_classes message = receiver = input end end - candidates.delete_if { |x| x == nil } - candidates.uniq! - candidates.sort! - candidates = candidates.grep(/^#{Regexp.quote(message)}/) if message != nil + methods = clean_sel( methods, message ) + methods = (methods-Object.instance_methods) + variables = clean_sel( variables, message ) + classes = clean_sel( classes, message ) + valid = [] + valid += methods.collect { |m| { :name => m, :type => 'm' } } + valid += variables.collect { |v| { :name => v, :type => 'v' } } + valid += classes.collect { |c| { :name => c, :type => 't' } } + valid.sort! { |x,y| x[:name] <=> y[:name] } outp = "" - valid = (candidates-Object.instance_methods) rg = 0..valid.length rg.step(150) do |x| stpos = 0+x enpos = 150+x - valid[stpos..enpos].each { |c| outp += "{'word':'%s','item':'%s'}," % [ c, c ] } + valid[stpos..enpos].each { |c| outp += "{'word':'%s','item':'%s','kind':'%s'}," % [ c[:name], c[:name], c[:type] ] } outp.sub!(/,$/, '') VIM::command("call extend(g:rubycomplete_completions, [%s])" % outp) From f71090fd084b96ec944a3994aebdba6939fcaecb Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 26 May 2006 17:38:59 +0000 Subject: [PATCH 292/411] fix typo --- ChangeLog | 8 ++++++-- ftplugin/ruby.vim | 3 +-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 564409da..b07f868c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ -2006-05-25 Mark Guzman - +2006-05-26 Doug Kearns + + * ftplugin/ruby.vim: fix typo + +2006-05-25 Mark Guzman + * autoload/rubycomplete.vim: added rails column support. switched to dictionary with type specifiers for methods, classes, and variables. started/added rails 1.0 support. diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index 9e2a38ec..913fafc7 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.23 2006/05/13 15:34:51 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.24 2006/05/26 17:38:59 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -54,7 +54,6 @@ setlocal include=^\\s*\\<\\(load\\\|\w*require\\)\\> setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'$','.rb','') setlocal suffixesadd=.rb -if version >= 700 if exists('&ofu') setlocal omnifunc=rubycomplete#Complete endif From de75a91fa31e8d80de29f1e4c0cd93047cea729a Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Mon, 19 Jun 2006 17:10:23 +0000 Subject: [PATCH 293/411] modified to change the default buffer loading behavior. buffers are no longer loaded/parsed automatically. enabling this feature requires setting the variable g:rubycomplete_buffer_loading. this was done as a security measure, the default vim7 install should not execute any code. symbol completion now works. i tested with global symbols as well as rails symbols. --- ChangeLog | 12 ++++++++++++ autoload/rubycomplete.vim | 23 +++++++++++++++++------ doc/ft-ruby-omni.txt | 6 ++++-- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index b07f868c..55f7201a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2006-06-19 Mark Guzman + + * autoload/rubycomplete.vim: modified to change the default + buffer loading behavior. buffers are no longer loaded/parsed + automatically. enabling this feature requires setting the + variable g:rubycomplete_buffer_loading. this was done as + a security measure, the default vim7 install should not + execute any code. + + * autoload/rubycomplete.vim: symbol completion now works. i + tested with global symbols as well as rails symbols. + 2006-05-26 Doug Kearns * ftplugin/ruby.vim: fix typo diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 156de2d1..51b37343 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.32 2006/05/25 21:40:44 segy Exp $ +" Info: $Id: rubycomplete.vim,v 1.33 2006/06/19 17:10:24 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -30,6 +30,11 @@ if !exists("g:rubycomplete_classes_in_global") let g:rubycomplete_classes_in_global = 0 endif +if !exists("g:rubycomplete_buffer_loading") + let g:rubycomplete_classes_in_global = 0 +endif + + " {{{ vim-side support functions function! s:ErrMsg(msg) echohl ErrorMsg @@ -229,6 +234,8 @@ def load_buffer_module(name) end def get_buffer_entity(name, vimfun) + loading_allowed = VIM::evaluate("exists('g:rubycomplete_buffer_loading') && g:rubycomplete_buffer_loading") + return nil if loading_allowed != '1' return nil if /(\"|\')+/.match( name ) buf = VIM::Buffer.current nums = eval( VIM::evaluate( vimfun % name ) ) @@ -257,8 +264,9 @@ end def get_buffer_classes() # this will be a little expensive. + loading_allowed = VIM::evaluate("exists('g:rubycomplete_buffer_loading') && g:rubycomplete_buffer_loading") allow_aggressive_load = VIM::evaluate("exists('g:rubycomplete_classes_in_global') && g:rubycomplete_classes_in_global") - return [] if allow_aggressive_load != '1' + return [] if allow_aggressive_load != '1' || loading_allowed != '1' buf = VIM::Buffer.current eob = buf.length @@ -340,8 +348,11 @@ def clean_sel(sel, msg) end def get_completions(base) - load_requires - load_rails + loading_allowed = VIM::evaluate("exists('g:rubycomplete_buffer_loading') && g:rubycomplete_buffer_loading") + if loading_allowed == '1' + load_requires + load_rails + end input = VIM::Buffer.current.line cpos = VIM::Window.current.cursor[1] - 1 @@ -350,7 +361,6 @@ def get_completions(base) input.sub!(/.*[ \t\n\"\\'`><=;|&{(]/, '') # Readline.basic_word_break_characters input.sub!(/self\./, '') - message = nil receiver = nil methods = [] @@ -376,6 +386,7 @@ def get_completions(base) when /^(:[^:.]*)$/ # Symbol if Symbol.respond_to?(:all_symbols) receiver = $1 + message = $1.sub( /:/, '' ) methods = Symbol.all_symbols.collect{|s| s.id2name} methods.delete_if { |c| c.match( /'/ ) } end @@ -489,7 +500,7 @@ def get_completions(base) variables = clean_sel( variables, message ) classes = clean_sel( classes, message ) valid = [] - valid += methods.collect { |m| { :name => m, :type => 'm' } } + valid += methods.collect { |m| { :name => m, :type => 'f' } } valid += variables.collect { |v| { :name => v, :type => 'v' } } valid += classes.collect { |c| { :name => c, :type => 't' } } valid.sort! { |x,y| x[:name] <=> y[:name] } diff --git a/doc/ft-ruby-omni.txt b/doc/ft-ruby-omni.txt index 98cdab17..36db8313 100644 --- a/doc/ft-ruby-omni.txt +++ b/doc/ft-ruby-omni.txt @@ -21,8 +21,10 @@ The completions provided by CTRL-X CTRL-O are sensitive to the context: Notes: - Vim will load/evaluate code in order to provide completions. This may - cause some code execution, which may be a concern. - - In context 1 above, Vim can parse the entire buffer to add a list of + cause some code execution, which may be a concern. This is no longer + enabled by default, to enable this feature add > + let g:rubycomplete_buffer_loading = 1 +< - In context 1 above, Vim can parse the entire buffer to add a list of classes to the completion results. This feature is turned off by default, to enable it add > let g:rubycomplete_classes_in_global = 1 From 2b0da7e16484efd5b367fbed2420b71b208369ad Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Mon, 10 Jul 2006 16:39:31 +0000 Subject: [PATCH 294/411] fold all multiline strings --- ChangeLog | 8 ++++++-- syntax/ruby.vim | 13 +++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 55f7201a..d38ec617 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,8 @@ -2006-06-19 Mark Guzman +2006-07-10 Doug Kearns + + * syntax/ruby.vim: fold all multiline strings + +2006-06-19 Mark Guzman * autoload/rubycomplete.vim: modified to change the default buffer loading behavior. buffers are no longer loaded/parsed @@ -482,7 +486,7 @@ 2005-08-27 Doug Kearns * bin/vim-ruby-install.rb: add Env.determine_home_dir using - %HOMEDRIVE%%HOMEPATH% as HOME on windows if HOME is not explicitly set + %HOMEDRIVE%%HOMEPATH% as HOME on Windows if HOME is not explicitly set * syntax/ruby.vim: fix regression in rubyOptDoBlock diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 17c9ae80..9cfde7ff 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.92 2006/05/25 07:46:57 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.93 2006/07/10 16:39:31 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -32,6 +32,7 @@ if exists("ruby_space_errors") endif endif +" Operators if exists("ruby_operators") syn match rubyOperator "\%(\^\|\~\|\%(class\s*\)\@\|<=\|\%(<\|\>\|>=\|>\||\|-\|/\|\*\*\|\*\|&\|%\|+\)" syn match rubyPseudoOperator "\%(-=\|/=\|\*\*=\|\*=\|&&\|&=\|&&=\|||\||=\|||=\|%=\|+=\|!\~\|!=\)" @@ -96,13 +97,13 @@ syn match rubyPredefinedConstant "\%(\%(\.\@" " Normal Regular Expression -syn region rubyString matchgroup=rubyStringDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\)\|[;\~=!|&(,[>]\)\s*\)\@<=/" end="/[iomx]*" skip="\\\\\|\\/" contains=@rubyStringSpecial -syn region rubyString matchgroup=rubyStringDelimiter start="\%(\<\%(split\|scan\|gsub\|sub\)\s*\)\@<=/" end="/[iomx]*" skip="\\\\\|\\/" contains=@rubyStringSpecial +syn region rubyString matchgroup=rubyStringDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\)\|[;\~=!|&(,[>]\)\s*\)\@<=/" end="/[iomx]*" skip="\\\\\|\\/" contains=@rubyStringSpecial fold +syn region rubyString matchgroup=rubyStringDelimiter start="\%(\<\%(split\|scan\|gsub\|sub\)\s*\)\@<=/" end="/[iomx]*" skip="\\\\\|\\/" contains=@rubyStringSpecial fold " Normal String and Shell Command Output -syn region rubyString matchgroup=rubyStringDelimiter start="\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial -syn region rubyString matchgroup=rubyStringDelimiter start="'" end="'" skip="\\\\\|\\'" -syn region rubyString matchgroup=rubyStringDelimiter start="`" end="`" skip="\\\\\|\\`" contains=@rubyStringSpecial +syn region rubyString matchgroup=rubyStringDelimiter start="\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial fold +syn region rubyString matchgroup=rubyStringDelimiter start="'" end="'" skip="\\\\\|\\'" fold +syn region rubyString matchgroup=rubyStringDelimiter start="`" end="`" skip="\\\\\|\\`" contains=@rubyStringSpecial fold " Generalized Regular Expression syn region rubyString matchgroup=rubyStringDelimiter start="%r\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1[iomx]*" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold From 1e1d0e582a6f49dd1f74bda8ab16b2a19b771e3b Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 11 Jul 2006 08:57:32 +0000 Subject: [PATCH 295/411] only set 'omnifunc' if Vim has been compiled with the Ruby interface --- ChangeLog | 5 +++++ ftplugin/ruby.vim | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index d38ec617..eb1a2ee9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-07-11 Doug Kearns + + * ftplugin/ruby.vim: only set 'omnifunc' if Vim has been compiled with + the Ruby interface + 2006-07-10 Doug Kearns * syntax/ruby.vim: fold all multiline strings diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index 913fafc7..cdf9222a 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.24 2006/05/26 17:38:59 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.25 2006/07/11 08:57:32 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -54,7 +54,7 @@ setlocal include=^\\s*\\<\\(load\\\|\w*require\\)\\> setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'$','.rb','') setlocal suffixesadd=.rb -if exists('&ofu') +if exists("&ofu") && has("ruby") setlocal omnifunc=rubycomplete#Complete endif From 773e052350d02715114aa51e992ab28541829984 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 11 Jul 2006 09:24:53 +0000 Subject: [PATCH 296/411] update documentation for next release --- ChangeLog | 3 +++ FAQ | 7 ++++--- INSTALL | 43 ++++++++++++++++++++++++++++-------------- NEWS | 38 +++++++++++++++++++++++++++++++++++++ README | 8 ++++---- doc/ft-ruby-syntax.txt | 23 ++++++++++++++++------ 6 files changed, 95 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index eb1a2ee9..129d2d5d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2006-07-11 Doug Kearns + * FAQ, INSTALL, NEWS, README, doc/ft-ruby-syntax.txt: update + documentation for next release + * ftplugin/ruby.vim: only set 'omnifunc' if Vim has been compiled with the Ruby interface diff --git a/FAQ b/FAQ index 1644829d..9054e853 100644 --- a/FAQ +++ b/FAQ @@ -52,8 +52,8 @@ Again, see installation instructions below. If you obtained the vim-ruby files via RubyGems, run: > - vim-ruby-install.rb - + vim-ruby-install.rb + If you downloaded a tarball, unpack it, change to the created directory, and run: > @@ -71,6 +71,7 @@ Here is an example installation transcript: 2) E:/Vim/vimfiles ~ ~ Please select one (or anything else to specify another directory): 2 ~ + autoload/rubycomplete.vim -> E:/Vim/vimfiles/autoload/rubycomplete.vim ~ compiler/eruby.vim -> E:/Vim/vimfiles/compiler/eruby.vim ~ compiler/ruby.vim -> E:/Vim/vimfiles/compiler/ruby.vim ~ compiler/rubyunit.vim -> E:/Vim/vimfiles/compiler/rubyunit.vim ~ @@ -209,7 +210,7 @@ Yes: vim-ruby-devel@rubyforge.org. Only subscribers can post. To join, visit: http://rubyforge.org/mailman/listinfo/vim-ruby-devel The list is mirrored at: > - + http://news.gmane.org/gmane.comp.editors.vim.vim%2druby.devel diff --git a/INSTALL b/INSTALL index 1132b9ee..4c50679e 100644 --- a/INSTALL +++ b/INSTALL @@ -1,16 +1,17 @@ -= Installing Vim-Ruby += Installing vim-ruby -The Vim-Ruby runtime files may be installed via the vim-ruby gem or by +The vim-ruby runtime files may be installed via the vim-ruby gem or by downloading an archive file from http://rubyforge.org/frs/?group_id=16 NOTE: the installer vim-ruby-install.rb currently only supports Unix and Windows systems; other platforms may require a manual install. This installer is new and users with significant local modifications to their vim-ruby files -are encouraged to make a manual backup of each prior to installation. +are encouraged to make a manual backup prior to installation. == Prerequisites -1. Vim 6.x (6.3 recommended) +1. Vim 6.x (7.0 recommended; 7.0 compiled with the Ruby interface is required + for omni completion) http://www.vim.org/ 2. Ruby 1.8.x @@ -41,26 +42,40 @@ Windows C:\tmp> [unzip] vim-ruby.YYYY.MM.DD.tgz C:\tmp> ruby vim-ruby.YYY.MM.DD\bin\vim-ruby-install.rb -=== Manual Installation +== Manual Installation Alternatively, you can simply copy the desired files to an appropriate directory in your runtime path. For single user use this would typically be $HOME/.vim on Unix systems and $HOME/vimfiles on Windows and for system-wide use these would be installed in $VIM/vimfiles. -== Vim versions < 6.3 +== Vim Version Dependencies -For versions of Vim less than 6.3 the supplied ftdetect/ruby.vim file, used for -filetype detection, will be ignored. In order for the filetype detection to -operate correctly the autocommands specified in ftdetect/ruby.vim need to be -executed. See :help new-filetype, in Vim, for a mechanism to achieve this -which is appropriate for your version of Vim. +Some features of the vim-ruby package depend on specific versions and features +of Vim, as follows. -Again, we recommend you use the latest version of Vim at all times, where -possible. +=== Versions >= 7.0 compiled without the Ruby interface + +The omni completion script (autoload/rubycomplete.vim) will be installed but +the 'omnifunc' option will not be set to use this if Vim was not compiled with +the Ruby interface (+ruby). + +=== Versions < 7.0 + +While omni completion is a Vim 7.x series feature the supplied completion +script will still be installed to facilitate an easier upgrade. It will simply +be ignored by versions of Vim less than 7.0. + +=== Versions < 6.3 + +The supplied filetype detection script (ftdetect/ruby.vim file) will be +installed but ignored. In order for the filetype detection to operate +correctly the autocommands specified in ftdetect/ruby.vim need to be executed. +See :help new-filetype, in Vim, for a mechanism to achieve this which is +appropriate for your version of Vim. == Problems -If you have any problems installing the Vim-Ruby configuration files please +If you have any problems installing the vim-ruby configuration files please send a message to the mailing list (http://rubyforge.org/mail/?group_id=16) or post an item to the tracker (http://rubyforge.org/tracker/?group_id=16). diff --git a/NEWS b/NEWS index b16a3606..e96107b5 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,41 @@ += 2006.07.11 + +== Omni Completion + +A new omni completion function is now included which offers IntelliSense-like +functionality. See :help ft-ruby-omni for further information. + +Note: This will only work with Vim 7.x, compiled with the Ruby interface +(+ruby), and Ruby 1.8.x + +== Ruby Filetype Support + +Matchit support has been improved to include (), {}, and [] in the list of +patterns meaning these will be appropriately skipped when included in comments. + +== Ruby Syntax Highlighting + +Operators can now be highlighted by defining the Vim global variable +"ruby_operators". + +Multiline comments will now be folded. This can be disabled by defining the +"ruby_no_comment_fold" Vim variable. + +== Filetype Detection + +RJS and RXML templates are now detected as being 'filetype=ruby'. + +== FAQ + +There is a new FAQ document included. This is a work in progress and any +feedback would be appreciated. + +== Bug Fixes + +Ruby syntax file - if/unless modifiers after a method name ending with [?!=] +should now be highlighted correctly. + + = 2005.10.07 == Vim 6.4 diff --git a/README b/README index 595be8ee..645a76fc 100644 --- a/README +++ b/README @@ -27,9 +27,9 @@ For would-be contributors: - Thank you very much for taking an interest. Contents of the project: - - The 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'. + - 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: @@ -68,7 +68,7 @@ CVS topics: 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 soyabean.com.au). + (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 diff --git a/doc/ft-ruby-syntax.txt b/doc/ft-ruby-syntax.txt index 0d8a8b12..22179406 100644 --- a/doc/ft-ruby-syntax.txt +++ b/doc/ft-ruby-syntax.txt @@ -8,7 +8,7 @@ experience slow redrawing (or you are on a terminal with poor color support) you may want to turn it off by defining the "ruby_no_expensive" variable: > :let ruby_no_expensive = 1 - +< In this case the same color will be used for all control keywords. If you do want this feature enabled, but notice highlighting errors while @@ -16,7 +16,7 @@ scrolling backwards, which are fixed when redrawing with CTRL-L, try setting the "ruby_minlines" variable to a value larger than 50: > :let ruby_minlines = 100 - +> Ideally, this value should be a number of lines large enough to embrace your largest class or module. @@ -24,7 +24,7 @@ Highlighting of special identifiers can be disabled by defining "ruby_no_identifiers": > :let ruby_no_identifiers = 1 - +< This will prevent highlighting of special identifiers like "ConstantName", "$global_var", "@@class_var", "@instance_var", "| block_param |", and ":symbol". @@ -33,14 +33,19 @@ Significant methods of Kernel, Module and Object are highlighted by default. This can be disabled by defining "ruby_no_special_methods": > :let ruby_no_special_methods = 1 - +< This will prevent highlighting of important methods such as "require", "attr", "private", "raise" and "proc". +Ruby operators can be highlighted. This is enabled by defining +"ruby_operators": > + + :let ruby_operators = 1 +< Whitespace errors can be highlighted by defining "ruby_space_errors": > :let ruby_space_errors = 1 - +< This will highlight trailing whitespace and tabs preceded by a space character as errors. This can be refined by defining "ruby_no_trail_space_error" and "ruby_no_tab_space_error" which will ignore trailing whitespace and tabs after @@ -49,8 +54,14 @@ spaces respectively. Folding can be enabled by defining "ruby_fold": > :let ruby_fold = 1 - +< This will set the 'foldmethod' option to "syntax" and allow folding of classes, modules, methods, code blocks, heredocs and comments. +Folding of multiline comments can be disabled by defining +"ruby_no_comment_fold": > + + :let ruby_no_comment_fold = 1 +< + vim:tw=78:sw=4:ts=8:ft=help:norl: From e5f60ae27833df6b5a2cfccb4ca6c60d4f1dffb7 Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Wed, 12 Jul 2006 04:13:10 +0000 Subject: [PATCH 297/411] added in-buffer method def handling. also added an inital attempt at handling completion in a rails view --- ChangeLog | 4 +++ autoload/rubycomplete.vim | 64 ++++++++++++++++++++++++++++++--------- 2 files changed, 53 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 129d2d5d..1bf26786 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-07-12 Mark Guzman + * autoload/rubycomplete.vim: added in-buffer method def handling. also + added an inital attempt at handling completion in a rails view + 2006-07-11 Doug Kearns * FAQ, INSTALL, NEWS, README, doc/ft-ruby-syntax.txt: update diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 51b37343..925e1f19 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.33 2006/06/19 17:10:24 segy Exp $ +" Info: $Id: rubycomplete.vim,v 1.34 2006/07/12 04:13:11 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -74,15 +74,18 @@ function! s:GetBufferRubyEntity( name, type ) endfunction function! s:IsInClassDef() + return s:IsPosInClassDef( line('.') ) +endfunction + +function! s:IsPosInClassDef(pos) let [snum,enum] = s:GetBufferRubyEntity( '.*', "class" ) let ret = 'nil' - let pos = line('.') - if snum < pos && pos < enum + if snum < a:pos && a:pos < enum let ret = snum . '..' . enum endif - return ret + return ret endfunction function! s:GetRubyVarType(v) @@ -217,7 +220,7 @@ def load_buffer_class(name) begin eval classdef - rescue + rescue Exception VIM::evaluate( "s:ErrMsg( 'Problem loading class \"%s\", was it already completed?' )" % name ) end end @@ -228,7 +231,7 @@ def load_buffer_module(name) begin eval classdef - rescue + rescue Exception VIM::evaluate( "s:ErrMsg( 'Problem loading module \"%s\", was it already completed?' )" % name ) end end @@ -262,27 +265,37 @@ def get_var_type( receiver ) end end -def get_buffer_classes() +def get_buffer_entity_list( type ) # this will be a little expensive. loading_allowed = VIM::evaluate("exists('g:rubycomplete_buffer_loading') && g:rubycomplete_buffer_loading") allow_aggressive_load = VIM::evaluate("exists('g:rubycomplete_classes_in_global') && g:rubycomplete_classes_in_global") return [] if allow_aggressive_load != '1' || loading_allowed != '1' - + buf = VIM::Buffer.current eob = buf.length ret = [] rg = 1..eob + re = eval( "/^\s*%s\s*([A-Za-z0-9_-]*)(\s*<\s*([A-Za-z0-9_:-]*))?\s*/" % type ) rg.each do |x| - if /^\s*class\s*([A-Za-z0-9_-]*)(\s*<\s*([A-Za-z0-9_:-]*))?\s*/.match( buf[x] ) - ret.push $1 + if re.match( buf[x] ) + next if type == "def" && eval( VIM::evaluate("s:IsPosInClassDef(%s)" % x) ) != nil + ret.push $1 end end - return ret + return ret +end + +def get_buffer_methods + return get_buffer_entity_list( "def" ) end -def load_rails() +def get_buffer_classes + 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 != '1' @@ -312,12 +325,12 @@ def load_rails() begin require 'console_app' require 'console_with_helpers' - rescue - # 1.0 + rescue Exception + # assume 1.0 end Rails::Initializer.run VIM::command('let s:rubycomplete_rails_loaded = 1') - rescue + rescue Exception VIM::evaluate( "s:ErrMsg('Error loading rails environment')" ) end end @@ -347,6 +360,25 @@ def clean_sel(sel, msg) sel.grep(/^#{Regexp.quote(msg)}/) if msg != nil end +def get_rails_view_methods + allow_rails = VIM::evaluate("exists('g:rubycomplete_rails') && g:rubycomplete_rails") + rails_loaded = VIM::evaluate('s:rubycomplete_rails_loaded') + return [] if allow_rails != '1' || rails_loaded != '1' + + buf_path = VIM::evaluate('expand("%:p")') + file_name = VIM::evaluate('expand("%:t")') + path = buf_path.gsub( file_name, '' ) + + return [] unless /.*.{1}app.{1}views.{1}.*.{1}/.match( path ) + + clspl = File.basename( path ).camelize.pluralize + cls = clspl.singularize + ret = [] + ret += eval( "#{cls}.instance_methods" ) + ret += eval( "#{clspl}Helper.instance_methods" ) + return ret +end + def get_completions(base) loading_allowed = VIM::evaluate("exists('g:rubycomplete_buffer_loading') && g:rubycomplete_buffer_loading") if loading_allowed == '1' @@ -489,6 +521,8 @@ def get_completions(base) end if inclass == nil || found == nil + methods = get_buffer_methods + methods += get_rails_view_methods classes = eval("self.class.constants") classes += get_buffer_classes message = receiver = input From 8189c9ed543b11e140458ad312695619720a5504 Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Mon, 21 Aug 2006 19:52:49 +0000 Subject: [PATCH 298/411] modified the buffer loading code to prevent syntax errors from stopping completion --- ChangeLog | 4 + autoload/rubycomplete.vim | 686 +++++++++++++++++++------------------- 2 files changed, 353 insertions(+), 337 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1bf26786..6b2ea825 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-08-21 Mark Guzman + * autoload/rubycomplete.vim: modified the buffer loading code to prevent + syntax errors from stopping completion + 2006-07-12 Mark Guzman * autoload/rubycomplete.vim: added in-buffer method def handling. also added an inital attempt at handling completion in a rails view diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 925e1f19..015d2daa 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,10 +1,11 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.34 2006/07/12 04:13:11 segy Exp $ +" Info: $Id: rubycomplete.vim,v 1.35 2006/08/21 19:52:49 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns +" Version: 0.7 " ---------------------------------------------------------------------------- " " Ruby IRB/Complete author: Keiju ISHITSUKA(keiju@ishitsuka.com) @@ -155,7 +156,7 @@ function! rubycomplete#Complete(findstart, base) "findstart = 0 when we need to return the list of completions else let g:rubycomplete_completions = [] - execute "ruby get_completions('" . a:base . "')" + execute "ruby VimRubyCompletion.get_completions('" . a:base . "')" return g:rubycomplete_completions endif endfunction @@ -164,396 +165,407 @@ endfunction function! s:DefRuby() ruby << RUBYEOF # {{{ ruby completion -RailsWords = [ - "has_many", "has_one", - "belongs_to", - ] - -ReservedWords = [ - "BEGIN", "END", - "alias", "and", - "begin", "break", - "case", "class", - "def", "defined", "do", - "else", "elsif", "end", "ensure", - "false", "for", - "if", "in", - "module", - "next", "nil", "not", - "or", - "redo", "rescue", "retry", "return", - "self", "super", - "then", "true", - "undef", "unless", "until", - "when", "while", - "yield", - ] - -Operators = [ "%", "&", "*", "**", "+", "-", "/", - "<", "<<", "<=", "<=>", "==", "===", "=~", ">", ">=", ">>", - "[]", "[]=", "^", ] - - -def load_requires - 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? +class VimRubyCompletion + # {{{ constants + @@RailsWords = [ + "has_many", "has_one", + "belongs_to", + ] + + @@ReservedWords = [ + "BEGIN", "END", + "alias", "and", + "begin", "break", + "case", "class", + "def", "defined", "do", + "else", "elsif", "end", "ensure", + "false", "for", + "if", "in", + "module", + "next", "nil", "not", + "or", + "redo", "rescue", "retry", "return", + "self", "super", + "then", "true", + "undef", "unless", "until", + "when", "while", + "yield", + ] + + @@Operators = [ "%", "&", "*", "**", "+", "-", "/", + "<", "<<", "<=", "<=>", "==", "===", "=~", ">", ">=", ">>", + "[]", "[]=", "^", ] + #}}} constants + + + def load_requires + 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? + end end end -end -def load_buffer_class(name) - classdef = get_buffer_entity(name, 's:GetBufferRubyClass("%s")') - return if classdef == nil + def load_buffer_class(name) + classdef = get_buffer_entity(name, 's:GetBufferRubyClass("%s")') + return if classdef == nil - pare = /^\s*class\s*(.*)\s*<\s*(.*)\s*\n/.match( classdef ) - load_buffer_class( $2 ) if pare != nil + pare = /^\s*class\s*(.*)\s*<\s*(.*)\s*\n/.match( classdef ) + load_buffer_class( $2 ) if pare != nil - mixre = /.*\n\s*include\s*(.*)\s*\n/.match( classdef ) - load_buffer_module( $2 ) if mixre != nil + mixre = /.*\n\s*include\s*(.*)\s*\n/.match( classdef ) + load_buffer_module( $2 ) if mixre != nil - begin - eval classdef - rescue Exception - VIM::evaluate( "s:ErrMsg( 'Problem loading class \"%s\", was it already completed?' )" % name ) + begin + eval classdef + rescue Exception + VIM::evaluate( "s:ErrMsg( 'Problem loading class \"%s\", was it already completed?' )" % name ) + end end -end -def load_buffer_module(name) - classdef = get_buffer_entity(name, 's:GetBufferRubyModule("%s")') - return if classdef == nil + def load_buffer_module(name) + classdef = get_buffer_entity(name, 's:GetBufferRubyModule("%s")') + return if classdef == nil - begin - eval classdef - rescue Exception - VIM::evaluate( "s:ErrMsg( 'Problem loading module \"%s\", was it already completed?' )" % name ) - end -end - -def get_buffer_entity(name, vimfun) - loading_allowed = VIM::evaluate("exists('g:rubycomplete_buffer_loading') && g:rubycomplete_buffer_loading") - return nil if loading_allowed != '1' - return nil if /(\"|\')+/.match( name ) - buf = VIM::Buffer.current - nums = eval( VIM::evaluate( vimfun % name ) ) - return nil if nums == nil - return nil if nums.min == nums.max && nums.min == 0 - - cur_line = VIM::Buffer.current.line_number - classdef = "" - nums.each do |x| - if x != cur_line - ln = buf[x] - classdef += "%s\n" % ln + begin + eval classdef + rescue Exception + VIM::evaluate( "s:ErrMsg( 'Problem loading module \"%s\", was it already completed?' )" % name ) end end - return classdef -end + def get_buffer_entity(name, vimfun) + loading_allowed = VIM::evaluate("exists('g:rubycomplete_buffer_loading') && g:rubycomplete_buffer_loading") + return nil if loading_allowed != '1' + return nil if /(\"|\')+/.match( name ) + buf = VIM::Buffer.current + nums = eval( VIM::evaluate( vimfun % name ) ) + return nil if nums == nil + return nil if nums.min == nums.max && nums.min == 0 + + cur_line = VIM::Buffer.current.line_number + classdef = "" + nums.each do |x| + if x != cur_line + ln = buf[x] + classdef += "%s\n" % ln if /class|def\s+|include/.match(ln) + classdef += "end\n" if /def\s+/.match(ln) + end + end + classdef += "end\n" if classdef.length > 1 -def get_var_type( receiver ) - if /(\"|\')+/.match( receiver ) - "String" - else - VIM::evaluate("s:GetRubyVarType('%s')" % receiver) + return classdef end -end - -def get_buffer_entity_list( type ) - # this will be a little expensive. - loading_allowed = VIM::evaluate("exists('g:rubycomplete_buffer_loading') && g:rubycomplete_buffer_loading") - allow_aggressive_load = VIM::evaluate("exists('g:rubycomplete_classes_in_global') && g:rubycomplete_classes_in_global") - return [] if allow_aggressive_load != '1' || loading_allowed != '1' - - buf = VIM::Buffer.current - eob = buf.length - ret = [] - rg = 1..eob - re = eval( "/^\s*%s\s*([A-Za-z0-9_-]*)(\s*<\s*([A-Za-z0-9_:-]*))?\s*/" % type ) - - rg.each do |x| - if re.match( buf[x] ) - next if type == "def" && eval( VIM::evaluate("s:IsPosInClassDef(%s)" % x) ) != nil - ret.push $1 + + def get_var_type( receiver ) + if /(\"|\')+/.match( receiver ) + "String" + else + VIM::evaluate("s:GetRubyVarType('%s')" % receiver) end end - return ret -end - -def get_buffer_methods - return get_buffer_entity_list( "def" ) -end - -def get_buffer_classes - 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 != '1' - - buf_path = VIM::evaluate('expand("%:p")') - file_name = VIM::evaluate('expand("%:t")') - path = buf_path.gsub( file_name, '' ) - path.gsub!( /\\/, "/" ) - pup = [ "./", "../", "../../", "../../../", "../../../../" ] - pok = nil - - pup.each do |sup| - tpok = "%s%sconfig" % [ path, sup ] - if File.exists?( tpok ) - pok = tpok - break + def get_buffer_entity_list( type ) + # this will be a little expensive. + loading_allowed = VIM::evaluate("exists('g:rubycomplete_buffer_loading') && g:rubycomplete_buffer_loading") + allow_aggressive_load = VIM::evaluate("exists('g:rubycomplete_classes_in_global') && g:rubycomplete_classes_in_global") + return [] if allow_aggressive_load != '1' || loading_allowed != '1' + + buf = VIM::Buffer.current + eob = buf.length + ret = [] + rg = 1..eob + re = eval( "/^\s*%s\s*([A-Za-z0-9_-]*)(\s*<\s*([A-Za-z0-9_:-]*))?\s*/" % type ) + + rg.each do |x| + if re.match( buf[x] ) + next if type == "def" && eval( VIM::evaluate("s:IsPosInClassDef(%s)" % x) ) != nil + ret.push $1 + end end + + return ret end - return if pok == nil + def get_buffer_methods + return get_buffer_entity_list( "def" ) + end - bootfile = pok + "/boot.rb" - envfile = pok + "/environment.rb" - if File.exists?( bootfile ) && File.exists?( envfile ) - begin - require bootfile - require envfile + def get_buffer_classes + 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 != '1' + + buf_path = VIM::evaluate('expand("%:p")') + file_name = VIM::evaluate('expand("%:t")') + path = buf_path.gsub( file_name, '' ) + path.gsub!( /\\/, "/" ) + pup = [ "./", "../", "../../", "../../../", "../../../../" ] + pok = nil + + pup.each do |sup| + tpok = "%s%sconfig" % [ path, sup ] + if File.exists?( tpok ) + pok = tpok + break + end + end + + return if pok == nil + + bootfile = pok + "/boot.rb" + envfile = pok + "/environment.rb" + if File.exists?( bootfile ) && File.exists?( envfile ) begin - require 'console_app' - require 'console_with_helpers' + require bootfile + require envfile + begin + require 'console_app' + require 'console_with_helpers' + rescue Exception + # assume 1.0 + end + Rails::Initializer.run + VIM::command('let s:rubycomplete_rails_loaded = 1') rescue Exception - # assume 1.0 + VIM::evaluate( "s:ErrMsg('Error loading rails environment')" ) end - Rails::Initializer.run - VIM::command('let s:rubycomplete_rails_loaded = 1') - rescue Exception - VIM::evaluate( "s:ErrMsg('Error loading rails environment')" ) end end -end - -def get_rails_helpers - allow_rails = VIM::evaluate("exists('g:rubycomplete_rails') && g:rubycomplete_rails") - rails_loaded = VIM::evaluate('s:rubycomplete_rails_loaded') - return [] if allow_rails != '1' || rails_loaded != '1' - return RailsWords -end - -def add_rails_columns( cls ) - allow_rails = VIM::evaluate("exists('g:rubycomplete_rails') && g:rubycomplete_rails") - rails_loaded = VIM::evaluate('s:rubycomplete_rails_loaded') - return [] if allow_rails != '1' || rails_loaded != '1' - eval( "#{cls}.establish_connection" ) - return [] unless eval( "#{cls}.ancestors.include?(ActiveRecord::Base).to_s" ) - col = eval( "#{cls}.column_names" ) - return col if col - return [] -end - -def clean_sel(sel, msg) - sel.delete_if { |x| x == nil } - sel.uniq! - sel.grep(/^#{Regexp.quote(msg)}/) if msg != nil -end - -def get_rails_view_methods - allow_rails = VIM::evaluate("exists('g:rubycomplete_rails') && g:rubycomplete_rails") - rails_loaded = VIM::evaluate('s:rubycomplete_rails_loaded') - return [] if allow_rails != '1' || rails_loaded != '1' - - buf_path = VIM::evaluate('expand("%:p")') - file_name = VIM::evaluate('expand("%:t")') - path = buf_path.gsub( file_name, '' ) - - return [] unless /.*.{1}app.{1}views.{1}.*.{1}/.match( path ) - - clspl = File.basename( path ).camelize.pluralize - cls = clspl.singularize - ret = [] - ret += eval( "#{cls}.instance_methods" ) - ret += eval( "#{clspl}Helper.instance_methods" ) - return ret -end - -def get_completions(base) - loading_allowed = VIM::evaluate("exists('g:rubycomplete_buffer_loading') && g:rubycomplete_buffer_loading") - if loading_allowed == '1' - load_requires - load_rails + + def get_rails_helpers + allow_rails = VIM::evaluate("exists('g:rubycomplete_rails') && g:rubycomplete_rails") + rails_loaded = VIM::evaluate('s:rubycomplete_rails_loaded') + return [] if allow_rails != '1' || rails_loaded != '1' + return @@RailsWords end - input = VIM::Buffer.current.line - cpos = VIM::Window.current.cursor[1] - 1 - input = input[0..cpos] - input += base - input.sub!(/.*[ \t\n\"\\'`><=;|&{(]/, '') # Readline.basic_word_break_characters - input.sub!(/self\./, '') - - message = nil - receiver = nil - methods = [] - variables = [] - classes = [] - - case input - when /^(\/[^\/]*\/)\.([^.]*)$/ # Regexp - receiver = $1 - message = Regexp.quote($2) - methods = Regexp.instance_methods(true) - - when /^([^\]]*\])\.([^.]*)$/ # Array - receiver = $1 - message = Regexp.quote($2) - methods = Array.instance_methods(true) - - when /^([^\}]*\})\.([^.]*)$/ # Proc or Hash - receiver = $1 - message = Regexp.quote($2) - methods = Proc.instance_methods(true) | Hash.instance_methods(true) - - when /^(:[^:.]*)$/ # Symbol - if Symbol.respond_to?(:all_symbols) - receiver = $1 - message = $1.sub( /:/, '' ) - methods = Symbol.all_symbols.collect{|s| s.id2name} - methods.delete_if { |c| c.match( /'/ ) } - end + def add_rails_columns( cls ) + allow_rails = VIM::evaluate("exists('g:rubycomplete_rails') && g:rubycomplete_rails") + rails_loaded = VIM::evaluate('s:rubycomplete_rails_loaded') + return [] if allow_rails != '1' || rails_loaded != '1' + eval( "#{cls}.establish_connection" ) + return [] unless eval( "#{cls}.ancestors.include?(ActiveRecord::Base).to_s" ) + col = eval( "#{cls}.column_names" ) + return col if col + return [] + end - when /^::([A-Z][^:\.\(]*)$/ # Absolute Constant or class methods - receiver = $1 - methods = Object.constants - methods.grep(/^#{receiver}/).collect{|e| "::" + e} + def clean_sel(sel, msg) + sel.delete_if { |x| x == nil } + sel.uniq! + sel.grep(/^#{Regexp.quote(msg)}/) if msg != nil + end - when /^(((::)?[A-Z][^:.\(]*)+)::?([^:.]*)$/ # Constant or class methods - receiver = $1 - message = Regexp.quote($4) - begin - methods = eval("#{receiver}.constants | #{receiver}.methods") - rescue Exception - methods = [] - end - methods.grep(/^#{message}/).collect{|e| receiver + "::" + e} + def get_rails_view_methods + allow_rails = VIM::evaluate("exists('g:rubycomplete_rails') && g:rubycomplete_rails") + rails_loaded = VIM::evaluate('s:rubycomplete_rails_loaded') + return [] if allow_rails != '1' || rails_loaded != '1' - when /^(:[^:.]+)\.([^.]*)$/ # Symbol - receiver = $1 - message = Regexp.quote($2) - methods = Symbol.instance_methods(true) + buf_path = VIM::evaluate('expand("%:p")') + file_name = VIM::evaluate('expand("%:t")') + path = buf_path.gsub( file_name, '' ) - when /^([0-9_]+(\.[0-9_]+)?(e[0-9]+)?)\.([^.]*)$/ # Numeric - receiver = $1 - message = Regexp.quote($4) - begin - methods = eval(receiver).methods - rescue Exception - methods = [] - end + return [] unless /.*.{1}app.{1}views.{1}.*.{1}/.match( path ) + + clspl = File.basename( path ).camelize.pluralize + cls = clspl.singularize + ret = [] + ret += eval( "#{cls}.instance_methods" ) + ret += eval( "#{clspl}Helper.instance_methods" ) + return ret + end + + def self.get_completions(base) + b = VimRubyCompletion.new + b.get_completions base + end + + def get_completions(base) + loading_allowed = VIM::evaluate("exists('g:rubycomplete_buffer_loading') && g:rubycomplete_buffer_loading") + if loading_allowed == '1' + load_requires + load_rails + end + + input = VIM::Buffer.current.line + cpos = VIM::Window.current.cursor[1] - 1 + input = input[0..cpos] + input += base + input.sub!(/.*[ \t\n\"\\'`><=;|&{(]/, '') # Readline.basic_word_break_characters + input.sub!(/self\./, '') + + message = nil + receiver = nil + methods = [] + variables = [] + classes = [] + + case input + when /^(\/[^\/]*\/)\.([^.]*)$/ # Regexp + receiver = $1 + message = Regexp.quote($2) + methods = Regexp.instance_methods(true) - when /^(\$[^.]*)$/ #global - methods = global_variables.grep(Regexp.new(Regexp.quote($1))) + when /^([^\]]*\])\.([^.]*)$/ # Array + receiver = $1 + message = Regexp.quote($2) + methods = Array.instance_methods(true) - when /^((\.?[^.]+)+)\.([^.]*)$/ # variable - receiver = $1 - message = Regexp.quote($3) - load_buffer_class( receiver ) + when /^([^\}]*\})\.([^.]*)$/ # Proc or Hash + receiver = $1 + message = Regexp.quote($2) + methods = Proc.instance_methods(true) | Hash.instance_methods(true) + + when /^(:[^:.]*)$/ # Symbol + if Symbol.respond_to?(:all_symbols) + receiver = $1 + message = $1.sub( /:/, '' ) + methods = Symbol.all_symbols.collect{|s| s.id2name} + methods.delete_if { |c| c.match( /'/ ) } + end - cv = eval("self.class.constants") - vartype = get_var_type( receiver ) - if vartype != '' - load_buffer_class( vartype ) + when /^::([A-Z][^:\.\(]*)$/ # Absolute Constant or class methods + receiver = $1 + methods = Object.constants + methods.grep(/^#{receiver}/).collect{|e| "::" + e} + when /^(((::)?[A-Z][^:.\(]*)+)::?([^:.]*)$/ # Constant or class methods + receiver = $1 + message = Regexp.quote($4) begin - methods = eval("#{vartype}.instance_methods") - variables = eval("#{vartype}.instance_variables") + methods = eval("#{receiver}.constants | #{receiver}.methods") rescue Exception + methods = [] end - elsif (cv).include?(receiver) - # foo.func and foo is local var. - methods = eval("#{receiver}.methods") - vartype = receiver - elsif /^[A-Z]/ =~ receiver and /\./ !~ receiver - vartype = receiver - # Foo::Bar.func + methods.grep(/^#{message}/).collect{|e| receiver + "::" + e} + + when /^(:[^:.]+)\.([^.]*)$/ # Symbol + receiver = $1 + message = Regexp.quote($2) + methods = Symbol.instance_methods(true) + + when /^([0-9_]+(\.[0-9_]+)?(e[0-9]+)?)\.([^.]*)$/ # Numeric + receiver = $1 + message = Regexp.quote($4) begin - methods = eval("#{receiver}.methods") + methods = eval(receiver).methods rescue Exception + methods = [] end - else - # func1.func2 - ObjectSpace.each_object(Module){|m| - next if m.name != "IRB::Context" and - /^(IRB|SLex|RubyLex|RubyToken)/ =~ m.name - methods.concat m.instance_methods(false) - } - end - variables += add_rails_columns( "#{vartype}" ) if vartype && vartype.length > 0 - when /^\(?\s*[A-Za-z0-9:^@.%\/+*\(\)]+\.\.\.?[A-Za-z0-9:^@.%\/+*\(\)]+\s*\)?\.([^.]*)/ - message = $1 - methods = Range.instance_methods(true) + when /^(\$[^.]*)$/ #global + methods = global_variables.grep(Regexp.new(Regexp.quote($1))) - when /^\.([^.]*)$/ # unknown(maybe String) - message = Regexp.quote($1) - methods = String.instance_methods(true) + when /^((\.?[^.]+)+)\.([^.]*)$/ # variable + receiver = $1 + message = Regexp.quote($3) + load_buffer_class( receiver ) - else - inclass = eval( VIM::evaluate("s:IsInClassDef()") ) + cv = eval("self.class.constants") + vartype = get_var_type( receiver ) + if vartype != '' + load_buffer_class( vartype ) + + begin + methods = eval("#{vartype}.instance_methods") + variables = eval("#{vartype}.instance_variables") + rescue Exception + end + elsif (cv).include?(receiver) + # foo.func and foo is local var. + methods = eval("#{receiver}.methods") + vartype = receiver + elsif /^[A-Z]/ =~ receiver and /\./ !~ receiver + vartype = receiver + # Foo::Bar.func + begin + methods = eval("#{receiver}.methods") + rescue Exception + end + else + # func1.func2 + ObjectSpace.each_object(Module){|m| + next if m.name != "IRB::Context" and + /^(IRB|SLex|RubyLex|RubyToken)/ =~ m.name + methods.concat m.instance_methods(false) + } + end + variables += add_rails_columns( "#{vartype}" ) if vartype && vartype.length > 0 - if inclass != nil - classdef = "%s\n" % VIM::Buffer.current[ inclass.min ] - found = /^\s*class\s*([A-Za-z0-9_-]*)(\s*<\s*([A-Za-z0-9_:-]*))?\s*\n$/.match( classdef ) + when /^\(?\s*[A-Za-z0-9:^@.%\/+*\(\)]+\.\.\.?[A-Za-z0-9:^@.%\/+*\(\)]+\s*\)?\.([^.]*)/ + message = $1 + methods = Range.instance_methods(true) - if found != nil - receiver = $1 - message = input - load_buffer_class( receiver ) - begin - methods = eval( "#{receiver}.instance_methods" ) - methods += get_rails_helpers - variables += add_rails_columns( "#{receiver}" ) - rescue Exception - found = nil + when /^\.([^.]*)$/ # unknown(maybe String) + message = Regexp.quote($1) + methods = String.instance_methods(true) + + else + inclass = eval( VIM::evaluate("s:IsInClassDef()") ) + + if inclass != nil + classdef = "%s\n" % VIM::Buffer.current[ inclass.min ] + found = /^\s*class\s*([A-Za-z0-9_-]*)(\s*<\s*([A-Za-z0-9_:-]*))?\s*\n$/.match( classdef ) + + if found != nil + receiver = $1 + message = input + load_buffer_class( receiver ) + begin + methods = eval( "#{receiver}.instance_methods" ) + methods += get_rails_helpers + variables += add_rails_columns( "#{receiver}" ) + rescue Exception + found = nil + end end end - end - if inclass == nil || found == nil - methods = get_buffer_methods - methods += get_rails_view_methods - classes = eval("self.class.constants") - classes += get_buffer_classes - message = receiver = input + if inclass == nil || found == nil + methods = get_buffer_methods + methods += get_rails_view_methods + classes = eval("self.class.constants") + classes += get_buffer_classes + message = receiver = input + end end - end - methods = clean_sel( methods, message ) - methods = (methods-Object.instance_methods) - variables = clean_sel( variables, message ) - classes = clean_sel( classes, message ) - valid = [] - valid += methods.collect { |m| { :name => m, :type => 'f' } } - valid += variables.collect { |v| { :name => v, :type => 'v' } } - valid += classes.collect { |c| { :name => c, :type => 't' } } - valid.sort! { |x,y| x[:name] <=> y[:name] } - - outp = "" - - rg = 0..valid.length - rg.step(150) do |x| - stpos = 0+x - enpos = 150+x - valid[stpos..enpos].each { |c| outp += "{'word':'%s','item':'%s','kind':'%s'}," % [ c[:name], c[:name], c[:type] ] } - outp.sub!(/,$/, '') - - VIM::command("call extend(g:rubycomplete_completions, [%s])" % outp) + methods = clean_sel( methods, message ) + methods = (methods-Object.instance_methods) + variables = clean_sel( variables, message ) + classes = clean_sel( classes, message ) + valid = [] + valid += methods.collect { |m| { :name => m, :type => 'f' } } + valid += variables.collect { |v| { :name => v, :type => 'v' } } + valid += classes.collect { |c| { :name => c, :type => 't' } } + valid.sort! { |x,y| x[:name] <=> y[:name] } + outp = "" + + rg = 0..valid.length + rg.step(150) do |x| + stpos = 0+x + enpos = 150+x + valid[stpos..enpos].each { |c| outp += "{'word':'%s','item':'%s','kind':'%s'}," % [ c[:name], c[:name], c[:type] ] } + outp.sub!(/,$/, '') + + VIM::command("call extend(g:rubycomplete_completions, [%s])" % outp) + outp = "" + end end -end -# }}} ruby completion +end # VimRubyCompletion +# }}} ruby completion RUBYEOF endfunction From 92019203946c56b5a3b341edad5968d8bd89b1c9 Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Fri, 8 Sep 2006 02:59:25 +0000 Subject: [PATCH 299/411] autoload rubygems if possible. added debugging print. clean up the buffer loading code a bit --- ChangeLog | 4 +++ autoload/rubycomplete.vim | 76 +++++++++++++++++++++++++++++++-------- 2 files changed, 66 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6b2ea825..945673c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-09-07 Mark Guzman + * autoload/rubycomplete.vim: autoload rubygems if possible. added + debugging print. clean up the buffer loading code a bit + 2006-08-21 Mark Guzman * autoload/rubycomplete.vim: modified the buffer loading code to prevent syntax errors from stopping completion diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 015d2daa..599aee5e 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,11 +1,10 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.35 2006/08/21 19:52:49 segy Exp $ +" Info: $Id: rubycomplete.vim,v 1.36 2006/09/08 02:59:25 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns -" Version: 0.7 " ---------------------------------------------------------------------------- " " Ruby IRB/Complete author: Keiju ISHITSUKA(keiju@ishitsuka.com) @@ -35,6 +34,9 @@ if !exists("g:rubycomplete_buffer_loading") let g:rubycomplete_classes_in_global = 0 endif +if !exists("g:rubycomplete_rails_proactive") + let g:rubycomplete_rails_proactive = 0 +endif " {{{ vim-side support functions function! s:ErrMsg(msg) @@ -93,23 +95,27 @@ function! s:GetRubyVarType(v) let stopline = 1 let vtp = '' let pos = getpos('.') - let [lnum,lcol] = searchpos('^\s*#\s*@var\s*'.a:v.'\>\s\+[^ \t]\+\s*$','nb',stopline) + let sstr = '^\s*#\s*@var\s*'.a:v.'\>\s\+[^ \t]\+\s*$' + let [lnum,lcol] = searchpos(sstr,'nb',stopline) if lnum != 0 && lcol != 0 call setpos('.',pos) let str = getline(lnum) - let vtp = substitute(str,'^\s*#\s*@var\s*'.a:v.'\>\s\+\([^ \t]\+\)\s*$','\1','') + let vtp = substitute(str,sstr,'\1','') return vtp endif call setpos('.',pos) + let ctors = '\(now\|new\|open\|get_instance' if exists('g:rubycomplete_rails') && g:rubycomplete_rails == 1 && s:rubycomplete_rails_loaded == 1 - let ctors = '\(now\|new\|open\|get_instance\|find\|create\)' + let ctors = ctors.'\|find\|create' else - let ctors = '\(now\|new\|open\|get_instance\)' endif + let ctors = ctors.'\)' - let [lnum,lcol] = searchpos(''.a:v.'\>\s*[+\-*/]*=\s*\([^ \t]\+.' . ctors .'\>\|[\[{"''/]\|%r{\|[A-Za-z0-9@:\-()]\+...\?\)','nb',stopline) + let fstr = '=\s*\([^ \t]\+.' . ctors .'\>\|[\[{"''/]\|%r{\|[A-Za-z0-9@:\-()\.]\+...\?\)' + let sstr = ''.a:v.'\>\s*[+\-*/]*'.fstr + let [lnum,lcol] = searchpos(sstr,'nb',stopline) if lnum != 0 && lcol != 0 - let str = matchstr(getline(lnum),'=\s*\([^ \t]\+.' . ctors . '\>\|[\[{"''/]\|%r{\|[A-Za-z0-9@:\-()]\+...\?\)',lcol) + let str = matchstr(getline(lnum),fstr,lcol) let str = substitute(str,'^=\s*','','') call setpos('.',pos) if str == '"' || str == '''' @@ -167,6 +173,7 @@ ruby << RUBYEOF # {{{ ruby completion class VimRubyCompletion # {{{ constants + @@debug = false @@RailsWords = [ "has_many", "has_one", "belongs_to", @@ -199,6 +206,11 @@ class VimRubyCompletion def load_requires + begin + require 'rubygems' + rescue Exception + #ignore? + end buf = VIM::Buffer.current enum = buf.line_number nums = Range.new( 1, enum ) @@ -254,8 +266,11 @@ class VimRubyCompletion nums.each do |x| if x != cur_line ln = buf[x] - classdef += "%s\n" % ln if /class|def\s+|include/.match(ln) - classdef += "end\n" if /def\s+/.match(ln) + if /(module|class|def|include)\s+/.match(ln) + classdef += "%s\n" % ln + classdef += "end\n" if /def\s+/.match(ln) + dprint ln + end end end classdef += "end\n" if classdef.length > 1 @@ -271,6 +286,10 @@ class VimRubyCompletion end end + def dprint( txt ) + print txt if @@debug + end + def get_buffer_entity_list( type ) # this will be a little expensive. loading_allowed = VIM::evaluate("exists('g:rubycomplete_buffer_loading') && g:rubycomplete_buffer_loading") @@ -293,6 +312,10 @@ class VimRubyCompletion return ret end + def get_buffer_modules + return get_buffer_entity_list( "modules" ) + end + def get_buffer_methods return get_buffer_entity_list( "def" ) end @@ -301,6 +324,14 @@ class VimRubyCompletion return get_buffer_entity_list( "class" ) end + def self.pre_load_rails + require 'thread' + Thread.new do + v = VimRubyCompletion.new + v.load_rails + end + end + def load_rails allow_rails = VIM::evaluate("exists('g:rubycomplete_rails') && g:rubycomplete_rails") return if allow_rails != '1' @@ -353,10 +384,14 @@ class VimRubyCompletion allow_rails = VIM::evaluate("exists('g:rubycomplete_rails') && g:rubycomplete_rails") rails_loaded = VIM::evaluate('s:rubycomplete_rails_loaded') return [] if allow_rails != '1' || rails_loaded != '1' - eval( "#{cls}.establish_connection" ) - return [] unless eval( "#{cls}.ancestors.include?(ActiveRecord::Base).to_s" ) - col = eval( "#{cls}.column_names" ) - return col if col + begin + eval( "#{cls}.establish_connection" ) + return [] unless eval( "#{cls}.ancestors.include?(ActiveRecord::Base).to_s" ) + col = eval( "#{cls}.column_names" ) + return col if col + rescue + return [] + end return [] end @@ -427,6 +462,7 @@ class VimRubyCompletion methods = Proc.instance_methods(true) | Hash.instance_methods(true) when /^(:[^:.]*)$/ # Symbol + dprint "symbol" if Symbol.respond_to?(:all_symbols) receiver = $1 message = $1.sub( /:/, '' ) @@ -435,11 +471,13 @@ class VimRubyCompletion end when /^::([A-Z][^:\.\(]*)$/ # Absolute Constant or class methods + dprint "const or cls" receiver = $1 methods = Object.constants methods.grep(/^#{receiver}/).collect{|e| "::" + e} when /^(((::)?[A-Z][^:.\(]*)+)::?([^:.]*)$/ # Constant or class methods + dprint "const or cls 2" receiver = $1 message = Regexp.quote($4) begin @@ -473,6 +511,7 @@ class VimRubyCompletion cv = eval("self.class.constants") vartype = get_var_type( receiver ) + dprint "vartype: %s" % vartype if vartype != '' load_buffer_class( vartype ) @@ -480,6 +519,7 @@ class VimRubyCompletion methods = eval("#{vartype}.instance_methods") variables = eval("#{vartype}.instance_variables") rescue Exception + dprint "load_buffer_class err: %s" % $! end elsif (cv).include?(receiver) # foo.func and foo is local var. @@ -536,8 +576,11 @@ class VimRubyCompletion methods += get_rails_view_methods classes = eval("self.class.constants") classes += get_buffer_classes + classes += get_buffer_modules message = receiver = input end + + methods += Kernel.public_methods end methods = clean_sel( methods, message ) @@ -572,4 +615,9 @@ endfunction let s:rubycomplete_rails_loaded = 0 call s:DefRuby() + + +if g:rubycomplete_rails_proactive == 1 + execute "ruby VimRubyCompletion.pre_load_rails" +endif " vim:tw=78:sw=4:ts=8:et:fdm=marker:ft=vim:norl: From d5604680ca7adab6a2f8259537eabfd17467d062 Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Tue, 19 Sep 2006 04:10:31 +0000 Subject: [PATCH 300/411] improved rails view support. included rails helpers in rails completions. kernel elements are also included in default completions. improved the handling of "broken" code. --- ChangeLog | 5 ++ autoload/rubycomplete.vim | 126 ++++++++++++++++++++++++-------------- 2 files changed, 84 insertions(+), 47 deletions(-) diff --git a/ChangeLog b/ChangeLog index 945673c2..5c457f34 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-09-19 Mark Guzman + * autoload/rubycomplete.vim: improved rails view support. included + rails helpers in rails completions. kernel elements are also included + in default completions. improved the handling of "broken" code. + 2006-09-07 Mark Guzman * autoload/rubycomplete.vim: autoload rubygems if possible. added debugging print. clean up the buffer loading code a bit diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 599aee5e..574161b7 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,10 +1,11 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.36 2006/09/08 02:59:25 segy Exp $ +" Info: $Id: rubycomplete.vim,v 1.37 2006/09/19 04:10:32 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns +" Maintainer Version: 0.7 " ---------------------------------------------------------------------------- " " Ruby IRB/Complete author: Keiju ISHITSUKA(keiju@ishitsuka.com) @@ -88,7 +89,7 @@ function! s:IsPosInClassDef(pos) let ret = snum . '..' . enum endif - return ret + return ret endfunction function! s:GetRubyVarType(v) @@ -171,14 +172,15 @@ endfunction function! s:DefRuby() ruby << RUBYEOF # {{{ ruby completion + +begin + require 'rubygems' +rescue Exception + #ignore? +end class VimRubyCompletion # {{{ constants @@debug = false - @@RailsWords = [ - "has_many", "has_one", - "belongs_to", - ] - @@ReservedWords = [ "BEGIN", "END", "alias", "and", @@ -206,11 +208,6 @@ class VimRubyCompletion def load_requires - begin - require 'rubygems' - rescue Exception - #ignore? - end buf = VIM::Buffer.current enum = buf.line_number nums = Range.new( 1, enum ) @@ -266,8 +263,8 @@ class VimRubyCompletion nums.each do |x| if x != cur_line ln = buf[x] - if /(module|class|def|include)\s+/.match(ln) - classdef += "%s\n" % ln + if /^\s*(module|class|def|include)\s+/.match(ln) + classdef += "%s\n" % ln classdef += "end\n" if /def\s+/.match(ln) dprint ln end @@ -295,7 +292,7 @@ class VimRubyCompletion loading_allowed = VIM::evaluate("exists('g:rubycomplete_buffer_loading') && g:rubycomplete_buffer_loading") allow_aggressive_load = VIM::evaluate("exists('g:rubycomplete_classes_in_global') && g:rubycomplete_classes_in_global") return [] if allow_aggressive_load != '1' || loading_allowed != '1' - + buf = VIM::Buffer.current eob = buf.length ret = [] @@ -305,11 +302,11 @@ class VimRubyCompletion rg.each do |x| if re.match( buf[x] ) next if type == "def" && eval( VIM::evaluate("s:IsPosInClassDef(%s)" % x) ) != nil - ret.push $1 + ret.push $1 end end - return ret + return ret end def get_buffer_modules @@ -324,13 +321,6 @@ class VimRubyCompletion return get_buffer_entity_list( "class" ) end - def self.pre_load_rails - require 'thread' - Thread.new do - v = VimRubyCompletion.new - v.load_rails - end - end def load_rails allow_rails = VIM::evaluate("exists('g:rubycomplete_rails') && g:rubycomplete_rails") @@ -338,23 +328,38 @@ class VimRubyCompletion buf_path = VIM::evaluate('expand("%:p")') file_name = VIM::evaluate('expand("%:t")') - path = buf_path.gsub( file_name, '' ) - path.gsub!( /\\/, "/" ) - pup = [ "./", "../", "../../", "../../../", "../../../../" ] - pok = nil - - pup.each do |sup| - tpok = "%s%sconfig" % [ path, sup ] - if File.exists?( tpok ) - pok = tpok - break + vim_dir = VIM::evaluate('getcwd()') + file_dir = buf_path.gsub( file_name, '' ) + file_dir.gsub!( /\\/, "/" ) + vim_dir.gsub!( /\\/, "/" ) + vim_dir << "/" + dirs = [ vim_dir, file_dir ] + sdirs = [ "", "./", "../", "../../", "../../../", "../../../../" ] + rails_base = nil + + dirs.each do |dir| + sdirs.each do |sub| + trail = "%s%s" % [ dir, sub ] + tcfg = "%sconfig" % trail + + if File.exists?( tcfg ) + rails_base = trail + break + end end + break if rails_base end - return if pok == nil + return if rails_base == nil + $:.push rails_base unless $:.index( rails_base ) - bootfile = pok + "/boot.rb" - envfile = pok + "/environment.rb" + rails_config = rails_base + "config/" + rails_lib = rails_base + "lib/" + $:.push rails_config unless $:.index( rails_config ) + $:.push rails_lib unless $:.index( rails_lib ) + + bootfile = rails_config + "boot.rb" + envfile = rails_config + "environment.rb" if File.exists?( bootfile ) && File.exists?( envfile ) begin require bootfile @@ -363,11 +368,13 @@ class VimRubyCompletion require 'console_app' require 'console_with_helpers' rescue Exception + dprint "Rails 1.1+ Error %s" % $! # assume 1.0 end - Rails::Initializer.run + eval( "Rails::Initializer.run" ) VIM::command('let s:rubycomplete_rails_loaded = 1') rescue Exception + dprint "Rails Error %s" % $! VIM::evaluate( "s:ErrMsg('Error loading rails environment')" ) end end @@ -377,7 +384,31 @@ class VimRubyCompletion allow_rails = VIM::evaluate("exists('g:rubycomplete_rails') && g:rubycomplete_rails") rails_loaded = VIM::evaluate('s:rubycomplete_rails_loaded') return [] if allow_rails != '1' || rails_loaded != '1' - return @@RailsWords + + buf_path = VIM::evaluate('expand("%:p")') + buf_path.gsub!( /\\/, "/" ) + path_elm = buf_path.split( "/" ) + i = path_elm.index( "app" ) + + return [] unless i + i += 1 + type = path_elm[i] + type.downcase! + + ret = [] + case type + when "views" + ret += ActionView::Base.instance_methods + ret += ActionView::Base.methods + when "controllers" + ret += ActionController::Base.instance_methods + ret += ActionController::Base.methods + when "models" + ret += ActiveRecord::Base.instance_methods + ret += ActiveRecord::Base.methods + end + + return ret end def add_rails_columns( cls ) @@ -407,13 +438,16 @@ class VimRubyCompletion return [] if allow_rails != '1' || rails_loaded != '1' buf_path = VIM::evaluate('expand("%:p")') - file_name = VIM::evaluate('expand("%:t")') - path = buf_path.gsub( file_name, '' ) + buf_path.gsub!( /\\/, "/" ) + pelm = buf_path.split( "/" ) + idx = pelm.index( "views" ) - return [] unless /.*.{1}app.{1}views.{1}.*.{1}/.match( path ) + return [] unless idx + idx += 1 - clspl = File.basename( path ).camelize.pluralize + clspl = pelm[idx].camelize.pluralize cls = clspl.singularize + ret = [] ret += eval( "#{cls}.instance_methods" ) ret += eval( "#{clspl}Helper.instance_methods" ) @@ -573,6 +607,7 @@ class VimRubyCompletion if inclass == nil || found == nil methods = get_buffer_methods + methods += get_rails_helpers methods += get_rails_view_methods classes = eval("self.class.constants") classes += get_buffer_classes @@ -608,7 +643,7 @@ class VimRubyCompletion end end # VimRubyCompletion -# }}} ruby completion +# }}} ruby completion RUBYEOF endfunction @@ -617,7 +652,4 @@ let s:rubycomplete_rails_loaded = 0 call s:DefRuby() -if g:rubycomplete_rails_proactive == 1 - execute "ruby VimRubyCompletion.pre_load_rails" -endif " vim:tw=78:sw=4:ts=8:et:fdm=marker:ft=vim:norl: From 756c1ac1c94bf90e1cd518a8e1fe123eae696254 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Mon, 23 Oct 2006 15:03:03 +0000 Subject: [PATCH 301/411] recognise '-' trim mode eRuby block delimiters --- ChangeLog | 12 +++++++++--- syntax/eruby.vim | 10 +++++----- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5c457f34..6e64c226 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,14 @@ -2006-09-19 Mark Guzman +2006-10-24 Doug Kearns + + * syntax/eruby.vim: recognise '-' trim mode block delimiters (Nikolai + Weibull) + +2006-09-19 Mark Guzman * autoload/rubycomplete.vim: improved rails view support. included rails helpers in rails completions. kernel elements are also included in default completions. improved the handling of "broken" code. -2006-09-07 Mark Guzman +2006-09-07 Mark Guzman * autoload/rubycomplete.vim: autoload rubygems if possible. added debugging print. clean up the buffer loading code a bit @@ -11,7 +16,8 @@ * autoload/rubycomplete.vim: modified the buffer loading code to prevent syntax errors from stopping completion -2006-07-12 Mark Guzman +2006-07-12 Mark Guzman + * autoload/rubycomplete.vim: added in-buffer method def handling. also added an inital attempt at handling completion in a rails view diff --git a/syntax/eruby.vim b/syntax/eruby.vim index a8219f40..0eb7b313 100644 --- a/syntax/eruby.vim +++ b/syntax/eruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: eRuby " Maintainer: Doug Kearns -" Info: $Id: eruby.vim,v 1.8 2006/04/15 12:01:18 dkearns Exp $ +" Info: $Id: eruby.vim,v 1.9 2006/10/23 15:03:03 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -29,10 +29,10 @@ endif syn cluster erubyRegions contains=erubyOneLiner,erubyBlock,erubyExpression,erubyComment -syn region erubyOneLiner matchgroup=erubyDelimiter start="^%%\@!" end="$" contains=@rubyTop containedin=ALLBUT,@erubyRegions keepend oneline -syn region erubyBlock matchgroup=erubyDelimiter start="<%%\@!" end="%>" contains=@rubyTop containedin=ALLBUT,@erubyRegions -syn region erubyExpression matchgroup=erubyDelimiter start="<%=" end="%>" contains=@rubyTop containedin=ALLBUT,@erubyRegions -syn region erubyComment matchgroup=erubyDelimiter start="<%#" end="%>" contains=rubyTodo,@Spell containedin=ALLBUT,@erubyRegions keepend +syn region erubyOneLiner matchgroup=erubyDelimiter start="^%%\@!" end="$" contains=@rubyTop containedin=ALLBUT,@erubyRegions keepend oneline +syn region erubyBlock matchgroup=erubyDelimiter start="<%%\@!-\=" end="-\=%>" contains=@rubyTop containedin=ALLBUT,@erubyRegions +syn region erubyExpression matchgroup=erubyDelimiter start="<%=" end="-\=%>" contains=@rubyTop containedin=ALLBUT,@erubyRegions +syn region erubyComment matchgroup=erubyDelimiter start="<%#" end="-\=%>" contains=rubyTodo,@Spell containedin=ALLBUT,@erubyRegions keepend " Define the default highlighting. " For version 5.7 and earlier: only when not done already From 50d4f083b071009dd286f9d721619fd314d515ae Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 28 Oct 2006 03:14:33 +0000 Subject: [PATCH 302/411] remove accidently included nextgroup arg in 'heredoc' syntax group definitions --- ChangeLog | 50 ++++++++++++++++++++++++++++--------------------- syntax/ruby.vim | 18 +++++++++--------- 2 files changed, 38 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6e64c226..f6699eed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,18 +1,26 @@ +2006-10-28 Doug Kearns + + * syntax/ruby.vim: remove accidently included nextgroup arg in + 'heredoc' syntax group definitions + 2006-10-24 Doug Kearns * syntax/eruby.vim: recognise '-' trim mode block delimiters (Nikolai Weibull) 2006-09-19 Mark Guzman + * autoload/rubycomplete.vim: improved rails view support. included rails helpers in rails completions. kernel elements are also included in default completions. improved the handling of "broken" code. 2006-09-07 Mark Guzman + * autoload/rubycomplete.vim: autoload rubygems if possible. added debugging print. clean up the buffer loading code a bit 2006-08-21 Mark Guzman + * autoload/rubycomplete.vim: modified the buffer loading code to prevent syntax errors from stopping completion @@ -36,13 +44,13 @@ 2006-06-19 Mark Guzman * autoload/rubycomplete.vim: modified to change the default - buffer loading behavior. buffers are no longer loaded/parsed - automatically. enabling this feature requires setting the + buffer loading behavior. buffers are no longer loaded/parsed + automatically. enabling this feature requires setting the variable g:rubycomplete_buffer_loading. this was done as a security measure, the default vim7 install should not execute any code. - * autoload/rubycomplete.vim: symbol completion now works. i + * autoload/rubycomplete.vim: symbol completion now works. i tested with global symbols as well as rails symbols. 2006-05-26 Doug Kearns @@ -51,7 +59,7 @@ 2006-05-25 Mark Guzman - * autoload/rubycomplete.vim: added rails column support. + * autoload/rubycomplete.vim: added rails column support. switched to dictionary with type specifiers for methods, classes, and variables. started/added rails 1.0 support. added rails database connection support. @@ -74,8 +82,8 @@ 2006-05-11 Mark Guzman - * autoload/rubycomplete.vim: added checks for the existance of - global config variables per dkearns' patch. refined error messages + * autoload/rubycomplete.vim: added checks for the existance of + global config variables per dkearns' patch. refined error messages to use vim error style 2006-05-11 Doug Kearns @@ -107,8 +115,8 @@ 2006-05-07 Mark Guzman - * autoload/rubycomplete.vim: Switched to script local vars, - per patch from dkearns. removed secondary array clause. applied + * autoload/rubycomplete.vim: Switched to script local vars, + per patch from dkearns. removed secondary array clause. applied patch provided by dkearns, fixes input handling. 2006-05-07 Doug Kearns @@ -129,40 +137,40 @@ 2006-04-28 Mark Guzman * autoload/rubycomplete.vim: started adding raw range support - 1..2.. fixed the symbol completion bug, where you + 1..2.. fixed the symbol completion bug, where you would end up with a double colon. 2006-04-27 Mark Guzman - * autoload/rubycomplete.vim: added variable type detection for + * autoload/rubycomplete.vim: added variable type detection for Ranges. added handlers for string completion: "test". 2006-04-26 Mark Guzman - * autoload/rubycomplete.vim: removed cWORD expansion in favor of - grabbing the whole line. added support for completing variables + * autoload/rubycomplete.vim: removed cWORD expansion in favor of + grabbing the whole line. added support for completing variables inside operations and parameter lists. removed excess cruft code. - removed commented code. + removed commented code. - * autoload/rubycomplete.vim: fixed the truncation code. this fixes - f.chomp! returning chomp! again, where it should provide + * autoload/rubycomplete.vim: fixed the truncation code. this fixes + f.chomp! returning chomp! again, where it should provide the global list. It also fixes f.foo( a.B, b. returning a's list when it should return b's. - + 2006-04-26 Doug Kearns * autoload/rubycomplete.vim: set 'expandtab' properly 2006-04-25 Mark Guzman - * autoload/rubycomplete.vim: started stripping out preceding - assigment operation stuff. "x = A", would attempt to complete - A using the global list. I've started removing old/commented + * autoload/rubycomplete.vim: started stripping out preceding + assigment operation stuff. "x = A", would attempt to complete + A using the global list. I've started removing old/commented code in an effort to slim down the file. 2006-04-25 Doug Kearns - * autoload/rubycomplete.vim: remove excess whitespace + * autoload/rubycomplete.vim: remove excess whitespace * indent/ruby.vim: make sure 'smartindent' is disabled @@ -189,7 +197,7 @@ controlling the addition of classes defined in the current buffer to the global completion list - * autoload/rubycomplete.vim: the global variable list is now sorted + * autoload/rubycomplete.vim: the global variable list is now sorted and dups are removed * autoload/rubycomplete.vim: fixed a bug with rails support, where diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 9cfde7ff..f9c23ea1 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.93 2006/07/10 16:39:31 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.94 2006/10/28 03:14:33 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -134,15 +134,15 @@ syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s* syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%(\.\|::\)\)\_s*\)\@ Date: Wed, 8 Nov 2006 13:01:56 +0000 Subject: [PATCH 303/411] don't include trailing whitespace in matches for 'def', 'class', and 'module' keywords --- ChangeLog | 5 +++++ syntax/ruby.vim | 14 +++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index f6699eed..a37bf165 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-11-08 Doug Kearns + + * syntax/ruby.vim: don't include trailing whitespace in matches for + 'def', 'class', and 'module' keywords + 2006-10-28 Doug Kearns * syntax/ruby.vim: remove accidently included nextgroup arg in diff --git a/syntax/ruby.vim b/syntax/ruby.vim index f9c23ea1..a5dcb432 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.94 2006/10/28 03:14:33 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.95 2006/11/08 13:01:57 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -150,10 +150,10 @@ end " Expensive Mode - colorize *end* according to opening statement if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") - syn region rubyFunction matchgroup=rubyDefine start="\ Date: Wed, 8 Nov 2006 17:09:35 +0000 Subject: [PATCH 304/411] New eRuby indenting algorithm --- indent/eruby.vim | 53 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 5 deletions(-) diff --git a/indent/eruby.vim b/indent/eruby.vim index 987c8cf6..99cc2ec3 100644 --- a/indent/eruby.vim +++ b/indent/eruby.vim @@ -1,16 +1,59 @@ " Vim indent file -" Language: Ruby -" Maintainer: Doug Kearns -" Info: $Id: eruby.vim,v 1.4 2006/04/15 12:01:18 dkearns Exp $ +" Language: eRuby +" Maintainer: Tim Pope +" Info: $Id: eruby.vim,v 1.5 2006/11/08 17:09:35 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns -" Only load this indent file when no other was loaded. if exists("b:did_indent") finish endif +runtime! indent/ruby.vim +unlet! b:did_indent + runtime! indent/html.vim +unlet! b:did_indent + +let b:did_indent = 1 + +setlocal indentexpr=GetErubyIndent(v:lnum) +setlocal indentkeys=o,O,*,<>>,{,},!^F,=end,=else,=elsif,=rescue,=ensure,=when + +" Only define the function once. +if exists("*GetErubyIndent") + finish +endif + +function! GetErubyIndent(lnum) + let vcol = col('.') + call cursor(a:lnum,1) + let inruby = searchpair('<%','','%>') + call cursor(a:lnum,vcol) + if inruby + let ind = GetRubyIndent() + else + let ind = HtmlIndentGet(a:lnum) + endif + let lnum = prevnonblank(a:lnum-1) + let line = getline(lnum) + let cline = getline(a:lnum) + if cline =~# '<%\s*\%(end\|else\|\%(elsif\|rescue\|ensure\|case\|when\).\{-\}\)\s*-\=%>' + let ind = ind - &sw + endif + if line =~# '\' + let ind = ind + &sw + elseif line =~# '<%\s*\%(if\|unless\|for\|while\|until\|def\|class\|module\|begin\|else\|elsif\|rescue\|ensure\|when\)\>.*%>' + let ind = ind + &sw + endif + if line =~# '^\s*<%[=#]\=\s*$' + let ind = ind + &sw + endif + if cline =~# '^\s*-\=%>\s*$' + let ind = ind - &sw + endif + return ind +endfunction -" vim: nowrap sw=2 sts=2 ts=8 ff=unix: +" vim:set sw=2 sts=2 ts=8 noet ff=unix: From 600cc9ba8831c77011dbb7b216cb2d19eded2979 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Wed, 8 Nov 2006 17:13:57 +0000 Subject: [PATCH 305/411] add missing ChangeLog entry for indent/eruby.vim --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index a37bf165..1558047a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-11-08 Tim Pope + + * indent/eruby.vim: new indenting algorithm + 2006-11-08 Doug Kearns * syntax/ruby.vim: don't include trailing whitespace in matches for From 2e3aa49ee0b2b11c73d8886607bf5e68fee44de0 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Thu, 9 Nov 2006 06:02:10 +0000 Subject: [PATCH 306/411] Rearranged keywords; new 'indentkeys' --- ChangeLog | 6 +++++- indent/eruby.vim | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1558047a..1244aae9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,8 @@ -2006-11-08 Tim Pope +2006-11-08 Tim Pope + + * indent/eruby.vim: Rearranged keywords; new 'indentkeys' + +2006-11-08 Tim Pope * indent/eruby.vim: new indenting algorithm diff --git a/indent/eruby.vim b/indent/eruby.vim index 99cc2ec3..a35c0aaf 100644 --- a/indent/eruby.vim +++ b/indent/eruby.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: eRuby " Maintainer: Tim Pope -" Info: $Id: eruby.vim,v 1.5 2006/11/08 17:09:35 tpope Exp $ +" Info: $Id: eruby.vim,v 1.6 2006/11/09 06:02:10 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -19,7 +19,7 @@ unlet! b:did_indent let b:did_indent = 1 setlocal indentexpr=GetErubyIndent(v:lnum) -setlocal indentkeys=o,O,*,<>>,{,},!^F,=end,=else,=elsif,=rescue,=ensure,=when +setlocal indentkeys=o,O,*,<>>,{,},0),0],o,O,!^F,=end,=else,=elsif,=rescue,=ensure,=when " Only define the function once. if exists("*GetErubyIndent") @@ -39,12 +39,12 @@ function! GetErubyIndent(lnum) let lnum = prevnonblank(a:lnum-1) let line = getline(lnum) let cline = getline(a:lnum) - if cline =~# '<%\s*\%(end\|else\|\%(elsif\|rescue\|ensure\|case\|when\).\{-\}\)\s*-\=%>' + if cline =~# '<%\s*\%(end\|else\|\%(ensure\|rescue\|elsif\|when\).\{-\}\)\s*\%(-\=%>\|$\)' let ind = ind - &sw endif if line =~# '\' let ind = ind + &sw - elseif line =~# '<%\s*\%(if\|unless\|for\|while\|until\|def\|class\|module\|begin\|else\|elsif\|rescue\|ensure\|when\)\>.*%>' + elseif line =~# '<%\s*\%(module\|class\|def\|if\|for\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure\|rescue\)\>.*%>' let ind = ind + &sw endif if line =~# '^\s*<%[=#]\=\s*$' From e413a47325906c14c6f0e730ca522f82d08e35c4 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Thu, 9 Nov 2006 21:34:52 +0000 Subject: [PATCH 307/411] Different indent behavior for a line ending in an open parenthesis. --- ChangeLog | 5 +++++ indent/ruby.vim | 16 +++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1244aae9..ede34819 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-11-09 Tim Pope + + * indent.ruby.vim: Only increase one 'shiftwidth' after a line ending + with an open parenthesis. + 2006-11-08 Tim Pope * indent/eruby.vim: Rearranged keywords; new 'indentkeys' diff --git a/indent/ruby.vim b/indent/ruby.vim index 217cb2eb..cc67f9e9 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Ruby " Maintainer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.38 2006/04/25 07:05:42 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.39 2006/11/09 21:34:53 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -217,7 +217,11 @@ function GetRubyIndent() call cursor(v:lnum, col) let bs = strpart('(){}[]', stridx(')}]', line[col - 1]) * 2, 2) if searchpair(escape(bs[0], '\['), '', bs[1], 'bW', s:skip_expr) > 0 - let ind = line[col-1]==')' ? virtcol('.')-1 : indent(s:GetMSL(line('.'))) + if line[col-1]==')' && col('.') != col('$') - 1 + let ind = virtcol('.')-1 + else + let ind = indent(s:GetMSL(line('.'))) + endif endif return ind endif @@ -274,7 +278,11 @@ function GetRubyIndent() if line =~ '[[({]' let counts = s:LineHasOpeningBrackets(lnum) if counts[0] == '1' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0 - return virtcol('.') + if col('.') + 1 == col('$') + return ind + &sw + else + return virtcol('.') + endif elseif counts[1] == '1' || counts[2] == '1' return ind + &sw else @@ -361,3 +369,5 @@ endfunction let &cpo = s:cpo_save unlet s:cpo_save + +" vim:set sw=2 sts=2 ts=8 noet ff=unix: From a0434cb0b1b92af65a3772d316729ebad2cebacd Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Thu, 30 Nov 2006 07:45:28 +0000 Subject: [PATCH 308/411] Display constants as defines. Added a rails preloading option. Fixed a bug detecting ranges defined with %r{. Added support for completion in rails migrations. Will now fail-over to syntax completion automatically, if the vim isn't built with ruby support. Added support for class detection using ObjectSpace. Tweeked buffer searching code to find modules/classes reliably in more cases. --- autoload/rubycomplete.vim | 253 +++++++++++++++++++++++++++++--------- 1 file changed, 197 insertions(+), 56 deletions(-) diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 574161b7..0f4f132e 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,11 +1,11 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.37 2006/09/19 04:10:32 segy Exp $ +" Info: $Id: rubycomplete.vim,v 1.38 2006/11/30 07:45:28 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns -" Maintainer Version: 0.7 +" Maintainer Version: 0.8 " ---------------------------------------------------------------------------- " " Ruby IRB/Complete author: Keiju ISHITSUKA(keiju@ishitsuka.com) @@ -13,7 +13,10 @@ " {{{ requirement checks if !has('ruby') - s:ErrMsg( "Error: Required vim compiled with +ruby" ) + s:ErrMsg( "Error: Rubycomplete requires vim compiled with +ruby" ) + s:ErrMsg( "Error: falling back to syntax completion" ) + " lets fall back to syntax completion + setlocal omnifunc=syntaxcomplete#Complete finish endif @@ -23,6 +26,7 @@ if version < 700 endif " }}} requirement checks +" {{{ configuration failsafe initialization if !exists("g:rubycomplete_rails") let g:rubycomplete_rails = 0 endif @@ -35,43 +39,76 @@ if !exists("g:rubycomplete_buffer_loading") let g:rubycomplete_classes_in_global = 0 endif -if !exists("g:rubycomplete_rails_proactive") - let g:rubycomplete_rails_proactive = 0 +if !exists("g:rubycomplete_include_object") + let g:rubycomplete_include_object = 0 endif +if !exists("g:rubycomplete_include_objectspace") + let g:rubycomplete_include_objectspace = 0 +endif +" }}} configuration failsafe initialization + " {{{ vim-side support functions +let s:rubycomplete_debug = 0 + function! s:ErrMsg(msg) echohl ErrorMsg echo a:msg echohl None endfunction -function! s:GetBufferRubyModule(name) - let [snum,enum] = s:GetBufferRubyEntity(a:name, "module") +function! s:dprint(msg) + if s:rubycomplete_debug == 1 + echom a:msg + endif +endfunction + +function! s:GetBufferRubyModule(name, ...) + if a:0 == 1 + let [snum,enum] = s:GetBufferRubyEntity(a:name, "module", a:1) + else + let [snum,enum] = s:GetBufferRubyEntity(a:name, "module") + endif return snum . '..' . enum endfunction -function! s:GetBufferRubyClass(name) - let [snum,enum] = s:GetBufferRubyEntity(a:name, "class") +function! s:GetBufferRubyClass(name, ...) + if a:0 >= 1 + let [snum,enum] = s:GetBufferRubyEntity(a:name, "class", a:1) + else + let [snum,enum] = s:GetBufferRubyEntity(a:name, "class") + endif return snum . '..' . enum endfunction function! s:GetBufferRubySingletonMethods(name) endfunction -function! s:GetBufferRubyEntity( name, type ) +function! s:GetBufferRubyEntity( name, type, ... ) + let lastpos = getpos(".") + let lastline = lastpos + if (a:0 >= 1) + let lastline = [ 0, a:1, 0, 0 ] + call cursor( a:1, 0 ) + endif + let stopline = 1 - let crex = '^\s*' . a:type . '\s*' . a:name . '\s*\(<\s*.*\s*\)\?\n*\(\(\s\|#\).*\n*\)*\n*\s*end$' - let [lnum,lcol] = searchpos( crex, 'nbw') + + let crex = '^\s*\<' . a:type . '\>\s*\<' . a:name . '\>\s*\(<\s*.*\s*\)\?' + let [lnum,lcol] = searchpos( crex, 'w' ) + "let [lnum,lcol] = searchpairpos( crex . '\zs', '', '\(end\|}\)', 'w' ) + if lnum == 0 && lcol == 0 + call cursor(lastpos[1], lastpos[2]) return [0,0] endif - let [enum,ecol] = searchpos( crex, 'nebw') + let curpos = getpos(".") + let [enum,ecol] = searchpairpos( crex, '', '\(end\|}\)', 'wr' ) + call cursor(lastpos[1], lastpos[2]) + if lnum > enum - let realdef = getline( lnum ) - let crexb = '^' . realdef . '\n*\(\(\s\|#\).*\n*\)*\n*\s*end$' - let [enum,ecol] = searchpos( crexb, 'necw' ) + return [0,0] endif " we found a the class def return [lnum,enum] @@ -112,16 +149,17 @@ function! s:GetRubyVarType(v) endif let ctors = ctors.'\)' - let fstr = '=\s*\([^ \t]\+.' . ctors .'\>\|[\[{"''/]\|%r{\|[A-Za-z0-9@:\-()\.]\+...\?\)' + let fstr = '=\s*\([^ \t]\+.' . ctors .'\>\|[\[{"''/]\|%w\[\|%r{\|[A-Za-z0-9@:\-()\.]\+...\?\)' let sstr = ''.a:v.'\>\s*[+\-*/]*'.fstr let [lnum,lcol] = searchpos(sstr,'nb',stopline) if lnum != 0 && lcol != 0 let str = matchstr(getline(lnum),fstr,lcol) let str = substitute(str,'^=\s*','','') + call setpos('.',pos) if str == '"' || str == '''' return 'String' - elseif str == '[' + elseif str == '[' || stridx(str, '%w[') != -1 return 'Array' elseif str == '{' return 'Hash' @@ -141,6 +179,11 @@ endfunction "}}} vim-side support functions +"{{{ vim-side completion function +function! rubycomplete#Init() + execute "ruby VimRubyCompletion.preload_rails" +endfunction + function! rubycomplete#Complete(findstart, base) "findstart = 1 when we need to get the text length if a:findstart @@ -167,19 +210,20 @@ function! rubycomplete#Complete(findstart, base) return g:rubycomplete_completions endif endfunction +"}}} vim-side completion function - +"{{{ ruby-side code function! s:DefRuby() ruby << RUBYEOF # {{{ ruby completion begin - require 'rubygems' + require 'rubygems' # let's assume this is safe...? rescue Exception #ignore? end class VimRubyCompletion - # {{{ constants +# {{{ constants @@debug = false @@ReservedWords = [ "BEGIN", "END", @@ -204,9 +248,9 @@ class VimRubyCompletion @@Operators = [ "%", "&", "*", "**", "+", "-", "/", "<", "<<", "<=", "<=>", "==", "===", "=~", ">", ">=", ">>", "[]", "[]=", "^", ] - #}}} constants - +# }}} constants +# {{{ buffer analysis magic def load_requires buf = VIM::Buffer.current enum = buf.line_number @@ -222,23 +266,26 @@ class VimRubyCompletion end def load_buffer_class(name) + dprint "load_buffer_class(%s) START" % name classdef = get_buffer_entity(name, 's:GetBufferRubyClass("%s")') return if classdef == nil pare = /^\s*class\s*(.*)\s*<\s*(.*)\s*\n/.match( classdef ) - load_buffer_class( $2 ) if pare != nil + load_buffer_class( $2 ) if pare != nil && $2 != name # load parent class if needed mixre = /.*\n\s*include\s*(.*)\s*\n/.match( classdef ) - load_buffer_module( $2 ) if mixre != nil + load_buffer_module( $2 ) if mixre != nil && $2 != name # load mixins if needed begin eval classdef rescue Exception VIM::evaluate( "s:ErrMsg( 'Problem loading class \"%s\", was it already completed?' )" % name ) end + dprint "load_buffer_class(%s) END" % name end def load_buffer_module(name) + dprint "load_buffer_module(%s) START" % name classdef = get_buffer_entity(name, 's:GetBufferRubyModule("%s")') return if classdef == nil @@ -247,6 +294,7 @@ class VimRubyCompletion rescue Exception VIM::evaluate( "s:ErrMsg( 'Problem loading module \"%s\", was it already completed?' )" % name ) end + dprint "load_buffer_module(%s) END" % name end def get_buffer_entity(name, vimfun) @@ -258,20 +306,47 @@ class VimRubyCompletion return nil if nums == nil return nil if nums.min == nums.max && nums.min == 0 - cur_line = VIM::Buffer.current.line_number + dprint "get_buffer_entity START" + visited = [] + clscnt = 0 + bufname = VIM::Buffer.current.name classdef = "" - nums.each do |x| - if x != cur_line - ln = buf[x] - if /^\s*(module|class|def|include)\s+/.match(ln) + cur_line = VIM::Buffer.current.line_number + while (nums != nil && !(nums.min == 0 && nums.max == 0) ) + dprint "visited: %s" % visited.to_s + break if visited.index( nums ) + visited << nums + + nums.each do |x| + 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" + #dprint "\$1: %s" % $1 classdef += "%s\n" % ln classdef += "end\n" if /def\s+/.match(ln) dprint ln + end end end + + nm = "%s(::.*)*\", %s, \"" % [ name, nums.last ] + nums = eval( VIM::evaluate( vimfun % nm ) ) + dprint "nm: \"%s\"" % nm + dprint "vimfun: %s" % (vimfun % nm) + dprint "got nums: %s" % nums.to_s + end + if classdef.length > 1 + classdef += "end\n"*clscnt + # classdef = "class %s\n%s\nend\n" % [ bufname.gsub( /\/|\\/, "_" ), classdef ] end - classdef += "end\n" if classdef.length > 1 + dprint "get_buffer_entity END" + dprint "classdef====start" + lns = classdef.split( "\n" ) + lns.each { |x| dprint x } + dprint "classdef====end" return classdef end @@ -297,7 +372,7 @@ class VimRubyCompletion eob = buf.length ret = [] rg = 1..eob - re = eval( "/^\s*%s\s*([A-Za-z0-9_-]*)(\s*<\s*([A-Za-z0-9_:-]*))?\s*/" % type ) + re = eval( "/^\s*%s\s*([A-Za-z0-9_:-]*)(\s*<\s*([A-Za-z0-9_:-]*))?\s*/" % type ) rg.each do |x| if re.match( buf[x] ) @@ -371,8 +446,9 @@ class VimRubyCompletion dprint "Rails 1.1+ Error %s" % $! # assume 1.0 end - eval( "Rails::Initializer.run" ) + #eval( "Rails::Initializer.run" ) #not necessary? VIM::command('let s:rubycomplete_rails_loaded = 1') + dprint "rails loaded" rescue Exception dprint "Rails Error %s" % $! VIM::evaluate( "s:ErrMsg('Error loading rails environment')" ) @@ -388,26 +464,45 @@ class VimRubyCompletion buf_path = VIM::evaluate('expand("%:p")') buf_path.gsub!( /\\/, "/" ) path_elm = buf_path.split( "/" ) - i = path_elm.index( "app" ) + dprint "buf_path: %s" % buf_path + types = [ "app", "db", "lib", "test", "components", "script" ] - return [] unless i - i += 1 + i = nil + ret = [] + type = nil + types.each do |t| + i = path_elm.index( t ) + break if i + end type = path_elm[i] type.downcase! - ret = [] + dprint "type: %s" % type case type - when "views" - ret += ActionView::Base.instance_methods - ret += ActionView::Base.methods - when "controllers" - ret += ActionController::Base.instance_methods - ret += ActionController::Base.methods - when "models" - ret += ActiveRecord::Base.instance_methods - ret += ActiveRecord::Base.methods + when "app" + i += 1 + subtype = path_elm[i] + subtype.downcase! + + dprint "subtype: %s" % subtype + case subtype + when "views" + ret += ActionView::Base.instance_methods + ret += ActionView::Base.methods + when "controllers" + ret += ActionController::Base.instance_methods + ret += ActionController::Base.methods + when "models" + ret += ActiveRecord::Base.instance_methods + ret += ActiveRecord::Base.methods + end + + when "db" + ret += ActiveRecord::ConnectionAdapters::SchemaStatements.instance_methods + ret += ActiveRecord::ConnectionAdapters::SchemaStatements.methods end + return ret end @@ -415,12 +510,14 @@ class VimRubyCompletion allow_rails = VIM::evaluate("exists('g:rubycomplete_rails') && g:rubycomplete_rails") rails_loaded = VIM::evaluate('s:rubycomplete_rails_loaded') return [] if allow_rails != '1' || rails_loaded != '1' + begin eval( "#{cls}.establish_connection" ) return [] unless eval( "#{cls}.ancestors.include?(ActiveRecord::Base).to_s" ) col = eval( "#{cls}.column_names" ) return col if col rescue + dprint "add_rails_columns err: (cls: %s) %s" % [ cls, $! ] return [] end return [] @@ -449,10 +546,30 @@ class VimRubyCompletion cls = clspl.singularize ret = [] - ret += eval( "#{cls}.instance_methods" ) - ret += eval( "#{clspl}Helper.instance_methods" ) + begin + ret += eval( "#{cls}.instance_methods" ) + ret += eval( "#{clspl}Helper.instance_methods" ) + rescue Exception + dprint "Error: Unable to load rails view helpers for %s: %s" % [ cls, $! ] + end + return ret end +# }}} buffer analysis magic + +# {{{ main completion code + def self.preload_rails + a = VimRubyCompletion.new + require 'Thread' + Thread.new(a) do |b| + begin + b.load_rails + rescue + end + end + a.load_rails + rescue + end def self.get_completions(base) b = VimRubyCompletion.new @@ -472,12 +589,15 @@ class VimRubyCompletion input += base input.sub!(/.*[ \t\n\"\\'`><=;|&{(]/, '') # Readline.basic_word_break_characters input.sub!(/self\./, '') + input.sub!(/.*((\.\.[\[(]?)|([\[(]))/, '') + dprint 'input %s' % input message = nil receiver = nil methods = [] variables = [] classes = [] + constants = [] case input when /^(\/[^\/]*\/)\.([^.]*)$/ # Regexp @@ -511,22 +631,27 @@ class VimRubyCompletion methods.grep(/^#{receiver}/).collect{|e| "::" + e} when /^(((::)?[A-Z][^:.\(]*)+)::?([^:.]*)$/ # Constant or class methods - dprint "const or cls 2" receiver = $1 message = Regexp.quote($4) + dprint "const or cls 2 [recv: \'%s\', msg: \'%s\']" % [ receiver, message ] + load_buffer_class( receiver ) begin - methods = eval("#{receiver}.constants | #{receiver}.methods") + classes = eval("#{receiver}.constants") + #methods = eval("#{receiver}.methods") rescue Exception + dprint "exception: %s" % $! methods = [] end methods.grep(/^#{message}/).collect{|e| receiver + "::" + e} when /^(:[^:.]+)\.([^.]*)$/ # Symbol + dprint "symbol" receiver = $1 message = Regexp.quote($2) methods = Symbol.instance_methods(true) when /^([0-9_]+(\.[0-9_]+)?(e[0-9]+)?)\.([^.]*)$/ # Numeric + dprint "numeric" receiver = $1 message = Regexp.quote($4) begin @@ -536,9 +661,11 @@ class VimRubyCompletion end when /^(\$[^.]*)$/ #global + dprint "global" methods = global_variables.grep(Regexp.new(Regexp.quote($1))) when /^((\.?[^.]+)+)\.([^.]*)$/ # variable + dprint "variable" receiver = $1 message = Regexp.quote($3) load_buffer_class( receiver ) @@ -585,9 +712,11 @@ class VimRubyCompletion methods = String.instance_methods(true) else + dprint "default/other" inclass = eval( VIM::evaluate("s:IsInClassDef()") ) if inclass != nil + dprint "inclass" classdef = "%s\n" % VIM::Buffer.current[ inclass.min ] found = /^\s*class\s*([A-Za-z0-9_-]*)(\s*<\s*([A-Za-z0-9_:-]*))?\s*\n$/.match( classdef ) @@ -597,7 +726,6 @@ class VimRubyCompletion load_buffer_class( receiver ) begin methods = eval( "#{receiver}.instance_methods" ) - methods += get_rails_helpers variables += add_rails_columns( "#{receiver}" ) rescue Exception found = nil @@ -606,26 +734,37 @@ class VimRubyCompletion end if inclass == nil || found == nil + dprint "inclass == nil" methods = get_buffer_methods - methods += get_rails_helpers methods += get_rails_view_methods - classes = eval("self.class.constants") + cls_const = Class.constants + constants = cls_const.select { |c| /^[A-Z_-]+$/.match( c ) } + classes = eval("self.class.constants") - constants classes += get_buffer_classes classes += get_buffer_modules + include_objectspace = VIM::evaluate("exists('g:rubycomplete_include_objectspace') && g:rubycomplete_include_objectspace") + ObjectSpace.each_object(Class) { |cls| classes << cls.to_s } if include_objectspace == "1" message = receiver = input end + methods += get_rails_helpers 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) + methods = (methods-Object.instance_methods) if include_object == "0" + rbcmeth = (VimRubyCompletion.instance_methods-Object.instance_methods) # lets remove those rubycomplete methods + methods = (methods-rbcmeth) variables = clean_sel( variables, message ) - classes = clean_sel( classes, message ) + classes = clean_sel( classes, message ) - ["VimRubyCompletion"] + constants = clean_sel( constants, message ) valid = [] - valid += methods.collect { |m| { :name => m, :type => 'f' } } + valid += methods.collect { |m| { :name => m, :type => 'm' } } valid += variables.collect { |v| { :name => v, :type => 'v' } } valid += classes.collect { |c| { :name => c, :type => 't' } } + valid += constants.collect { |d| { :name => d, :type => 'd' } } valid.sort! { |x,y| x[:name] <=> y[:name] } outp = "" @@ -641,6 +780,7 @@ class VimRubyCompletion outp = "" end end +# }}} main completion code end # VimRubyCompletion # }}} ruby completion @@ -650,6 +790,7 @@ endfunction 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: From 8099df74d43363cccb4e9d918f59a928354f779f Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Fri, 1 Dec 2006 00:59:05 +0000 Subject: [PATCH 309/411] updated for rubycomplete changes --- ChangeLog | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ChangeLog b/ChangeLog index ede34819..3e34c9cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2006-11-30 Mark Guzman + * rubycomplete.vim: Display constants as defines. Added a rails + preloading option. Fixed a bug detecting ranges defined with %r{. + Added support for completion in rails migrations. Will now + fail-over to syntax completion automatically, if the vim isn't built + with ruby support. Added support for class detection using ObjectSpace. + Tweeked buffer searching code to find modules/classes reliably in more + cases. + 2006-11-09 Tim Pope * indent.ruby.vim: Only increase one 'shiftwidth' after a line ending From 9e99bdd926e34831f61a1c80efce1c4b4a975270 Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Fri, 1 Dec 2006 06:48:21 +0000 Subject: [PATCH 310/411] changed the path detection code to use the built-in interpreter if it's available under windows --- ftplugin/ruby.vim | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index cdf9222a..03918df1 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,13 +1,13 @@ " Vim filetype plugin -" Language: Ruby -" Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.25 2006/07/11 08:57:32 dkearns Exp $ -" URL: http://vim-ruby.rubyforge.org -" Anon CVS: See above site -" Release Coordinator: Doug Kearns +" Language: Ruby +" Maintainer: Gavin Sinclair +" Info: $Id: ruby.vim,v 1.26 2006/12/01 06:48:21 segy Exp $ +" URL: http://vim-ruby.rubyforge.org +" Anon CVS: See above site +" Release Coordinator: Doug Kearns " ---------------------------------------------------------------------------- " -" Original matchit support thanks to Ned Konz. See his ftplugin/ruby.vim at +" Original matchit support thanks to Ned Konz. See his ftplugin/ruby.vim at " http://bike-nomad.com/vim/ruby.vim. " ---------------------------------------------------------------------------- @@ -27,15 +27,15 @@ if exists("loaded_matchit") && !exists("b:match_words") " TODO: improve optional do loops let b:match_words = \ '\%(' . - \ '\%(\%(\.\|\:\:\)\s*\|\:\)\@' . - \ '\|' . - \ '\%(\%(^\|\.\.\.\=\|[\,;=([<>~\*/%!&^|+-]\)\s*\)\@<=\%(if\|unless\|until\|while\)\>' . + \ '\%(\%(\.\|\:\:\)\s*\|\:\)\@' . + \ '\|' . + \ '\%(\%(^\|\.\.\.\=\|[\,;=([<>~\*/%!&^|+-]\)\s*\)\@<=\%(if\|unless\|until\|while\)\>' . \ '\)' . \ ':' . \ '\%(' . - \ '\%(\%(\.\|\:\:\)\s*\|\:\)\@' . - \ '\|' . - \ '\%(\%(^\|;\)\s*\)\@<=\' . + \ '\%(\%(\.\|\:\:\)\s*\|\:\)\@' . + \ '\|' . + \ '\%(\%(^\|;\)\s*\)\@<=\' . \ '\)' . \ ':' . \ '\%(\%(\.\|\:\:\)\s*\|\:\)\@' . @@ -65,7 +65,10 @@ setlocal comments=:# setlocal commentstring=#\ %s if !exists("s:rubypath") - if executable("ruby") + if has("ruby") && has("win32") + ruby VIM::command( 'let s:rubypath = "%s"' % ($: + begin; require %q{rubygems}; Gem.all_load_paths.sort.uniq; rescue LoadError; []; end).join(%q{,}) ) + let s:rubypath = '.,' . substitute(s:rubypath, '\%(^\|,\)\.\%(,\|$\)', ',,', '') + elseif executable("ruby") let s:code = "print ($: + begin; require %q{rubygems}; Gem.all_load_paths.sort.uniq; rescue LoadError; []; end).join(%q{,})" if &shellxquote == "'" let s:rubypath = system('ruby -e "' . s:code . '"') @@ -84,7 +87,7 @@ let &l:path = s:rubypath if has("gui_win32") && !exists("b:browsefilter") let b:browsefilter = "Ruby Source Files (*.rb)\t*.rb\n" . - \ "All Files (*.*)\t*.*\n" + \ "All Files (*.*)\t*.*\n" endif let b:undo_ftplugin = "setl fo< inc< inex< sua< def< com< cms< path< ofu<" @@ -98,7 +101,7 @@ unlet s:cpo_save " " 1. Look for the latest "matchit" plugin at " -" http://www.vim.org/scripts/script.php?script_id=39 +" http://www.vim.org/scripts/script.php?script_id=39 " " It is also packaged with Vim, in the $VIMRUNTIME/macros directory. " @@ -109,16 +112,16 @@ unlet s:cpo_save " 4. Ensure this file (ftplugin/ruby.vim) is installed. " " 5. Ensure you have this line in your $HOME/.vimrc: -" filetype plugin on +" filetype plugin on " " 6. Restart Vim and create the matchit documentation: " -" :helptags ~/.vim/doc +" :helptags ~/.vim/doc " " Now you can do ":help matchit", and you should be able to use "%" on Ruby -" keywords. Try ":echo b:match_words" to be sure. +" keywords. Try ":echo b:match_words" to be sure. " -" Thanks to Mark J. Reed for the instructions. See ":help vimrc" for the +" Thanks to Mark J. Reed for the instructions. See ":help vimrc" for the " locations of plugin directories, etc., as there are several options, and it " differs on Windows. Email gsinclair@soyabean.com.au if you need help. " From 6dab2322c2045705a39508fe91e3723b2a9451bb Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sun, 3 Dec 2006 05:47:00 +0000 Subject: [PATCH 311/411] add tpope to list of contributors --- CONTRIBUTORS | 1 + ChangeLog | 24 +++++++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 27d7743b..1126f817 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2,6 +2,7 @@ Maintainers: Mark Guzman Tim Hammerquist Doug Kearns + Tim Pope Gavin Sinclair Nikolai Weibull diff --git a/ChangeLog b/ChangeLog index 3e34c9cc..98bb00ab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,15 +1,25 @@ +2006-12-03 Doug Kearns + + * CONTRIBUTORS: add tpope + +2006-12-01 Mark Guzman + + * ftplugin/ruby.vim: changed the path detection code to use the + built-in interpreter if it's available under windows + 2006-11-30 Mark Guzman - * rubycomplete.vim: Display constants as defines. Added a rails - preloading option. Fixed a bug detecting ranges defined with %r{. - Added support for completion in rails migrations. Will now + + * autoload/rubycomplete.vim: Display constants as defines. Added a + rails preloading option. Fixed a bug detecting ranges defined with + %r{. Added support for completion in rails migrations. Will now fail-over to syntax completion automatically, if the vim isn't built - with ruby support. Added support for class detection using ObjectSpace. - Tweeked buffer searching code to find modules/classes reliably in more - cases. + with ruby support. Added support for class detection using + ObjectSpace. Tweeked buffer searching code to find modules/classes + reliably in more cases. 2006-11-09 Tim Pope - * indent.ruby.vim: Only increase one 'shiftwidth' after a line ending + * indent/ruby.vim: Only increase one 'shiftwidth' after a line ending with an open parenthesis. 2006-11-08 Tim Pope From 2fd449912820ce89e9ba6dc5cc1e9460f21b72e6 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Mon, 4 Dec 2006 21:35:00 +0000 Subject: [PATCH 312/411] Special case for "end" on first line of multi-line eRuby block. --- ChangeLog | 5 +++++ indent/eruby.vim | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 98bb00ab..ec185ec5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-12-04 Tim Pope + + * indent/eruby.vim: Special case for "end" on first line of multi-line + eRuby block. + 2006-12-03 Doug Kearns * CONTRIBUTORS: add tpope diff --git a/indent/eruby.vim b/indent/eruby.vim index a35c0aaf..d2a9f7f0 100644 --- a/indent/eruby.vim +++ b/indent/eruby.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: eRuby " Maintainer: Tim Pope -" Info: $Id: eruby.vim,v 1.6 2006/11/09 06:02:10 tpope Exp $ +" Info: $Id: eruby.vim,v 1.7 2006/12/04 21:35:01 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -47,7 +47,7 @@ function! GetErubyIndent(lnum) elseif line =~# '<%\s*\%(module\|class\|def\|if\|for\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure\|rescue\)\>.*%>' let ind = ind + &sw endif - if line =~# '^\s*<%[=#]\=\s*$' + if line =~# '^\s*<%[=#]\=\s*$' && cline !~# '^\s*end\>' let ind = ind + &sw endif if cline =~# '^\s*-\=%>\s*$' From 4428f4f7ddf89fcfa02a0e1bb6f41be2c481fe95 Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Thu, 7 Dec 2006 14:54:46 +0000 Subject: [PATCH 313/411] modified the path detection code use the built-in interpreter if it's available in all cases. --- ChangeLog | 5 +++++ ftplugin/ruby.vim | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ec185ec5..c30ae8f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-12-07 Mark Guzman + + * ftplugin/ruby.vim: modified the path detection code use + the built-in interpreter if it's available in all cases. + 2006-12-04 Tim Pope * indent/eruby.vim: Special case for "end" on first line of multi-line diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index 03918df1..4745d111 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.26 2006/12/01 06:48:21 segy Exp $ +" Info: $Id: ruby.vim,v 1.27 2006/12/07 14:54:47 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -65,7 +65,7 @@ setlocal comments=:# setlocal commentstring=#\ %s if !exists("s:rubypath") - if has("ruby") && has("win32") + if has("ruby") ruby VIM::command( 'let s:rubypath = "%s"' % ($: + begin; require %q{rubygems}; Gem.all_load_paths.sort.uniq; rescue LoadError; []; end).join(%q{,}) ) let s:rubypath = '.,' . substitute(s:rubypath, '\%(^\|,\)\.\%(,\|$\)', ',,', '') elseif executable("ruby") From bbb79d62cfcf3de9dc45967c97ddfc98ca4240f3 Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Wed, 13 Dec 2006 21:20:47 +0000 Subject: [PATCH 314/411] added support for lambda and '&' defined procs --- ChangeLog | 5 +++++ autoload/rubycomplete.vim | 12 +++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index c30ae8f1..81d9ee31 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-12-13 Mark Guzman + + * autoload/rubycomplete.vim: added support for lambda and '&' defined + procs. + 2006-12-07 Mark Guzman * ftplugin/ruby.vim: modified the path detection code use diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 0f4f132e..e7b6ae70 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.38 2006/11/30 07:45:28 segy Exp $ +" Info: $Id: rubycomplete.vim,v 1.39 2006/12/13 21:20:47 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -149,7 +149,7 @@ function! s:GetRubyVarType(v) endif let ctors = ctors.'\)' - let fstr = '=\s*\([^ \t]\+.' . ctors .'\>\|[\[{"''/]\|%w\[\|%r{\|[A-Za-z0-9@:\-()\.]\+...\?\)' + let fstr = '=\s*\([^ \t]\+.' . ctors .'\>\|[\[{"''/]\|%[xwQqr][(\[{@]\|[A-Za-z0-9@:\-()\.]\+...\?\|lambda\|&\)' let sstr = ''.a:v.'\>\s*[+\-*/]*'.fstr let [lnum,lcol] = searchpos(sstr,'nb',stopline) if lnum != 0 && lcol != 0 @@ -157,7 +157,7 @@ function! s:GetRubyVarType(v) let str = substitute(str,'^=\s*','','') call setpos('.',pos) - if str == '"' || str == '''' + if str == '"' || str == '''' || stridx(tolower(str), '%q[') != -1 return 'String' elseif str == '[' || stridx(str, '%w[') != -1 return 'Array' @@ -167,6 +167,8 @@ function! s:GetRubyVarType(v) return 'Regexp' elseif strlen(str) >= 4 && stridx(str,'..') != -1 return 'Range' + elseif stridx(str, 'lambda') != -1 || str == '&' + return 'Proc' elseif strlen(str) > 4 let l = stridx(str,'.') return str[0:l-1] @@ -737,11 +739,13 @@ class VimRubyCompletion dprint "inclass == nil" methods = get_buffer_methods methods += get_rails_view_methods + cls_const = Class.constants constants = cls_const.select { |c| /^[A-Z_-]+$/.match( c ) } classes = eval("self.class.constants") - constants classes += get_buffer_classes classes += get_buffer_modules + include_objectspace = VIM::evaluate("exists('g:rubycomplete_include_objectspace') && g:rubycomplete_include_objectspace") ObjectSpace.each_object(Class) { |cls| classes << cls.to_s } if include_objectspace == "1" message = receiver = input @@ -757,9 +761,11 @@ class VimRubyCompletion methods = (methods-Object.instance_methods) if include_object == "0" rbcmeth = (VimRubyCompletion.instance_methods-Object.instance_methods) # lets remove those rubycomplete methods methods = (methods-rbcmeth) + variables = clean_sel( variables, message ) classes = clean_sel( classes, message ) - ["VimRubyCompletion"] constants = clean_sel( constants, message ) + valid = [] valid += methods.collect { |m| { :name => m, :type => 'm' } } valid += variables.collect { |v| { :name => v, :type => 'v' } } From ef5fba8b644d8e1c3830ccc9ad08b0757a2a858a Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Mon, 22 Jan 2007 19:48:01 +0000 Subject: [PATCH 315/411] Only use Ruby interface to determine path on Windows --- ChangeLog | 6 +++++- ftplugin/ruby.vim | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 81d9ee31..b4a69b27 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,8 @@ -2006-12-13 Mark Guzman +2007-01-22 Tim Pope + + * ftplugin/ruby.vim: Limited path detection code to Windows, again. + +2006-12-13 Mark Guzman * autoload/rubycomplete.vim: added support for lambda and '&' defined procs. diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index 4745d111..4958970b 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.27 2006/12/07 14:54:47 segy Exp $ +" Info: $Id: ruby.vim,v 1.28 2007/01/22 19:48:01 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -65,7 +65,7 @@ setlocal comments=:# setlocal commentstring=#\ %s if !exists("s:rubypath") - if has("ruby") + if has("ruby") && has("win32") ruby VIM::command( 'let s:rubypath = "%s"' % ($: + begin; require %q{rubygems}; Gem.all_load_paths.sort.uniq; rescue LoadError; []; end).join(%q{,}) ) let s:rubypath = '.,' . substitute(s:rubypath, '\%(^\|,\)\.\%(,\|$\)', ',,', '') elseif executable("ruby") From 2a6088729b13227d4ffcaabf7c85709583e36c30 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 10 Feb 2007 09:38:43 +0000 Subject: [PATCH 316/411] only reset 'ofu' if it exists and was set by the ftplugin (for Vim 6 compatibility) --- ChangeLog | 5 +++++ ftplugin/ruby.vim | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b4a69b27..1838ce13 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-02-10 Doug Kearns + + * ftplugin/ruby.vim: only reset 'ofu' if it exists and was set by the + ftplugin (for Vim 6 compatibility) + 2007-01-22 Tim Pope * ftplugin/ruby.vim: Limited path detection code to Windows, again. diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index 4958970b..1cc6bdb7 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.28 2007/01/22 19:48:01 tpope Exp $ +" Info: $Id: ruby.vim,v 1.29 2007/02/10 09:38:43 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -90,8 +90,9 @@ if has("gui_win32") && !exists("b:browsefilter") \ "All Files (*.*)\t*.*\n" endif -let b:undo_ftplugin = "setl fo< inc< inex< sua< def< com< cms< path< ofu<" +let b:undo_ftplugin = "setl fo< inc< inex< sua< def< com< cms< path<" \ "| unlet! b:browsefilter b:match_ignorecase b:match_words b:match_skip" + \ "| if exists('&ofu') && has('ruby') | setl ofu< | endif" let &cpo = s:cpo_save unlet s:cpo_save From eec345c1c3212d85bf6e782adfc5f71c27a5a803 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Mon, 19 Feb 2007 01:49:49 +0000 Subject: [PATCH 317/411] syntax/ruby.vim: Separate Regexp group. Nest Ruby code inside string interpolation. Restored highlighting of method, class, and module declarations. --- ChangeLog | 6 ++++++ syntax/ruby.vim | 38 ++++++++++++++++++++------------------ 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1838ce13..071857a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-02-18 Tim Pope + + * syntax/ruby.vim: Separate Regexp group. Nest Ruby code inside + string interpolation. Restored highlighting of method, class, and + module declarations. + 2007-02-10 Doug Kearns * ftplugin/ruby.vim: only reset 'ofu' if it exists and was set by the diff --git a/syntax/ruby.vim b/syntax/ruby.vim index a5dcb432..3bbabc0b 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.95 2006/11/08 13:01:57 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.96 2007/02/19 01:49:49 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -42,7 +42,7 @@ endif " Expression Substitution and Backslash Notation syn match rubyEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display syn match rubyEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display -syn match rubyInterpolation "#{[^}]*}" contained +syn region rubyInterpolated matchgroup=rubyInterpolation start="#{" end="}" contains=TOP contained syn match rubyInterpolation "#\%(\$\|@@\=\)\w\+" contained display syn match rubyNoInterpolation "\\#{[^}]*}" contained syn match rubyNoInterpolation "\\#\%(\$\|@@\=\)\w\+" contained display @@ -54,7 +54,7 @@ syn region rubyNestedCurlyBraces start="{" end="}" skip="\\\\\|\\}" transparent syn region rubyNestedAngleBrackets start="<" end=">" skip="\\\\\|\\>" transparent contained contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimEscape syn region rubyNestedSquareBrackets start="\[" end="\]" skip="\\\\\|\\\]" transparent contained contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimEscape -syn cluster rubyStringSpecial contains=rubyInterpolation,rubyNoInterpolation,rubyEscape +syn cluster rubyStringSpecial contains=rubyInterpolation,rubyInterpolated,rubyNoInterpolation,rubyEscape syn cluster rubyExtendedStringSpecial contains=@rubyStringSpecial,rubyNestedParentheses,rubyNestedCurlyBraces,rubyNestedAngleBrackets,rubyNestedSquareBrackets " Numbers and ASCII Codes @@ -97,8 +97,8 @@ syn match rubyPredefinedConstant "\%(\%(\.\@" " Normal Regular Expression -syn region rubyString matchgroup=rubyStringDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\)\|[;\~=!|&(,[>]\)\s*\)\@<=/" end="/[iomx]*" skip="\\\\\|\\/" contains=@rubyStringSpecial fold -syn region rubyString matchgroup=rubyStringDelimiter start="\%(\<\%(split\|scan\|gsub\|sub\)\s*\)\@<=/" end="/[iomx]*" skip="\\\\\|\\/" contains=@rubyStringSpecial fold +syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\)\|[;\~=!|&(,[>]\)\s*\)\@<=/" end="/[iomx]*" skip="\\\\\|\\/" contains=@rubyStringSpecial fold +syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\<\%(split\|scan\|gsub\|sub\)\s*\)\@<=/" end="/[iomx]*" skip="\\\\\|\\/" contains=@rubyStringSpecial fold " Normal String and Shell Command Output syn region rubyString matchgroup=rubyStringDelimiter start="\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial fold @@ -106,11 +106,11 @@ syn region rubyString matchgroup=rubyStringDelimiter start="'" end="'" skip="\\ syn region rubyString matchgroup=rubyStringDelimiter start="`" end="`" skip="\\\\\|\\`" contains=@rubyStringSpecial fold " Generalized Regular Expression -syn region rubyString matchgroup=rubyStringDelimiter start="%r\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1[iomx]*" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold -syn region rubyString matchgroup=rubyStringDelimiter start="%r{" end="}[iomx]*" skip="\\\\\|\\}" contains=@rubyStringSpecial,rubyNestedCurlyBraces,rubyDelimEscape fold -syn region rubyString matchgroup=rubyStringDelimiter start="%r<" end=">[iomx]*" skip="\\\\\|\\>" contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold -syn region rubyString matchgroup=rubyStringDelimiter start="%r\[" end="\][iomx]*" skip="\\\\\|\\\]" contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimEscape fold -syn region rubyString matchgroup=rubyStringDelimiter start="%r(" end=")[iomx]*" skip="\\\\\|\\)" contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimEscape fold +syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1[iomx]*" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold +syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r{" end="}[iomx]*" skip="\\\\\|\\}" contains=@rubyStringSpecial,rubyNestedCurlyBraces,rubyDelimEscape fold +syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r<" end=">[iomx]*" skip="\\\\\|\\>" contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold +syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\[" end="\][iomx]*" skip="\\\\\|\\\]" contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimEscape fold +syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r(" end=")[iomx]*" skip="\\\\\|\\)" contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimEscape fold " Generalized Single Quoted String, Symbol and Array of Strings syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold @@ -150,10 +150,10 @@ end " Expensive Mode - colorize *end* according to opening statement if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") - syn region rubyFunction matchgroup=rubyDefine start="\= 508 || !exists("did_ruby_syntax_inits") HiLink rubyInterpolation Special HiLink rubyNoInterpolation rubyString HiLink rubySharpBang PreProc + HiLink rubyRegexpDelimiter rubyStringDelimiter HiLink rubyStringDelimiter Delimiter + HiLink rubyRegexp rubyString HiLink rubyString String HiLink rubyTodo Todo From 98e94c9cad7d2a48751edded94de15d86b36de71 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Tue, 20 Feb 2007 22:52:48 +0000 Subject: [PATCH 318/411] Separate rubyType group --- ChangeLog | 5 +++++ syntax/ruby.vim | 17 +++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 071857a3..181d51ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-02-20 Tim Pope + + * syntax/ruby.vim: Place class/module declarations in a separate + group. Allow self to be highlighted in a method declaration. + 2007-02-18 Tim Pope * syntax/ruby.vim: Separate Regexp group. Nest Ruby code inside diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 3bbabc0b..208237ca 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.96 2007/02/19 01:49:49 tpope Exp $ +" Info: $Id: ruby.vim,v 1.97 2007/02/20 22:52:49 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -150,14 +150,14 @@ end " Expensive Mode - colorize *end* according to opening statement if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") - syn region rubyFunction matchgroup=rubyDefine start="\\s*" end="\%(\s*\%(\s\|(\|;\|$\|#\)\)\@=" oneline - syn region rubyClass matchgroup=rubyDefine start="\\s*" end="\%(\s*\%(\s\|<\|;\|$\|#\)\)\@=" oneline - syn match rubyDefine "\" display @@ -181,7 +181,7 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") exec "syn sync minlines=" . ruby_minlines else - syn region rubyFunction matchgroup=rubyControl start="\\s*" end="\ze\%(\s\|(\|;\|$\)" oneline + syn region rubyFunction matchgroup=rubyControl start="\\s*" end="\ze\%(\s\|(\|;\|$\)" oneline contains=rubyPseudoVariable syn region rubyClass matchgroup=rubyControl start="\\s*" end="\ze\%(\s\|<\|;\|$\)" oneline syn match rubyControl "\= 508 || !exists("did_ruby_syntax_inits") command -nargs=+ HiLink hi def link endif + HiLink rubyType rubyDefine HiLink rubyDefine Define HiLink rubyFunction Function HiLink rubyControl Statement From 0469794b90335d43c27359291267970c1fbfd9b3 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 22 Feb 2007 15:10:35 +0000 Subject: [PATCH 319/411] highlight short format interpolated variables --- ChangeLog | 4 ++++ syntax/ruby.vim | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 181d51ba..9c19bb39 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-02-22 Doug Kearns + + * syntax/ruby.vim: highlight short format interpolated variables + 2007-02-20 Tim Pope * syntax/ruby.vim: Place class/module declarations in a separate diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 208237ca..f0c8188c 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.97 2007/02/20 22:52:49 tpope Exp $ +" Info: $Id: ruby.vim,v 1.98 2007/02/22 15:10:36 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -43,9 +43,9 @@ endif syn match rubyEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display syn match rubyEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display syn region rubyInterpolated matchgroup=rubyInterpolation start="#{" end="}" contains=TOP contained -syn match rubyInterpolation "#\%(\$\|@@\=\)\w\+" contained display -syn match rubyNoInterpolation "\\#{[^}]*}" contained -syn match rubyNoInterpolation "\\#\%(\$\|@@\=\)\w\+" contained display +syn match rubyInterpolation "#\ze\%(\$\|@@\=\)\w\+" contained display nextgroup=rubyClassVariable,rubyInstanceVariable,rubyGlobalVariable +syn match rubyNoInterpolation "\\#{[^}]*}" contained +syn match rubyNoInterpolation "\\#\%(\$\|@@\=\)\w\+" contained display syn match rubyDelimEscape "\\[(<{\[)>}\]]" transparent display contained contains=NONE From 675af5ee1eb3be6d5c6ddb133535bd7f791fdcfd Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Thu, 22 Feb 2007 17:32:02 +0000 Subject: [PATCH 320/411] indent/eruby.vim and syntax/ruby.vim --- ChangeLog | 8 ++++++ indent/eruby.vim | 4 +-- syntax/ruby.vim | 66 ++++++++++++++++++++++++++---------------------- 3 files changed, 46 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9c19bb39..733e993c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-02-22 Tim Pope + + * indent/eruby.vim: Fixed an edge case. + * syntax/ruby.vim: Simpler method and class declaration highlighting. + Changed some contains=ALLBUT,... to contains=TOP. Altered some + highlight links: rubyConstant is now Type; rubySymbol is now Constant. + New groups like rubyLoop and rubyCondition. + 2007-02-22 Doug Kearns * syntax/ruby.vim: highlight short format interpolated variables diff --git a/indent/eruby.vim b/indent/eruby.vim index d2a9f7f0..ee2d08ae 100644 --- a/indent/eruby.vim +++ b/indent/eruby.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: eRuby " Maintainer: Tim Pope -" Info: $Id: eruby.vim,v 1.7 2006/12/04 21:35:01 tpope Exp $ +" Info: $Id: eruby.vim,v 1.8 2007/02/22 17:32:02 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -31,7 +31,7 @@ function! GetErubyIndent(lnum) call cursor(a:lnum,1) let inruby = searchpair('<%','','%>') call cursor(a:lnum,vcol) - if inruby + if inruby && getline(a:lnum) !~ '^<%' let ind = GetRubyIndent() else let ind = HtmlIndentGet(a:lnum) diff --git a/syntax/ruby.vim b/syntax/ruby.vim index f0c8188c..13d5d8eb 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.98 2007/02/22 15:10:36 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.99 2007/02/22 17:32:03 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -43,6 +43,7 @@ endif syn match rubyEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display syn match rubyEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display syn region rubyInterpolated matchgroup=rubyInterpolation start="#{" end="}" contains=TOP contained +"syn match rubyInterpolation "#\%(\$\|@@\=\)\w\+" contained contains=rubyInstanceVariable,rubyClassVariable,rubyGlobalVariable display syn match rubyInterpolation "#\ze\%(\$\|@@\=\)\w\+" contained display nextgroup=rubyClassVariable,rubyInstanceVariable,rubyGlobalVariable syn match rubyNoInterpolation "\\#{[^}]*}" contained syn match rubyNoInterpolation "\\#\%(\$\|@@\=\)\w\+" contained display @@ -70,7 +71,7 @@ syn match rubyFloat "\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE syn match rubyLocalVariableOrMethod "\<[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent syn match rubyBlockArgument "&[_[:lower:]][_[:alnum:]]" contains=NONE display transparent -syn match rubyConstant "\%(\%(\.\@\%(\s*(\)\@!" +syn match rubyConstant "\%(\%([.@$]\@\%(\s*(\)\@!" syn match rubyClassVariable "@@\h\w*" display syn match rubyInstanceVariable "@\h\w*" display syn match rubyGlobalVariable "$\%(\h\w*\|-.\)" @@ -148,32 +149,37 @@ if exists('main_syntax') && main_syntax == 'eruby' let b:ruby_no_expensive = 1 end +syn match rubyMethodDeclaration "[_[:alnum:]@$][^[:space:];#(]*" contained contains=rubyFunction,rubyConstant,rubyBoolean,rubyPseudoVariable,rubyInstanceVariable,rubyClassVariable,rubyGlobalVariable +syn match rubyClassDeclaration "[_[:alnum:]@$][^[:space:];#(]*" contained contains=rubyConstant +syn match rubyModuleDeclaration "[_[:alnum:]@$][^[:space:];#(]*" contained contains=rubyConstant +syn match rubyFunction "\<[_[:lower:]][_[:alnum:]]*[?!=]\=.\@!" contained " Expensive Mode - colorize *end* according to opening statement if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") - syn region rubyFunction matchgroup=rubyDefine start="\\s*" end="\%(\s*\%(\s\|(\|;\|$\|#\)\)\@=" oneline contains=rubyPseudoVariable - syn region rubyClass matchgroup=rubyType start="\\s*" end="\%(\s*\%(\s\|<\|;\|$\|#\)\)\@=" oneline - syn match rubyType "\" nextgroup=rubyMethodDeclaration skipwhite skipnl + syn match rubyClass "\" nextgroup=rubyClassDeclaration skipwhite skipnl + syn match rubyModule "\" nextgroup=rubyModuleDeclaration skipwhite skipnl + syn region rubyBlock start="\" matchgroup=rubyDefine end="\" contains=TOP fold + syn region rubyBlock start="\" matchgroup=rubyClass end="\" contains=TOP fold + syn region rubyBlock start="\" matchgroup=rubyModule end="\" contains=TOP fold " modifiers - syn match rubyControl "\<\%(if\|unless\|while\|until\)\>" display + syn match rubyConditional "\<\%(if\|unless\)\>" display + syn match rubyLoop "\<\%(while\|until\)\>" display " *do* requiring *end* - syn region rubyDoBlock matchgroup=rubyControl start="\" end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold + syn region rubyDoBlock matchgroup=rubyControl start="\" end="\" contains=TOP fold " *{* requiring *}* - syn region rubyCurlyBlock start="{" end="}" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold + syn region rubyCurlyBlock start="{" end="}" contains=TOP fold " statements without *do* - syn region rubyNoDoBlock matchgroup=rubyControl start="\<\%(case\|begin\)\>" start="\%(^\|\.\.\.\=\|[,;=([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold + syn region rubyNoDoBlock matchgroup=rubyControl start="\" end="\" contains=TOP fold + syn region rubyNoDoBlock matchgroup=rubyConditional start="\" start="\%(^\|\.\.\.\=\|[,;=([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\" contains=TOP fold + syn keyword rubyConditional else elsif then when " statement with optional *do* - syn region rubyOptDoLine matchgroup=rubyControl start="\" start="\%(\%(^\|\.\.\.\=\|[?:,;=([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\%(\\|:\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo - syn region rubyOptDoBlock start="\" start="\%(\%(^\|\.\.\.\=\|[:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" matchgroup=rubyControl end="\" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo nextgroup=rubyOptDoLine fold + syn region rubyOptDoLine matchgroup=rubyLoop start="\" start="\%(\%(^\|\.\.\.\=\|[?:,;=([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\%(\\|:\)" end="\ze\%(;\|$\)" oneline contains=TOP + syn region rubyOptDoBlock start="\" start="\%(\%(^\|\.\.\.\=\|[:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" matchgroup=rubyLoop end="\" contains=TOP nextgroup=rubyOptDoLine fold if !exists("ruby_minlines") let ruby_minlines = 50 @@ -181,17 +187,16 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") exec "syn sync minlines=" . ruby_minlines else - syn region rubyFunction matchgroup=rubyControl start="\\s*" end="\ze\%(\s\|(\|;\|$\)" oneline contains=rubyPseudoVariable - syn region rubyClass matchgroup=rubyControl start="\\s*" end="\ze\%(\s\|<\|;\|$\)" oneline - syn match rubyControl "\" nextgroup=rubyMethodDeclaration skipwhite skipnl + syn match rubyControl "\" nextgroup=rubyClassDeclaration skipwhite skipnl + syn match rubyControl "\" nextgroup=rubyModuleDeclaration skipwhite skipnl + syn keyword rubyControl case begin do for if unless while until else elsif then when end endif " Keywords " Note: the following keywords have already been defined: " begin case class def do end for if module unless until while -syn keyword rubyControl and break else elsif ensure in next not or redo rescue retry return then when +syn keyword rubyControl and break ensure in next not or redo rescue retry return syn match rubyOperator "\= 508 || !exists("did_ruby_syntax_inits") command -nargs=+ HiLink hi def link endif - HiLink rubyType rubyDefine + HiLink rubyClass rubyDefine + HiLink rubyModule rubyDefine HiLink rubyDefine Define HiLink rubyFunction Function + HiLink rubyConditional Conditional + HiLink rubyLoop Loop HiLink rubyControl Statement HiLink rubyInclude Include HiLink rubyInteger Number - HiLink rubyASCIICode rubyInteger + HiLink rubyASCIICode Character HiLink rubyFloat Float - HiLink rubyBoolean rubyPseudoVariable + HiLink rubyBoolean Boolean HiLink rubyException Exception - HiLink rubyClass Type - HiLink rubyModule Type if !exists("ruby_no_identifiers") HiLink rubyIdentifier Identifier else HiLink rubyIdentifier NONE endif HiLink rubyClassVariable rubyIdentifier - HiLink rubyConstant rubyIdentifier + HiLink rubyConstant Type HiLink rubyGlobalVariable rubyIdentifier HiLink rubyBlockParameter rubyIdentifier HiLink rubyInstanceVariable rubyIdentifier HiLink rubyPredefinedIdentifier rubyIdentifier HiLink rubyPredefinedConstant rubyPredefinedIdentifier HiLink rubyPredefinedVariable rubyPredefinedIdentifier - HiLink rubySymbol rubyIdentifier + HiLink rubySymbol Constant HiLink rubyKeyword Keyword HiLink rubyOperator Operator HiLink rubyPseudoOperator rubyOperator @@ -304,4 +310,4 @@ endif let b:current_syntax = "ruby" -" vim: nowrap sw=2 sts=2 ts=8 ff=unix: +" vim: nowrap sw=2 sts=2 ts=8 noet ff=unix: From 08929bd5ec2f04205c6fa7fbbe6717fb4db32e54 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 23 Feb 2007 13:21:05 +0000 Subject: [PATCH 321/411] link the rubyLoop syntax group to the Repeat highlight group --- ChangeLog | 6 ++++++ syntax/ruby.vim | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 733e993c..7dcfdf94 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,12 @@ +2007-02-23 Doug Kearns + + * syntax/ruby.vim: link the rubyLoop syntax group to the Repeat + highlight group + 2007-02-22 Tim Pope * indent/eruby.vim: Fixed an edge case. + * syntax/ruby.vim: Simpler method and class declaration highlighting. Changed some contains=ALLBUT,... to contains=TOP. Altered some highlight links: rubyConstant is now Type; rubySymbol is now Constant. diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 13d5d8eb..d1a6520a 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.99 2007/02/22 17:32:03 tpope Exp $ +" Info: $Id: ruby.vim,v 1.100 2007/02/23 13:21:05 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -257,7 +257,7 @@ if version >= 508 || !exists("did_ruby_syntax_inits") HiLink rubyDefine Define HiLink rubyFunction Function HiLink rubyConditional Conditional - HiLink rubyLoop Loop + HiLink rubyLoop Repeat HiLink rubyControl Statement HiLink rubyInclude Include HiLink rubyInteger Number From ad21c1137f1ed8e0c781252a2df7d64c59be5b76 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 23 Feb 2007 13:57:22 +0000 Subject: [PATCH 322/411] make sure multi-line backslash escaped interpolation regions are highlighted as rubyString --- ChangeLog | 5 +++++ syntax/ruby.vim | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7dcfdf94..c8343bc4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-02-23 Doug Kearns + + * syntax/ruby.vim: make sure multi-line backslash escaped + interpolation regions are highlighted as rubyString + 2007-02-23 Doug Kearns * syntax/ruby.vim: link the rubyLoop syntax group to the Repeat diff --git a/syntax/ruby.vim b/syntax/ruby.vim index d1a6520a..840825e1 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.100 2007/02/23 13:21:05 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.101 2007/02/23 13:57:23 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -45,8 +45,8 @@ syn match rubyEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\ syn region rubyInterpolated matchgroup=rubyInterpolation start="#{" end="}" contains=TOP contained "syn match rubyInterpolation "#\%(\$\|@@\=\)\w\+" contained contains=rubyInstanceVariable,rubyClassVariable,rubyGlobalVariable display syn match rubyInterpolation "#\ze\%(\$\|@@\=\)\w\+" contained display nextgroup=rubyClassVariable,rubyInstanceVariable,rubyGlobalVariable -syn match rubyNoInterpolation "\\#{[^}]*}" contained -syn match rubyNoInterpolation "\\#\%(\$\|@@\=\)\w\+" contained display +syn region rubyNoInterpolation start="\\#{" end="}" contained +syn match rubyNoInterpolation "\\#\%(\$\|@@\=\)\w\+" contained display syn match rubyDelimEscape "\\[(<{\[)>}\]]" transparent display contained contains=NONE From 01abe0e1a181eab2a29f999238e03e807de8f1f3 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Fri, 23 Feb 2007 17:52:03 +0000 Subject: [PATCH 323/411] syntax/ruby.vim changes --- ChangeLog | 5 +++++ syntax/ruby.vim | 28 +++++++++++++++++----------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index c8343bc4..0d392692 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-02-23 Tim Pope + + * syntax/ruby.vim: Fixed method highlighting when not at the end of + the line. Highlight aliases. Account for \ before #{} interpolation. + 2007-02-23 Doug Kearns * syntax/ruby.vim: make sure multi-line backslash escaped diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 840825e1..c4ddc192 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.101 2007/02/23 13:57:23 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.102 2007/02/23 17:52:03 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -42,7 +42,7 @@ endif " Expression Substitution and Backslash Notation syn match rubyEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display syn match rubyEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display -syn region rubyInterpolated matchgroup=rubyInterpolation start="#{" end="}" contains=TOP contained +syn region rubyInterpolated matchgroup=rubyInterpolation start="\\\@>\|[<>]=\=\|<=>\|===\|=\~\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration " Expensive Mode - colorize *end* according to opening statement if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") + syn match rubyDefine "\" nextgroup=rubyAliasDeclaration skipwhite skipnl syn match rubyDefine "\" nextgroup=rubyMethodDeclaration skipwhite skipnl syn match rubyClass "\" nextgroup=rubyClassDeclaration skipwhite skipnl syn match rubyModule "\" nextgroup=rubyModuleDeclaration skipwhite skipnl @@ -164,7 +169,7 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") " modifiers syn match rubyConditional "\<\%(if\|unless\)\>" display - syn match rubyLoop "\<\%(while\|until\)\>" display + syn match rubyRepeat "\<\%(while\|until\)\>" display " *do* requiring *end* syn region rubyDoBlock matchgroup=rubyControl start="\" end="\" contains=TOP fold @@ -178,8 +183,8 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") syn keyword rubyConditional else elsif then when " statement with optional *do* - syn region rubyOptDoLine matchgroup=rubyLoop start="\" start="\%(\%(^\|\.\.\.\=\|[?:,;=([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\%(\\|:\)" end="\ze\%(;\|$\)" oneline contains=TOP - syn region rubyOptDoBlock start="\" start="\%(\%(^\|\.\.\.\=\|[:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" matchgroup=rubyLoop end="\" contains=TOP nextgroup=rubyOptDoLine fold + syn region rubyOptDoLine matchgroup=rubyRepeat start="\" start="\%(\%(^\|\.\.\.\=\|[?:,;=([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\%(\\|:\)" end="\ze\%(;\|$\)" oneline contains=TOP + syn region rubyOptDoBlock start="\" start="\%(\%(^\|\.\.\.\=\|[:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" matchgroup=rubyRepeat end="\" contains=TOP nextgroup=rubyOptDoLine fold if !exists("ruby_minlines") let ruby_minlines = 50 @@ -191,6 +196,7 @@ else syn match rubyControl "\" nextgroup=rubyClassDeclaration skipwhite skipnl syn match rubyControl "\" nextgroup=rubyModuleDeclaration skipwhite skipnl syn keyword rubyControl case begin do for if unless while until else elsif then when end + syn keyword rubyKeyword alias endif " Keywords @@ -198,7 +204,7 @@ endif " begin case class def do end for if module unless until while syn keyword rubyControl and break ensure in next not or redo rescue retry return syn match rubyOperator "\= 508 || !exists("did_ruby_syntax_inits") HiLink rubyDefine Define HiLink rubyFunction Function HiLink rubyConditional Conditional - HiLink rubyLoop Repeat + HiLink rubyRepeat Repeat HiLink rubyControl Statement HiLink rubyInclude Include HiLink rubyInteger Number From 6e22fdad94d06b9b3842c55dc6d4b205a0698f4a Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Fri, 23 Feb 2007 18:10:05 +0000 Subject: [PATCH 324/411] Document alternative to ruby_no_identifiers --- ChangeLog | 5 +++++ doc/ft-ruby-syntax.txt | 6 +++--- syntax/ruby.vim | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0d392692..97503060 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-02-23 Tim Pope + + * doc/ft-ruby-syntax.txt: Recommend hi link rubyIdentifier NONE over + ruby_no_identifiers. + 2007-02-23 Tim Pope * syntax/ruby.vim: Fixed method highlighting when not at the end of diff --git a/doc/ft-ruby-syntax.txt b/doc/ft-ruby-syntax.txt index 22179406..54d20633 100644 --- a/doc/ft-ruby-syntax.txt +++ b/doc/ft-ruby-syntax.txt @@ -20,10 +20,10 @@ the "ruby_minlines" variable to a value larger than 50: > Ideally, this value should be a number of lines large enough to embrace your largest class or module. -Highlighting of special identifiers can be disabled by defining -"ruby_no_identifiers": > +Highlighting of special identifiers can be disabled by removing the +rubyIdentifier highlighting: > - :let ruby_no_identifiers = 1 + :hi link rubyIdentifier NONE < This will prevent highlighting of special identifiers like "ConstantName", "$global_var", "@@class_var", "@instance_var", "| block_param |", and diff --git a/syntax/ruby.vim b/syntax/ruby.vim index c4ddc192..02ac05bf 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.102 2007/02/23 17:52:03 tpope Exp $ +" Info: $Id: ruby.vim,v 1.103 2007/02/23 18:10:05 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -156,7 +156,7 @@ syn match rubyClassDeclaration "[^[:space:];#(]\+" contained contains=rubyCo syn match rubyModuleDeclaration "[^[:space:];#(]\+" contained contains=rubyConstant syn match rubyFunction "\<[_[:lower:]][_[:alnum:]]*[?!=]\=\.\@!" contained containedin=rubyMethodDeclaration syn match rubyFunction "\%(\s\|^\)\@<=[_[:lower:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2 -syn match rubyFunction "\%([[:space:].]\|^\)\@<=\%(\[\]=\=\|\*\*\|[+-]@\=\|[*/%|^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|=\~\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration +syn match rubyFunction "\%([[:space:].]\|^\)\@<=\%(\[\]=\=\|\*\*\|[+-]@\=\|[*/%|^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|=\~\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration " Expensive Mode - colorize *end* according to opening statement if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") syn match rubyDefine "\" nextgroup=rubyAliasDeclaration skipwhite skipnl From c2cd6f97edd8dfbd4052a42bcb2063f65a8e70a0 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 24 Feb 2007 04:02:50 +0000 Subject: [PATCH 325/411] highlight == and & 'operator' redefinitions properly --- ChangeLog | 5 +++++ syntax/ruby.vim | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 97503060..3918904d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-02-24 Doug Kearns + + * syntax/ruby.vim: highlight == and & 'operator' redefinitions + properly + 2007-02-23 Tim Pope * doc/ft-ruby-syntax.txt: Recommend hi link rubyIdentifier NONE over diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 02ac05bf..032f8c2d 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.103 2007/02/23 18:10:05 tpope Exp $ +" Info: $Id: ruby.vim,v 1.104 2007/02/24 04:02:50 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -156,7 +156,7 @@ syn match rubyClassDeclaration "[^[:space:];#(]\+" contained contains=rubyCo syn match rubyModuleDeclaration "[^[:space:];#(]\+" contained contains=rubyConstant syn match rubyFunction "\<[_[:lower:]][_[:alnum:]]*[?!=]\=\.\@!" contained containedin=rubyMethodDeclaration syn match rubyFunction "\%(\s\|^\)\@<=[_[:lower:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2 -syn match rubyFunction "\%([[:space:].]\|^\)\@<=\%(\[\]=\=\|\*\*\|[+-]@\=\|[*/%|^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|=\~\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration +syn match rubyFunction "\%([[:space:].]\|^\)\@<=\%(\[\]=\=\|\*\*\|[+-]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|==\|=\~\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration " Expensive Mode - colorize *end* according to opening statement if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") syn match rubyDefine "\" nextgroup=rubyAliasDeclaration skipwhite skipnl From 6c6aab3599ff90fa134e4116d1c8f85bd5cca108 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 24 Feb 2007 11:00:03 +0000 Subject: [PATCH 326/411] allow escape sequences and interpolation inside symbol 'names' specified with a string --- ChangeLog | 5 +++++ syntax/ruby.vim | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3918904d..4da74cb8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-02-24 Doug Kearns + + * syntax/ruby.vim: allow escape sequences and interpolation inside + symbol 'names' specified with a string + 2007-02-24 Doug Kearns * syntax/ruby.vim: highlight == and & 'operator' redefinitions diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 032f8c2d..3ffdf0fb 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.104 2007/02/24 04:02:50 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.105 2007/02/24 11:00:03 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -79,6 +79,7 @@ syn match rubySymbol ":\@\|<=\|<\|===\|==\|=\~\|>>\|>=\| syn match rubySymbol ":\@_,;:!?/.'"@$*\&+0]\)" syn match rubySymbol ":\@\|{\)\s*\)|\s*\)\@<=[( ,a-zA-Z0-9_*)]\+\%(\s*|\)\@=" display else From 0c3a0ad5f10581177f9c915551907ddc91f73905 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sun, 25 Feb 2007 05:19:09 +0000 Subject: [PATCH 327/411] "def end", "set keywordprg=ri" --- ChangeLog | 6 ++++++ ftplugin/ruby.vim | 4 +++- syntax/ruby.vim | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4da74cb8..344f4946 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-02-24 Tim Pope + + * ftplugin/ruby.vim: set keywordprg=ri + + * syntax/ruby.vim: Allow for "def end" madness + 2007-02-24 Doug Kearns * syntax/ruby.vim: allow escape sequences and interpolation inside diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index 1cc6bdb7..cca480f9 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.29 2007/02/10 09:38:43 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.30 2007/02/25 05:19:10 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -20,6 +20,8 @@ let b:did_ftplugin = 1 let s:cpo_save = &cpo set cpo&vim +setlocal keywordprg=ri + " Matchit support if exists("loaded_matchit") && !exists("b:match_words") let b:match_ignorecase = 0 diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 3ffdf0fb..f69b68fa 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.105 2007/02/24 11:00:03 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.106 2007/02/25 05:19:10 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -164,7 +164,7 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") syn match rubyDefine "\" nextgroup=rubyMethodDeclaration skipwhite skipnl syn match rubyClass "\" nextgroup=rubyClassDeclaration skipwhite skipnl syn match rubyModule "\" nextgroup=rubyModuleDeclaration skipwhite skipnl - syn region rubyBlock start="\" matchgroup=rubyDefine end="\" contains=TOP fold + syn region rubyBlock start="\" matchgroup=rubyDefine end="\%(\" contains=TOP fold syn region rubyBlock start="\" matchgroup=rubyClass end="\" contains=TOP fold syn region rubyBlock start="\" matchgroup=rubyModule end="\" contains=TOP fold From ff62639ababf85579453b6821fcfa54e4808c96d Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sun, 25 Feb 2007 18:01:42 +0000 Subject: [PATCH 328/411] Method highlighting --- ChangeLog | 5 +++++ syntax/ruby.vim | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 344f4946..54a1d1db 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-02-25 Tim Pope + + * syntax/ruby.vim: Highlight symbols and global variables in aliases. + Highlight capitalized method names. + 2007-02-24 Tim Pope * ftplugin/ruby.vim: set keywordprg=ri diff --git a/syntax/ruby.vim b/syntax/ruby.vim index f69b68fa..7f708c2b 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.106 2007/02/25 05:19:10 tpope Exp $ +" Info: $Id: ruby.vim,v 1.107 2007/02/25 18:01:43 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -150,13 +150,13 @@ if exists('main_syntax') && main_syntax == 'eruby' let b:ruby_no_expensive = 1 end -syn match rubyAliasDeclaration "[^[:space:];#.()]\+" contained nextgroup=rubyAliasDeclaration2 skipwhite -syn match rubyAliasDeclaration2 "[^[:space:];#.()]\+" contained +syn match rubyAliasDeclaration "[^[:space:];#.()]\+" contained contains=rubySymbol,rubyGlobalVariable nextgroup=rubyAliasDeclaration2 skipwhite +syn match rubyAliasDeclaration2 "[^[:space:];#.()]\+" contained contains=rubySymbol,rubyGlobalVariable syn match rubyMethodDeclaration "[^[:space:];#(]\+" contained contains=rubyConstant,rubyBoolean,rubyPseudoVariable,rubyInstanceVariable,rubyClassVariable,rubyGlobalVariable syn match rubyClassDeclaration "[^[:space:];#(]\+" contained contains=rubyConstant syn match rubyModuleDeclaration "[^[:space:];#(]\+" contained contains=rubyConstant -syn match rubyFunction "\<[_[:lower:]][_[:alnum:]]*[?!=]\=\.\@!" contained containedin=rubyMethodDeclaration -syn match rubyFunction "\%(\s\|^\)\@<=[_[:lower:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2 +syn match rubyFunction "\<[_[:alpha:]][_[:alnum:]]*[?!=]\=[[:alnum:].:?!=]\@!" contained containedin=rubyMethodDeclaration +syn match rubyFunction "\%(\s\|^\)\@<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2 syn match rubyFunction "\%([[:space:].]\|^\)\@<=\%(\[\]=\=\|\*\*\|[+-]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|==\|=\~\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration " Expensive Mode - colorize *end* according to opening statement if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") From 630c7882bc53346387aa4bd05c0562550d307b4f Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sun, 25 Feb 2007 23:24:47 +0000 Subject: [PATCH 329/411] syntax/ruby.vim --- ChangeLog | 4 ++++ syntax/ruby.vim | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 54a1d1db..ae1adc96 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-02-25 Tim Pope + + * syntax/ruby.vim: Highlight predefined global variables in aliases. + 2007-02-25 Tim Pope * syntax/ruby.vim: Highlight symbols and global variables in aliases. diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 7f708c2b..07fa4cd1 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.107 2007/02/25 18:01:43 tpope Exp $ +" Info: $Id: ruby.vim,v 1.108 2007/02/25 23:24:48 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -150,8 +150,8 @@ if exists('main_syntax') && main_syntax == 'eruby' let b:ruby_no_expensive = 1 end -syn match rubyAliasDeclaration "[^[:space:];#.()]\+" contained contains=rubySymbol,rubyGlobalVariable nextgroup=rubyAliasDeclaration2 skipwhite -syn match rubyAliasDeclaration2 "[^[:space:];#.()]\+" contained contains=rubySymbol,rubyGlobalVariable +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 syn match rubyModuleDeclaration "[^[:space:];#(]\+" contained contains=rubyConstant From 465194db7fd16581a86eb1067de235b94a8ac445 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Mon, 26 Feb 2007 08:04:30 +0000 Subject: [PATCH 330/411] highlight methods named "end" when the definition is distributed over multiple lines --- ChangeLog | 5 +++++ syntax/ruby.vim | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ae1adc96..5b92eda1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-02-26 Doug Kearns + + * syntax/ruby.vim: highlight methods named "end" when the definition + is distributed over multiple lines (i.e. allow more "def end" madness) + 2007-02-25 Tim Pope * syntax/ruby.vim: Highlight predefined global variables in aliases. diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 07fa4cd1..a84cd716 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.108 2007/02/25 23:24:48 tpope Exp $ +" Info: $Id: ruby.vim,v 1.109 2007/02/26 08:04:31 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -164,7 +164,7 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") syn match rubyDefine "\" nextgroup=rubyMethodDeclaration skipwhite skipnl syn match rubyClass "\" nextgroup=rubyClassDeclaration skipwhite skipnl syn match rubyModule "\" nextgroup=rubyModuleDeclaration skipwhite skipnl - syn region rubyBlock start="\" matchgroup=rubyDefine end="\%(\" contains=TOP fold + syn region rubyBlock start="\" matchgroup=rubyDefine end="\%(\" contains=TOP fold syn region rubyBlock start="\" matchgroup=rubyClass end="\" contains=TOP fold syn region rubyBlock start="\" matchgroup=rubyModule end="\" contains=TOP fold From a21a27c5fce443f9acd35f753f286275e5d6d7e1 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Mon, 26 Feb 2007 08:29:55 +0000 Subject: [PATCH 331/411] highlight interpolation regions preceded by multiple backslashes properly --- ChangeLog | 5 +++++ syntax/ruby.vim | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5b92eda1..91c4e788 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-02-26 Doug Kearns + + * syntax/ruby.vim: highlight interpolation regions preceded by + multiple backslashes properly + 2007-02-26 Doug Kearns * syntax/ruby.vim: highlight methods named "end" when the definition diff --git a/syntax/ruby.vim b/syntax/ruby.vim index a84cd716..86cc607e 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.109 2007/02/26 08:04:31 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.110 2007/02/26 08:29:56 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -42,10 +42,11 @@ endif " Expression Substitution and Backslash Notation syn match rubyEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display syn match rubyEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display -syn region rubyInterpolated matchgroup=rubyInterpolation start="\\\@}\]]" transparent display contained contains=NONE From 323b6ec9c01fdcc263aa3ee9a46e91b67388d641 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Mon, 26 Feb 2007 09:51:06 +0000 Subject: [PATCH 332/411] reorganise string interpolation syntax groups --- ChangeLog | 4 ++++ syntax/ruby.vim | 19 ++++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 91c4e788..a49fc8a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-02-26 Doug Kearns + + * syntax/ruby.vim: reorganise string interpolation syntax groups + 2007-02-26 Doug Kearns * syntax/ruby.vim: highlight interpolation regions preceded by diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 86cc607e..2d18205b 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.110 2007/02/26 08:29:56 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.111 2007/02/26 09:51:06 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -42,12 +42,13 @@ endif " Expression Substitution and Backslash Notation syn match rubyEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display syn match rubyEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display -syn region rubyInterpolated matchgroup=rubyInterpolation start="#{" end="}" contains=TOP contained -"syn match rubyInterpolation "#\%(\$\|@@\=\)\w\+" contained contains=rubyInstanceVariable,rubyClassVariable,rubyGlobalVariable display -syn match rubyInterpolation "#\ze\%(\$\|@@\=\)\w\+" contained display nextgroup=rubyClassVariable,rubyInstanceVariable,rubyGlobalVariable -syn region rubyNoInterpolation start="\\#{" end="}" contained -syn match rubyNoInterpolation "\\#{" contained display -syn match rubyNoInterpolation "\\#\%(\$\|@@\=\)\w\+" contained display + +syn region rubyInterpolation matchgroup=rubyInterpolationDelimiter start="#{" end="}" contained contains=TOP +syn match rubyInterpolation "#\%(\$\|@@\=\)\w\+" display contained contains=rubyInterpolationDelimiter,rubyInstanceVariable,rubyClassVariable,rubyGlobalVariable +syn match rubyInterpolationDelimiter "#\ze\%(\$\|@@\=\)\w\+" display contained +syn region rubyNoInterpolation start="\\#{" end="}" contained +syn match rubyNoInterpolation "\\#{" display contained +syn match rubyNoInterpolation "\\#\%(\$\|@@\=\)\w\+" display contained syn match rubyDelimEscape "\\[(<{\[)>}\]]" transparent display contained contains=NONE @@ -56,7 +57,7 @@ syn region rubyNestedCurlyBraces start="{" end="}" skip="\\\\\|\\}" transparent syn region rubyNestedAngleBrackets start="<" end=">" skip="\\\\\|\\>" transparent contained contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimEscape syn region rubyNestedSquareBrackets start="\[" end="\]" skip="\\\\\|\\\]" transparent contained contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimEscape -syn cluster rubyStringSpecial contains=rubyInterpolation,rubyInterpolated,rubyNoInterpolation,rubyEscape +syn cluster rubyStringSpecial contains=rubyInterpolation,rubyNoInterpolation,rubyEscape syn cluster rubyExtendedStringSpecial contains=@rubyStringSpecial,rubyNestedParentheses,rubyNestedCurlyBraces,rubyNestedAngleBrackets,rubyNestedSquareBrackets " Numbers and ASCII Codes @@ -301,7 +302,7 @@ if version >= 508 || !exists("did_ruby_syntax_inits") HiLink rubyDataDirective Delimiter HiLink rubyDocumentation Comment HiLink rubyEscape Special - HiLink rubyInterpolation Special + HiLink rubyInterpolationDelimiter Delimiter HiLink rubyNoInterpolation rubyString HiLink rubySharpBang PreProc HiLink rubyRegexpDelimiter rubyStringDelimiter From 646a635d95fcd265fb48bc759bb0e8aeb2bc4183 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Mon, 26 Feb 2007 14:06:00 +0000 Subject: [PATCH 333/411] make sure 'class << self' is always highlighted --- ChangeLog | 4 ++++ syntax/ruby.vim | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index a49fc8a9..27b60ea2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-02-26 Doug Kearns + + * syntax/ruby.vim: make sure 'class << self' is always highlighted + 2007-02-26 Doug Kearns * syntax/ruby.vim: reorganise string interpolation syntax groups diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 2d18205b..3276a3ea 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.111 2007/02/26 09:51:06 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.112 2007/02/26 14:06:00 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -154,9 +154,9 @@ end 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 -syn match rubyModuleDeclaration "[^[:space:];#(]\+" contained contains=rubyConstant +syn match rubyMethodDeclaration "[^[:space:];#(]\+" contained contains=rubyConstant,rubyBoolean,rubyPseudoVariable,rubyInstanceVariable,rubyClassVariable,rubyGlobalVariable +syn match rubyClassDeclaration "[^[:space:];#<]\+" contained contains=rubyConstant +syn match rubyModuleDeclaration "[^[:space:];#]\+" contained contains=rubyConstant syn match rubyFunction "\<[_[:alpha:]][_[:alnum:]]*[?!=]\=[[:alnum:].:?!=]\@!" contained containedin=rubyMethodDeclaration syn match rubyFunction "\%(\s\|^\)\@<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2 syn match rubyFunction "\%([[:space:].]\|^\)\@<=\%(\[\]=\=\|\*\*\|[+-]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|==\|=\~\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration From 6fc2b6b1f89cd51e796378a1f5b86a7f6c223ed1 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Mon, 26 Feb 2007 15:21:26 +0000 Subject: [PATCH 334/411] Nest then, else, elsif, when in appropriate constructs --- ChangeLog | 5 +++++ syntax/ruby.vim | 10 ++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 27b60ea2..b2a5e6af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-02-26 Tim Pope + + * syntax/ruby.vim: Limit then, else, elsif, and when to inside + conditional statements. + 2007-02-26 Doug Kearns * syntax/ruby.vim: make sure 'class << self' is always highlighted diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 3276a3ea..a698d141 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.112 2007/02/26 14:06:00 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.113 2007/02/26 15:21:26 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -181,9 +181,11 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") syn region rubyCurlyBlock start="{" end="}" contains=TOP fold " statements without *do* - syn region rubyNoDoBlock matchgroup=rubyControl start="\" end="\" contains=TOP fold - syn region rubyNoDoBlock matchgroup=rubyConditional start="\" start="\%(^\|\.\.\.\=\|[,;=([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\" contains=TOP fold - syn keyword rubyConditional else elsif then when + syn region rubyNoDoBlock matchgroup=rubyControl start="\" end="\" contains=TOP fold + syn region rubyCaseBlock matchgroup=rubyConditional start="\" end="\" contains=TOP fold + syn region rubyConditionalBlock matchgroup=rubyConditional start="\%(^\|\.\.\.\=\|[,;=([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\" contains=TOP fold + syn keyword rubyConditional then else when contained containedin=rubyCaseBlock + syn keyword rubyConditional then else elsif contained containedin=rubyConditionalBlock " statement with optional *do* syn region rubyOptDoLine matchgroup=rubyRepeat start="\" start="\%(\%(^\|\.\.\.\=\|[?:,;=([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\%(\\|:\)" end="\ze\%(;\|$\)" oneline contains=TOP From 734ca5158460158214a8d23e76d680ceb5736481 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 27 Feb 2007 11:54:10 +0000 Subject: [PATCH 335/411] :retab! syntax/ruby.vim to save a few bytes --- ChangeLog | 4 ++++ syntax/ruby.vim | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index b2a5e6af..631ce640 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-02-27 Doug Kearns + + * syntax/ruby.vim: :retab! the file to save a few bytes + 2007-02-26 Tim Pope * syntax/ruby.vim: Limit then, else, elsif, and when to inside diff --git a/syntax/ruby.vim b/syntax/ruby.vim index a698d141..8318e7db 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.113 2007/02/26 15:21:26 tpope Exp $ +" Info: $Id: ruby.vim,v 1.114 2007/02/27 11:54:11 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -34,18 +34,18 @@ endif " Operators if exists("ruby_operators") - syn match rubyOperator "\%(\^\|\~\|\%(class\s*\)\@\|<=\|\%(<\|\>\|>=\|>\||\|-\|/\|\*\*\|\*\|&\|%\|+\)" + syn match rubyOperator "\%(\^\|\~\|\%(class\s*\)\@\|<=\|\%(<\|\>\|>=\|>\||\|-\|/\|\*\*\|\*\|&\|%\|+\)" syn match rubyPseudoOperator "\%(-=\|/=\|\*\*=\|\*=\|&&\|&=\|&&=\|||\||=\|||=\|%=\|+=\|!\~\|!=\)" syn region rubyBracketOperator matchgroup=rubyOperator start="\%([_[:lower:]]\w*[?!=]\=\|}\)\@<=\[\s*" end="\s*]" endif " Expression Substitution and Backslash Notation -syn match rubyEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display -syn match rubyEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display +syn match rubyEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display +syn match rubyEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display syn region rubyInterpolation matchgroup=rubyInterpolationDelimiter start="#{" end="}" contained contains=TOP syn match rubyInterpolation "#\%(\$\|@@\=\)\w\+" display contained contains=rubyInterpolationDelimiter,rubyInstanceVariable,rubyClassVariable,rubyGlobalVariable -syn match rubyInterpolationDelimiter "#\ze\%(\$\|@@\=\)\w\+" display contained +syn match rubyInterpolationDelimiter "#\ze\%(\$\|@@\=\)\w\+" display contained syn region rubyNoInterpolation start="\\#{" end="}" contained syn match rubyNoInterpolation "\\#{" display contained syn match rubyNoInterpolation "\\#\%(\$\|@@\=\)\w\+" display contained @@ -162,9 +162,9 @@ syn match rubyFunction "\%(\s\|^\)\@<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\ syn match rubyFunction "\%([[:space:].]\|^\)\@<=\%(\[\]=\=\|\*\*\|[+-]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|==\|=\~\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration " Expensive Mode - colorize *end* according to opening statement if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") - syn match rubyDefine "\" nextgroup=rubyAliasDeclaration skipwhite skipnl + syn match rubyDefine "\" nextgroup=rubyAliasDeclaration skipwhite skipnl syn match rubyDefine "\" nextgroup=rubyMethodDeclaration skipwhite skipnl - syn match rubyClass "\" nextgroup=rubyClassDeclaration skipwhite skipnl + syn match rubyClass "\" nextgroup=rubyClassDeclaration skipwhite skipnl syn match rubyModule "\" nextgroup=rubyModuleDeclaration skipwhite skipnl syn region rubyBlock start="\" matchgroup=rubyDefine end="\%(\" contains=TOP fold syn region rubyBlock start="\" matchgroup=rubyClass end="\" contains=TOP fold @@ -197,9 +197,9 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") exec "syn sync minlines=" . ruby_minlines else - syn match rubyControl "\" nextgroup=rubyMethodDeclaration skipwhite skipnl - syn match rubyControl "\" nextgroup=rubyClassDeclaration skipwhite skipnl - syn match rubyControl "\" nextgroup=rubyModuleDeclaration skipwhite skipnl + syn match rubyControl "\" nextgroup=rubyMethodDeclaration skipwhite skipnl + syn match rubyControl "\" nextgroup=rubyClassDeclaration skipwhite skipnl + syn match rubyControl "\" nextgroup=rubyModuleDeclaration skipwhite skipnl syn keyword rubyControl case begin do for if unless while until else elsif then when end syn keyword rubyKeyword alias endif @@ -231,9 +231,9 @@ syn keyword rubyTodo FIXME NOTE TODO XXX contained syn match rubyComment "#.*" contains=rubySharpBang,rubySpaceError,rubyTodo,@Spell if !exists("ruby_no_comment_fold") syn region rubyMultilineComment start="\%(\%(^\s*#.*\n\)\@ Date: Tue, 27 Feb 2007 13:17:36 +0000 Subject: [PATCH 336/411] add rubyPredefinedVariable to short-form rubyInterpolation's contains list --- ChangeLog | 5 +++++ syntax/ruby.vim | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 631ce640..66cfd7f2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-02-27 Doug Kearns + + * syntax/ruby.vim: add rubyPredefinedVariable to short-form + rubyInterpolation's contains list + 2007-02-27 Doug Kearns * syntax/ruby.vim: :retab! the file to save a few bytes diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 8318e7db..5fbd716d 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.114 2007/02/27 11:54:11 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.115 2007/02/27 13:17:36 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -44,7 +44,7 @@ syn match rubyEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" conta syn match rubyEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display syn region rubyInterpolation matchgroup=rubyInterpolationDelimiter start="#{" end="}" contained contains=TOP -syn match rubyInterpolation "#\%(\$\|@@\=\)\w\+" display contained contains=rubyInterpolationDelimiter,rubyInstanceVariable,rubyClassVariable,rubyGlobalVariable +syn match rubyInterpolation "#\%(\$\|@@\=\)\w\+" display contained contains=rubyInterpolationDelimiter,rubyInstanceVariable,rubyClassVariable,rubyGlobalVariable,rubyPredefinedVariable syn match rubyInterpolationDelimiter "#\ze\%(\$\|@@\=\)\w\+" display contained syn region rubyNoInterpolation start="\\#{" end="}" contained syn match rubyNoInterpolation "\\#{" display contained From f224cd274c98f6ba8895e57389b55ef2fb5d7360 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Tue, 27 Feb 2007 15:40:35 +0000 Subject: [PATCH 337/411] balloonexpr --- ChangeLog | 4 +++ ftplugin/ruby.vim | 71 +++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 72 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 66cfd7f2..9569bc4b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-02-27 Tim Pope + + * ftplugin/ruby.vim: Provide 'balloonexpr'. + 2007-02-27 Doug Kearns * syntax/ruby.vim: add rubyPredefinedVariable to short-form diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index cca480f9..3f06295f 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.30 2007/02/25 05:19:10 tpope Exp $ +" Info: $Id: ruby.vim,v 1.31 2007/02/27 15:40:36 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -20,7 +20,11 @@ let b:did_ftplugin = 1 let s:cpo_save = &cpo set cpo&vim -setlocal keywordprg=ri +if has("gui_running") && !has("gui_win32") + setlocal keywordprg=ri\ -T +else + setlocal keywordprg=ri +endif " Matchit support if exists("loaded_matchit") && !exists("b:match_words") @@ -60,6 +64,11 @@ if exists("&ofu") && has("ruby") setlocal omnifunc=rubycomplete#Complete endif +if has('balloon_eval') && exists('+balloonexpr') + setlocal balloonexpr=RubyBalloonexpr() +endif + + " TODO: "setlocal define=^\\s*def @@ -92,13 +101,69 @@ if has("gui_win32") && !exists("b:browsefilter") \ "All Files (*.*)\t*.*\n" endif -let b:undo_ftplugin = "setl fo< inc< inex< sua< def< com< cms< path<" +let b:undo_ftplugin = "setl fo< inc< inex< sua< def< com< cms< path< 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" let &cpo = s:cpo_save unlet s:cpo_save +if exists("g:did_ruby_ftplugin_functions") + finish +endif +let g:did_ruby_ftplugin_functions = 1 + +function! RubyBalloonexpr() + if !exists('s:ri_found') + let s:ri_found = executable('ri') + endif + if s:ri_found + let line = getline(v:beval_lnum) + let b = matchstr(strpart(line,0,v:beval_col),'\%(\w\|[:.]\)*$') + let a = substitute(matchstr(strpart(line,v:beval_col),'^\w*\%([?!]\|\s*=\)\?'),'\s\+','','g') + let str = b.a + let before = strpart(line,0,v:beval_col-strlen(b)) + let after = strpart(line,v:beval_col+strlen(a)) + if str =~ '^\.' + let str = substitute(str,'^\.','#','g') + if before =~ '\]\s*$' + let str = 'Array'.str + elseif before =~ '}\s*$' + " False positives from blocks here + let str = 'Hash'.str + elseif before =~ "[\"'`]\\s*$" || before =~ '\$\d\+\s*$' + let str = 'String'.str + elseif before =~ '\$\d\+\.\d\+\s*$' + let str = 'Float'.str + elseif before =~ '\$\d\+\s*$' + let str = 'Integer'.str + elseif before =~ '/\s*$' + let str = 'Regexp'.str + else + let str = substitute(str,'^#','.','') + endif + endif + let str = substitute(str,'.*\.\s*to_f\s*\.\s*','Float#','') + let str = substitute(str,'.*\.\s*to_i\%(nt\)\=\s*\.\s*','Integer#','') + let str = substitute(str,'.*\.\s*to_s\%(tr\)\=\s*\.\s*','String#','') + let str = substitute(str,'.*\.\s*to_sym\s*\.\s*','Symbol#','') + let str = substitute(str,'.*\.\s*to_a\%(ry\)\=\s*\.\s*','Array#','') + let str = substitute(str,'.*\.\s*to_proc\s*\.\s*','Proc#','') + if str !~ '^\w' + return '' + endif + silent! let res = substitute(system("ri -f simple -T \"".str.'"'),'\n$','','') + if res =~ '^Nothing known about' || res =~ '^Bad argument:' + return '' + endif + return res + else + return "" + endif +endfunction + + " " Instructions for enabling "matchit" support: " From 521392cebbde4b73aa0c65514c8fac6fc662140f Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Tue, 27 Feb 2007 15:47:27 +0000 Subject: [PATCH 338/411] ballooneval comment --- ftplugin/ruby.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index 3f06295f..4be3a112 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.31 2007/02/27 15:40:36 tpope Exp $ +" Info: $Id: ruby.vim,v 1.32 2007/02/27 15:47:27 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -64,6 +64,7 @@ if exists("&ofu") && has("ruby") setlocal omnifunc=rubycomplete#Complete endif +" To activate, :set ballooneval if has('balloon_eval') && exists('+balloonexpr') setlocal balloonexpr=RubyBalloonexpr() endif From 1d13d66bbf74e18bb289140256d0b9323dcf02d3 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 28 Feb 2007 06:58:58 +0000 Subject: [PATCH 339/411] update documentation for next release --- CONTRIBUTORS | 2 +- ChangeLog | 4 ++++ NEWS | 43 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 1126f817..a9ccc474 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2,7 +2,7 @@ Maintainers: Mark Guzman Tim Hammerquist Doug Kearns - Tim Pope + Tim Pope Gavin Sinclair Nikolai Weibull diff --git a/ChangeLog b/ChangeLog index 9569bc4b..edf6d35a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-02-28 Doug Kearns + + * NEWS, CONTRIBUTORS: update documentation for next release + 2007-02-27 Tim Pope * ftplugin/ruby.vim: Provide 'balloonexpr'. diff --git a/NEWS b/NEWS index e96107b5..1d559ab3 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,46 @@ += 2007.02.XX + +== Omni Completion + +RubyGems is now loaded by default if available. + +== Ruby Syntax Highlighting + +Ruby code is now highlighted inside interpolation regions. + +Symbols are now highlighted with the Constant highlight group. Constants and +class names are now highlighted with the Type highlight group. + +Symbol names specified with a string now recognise interpolation and escape +sequences. + +Alias statements now receive special highlighting similar to other +'definitions'. + +== Ruby Filetype Support + +Matchit support has been improved to include (), {}, and [] in the list of +patterns so that these will be appropriately skipped when included in comments. + +ri has been added as the 'keywordprg' and 'balloonexpr' is set to return the +output of ri. + +== eRuby Indenting + +Tim Pope has taken over maintenance of the eRuby indent file. Ruby code is now +indented appropriately. + +== Bug Fixes + +Ruby syntax file + - trailing whitespace is no longer included with the def, class, module + keywords + - escaped interpolation regions should now be ignored in all cases + +eRuby syntax file + - '-' trim mode block delimiters are now recognised + + = 2006.07.11 == Omni Completion From de270484da6d5bb540a5ca9fdf908b3eadf566a5 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 28 Feb 2007 10:44:35 +0000 Subject: [PATCH 340/411] highlight conditional and loop expressions properly when used with the ternary operator and in blocks --- ChangeLog | 5 +++++ syntax/ruby.vim | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index edf6d35a..488f8610 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-02-28 Doug Kearns + + * syntax/ruby.vim: highlight conditional and loop expressions properly + when used with the ternary operator and in blocks + 2007-02-28 Doug Kearns * NEWS, CONTRIBUTORS: update documentation for next release diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 5fbd716d..e89b2f4e 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.115 2007/02/27 13:17:36 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.116 2007/02/28 10:44:35 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -183,13 +183,13 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") " statements without *do* syn region rubyNoDoBlock matchgroup=rubyControl start="\" end="\" contains=TOP fold syn region rubyCaseBlock matchgroup=rubyConditional start="\" end="\" contains=TOP fold - syn region rubyConditionalBlock matchgroup=rubyConditional start="\%(^\|\.\.\.\=\|[,;=([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\" contains=TOP fold + syn region rubyConditionalBlock matchgroup=rubyConditional start="\%(\%(^\|\.\.\.\=\|[{?:,;=([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\" contains=TOP fold syn keyword rubyConditional then else when contained containedin=rubyCaseBlock syn keyword rubyConditional then else elsif contained containedin=rubyConditionalBlock " statement with optional *do* - syn region rubyOptDoLine matchgroup=rubyRepeat start="\" start="\%(\%(^\|\.\.\.\=\|[?:,;=([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\%(\\|:\)" end="\ze\%(;\|$\)" oneline contains=TOP - syn region rubyOptDoBlock start="\" start="\%(\%(^\|\.\.\.\=\|[:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" matchgroup=rubyRepeat end="\" contains=TOP nextgroup=rubyOptDoLine fold + syn region rubyOptDoLine matchgroup=rubyRepeat start="\" start="\%(\%(^\|\.\.\.\=\|[{?:,;=([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\%(\\|:\)" end="\ze\%(;\|$\)" oneline contains=TOP + syn region rubyOptDoBlock start="\" start="\%(\%(^\|\.\.\.\=\|[{?:,;=([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" matchgroup=rubyRepeat end="\" contains=TOP nextgroup=rubyOptDoLine fold if !exists("ruby_minlines") let ruby_minlines = 50 From 1c35fe5a327268d8ede779c9ed2362eff11c1fb7 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 1 Mar 2007 07:10:27 +0000 Subject: [PATCH 341/411] refine the conditional/loop expression vs modifier highlighting heuristic --- ChangeLog | 5 +++++ syntax/ruby.vim | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 488f8610..130e8df7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-03-01 Doug Kearns + + * syntax/ruby.vim: refine the conditional/loop expression vs modifier + highlighting heuristic + 2007-02-28 Doug Kearns * syntax/ruby.vim: highlight conditional and loop expressions properly diff --git a/syntax/ruby.vim b/syntax/ruby.vim index e89b2f4e..162ae9a0 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.116 2007/02/28 10:44:35 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.117 2007/03/01 07:10:28 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -183,13 +183,13 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") " statements without *do* syn region rubyNoDoBlock matchgroup=rubyControl start="\" end="\" contains=TOP fold syn region rubyCaseBlock matchgroup=rubyConditional start="\" end="\" contains=TOP fold - syn region rubyConditionalBlock matchgroup=rubyConditional start="\%(\%(^\|\.\.\.\=\|[{?:,;=([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\" contains=TOP fold + syn region rubyConditionalBlock matchgroup=rubyConditional start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\" contains=TOP fold syn keyword rubyConditional then else when contained containedin=rubyCaseBlock syn keyword rubyConditional then else elsif contained containedin=rubyConditionalBlock " statement with optional *do* - syn region rubyOptDoLine matchgroup=rubyRepeat start="\" start="\%(\%(^\|\.\.\.\=\|[{?:,;=([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\%(\\|:\)" end="\ze\%(;\|$\)" oneline contains=TOP - syn region rubyOptDoBlock start="\" start="\%(\%(^\|\.\.\.\=\|[{?:,;=([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" matchgroup=rubyRepeat end="\" contains=TOP nextgroup=rubyOptDoLine fold + syn region rubyOptDoLine matchgroup=rubyRepeat start="\" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\%(\\|:\)" end="\ze\%(;\|$\)" oneline contains=TOP + syn region rubyOptDoBlock start="\" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" matchgroup=rubyRepeat end="\" contains=TOP nextgroup=rubyOptDoLine fold if !exists("ruby_minlines") let ruby_minlines = 50 From 7cf6b9a38e9c6043ea102dfe36b48bc3b8382778 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 2 Mar 2007 04:39:38 +0000 Subject: [PATCH 342/411] refine the conditional/loop expression vs modifier matchit heuristic --- ChangeLog | 5 +++++ ftplugin/ruby.vim | 46 +++++++++++++++++++++++----------------------- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index 130e8df7..3aa294c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-03-02 Doug Kearns + + * ftplugin/ruby.vim: refine the conditional/loop expression vs + modifier matchit heuristic + 2007-03-01 Doug Kearns * syntax/ruby.vim: refine the conditional/loop expression vs modifier diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index 4be3a112..cc161c28 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,9 +1,9 @@ " Vim filetype plugin -" Language: Ruby -" Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.32 2007/02/27 15:47:27 tpope Exp $ -" URL: http://vim-ruby.rubyforge.org -" Anon CVS: See above site +" Language: Ruby +" Maintainer: Gavin Sinclair +" Info: $Id: ruby.vim,v 1.33 2007/03/02 04:39:38 dkearns Exp $ +" URL: http://vim-ruby.rubyforge.org +" Anon CVS: See above site " Release Coordinator: Doug Kearns " ---------------------------------------------------------------------------- " @@ -31,26 +31,26 @@ if exists("loaded_matchit") && !exists("b:match_words") let b:match_ignorecase = 0 " TODO: improve optional do loops - let b:match_words = - \ '\%(' . - \ '\%(\%(\.\|\:\:\)\s*\|\:\)\@' . - \ '\|' . - \ '\%(\%(^\|\.\.\.\=\|[\,;=([<>~\*/%!&^|+-]\)\s*\)\@<=\%(if\|unless\|until\|while\)\>' . - \ '\)' . - \ ':' . - \ '\%(' . - \ '\%(\%(\.\|\:\:\)\s*\|\:\)\@' . - \ '\|' . - \ '\%(\%(^\|;\)\s*\)\@<=\' . - \ '\)' . - \ ':' . - \ '\%(\%(\.\|\:\:\)\s*\|\:\)\@' . - \ ',{:},\[:\],(:)' + let b:match_words = + \ '\%(' . + \ '\%(\%(\.\|\:\:\)\s*\|\:\)\@' . + \ '\|' . + \ '\%(\%(^\|\.\.\.\=\|[{\:\,;([<>~\*/%&^|+-]\|\%(\<[_[\:lower\:]][_[\:alnum\:]]*\)\@' . + \ '\)' . + \ ':' . + \ '\%(' . + \ '\%(\%(\.\|\:\:\)\s*\|\:\)\@' . + \ '\|' . + \ '\%(\%(^\|;\)\s*\)\@<=\' . + \ '\)' . + \ ':' . + \ '\%(\%(\.\|\:\:\)\s*\|\:\)\@' . + \ ',{:},\[:\],(:)' let b:match_skip = - \ "synIDattr(synID(line('.'),col('.'),0),'name') =~ '" . - \ "\\'" + \ "synIDattr(synID(line('.'),col('.'),0),'name') =~ '" . + \ "\\'" endif From 50acdb8c3e7720b69fcd972d6ebbd5b0823b58a5 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Fri, 2 Mar 2007 05:29:36 +0000 Subject: [PATCH 343/411] NEWS about omnicompletion --- ChangeLog | 4 ++++ NEWS | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/ChangeLog b/ChangeLog index 3aa294c2..db218145 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-03-02 Tim Pope + + * NEWS: Documented changes to omnicompletion. + 2007-03-02 Doug Kearns * ftplugin/ruby.vim: refine the conditional/loop expression vs diff --git a/NEWS b/NEWS index 1d559ab3..2aadb399 100644 --- a/NEWS +++ b/NEWS @@ -2,8 +2,19 @@ == Omni Completion +Fallback to syntax highlighting completion if Vim lacks the Ruby interface. + RubyGems is now loaded by default if available. +Classes are detected using ObjectSpace. Kernel methods are included in method +completion. + +More robustness; failure to parse buffer no longer errors or prevents +completion. + +Added completion in Rails views. Rails helpers are included. Rails migrations +now have completion. + == Ruby Syntax Highlighting Ruby code is now highlighted inside interpolation regions. From d984c8e3dc7f56b7b48734b3fe4321ca058cd981 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Fri, 2 Mar 2007 05:40:48 +0000 Subject: [PATCH 344/411] syntax/ruby.vim: highlight correctly if iskeyword includes a colon --- ChangeLog | 5 +++++ syntax/ruby.vim | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index db218145..c6a344d2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2002-03-02 Tim Pope + + * syntax/ruby.vim: Cope with (nonsensical) inclusion of : in + iskeyword. + 2007-03-02 Tim Pope * NEWS: Documented changes to omnicompletion. diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 162ae9a0..dba82dd2 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.117 2007/03/01 07:10:28 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.118 2007/03/02 05:40:49 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -73,7 +73,7 @@ syn match rubyFloat "\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE syn match rubyLocalVariableOrMethod "\<[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent syn match rubyBlockArgument "&[_[:lower:]][_[:alnum:]]" contains=NONE display transparent -syn match rubyConstant "\%(\%([.@$]\@\%(\s*(\)\@!" +syn match rubyConstant "\%(\%([.@$]\@\|::\)\@=\%(\s*(\)\@!" syn match rubyClassVariable "@@\h\w*" display syn match rubyInstanceVariable "@\h\w*" display syn match rubyGlobalVariable "$\%(\h\w*\|-.\)" From 05ec0bdad7cbfd0534d8e86bcca1bc54bc603b27 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 2 Mar 2007 08:46:05 +0000 Subject: [PATCH 345/411] update documentation for next release --- ChangeLog | 4 ++++ NEWS | 30 ++++++++++++++++-------------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index c6a344d2..2ae72e9f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-03-02 Doug Kearns + + * NEWS: update documentation for next release + 2002-03-02 Tim Pope * syntax/ruby.vim: Cope with (nonsensical) inclusion of : in diff --git a/NEWS b/NEWS index 2aadb399..5d618b1b 100644 --- a/NEWS +++ b/NEWS @@ -1,32 +1,28 @@ -= 2007.02.XX += 2007.02.02 == Omni Completion -Fallback to syntax highlighting completion if Vim lacks the Ruby interface. +Fall back to syntax highlighting completion if Vim lacks the Ruby interface. RubyGems is now loaded by default if available. Classes are detected using ObjectSpace. Kernel methods are included in method completion. -More robustness; failure to parse buffer no longer errors or prevents -completion. - Added completion in Rails views. Rails helpers are included. Rails migrations now have completion. == Ruby Syntax Highlighting -Ruby code is now highlighted inside interpolation regions. +Ruby code is highlighted inside interpolation regions. -Symbols are now highlighted with the Constant highlight group. Constants and -class names are now highlighted with the Type highlight group. +Symbols are now highlighted with the Constant highlight group; Constants and +class names with the Type highlight group. -Symbol names specified with a string now recognise interpolation and escape +Symbol names specified with a string recognise interpolation and escape sequences. -Alias statements now receive special highlighting similar to other -'definitions'. +Alias statements receive special highlighting similar to other 'definitions'. == Ruby Filetype Support @@ -45,11 +41,17 @@ indented appropriately. Ruby syntax file - trailing whitespace is no longer included with the def, class, module - keywords - - escaped interpolation regions should now be ignored in all cases + keywords. + - escaped interpolation regions should now be ignored in all cases. + - conditional and loop statements are now highlighted correctly in more + locations (where they're used as expressions). eRuby syntax file - - '-' trim mode block delimiters are now recognised + - '-' trim mode block delimiters are now recognised. + +Omni Completion + - more robustness; failure to parse buffer no longer errors or prevents + completion. = 2006.07.11 From 12621fd6974f49ec5e757a4ea05466d0dbab7afb Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 2 Mar 2007 14:24:20 +0000 Subject: [PATCH 346/411] fix typo --- ChangeLog | 4 ++++ NEWS | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2ae72e9f..9a623180 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-03-02 Doug Kearns + + * NEWS: fix typo + 2007-03-02 Doug Kearns * NEWS: update documentation for next release diff --git a/NEWS b/NEWS index 5d618b1b..cef08a08 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -= 2007.02.02 += 2007.03.02 == Omni Completion From 5728abe906269c3a429b7d2b40926cb7cc6073b1 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 3 Mar 2007 07:23:16 +0000 Subject: [PATCH 347/411] add rubyConditionalModifier and rubyRepeatModifier syntax groups for conditional and loop modifiers and match the optional 'do' or ':' in looping statements with a new rubyOptionalDo syntax group --- ChangeLog | 7 +++++++ syntax/ruby.vim | 13 ++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9a623180..3e24a7e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-03-03 Doug Kearns + + * syntax/ruby.vim: add rubyConditionalModifier and rubyRepeatModifier + syntax groups for conditional and loop modifiers and match the + optional 'do' or ':' in looping statements with a new rubyOptionalDo + syntax group + 2007-03-02 Doug Kearns * NEWS: fix typo diff --git a/syntax/ruby.vim b/syntax/ruby.vim index dba82dd2..a95e5284 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.118 2007/03/02 05:40:49 tpope Exp $ +" Info: $Id: ruby.vim,v 1.119 2007/03/03 07:23:16 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -171,8 +171,8 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") syn region rubyBlock start="\" matchgroup=rubyModule end="\" contains=TOP fold " modifiers - syn match rubyConditional "\<\%(if\|unless\)\>" display - syn match rubyRepeat "\<\%(while\|until\)\>" display + syn match rubyConditionalModifier "\<\%(if\|unless\)\>" display + syn match rubyRepeatModifier "\<\%(while\|until\)\>" display " *do* requiring *end* syn region rubyDoBlock matchgroup=rubyControl start="\" end="\" contains=TOP fold @@ -188,8 +188,8 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") syn keyword rubyConditional then else elsif contained containedin=rubyConditionalBlock " statement with optional *do* - syn region rubyOptDoLine matchgroup=rubyRepeat start="\" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\%(\\|:\)" end="\ze\%(;\|$\)" oneline contains=TOP - syn region rubyOptDoBlock start="\" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" matchgroup=rubyRepeat end="\" contains=TOP nextgroup=rubyOptDoLine fold + syn region rubyOptionalDoLine matchgroup=rubyRepeat start="\" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" matchgroup=rubyOptionalDo end="\%(\\|:\)" end="\ze\%(;\|$\)" oneline contains=TOP + syn region rubyOptionalDoBlock start="\" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" matchgroup=rubyRepeat end="\" contains=TOP nextgroup=rubyOptionalDoLine fold if !exists("ruby_minlines") let ruby_minlines = 50 @@ -268,7 +268,10 @@ if version >= 508 || !exists("did_ruby_syntax_inits") HiLink rubyDefine Define HiLink rubyFunction Function HiLink rubyConditional Conditional + HiLink rubyConditionalModifier rubyConditional HiLink rubyRepeat Repeat + HiLink rubyRepeatModifier rubyRepeat + HiLink rubyOptionalDo rubyRepeat HiLink rubyControl Statement HiLink rubyInclude Include HiLink rubyInteger Number From 8422e439543a87face3129e9a72a975f3bb85ccb Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 3 Mar 2007 11:39:13 +0000 Subject: [PATCH 348/411] simplify the b:match_words pattern by making better use of b:match_skip in concert with the previous syntax group additions --- ChangeLog | 6 ++++++ ftplugin/ruby.vim | 24 ++++++++---------------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3e24a7e4..890b7258 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-03-03 Doug Kearns + + * ftplugin/ruby.vim: simplify the b:match_words pattern by making + better use of b:match_skip in concert with the previous syntax group + additions + 2007-03-03 Doug Kearns * syntax/ruby.vim: add rubyConditionalModifier and rubyRepeatModifier diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index cc161c28..ae7c4c77 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.33 2007/03/02 04:39:38 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.34 2007/03/03 11:39:13 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -30,28 +30,20 @@ endif if exists("loaded_matchit") && !exists("b:match_words") let b:match_ignorecase = 0 - " TODO: improve optional do loops let b:match_words = - \ '\%(' . - \ '\%(\%(\.\|\:\:\)\s*\|\:\)\@' . - \ '\|' . - \ '\%(\%(^\|\.\.\.\=\|[{\:\,;([<>~\*/%&^|+-]\|\%(\<[_[\:lower\:]][_[\:alnum\:]]*\)\@' . - \ '\)' . + \ '\<\%(if\|unless\|case\|while\|until\|for\|do\|class\|module\|def\|begin\)\>' . \ ':' . - \ '\%(' . - \ '\%(\%(\.\|\:\:\)\s*\|\:\)\@' . - \ '\|' . - \ '\%(\%(^\|;\)\s*\)\@<=\' . - \ '\)' . + \ '\<\%(else\|elsif\|ensure\|when\|rescue\)\>' . \ ':' . - \ '\%(\%(\.\|\:\:\)\s*\|\:\)\@' . + \ '\' . \ ',{:},\[:\],(:)' let b:match_skip = \ "synIDattr(synID(line('.'),col('.'),0),'name') =~ '" . - \ "\\'" - + \ "\\'" endif setlocal formatoptions-=t formatoptions+=croql From 9da5ae81cdb5efbc3d1b3395591de623b81099d9 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Mon, 5 Mar 2007 14:20:24 +0000 Subject: [PATCH 349/411] add sigil prefixed identifiers to b:match_skip --- ChangeLog | 4 ++++ ftplugin/ruby.vim | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 890b7258..6cbbf883 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-03-05 Doug Kearns + + * ftplugin/ruby.vim: add sigil prefixed identifiers to b:match_skip + 2007-03-03 Doug Kearns * ftplugin/ruby.vim: simplify the b:match_words pattern by making diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index ae7c4c77..a6c56939 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.34 2007/03/03 11:39:13 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.35 2007/03/05 14:20:25 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -43,7 +43,8 @@ if exists("loaded_matchit") && !exists("b:match_words") \ "\\'" + \ "Function\\|BlockArgument\\|KeywordAsMethod\\|ClassVariable\\|" . + \ "InstanceVariable\\|GlobalVariable\\|Symbol\\)\\>'" endif setlocal formatoptions-=t formatoptions+=croql From 3fcbbd6739f20b3f3a363a0dcf086900b19bb73f Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Fri, 9 Mar 2007 15:14:41 +0000 Subject: [PATCH 350/411] matchit --- ChangeLog | 5 +++++ ftplugin/ruby.vim | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6cbbf883..1b9e623b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2002-03-09 Tim Pope + + * ftplugin/ruby.vim: Skip class= and for= with matchit (really belongs + in ftplugin/eruby.vim). + 2007-03-05 Doug Kearns * ftplugin/ruby.vim: add sigil prefixed identifiers to b:match_skip diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index a6c56939..07077814 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.35 2007/03/05 14:20:25 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.36 2007/03/09 15:14:41 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -31,7 +31,7 @@ if exists("loaded_matchit") && !exists("b:match_words") let b:match_ignorecase = 0 let b:match_words = - \ '\<\%(if\|unless\|case\|while\|until\|for\|do\|class\|module\|def\|begin\)\>' . + \ '\<\%(if\|unless\|case\|while\|until\|for\|do\|class\|module\|def\|begin\)\>=\@!' . \ ':' . \ '\<\%(else\|elsif\|ensure\|when\|rescue\)\>' . \ ':' . From 3068bee3aef2dc6cb5b9007d68368f749262ba6b Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Fri, 9 Mar 2007 15:21:24 +0000 Subject: [PATCH 351/411] OPTIMIZE in rubyTodo --- ChangeLog | 5 +++++ syntax/ruby.vim | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1b9e623b..f5c7f4ff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2002-03-09 Tim Pope + + * syntax/ruby.vim: Added OPTIMIZE alongside FIXME and TODO. Mirrors + Edge Rails' new annotations extractor tasks. + 2002-03-09 Tim Pope * ftplugin/ruby.vim: Skip class= and for= with matchit (really belongs diff --git a/syntax/ruby.vim b/syntax/ruby.vim index a95e5284..a3ed47ef 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.119 2007/03/03 07:23:16 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.120 2007/03/09 15:21:24 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -227,7 +227,7 @@ endif " Comments and Documentation syn match rubySharpBang "\%^#!.*" display -syn keyword rubyTodo FIXME NOTE TODO XXX contained +syn keyword rubyTodo FIXME NOTE TODO OPTIMIZE XXX contained syn match rubyComment "#.*" contains=rubySharpBang,rubySpaceError,rubyTodo,@Spell if !exists("ruby_no_comment_fold") syn region rubyMultilineComment start="\%(\%(^\s*#.*\n\)\@ Date: Sat, 17 Mar 2007 07:00:57 +0000 Subject: [PATCH 352/411] allow regexp literals to be highlighted after the 'else' keyword --- ChangeLog | 5 +++++ syntax/ruby.vim | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index f5c7f4ff..a1399421 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-03-17 Doug Kearns + + * syntax/ruby.vim: allow regexp literals to be highlighted after the + 'else' keyword + 2002-03-09 Tim Pope * syntax/ruby.vim: Added OPTIMIZE alongside FIXME and TODO. Mirrors diff --git a/syntax/ruby.vim b/syntax/ruby.vim index a3ed47ef..1f0ca310 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.120 2007/03/09 15:21:24 tpope Exp $ +" Info: $Id: ruby.vim,v 1.121 2007/03/17 07:00:57 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -101,7 +101,7 @@ syn match rubyPredefinedConstant "\%(\%(\.\@" " Normal Regular Expression -syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\)\|[;\~=!|&(,[>]\)\s*\)\@<=/" end="/[iomx]*" skip="\\\\\|\\/" contains=@rubyStringSpecial fold +syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\|else\)\|[;\~=!|&(,[>]\)\s*\)\@<=/" end="/[iomx]*" skip="\\\\\|\\/" contains=@rubyStringSpecial fold syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\<\%(split\|scan\|gsub\|sub\)\s*\)\@<=/" end="/[iomx]*" skip="\\\\\|\\/" contains=@rubyStringSpecial fold " Normal String and Shell Command Output From f6782f15749efbd9545c8291aeb37e2eed0dcf04 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 17 Mar 2007 12:39:15 +0000 Subject: [PATCH 353/411] when ruby_operators is set don't match '>' in '=>'; fix some minor bugs in the highlighting of pseudo operators and contain TOP in rubyBracketOperator --- ChangeLog | 6 ++++++ syntax/ruby.vim | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index a1399421..6333f2cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-03-17 Doug Kearns + + * syntax/ruby.vim: when ruby_operators is set don't match '>' in '=>'; + fix some minor bugs in the highlighting of pseudo operators and + contain TOP in rubyBracketOperator + 2007-03-17 Doug Kearns * syntax/ruby.vim: allow regexp literals to be highlighted after the diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 1f0ca310..8d1ce0b5 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.121 2007/03/17 07:00:57 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.122 2007/03/17 12:39:16 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -34,9 +34,9 @@ endif " Operators if exists("ruby_operators") - syn match rubyOperator "\%(\^\|\~\|\%(class\s*\)\@\|<=\|\%(<\|\>\|>=\|>\||\|-\|/\|\*\*\|\*\|&\|%\|+\)" - syn match rubyPseudoOperator "\%(-=\|/=\|\*\*=\|\*=\|&&\|&=\|&&=\|||\||=\|||=\|%=\|+=\|!\~\|!=\)" - syn region rubyBracketOperator matchgroup=rubyOperator start="\%([_[:lower:]]\w*[?!=]\=\|}\)\@<=\[\s*" end="\s*]" + syn match rubyOperator "\%(\^\|\~\|\%(class\s*\)\@\|<=\|\%(<\|\>\|>=\|=\@\||\|-\|/\|\*\*\|\*\|&\|%\|+\)" + syn match rubyPseudoOperator "\%(-=\|/=\|\*\*=\|\*=\|&&=\|&=\|&&\|||=\||=\|||\|%=\|+=\|!\~\|!=\)" + syn region rubyBracketOperator matchgroup=rubyOperator start="\%([_[:lower:]]\w*[?!=]\=\|[})]\)\@<=\[\s*" end="\s*]" contains=TOP endif " Expression Substitution and Backslash Notation From b6c5fbf24c03133fa5c0767877f1725b6a62094a Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Mon, 19 Mar 2007 10:37:53 +0000 Subject: [PATCH 354/411] highlight the scope and range operators when ruby_operators is set; simplify block parameter highlighting by adding the rubyBlockParameterList syntax group --- ChangeLog | 6 ++++++ syntax/ruby.vim | 12 +++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6333f2cd..24be4b54 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-03-19 Doug Kearns + + * syntax/ruby.vim: highlight the scope and range operators when + ruby_operators is set; simplify block parameter highlighting by adding + the rubyBlockParameterList syntax group + 2007-03-17 Doug Kearns * syntax/ruby.vim: when ruby_operators is set don't match '>' in '=>'; diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 8d1ce0b5..e20efcc2 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.122 2007/03/17 12:39:16 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.123 2007/03/19 10:37:54 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -34,7 +34,7 @@ endif " Operators if exists("ruby_operators") - syn match rubyOperator "\%(\^\|\~\|\%(class\s*\)\@\|<=\|\%(<\|\>\|>=\|=\@\||\|-\|/\|\*\*\|\*\|&\|%\|+\)" + syn match rubyOperator "\%([~!^&|*/%+-]\|\%(class\s*\)\@\|<=\|\%(<\|\>\|>=\|=\@\|\*\*\|\.\.\.\|\.\.\|::\)" syn match rubyPseudoOperator "\%(-=\|/=\|\*\*=\|\*=\|&&=\|&=\|&&\|||=\||=\|||\|%=\|+=\|!\~\|!=\)" syn region rubyBracketOperator matchgroup=rubyOperator start="\%([_[:lower:]]\w*[?!=]\=\|[})]\)\@<=\[\s*" end="\s*]" contains=TOP endif @@ -82,11 +82,9 @@ syn match rubySymbol ":\@_,;:!?/.'"@$*\&+0]\)" syn match rubySymbol ":\@\|{\)\s*\)|\s*\)\@<=[( ,a-zA-Z0-9_*)]\+\%(\s*|\)\@=" display -else - syn match rubyBlockParameter "\%(\%(\\|{\)\s*\)\@<=|\s*\zs[( ,a-zA-Z0-9_*)]\+\ze\s*|" display -endif + +syn match rubyBlockParameter "\h\w*" contained +syn region rubyBlockParameterList start="\%(\%(\\|{\)\s*\)\@<=|" end="|" oneline display contains=rubyBlockParameter syn match rubyPredefinedVariable #$[!$&"'*+,./0:;<=>?@\`~1-9]# syn match rubyPredefinedVariable "$_\>" display From ece9e10dcf4845be07da7241a1a367b7d26d9f0d Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 20 Mar 2007 12:19:19 +0000 Subject: [PATCH 355/411] add rubyArrayLiteral syntax group for folding multiline array literals --- ChangeLog | 5 +++++ syntax/ruby.vim | 13 ++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 24be4b54..40ed726e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-03-20 Doug Kearns + + * syntax/ruby.vim: add rubyArrayLiteral syntax group for folding + multiline array literals + 2007-03-19 Doug Kearns * syntax/ruby.vim: highlight the scope and range operators when diff --git a/syntax/ruby.vim b/syntax/ruby.vim index e20efcc2..3dd7676c 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.123 2007/03/19 10:37:54 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.124 2007/03/20 12:19:19 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -55,7 +55,11 @@ syn match rubyDelimEscape "\\[(<{\[)>}\]]" transparent display contained contain syn region rubyNestedParentheses start="(" end=")" skip="\\\\\|\\)" transparent contained contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimEscape syn region rubyNestedCurlyBraces start="{" end="}" skip="\\\\\|\\}" transparent contained contains=@rubyStringSpecial,rubyNestedCurlyBraces,rubyDelimEscape syn region rubyNestedAngleBrackets start="<" end=">" skip="\\\\\|\\>" transparent contained contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimEscape -syn region rubyNestedSquareBrackets start="\[" end="\]" skip="\\\\\|\\\]" transparent contained contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimEscape +if exists("ruby_operators") + syn region rubyNestedSquareBrackets start="\[" end="\]" skip="\\\\\|\\\]" transparent contained contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimEscape +else + syn region rubyNestedSquareBrackets start="\[" end="\]" skip="\\\\\|\\\]" transparent containedin=rubyArrayLiteral contained contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimEscape +endif syn cluster rubyStringSpecial contains=rubyInterpolation,rubyNoInterpolation,rubyEscape syn cluster rubyExtendedStringSpecial contains=@rubyStringSpecial,rubyNestedParentheses,rubyNestedCurlyBraces,rubyNestedAngleBrackets,rubyNestedSquareBrackets @@ -172,11 +176,10 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") syn match rubyConditionalModifier "\<\%(if\|unless\)\>" display syn match rubyRepeatModifier "\<\%(while\|until\)\>" display - " *do* requiring *end* syn region rubyDoBlock matchgroup=rubyControl start="\" end="\" contains=TOP fold - - " *{* requiring *}* + " curly bracket block or hash literal syn region rubyCurlyBlock start="{" end="}" contains=TOP fold +syn region rubyArrayLiteral matchgroup=Error start="\%(\w\|[\]})]\)\@" end="\" contains=TOP fold From b6821002de3dd330e2f497d49042bd950cb6bbaa Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 20 Mar 2007 13:15:13 +0000 Subject: [PATCH 356/411] remove the Vim version 5 compatibility code --- ChangeLog | 5 ++ syntax/eruby.vim | 37 ++++--------- syntax/ruby.vim | 132 ++++++++++++++++++++--------------------------- 3 files changed, 72 insertions(+), 102 deletions(-) diff --git a/ChangeLog b/ChangeLog index 40ed726e..4deddd20 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-03-20 Doug Kearns + + * syntax/ruby.vim, syntax/eruby.vim: remove the Vim version 5 + compatibility code + 2007-03-20 Doug Kearns * syntax/ruby.vim: add rubyArrayLiteral syntax group for folding diff --git a/syntax/eruby.vim b/syntax/eruby.vim index 0eb7b313..51f0cd12 100644 --- a/syntax/eruby.vim +++ b/syntax/eruby.vim @@ -1,17 +1,13 @@ " Vim syntax file " Language: eRuby " Maintainer: Doug Kearns -" Info: $Id: eruby.vim,v 1.9 2006/10/23 15:03:03 dkearns Exp $ +" Info: $Id: eruby.vim,v 1.10 2007/03/20 13:15:14 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") - finish +if exists("b:current_syntax") + finish endif if !exists("main_syntax") @@ -29,27 +25,14 @@ endif syn cluster erubyRegions contains=erubyOneLiner,erubyBlock,erubyExpression,erubyComment -syn region erubyOneLiner matchgroup=erubyDelimiter start="^%%\@!" end="$" contains=@rubyTop containedin=ALLBUT,@erubyRegions keepend oneline +syn region erubyOneLiner matchgroup=erubyDelimiter start="^%%\@!" end="$" contains=@rubyTop containedin=ALLBUT,@erubyRegions keepend oneline syn region erubyBlock matchgroup=erubyDelimiter start="<%%\@!-\=" end="-\=%>" contains=@rubyTop containedin=ALLBUT,@erubyRegions -syn region erubyExpression matchgroup=erubyDelimiter start="<%=" end="-\=%>" contains=@rubyTop containedin=ALLBUT,@erubyRegions -syn region erubyComment matchgroup=erubyDelimiter start="<%#" end="-\=%>" contains=rubyTodo,@Spell containedin=ALLBUT,@erubyRegions keepend - -" Define the default highlighting. -" For version 5.7 and earlier: only when not done already -" For version 5.8 and later: only when an item doesn't have highlighting yet -if version >= 508 || !exists("did_eruby_syntax_inits") - if version < 508 - let did_ruby_syntax_inits = 1 - command -nargs=+ HiLink hi link - else - command -nargs=+ HiLink hi def link - endif - - HiLink erubyDelimiter Delimiter - HiLink erubyComment Comment - - delcommand HiLink -endif +syn region erubyExpression matchgroup=erubyDelimiter start="<%=" end="-\=%>" contains=@rubyTop containedin=ALLBUT,@erubyRegions +syn region erubyComment matchgroup=erubyDelimiter start="<%#" end="-\=%>" contains=rubyTodo,@Spell containedin=ALLBUT,@erubyRegions keepend + +hi def link erubyDelimiter Delimiter +hi def link erubyComment Comment + let b:current_syntax = "eruby" if main_syntax == 'eruby' diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 3dd7676c..123ba2ba 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.124 2007/03/20 12:19:19 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.125 2007/03/20 13:15:14 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -11,12 +11,8 @@ " Thanks to perl.vim authors, and to Reimer Behrends. :-) (MN) " ---------------------------------------------------------------------------- -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") - finish +if exists("b:current_syntax") + finish endif if has("folding") && exists("ruby_fold") @@ -253,75 +249,61 @@ syn match rubyKeywordAsMethod "\%(\%(\.\@= 508 || !exists("did_ruby_syntax_inits") - if version < 508 - let did_ruby_syntax_inits = 1 - command -nargs=+ HiLink hi link - else - command -nargs=+ HiLink hi def link - endif - - HiLink rubyClass rubyDefine - HiLink rubyModule rubyDefine - HiLink rubyDefine Define - HiLink rubyFunction Function - HiLink rubyConditional Conditional - HiLink rubyConditionalModifier rubyConditional - HiLink rubyRepeat Repeat - HiLink rubyRepeatModifier rubyRepeat - HiLink rubyOptionalDo rubyRepeat - HiLink rubyControl Statement - HiLink rubyInclude Include - HiLink rubyInteger Number - HiLink rubyASCIICode Character - HiLink rubyFloat Float - HiLink rubyBoolean Boolean - HiLink rubyException Exception - if !exists("ruby_no_identifiers") - HiLink rubyIdentifier Identifier - else - HiLink rubyIdentifier NONE - endif - HiLink rubyClassVariable rubyIdentifier - HiLink rubyConstant Type - HiLink rubyGlobalVariable rubyIdentifier - HiLink rubyBlockParameter rubyIdentifier - HiLink rubyInstanceVariable rubyIdentifier - HiLink rubyPredefinedIdentifier rubyIdentifier - HiLink rubyPredefinedConstant rubyPredefinedIdentifier - HiLink rubyPredefinedVariable rubyPredefinedIdentifier - HiLink rubySymbol Constant - HiLink rubyKeyword Keyword - HiLink rubyOperator Operator - HiLink rubyPseudoOperator rubyOperator - HiLink rubyBeginEnd Statement - HiLink rubyAccess Statement - HiLink rubyAttribute Statement - HiLink rubyEval Statement - HiLink rubyPseudoVariable Constant - - HiLink rubyComment Comment - HiLink rubyData Comment - HiLink rubyDataDirective Delimiter - HiLink rubyDocumentation Comment - HiLink rubyEscape Special - HiLink rubyInterpolationDelimiter Delimiter - HiLink rubyNoInterpolation rubyString - HiLink rubySharpBang PreProc - HiLink rubyRegexpDelimiter rubyStringDelimiter - HiLink rubyStringDelimiter Delimiter - HiLink rubyRegexp rubyString - HiLink rubyString String - HiLink rubyTodo Todo - - HiLink rubyError Error - HiLink rubySpaceError rubyError - - delcommand HiLink +hi def link rubyClass rubyDefine +hi def link rubyModule rubyDefine +hi def link rubyDefine Define +hi def link rubyFunction Function +hi def link rubyConditional Conditional +hi def link rubyConditionalModifier rubyConditional +hi def link rubyRepeat Repeat +hi def link rubyRepeatModifier rubyRepeat +hi def link rubyOptionalDo rubyRepeat +hi def link rubyControl Statement +hi def link rubyInclude Include +hi def link rubyInteger Number +hi def link rubyASCIICode Character +hi def link rubyFloat Float +hi def link rubyBoolean Boolean +hi def link rubyException Exception +if !exists("ruby_no_identifiers") + hi def link rubyIdentifier Identifier +else + hi def link rubyIdentifier NONE endif +hi def link rubyClassVariable rubyIdentifier +hi def link rubyConstant Type +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 +hi def link rubyPredefinedVariable rubyPredefinedIdentifier +hi def link rubySymbol Constant +hi def link rubyKeyword Keyword +hi def link rubyOperator Operator +hi def link rubyPseudoOperator rubyOperator +hi def link rubyBeginEnd Statement +hi def link rubyAccess Statement +hi def link rubyAttribute Statement +hi def link rubyEval Statement +hi def link rubyPseudoVariable Constant + +hi def link rubyComment Comment +hi def link rubyData Comment +hi def link rubyDataDirective Delimiter +hi def link rubyDocumentation Comment +hi def link rubyEscape Special +hi def link rubyInterpolationDelimiter Delimiter +hi def link rubyNoInterpolation rubyString +hi def link rubySharpBang PreProc +hi def link rubyRegexpDelimiter rubyStringDelimiter +hi def link rubyStringDelimiter Delimiter +hi def link rubyRegexp rubyString +hi def link rubyString String +hi def link rubyTodo Todo + +hi def link rubyError Error +hi def link rubySpaceError rubyError let b:current_syntax = "ruby" From 4efe7a43816e43fbb9d16a87a1c9737fd42a8849 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 20 Mar 2007 13:54:24 +0000 Subject: [PATCH 357/411] ignore instance, class, and global variables named "end" when looking to deindent the closing end token --- ChangeLog | 5 +++++ indent/ruby.vim | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4deddd20..3155bf39 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-03-20 Doug Kearns + + * indent/ruby.vim: ignore instance, class, and global variables named + "end" when looking to deindent the closing end token + 2007-03-20 Doug Kearns * syntax/ruby.vim, syntax/eruby.vim: remove the Vim version 5 diff --git a/indent/ruby.vim b/indent/ruby.vim index cc67f9e9..a660d6b2 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Ruby " Maintainer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.39 2006/11/09 21:34:53 tpope Exp $ +" Info: $Id: ruby.vim,v 1.40 2007/03/20 13:54:25 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -73,7 +73,7 @@ let s:end_start_regex = '^\s*\zs\<\%(module\|class\|def\|if\|for' . let s:end_middle_regex = '\<\%(ensure\|else\|\%(\%(^\|;\)\s*\)\@<=\\|when\|elsif\)\>' " Regex that defines the end-match for the 'end' keyword. -let s:end_end_regex = '\%(^\|[^.:]\)\@<=\' +let s:end_end_regex = '\%(^\|[^.:@$]\)\@<=\' " Expression used for searchpair() call for finding match for 'end' keyword. let s:end_skip_expr = s:skip_expr . @@ -292,7 +292,7 @@ function GetRubyIndent() " If the previous line ended with an "end", match that "end"s beginning's " indent. - let col = s:Match(lnum, '\%(^\|[^.]\)\\s*\%(#.*\)\=$') + let col = s:Match(lnum, '\%(^\|[^.:@$]\)\\s*\%(#.*\)\=$') if col > 0 call cursor(lnum, col) if searchpair(s:end_start_regex, '', s:end_end_regex, 'bW', From 613e440fb1cbcc41b17b3e20b6d37d9b299c7cc7 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 28 Mar 2007 01:41:51 +0000 Subject: [PATCH 358/411] remove accidentally included matchgroup from rubyArrayLiteral --- ChangeLog | 5 +++++ syntax/ruby.vim | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3155bf39..2ff82968 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-03-28 Doug Kearns + + * syntax/ruby.vim: remove accidentally included matchgroup from + rubyArrayLiteral + 2007-03-20 Doug Kearns * indent/ruby.vim: ignore instance, class, and global variables named diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 123ba2ba..248ec10e 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.125 2007/03/20 13:15:14 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.126 2007/03/28 01:41:52 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -174,8 +174,8 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") syn region rubyDoBlock matchgroup=rubyControl start="\" end="\" contains=TOP fold " curly bracket block or hash literal - syn region rubyCurlyBlock start="{" end="}" contains=TOP fold -syn region rubyArrayLiteral matchgroup=Error start="\%(\w\|[\]})]\)\@" end="\" contains=TOP fold From 00ecf58fbd2decdede61627db7e332a6f3234d40 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 28 Mar 2007 05:11:47 +0000 Subject: [PATCH 359/411] rename the rubyNoDoBlock, rubyCaseBlock, rubyConditionalBlock, and rubyOptionalDoBlock syntax groups to rubyBlockExpression, rubyCaseExpression, rubyConditionalExpression, and rubyRepeatExpression respectively --- ChangeLog | 7 +++++++ syntax/ruby.vim | 27 +++++++++++++++------------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2ff82968..901eedf4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-03-28 Doug Kearns + + * syntax/ruby.vim: rename the rubyNoDoBlock, rubyCaseBlock, + rubyConditionalBlock, and rubyOptionalDoBlock syntax groups to + rubyBlockExpression, rubyCaseExpression, rubyConditionalExpression, + and rubyRepeatExpression respectively + 2007-03-28 Doug Kearns * syntax/ruby.vim: remove accidentally included matchgroup from diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 248ec10e..b6eec18a 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.126 2007/03/28 01:41:52 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.127 2007/03/28 05:11:47 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -12,7 +12,7 @@ " ---------------------------------------------------------------------------- if exists("b:current_syntax") - finish + finish endif if has("folding") && exists("ruby_fold") @@ -158,7 +158,9 @@ syn match rubyModuleDeclaration "[^[:space:];#]\+" contained contains=rubyC syn match rubyFunction "\<[_[:alpha:]][_[:alnum:]]*[?!=]\=[[:alnum:].:?!=]\@!" contained containedin=rubyMethodDeclaration syn match rubyFunction "\%(\s\|^\)\@<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2 syn match rubyFunction "\%([[:space:].]\|^\)\@<=\%(\[\]=\=\|\*\*\|[+-]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|==\|=\~\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration -" Expensive Mode - colorize *end* according to opening statement + +" Expensive Mode - match 'end' with the appropriate opening keyword for syntax +" based folding and special highlighting of module/class/method definitions if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") syn match rubyDefine "\" nextgroup=rubyAliasDeclaration skipwhite skipnl syn match rubyDefine "\" nextgroup=rubyMethodDeclaration skipwhite skipnl @@ -177,16 +179,17 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") syn region rubyCurlyBlock start="{" end="}" contains=TOP fold syn region rubyArrayLiteral start="\%(\w\|[\]})]\)\@" end="\" contains=TOP fold - syn region rubyCaseBlock matchgroup=rubyConditional start="\" end="\" contains=TOP fold - syn region rubyConditionalBlock matchgroup=rubyConditional start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\" contains=TOP fold - syn keyword rubyConditional then else when contained containedin=rubyCaseBlock - syn keyword rubyConditional then else elsif contained containedin=rubyConditionalBlock + " statements without 'do' + syn region rubyBlockExpression matchgroup=rubyControl start="\" end="\" contains=TOP fold + syn region rubyCaseExpression matchgroup=rubyConditional start="\" end="\" contains=TOP fold + syn region rubyConditionalExpression matchgroup=rubyConditional start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\" contains=TOP fold + + syn keyword rubyConditional then else when contained containedin=rubyCaseExpression + syn keyword rubyConditional then else elsif contained containedin=rubyConditionalExpression - " statement with optional *do* - syn region rubyOptionalDoLine matchgroup=rubyRepeat start="\" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" matchgroup=rubyOptionalDo end="\%(\\|:\)" end="\ze\%(;\|$\)" oneline contains=TOP - syn region rubyOptionalDoBlock start="\" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" matchgroup=rubyRepeat end="\" contains=TOP nextgroup=rubyOptionalDoLine fold + " statements with optional 'do' + syn region rubyOptionalDoLine matchgroup=rubyRepeat start="\" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" matchgroup=rubyOptionalDo end="\%(\\|:\)" end="\ze\%(;\|$\)" oneline contains=TOP + syn region rubyRepeatExpression start="\" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" matchgroup=rubyRepeat end="\" contains=TOP nextgroup=rubyOptionalDoLine fold if !exists("ruby_minlines") let ruby_minlines = 50 From d0353da9ca6e4a60bd2086a61d736b848c38eceb Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 28 Mar 2007 05:16:15 +0000 Subject: [PATCH 360/411] =?UTF-8?q?don't=20match=20[!=3D=3F]=20as=20part?= =?UTF-8?q?=20of=20a=20sigil=20prefixed=20symbol=20name?= --- ChangeLog | 5 +++++ syntax/ruby.vim | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 901eedf4..ce661b28 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-03-28 Doug Kearns + + * syntax/ruby.vim: don't match [!=?] as part of a sigil prefixed + symbol name + 2007-03-28 Doug Kearns * syntax/ruby.vim: rename the rubyNoDoBlock, rubyCaseBlock, diff --git a/syntax/ruby.vim b/syntax/ruby.vim index b6eec18a..27e03319 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.127 2007/03/28 05:11:47 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.128 2007/03/28 05:16:16 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -79,7 +79,8 @@ syn match rubyInstanceVariable "@\h\w*" display syn match rubyGlobalVariable "$\%(\h\w*\|-.\)" syn match rubySymbol ":\@\|<=\|<\|===\|==\|=\~\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)" syn match rubySymbol ":\@_,;:!?/.'"@$*\&+0]\)" -syn match rubySymbol ":\@ Date: Wed, 28 Mar 2007 08:38:29 +0000 Subject: [PATCH 361/411] add matchgroup to rubyArrayLiteral so that contained square brackets do not match in the start/end patterns --- ChangeLog | 5 +++++ syntax/ruby.vim | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ce661b28..40796714 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-03-28 Doug Kearns + + * syntax/ruby.vim: add matchgroup to rubyArrayLiteral so that + contained square brackets do not match in the start/end patterns + 2007-03-28 Doug Kearns * syntax/ruby.vim: don't match [!=?] as part of a sigil prefixed diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 27e03319..dcf44015 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.128 2007/03/28 05:16:16 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.129 2007/03/28 08:38:30 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -178,7 +178,7 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") syn region rubyDoBlock matchgroup=rubyControl start="\" end="\" contains=TOP fold " curly bracket block or hash literal syn region rubyCurlyBlock start="{" end="}" contains=TOP fold - syn region rubyArrayLiteral start="\%(\w\|[\]})]\)\@" end="\" contains=TOP fold From d938d1089303ab9e6f876622416fe4de131baaed Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 31 Mar 2007 12:11:10 +0000 Subject: [PATCH 362/411] add break, redo, next, and retry to b:match_words --- ChangeLog | 4 ++++ ftplugin/ruby.vim | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 40796714..023ccab8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-03-31 Doug Kearns + + * ftplugin/ruby.vim: add break, redo, next, and retry to b:match_words + 2007-03-28 Doug Kearns * syntax/ruby.vim: add matchgroup to rubyArrayLiteral so that diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index 07077814..11620354 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.36 2007/03/09 15:14:41 tpope Exp $ +" Info: $Id: ruby.vim,v 1.37 2007/03/31 12:11:10 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -33,7 +33,7 @@ if exists("loaded_matchit") && !exists("b:match_words") let b:match_words = \ '\<\%(if\|unless\|case\|while\|until\|for\|do\|class\|module\|def\|begin\)\>=\@!' . \ ':' . - \ '\<\%(else\|elsif\|ensure\|when\|rescue\)\>' . + \ '\<\%(else\|elsif\|ensure\|when\|rescue\|break\|redo\|next\|retry\)\>' . \ ':' . \ '\' . \ ',{:},\[:\],(:)' From a95fb628588321287cbd987698f5349c04836658 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 3 Apr 2007 11:25:22 +0000 Subject: [PATCH 363/411] allow text to appear after, and on the same line, as '=begin' in rubyDocumentation regions --- ChangeLog | 5 +++++ syntax/ruby.vim | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 023ccab8..4e9a8343 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-04-03 Doug Kearns + + * syntax/ruby.vim: allow text to appear after, and on the same line, + as '=begin' in rubyDocumentation regions + 2007-03-31 Doug Kearns * ftplugin/ruby.vim: add break, redo, next, and retry to b:match_words diff --git a/syntax/ruby.vim b/syntax/ruby.vim index dcf44015..8068ca24 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.129 2007/03/28 08:38:30 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.130 2007/04/03 11:25:25 dkearns Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -232,7 +232,7 @@ syn keyword rubyTodo FIXME NOTE TODO OPTIMIZE XXX contained syn match rubyComment "#.*" contains=rubySharpBang,rubySpaceError,rubyTodo,@Spell if !exists("ruby_no_comment_fold") syn region rubyMultilineComment start="\%(\%(^\s*#.*\n\)\@ Date: Mon, 16 Apr 2007 15:15:00 +0000 Subject: [PATCH 364/411] Early support for eruby subtypes --- ChangeLog | 5 ++++ ftdetect/ruby.vim | 2 +- ftplugin/ruby.vim | 4 +-- syntax/eruby.vim | 62 ++++++++++++++++++++++++++++++++++++----------- 4 files changed, 56 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4e9a8343..f3e01e0b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-04-16 Tim Pope + + * ftdetect/ruby.vim: detect *.erb as eruby + * syntax/eruby.vim: determine subtype by inspecting filename + 2007-04-03 Doug Kearns * syntax/ruby.vim: allow text to appear after, and on the same line, diff --git a/ftdetect/ruby.vim b/ftdetect/ruby.vim index 4fa8f461..1353f905 100644 --- a/ftdetect/ruby.vim +++ b/ftdetect/ruby.vim @@ -8,4 +8,4 @@ au BufNewFile,BufRead [rR]akefile* set filetype=ruby au BufNewFile,BufRead [rR]antfile,*.rant set filetype=ruby " eRuby -au BufNewFile,BufRead *.rhtml set filetype=eruby +au BufNewFile,BufRead *.erb,*.rhtml set filetype=eruby diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index 11620354..6af47a45 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.37 2007/03/31 12:11:10 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.38 2007/04/16 15:15:01 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -148,7 +148,7 @@ function! RubyBalloonexpr() return '' endif silent! let res = substitute(system("ri -f simple -T \"".str.'"'),'\n$','','') - if res =~ '^Nothing known about' || res =~ '^Bad argument:' + if res =~ '^Nothing known about' || res =~ '^Bad argument:' || res =~ '^More than one method' return '' endif return res diff --git a/syntax/eruby.vim b/syntax/eruby.vim index 51f0cd12..11d78fd2 100644 --- a/syntax/eruby.vim +++ b/syntax/eruby.vim @@ -1,39 +1,73 @@ " Vim syntax file -" Language: eRuby -" Maintainer: Doug Kearns -" Info: $Id: eruby.vim,v 1.10 2007/03/20 13:15:14 dkearns Exp $ +" Language: ERB +" Maintainer: Tim Pope +" Info: $Id: eruby.vim,v 1.11 2007/04/16 15:15:01 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns if exists("b:current_syntax") - finish + finish endif if !exists("main_syntax") let main_syntax = 'eruby' endif +if !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\+') + " Check extension if main_syntax wasn't set. main_syntax can be set if this + " file is included from yet another syntax file. + if main_syntax == 'eruby' && b:eruby_subtype == '' + let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\.erb$','',''),'\.\zs\w\+$') + endif + if b:eruby_subtype == 'rhtml' + let b:eruby_subtype = 'html' + elseif b:eruby_subtype == 'yml' + let b:eruby_subtype = 'yaml' + elseif b:eruby_subtype == 'txt' + " Conventional; not a real file type + let b:eruby_subtype = 'text' + elseif b:eruby_subtype == '' && main_syntax == 'eruby' + let b:eruby_subtype == 'html' + endif +endif + if version < 600 - so :p:h/html.vim syn include @rubyTop :p:h/ruby.vim else - runtime! syntax/html.vim - unlet b:current_syntax + if b:eruby_subtype != '' + exe "runtime! syntax/".b:eruby_subtype.".vim" + unlet! b:current_syntax + endif syn include @rubyTop syntax/ruby.vim endif syn cluster erubyRegions contains=erubyOneLiner,erubyBlock,erubyExpression,erubyComment -syn region erubyOneLiner matchgroup=erubyDelimiter start="^%%\@!" end="$" contains=@rubyTop containedin=ALLBUT,@erubyRegions keepend oneline -syn region erubyBlock matchgroup=erubyDelimiter start="<%%\@!-\=" end="-\=%>" contains=@rubyTop containedin=ALLBUT,@erubyRegions -syn region erubyExpression matchgroup=erubyDelimiter start="<%=" end="-\=%>" contains=@rubyTop containedin=ALLBUT,@erubyRegions -syn region erubyComment matchgroup=erubyDelimiter start="<%#" end="-\=%>" contains=rubyTodo,@Spell containedin=ALLBUT,@erubyRegions keepend +syn region erubyOneLiner matchgroup=erubyDelimiter start="^%%\@!" end="$" contains=@rubyTop containedin=ALLBUT,@erbRegions keepend oneline +syn region erubyBlock matchgroup=erubyDelimiter start="<%%\@!-\=" end="-\=%>" contains=@rubyTop containedin=ALLBUT,@erbRegions +syn region erubyExpression matchgroup=erubyDelimiter start="<%=" end="-\=%>" contains=@rubyTop containedin=ALLBUT,@erbRegions +syn region erubyComment matchgroup=erubyDelimiter start="<%#" end="-\=%>" contains=rubyTodo,@Spell containedin=ALLBUT,@erbRegions keepend -hi def link erubyDelimiter Delimiter -hi def link erubyComment Comment +" Define the default highlighting. +" For version 5.7 and earlier: only when not done already +" For version 5.8 and later: only when an item doesn't have highlighting yet +if version >= 508 || !exists("did_eruby_syntax_inits") + if version < 508 + let did_ruby_syntax_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif -let b:current_syntax = "eruby" + HiLink erubyDelimiter Delimiter + HiLink erubyComment Comment + + delcommand HiLink +endif +let b:current_syntax = 'eruby' if main_syntax == 'eruby' unlet main_syntax From 779c584fc98ca8789469b6581988a0cd02dc8b47 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Mon, 16 Apr 2007 17:03:36 +0000 Subject: [PATCH 365/411] Add subtype support to indent/eruby.vim --- ChangeLog | 5 +++++ ftplugin/eruby.vim | 10 ++++------ indent/eruby.vim | 34 ++++++++++++++++++++++++---------- syntax/eruby.vim | 4 ++-- 4 files changed, 35 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index f3e01e0b..7ff24c2c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-04-16 Tim Pope + + * ftplugin/ruby.vim: add *.erb to the browse filter + * indent/eruby.vim: use 'indentexpr' from subtype + 2007-04-16 Tim Pope * ftdetect/ruby.vim: detect *.erb as eruby diff --git a/ftplugin/eruby.vim b/ftplugin/eruby.vim index 3d5eceb6..5b5b6077 100644 --- a/ftplugin/eruby.vim +++ b/ftplugin/eruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: eRuby " Maintainer: Doug Kearns -" Info: $Id: eruby.vim,v 1.5 2006/04/15 12:01:18 dkearns Exp $ +" Info: $Id: eruby.vim,v 1.6 2007/04/16 17:03:36 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -16,9 +16,7 @@ set cpo-=C " Define some defaults in case the included ftplugins don't set them. let s:undo_ftplugin = "" -let s:browsefilter = "Ruby Files (*.rb)\t*.rb\n" . - \ "HTML Files (*.html, *.htm)\t*.html;*.htm\n" . - \ "All Files (*.*)\t*.*\n" +let s:browsefilter = "All Files (*.*)\t*.*\n" let s:match_words = "" runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim @@ -46,7 +44,7 @@ if exists("b:undo_ftplugin") let s:undo_ftplugin = b:undo_ftplugin . " | " . s:undo_ftplugin endif if exists ("b:browsefilter") - let s:browsefilter = b:browsefilter . s:browsefilter + let s:browsefilter = substitute(b:browsefilter,'\cAll Files (\*\.\*)\t\*\.\*\n','','') . s:browsefilter endif if exists("b:match_words") let s:match_words = b:match_words . ',' . s:match_words @@ -54,7 +52,7 @@ endif " Change the browse dialog on Win32 to show mainly eRuby-related files if has("gui_win32") - let b:browsefilter="eRuby Files (*.rhtml)\t*.rhtml\n" . s:browsefilter + let b:browsefilter="eRuby Files (*.erb, *.rhtml)\t*.erb;*.rhtml\n" . s:browsefilter endif " Load the combined list of match_words for matchit.vim diff --git a/indent/eruby.vim b/indent/eruby.vim index ee2d08ae..8aac09b8 100644 --- a/indent/eruby.vim +++ b/indent/eruby.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: eRuby " Maintainer: Tim Pope -" Info: $Id: eruby.vim,v 1.8 2007/02/22 17:32:02 tpope Exp $ +" Info: $Id: eruby.vim,v 1.9 2007/04/16 17:03:36 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -12,13 +12,27 @@ endif runtime! indent/ruby.vim unlet! b:did_indent +set indentexpr= -runtime! indent/html.vim +if exists("b:eruby_subtype") + exe "runtime! indent/".b:eruby_subtype.".vim" +else + runtime! indent/html.vim +endif unlet! b:did_indent +if &l:indentexpr == '' + if &l:cindent + let &l:indentexpr = 'cindent(v:lnum)' + else + let &l:indentexpr = 'indent(prevnonblank(v:lnum-1))' + endif +endif +let b:eruby_subtype_indentexpr = &l:indentexpr + let b:did_indent = 1 -setlocal indentexpr=GetErubyIndent(v:lnum) +setlocal indentexpr=GetErubyIndent() setlocal indentkeys=o,O,*,<>>,{,},0),0],o,O,!^F,=end,=else,=elsif,=rescue,=ensure,=when " Only define the function once. @@ -26,19 +40,19 @@ if exists("*GetErubyIndent") finish endif -function! GetErubyIndent(lnum) +function! GetErubyIndent() let vcol = col('.') - call cursor(a:lnum,1) + call cursor(v:lnum,1) let inruby = searchpair('<%','','%>') - call cursor(a:lnum,vcol) - if inruby && getline(a:lnum) !~ '^<%' + call cursor(v:lnum,vcol) + if inruby && getline(v:lnum) !~ '^<%' let ind = GetRubyIndent() else - let ind = HtmlIndentGet(a:lnum) + exe "let ind = ".b:eruby_subtype_indentexpr endif - let lnum = prevnonblank(a:lnum-1) + let lnum = prevnonblank(v:lnum-1) let line = getline(lnum) - let cline = getline(a:lnum) + let cline = getline(v:lnum) if cline =~# '<%\s*\%(end\|else\|\%(ensure\|rescue\|elsif\|when\).\{-\}\)\s*\%(-\=%>\|$\)' let ind = ind - &sw endif diff --git a/syntax/eruby.vim b/syntax/eruby.vim index 11d78fd2..ddb8b940 100644 --- a/syntax/eruby.vim +++ b/syntax/eruby.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: ERB +" Language: eRuby " Maintainer: Tim Pope -" Info: $Id: eruby.vim,v 1.11 2007/04/16 15:15:01 tpope Exp $ +" Info: $Id: eruby.vim,v 1.12 2007/04/16 17:03:36 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns From 25ade03d663e5f073c5b41957c36f6180ab0c923 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Tue, 17 Apr 2007 18:18:24 +0000 Subject: [PATCH 366/411] Support for a subtype in ftplugin/eruby.vim --- ChangeLog | 5 +++++ ftplugin/eruby.vim | 56 +++++++++++++++++++++++++++++++++------------- syntax/eruby.vim | 26 +++++++++------------ syntax/ruby.vim | 17 +++++++++----- 4 files changed, 67 insertions(+), 37 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7ff24c2c..ff684d57 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-04-17 Tim Pope + + * syntax/ruby.vim: highlight %s() as a symbol, not a string + * ftplugin/eruby.vim: determine and use eruby subtype + 2007-04-16 Tim Pope * ftplugin/ruby.vim: add *.erb to the browse filter diff --git a/ftplugin/eruby.vim b/ftplugin/eruby.vim index 5b5b6077..8a0faeb9 100644 --- a/ftplugin/eruby.vim +++ b/ftplugin/eruby.vim @@ -1,13 +1,13 @@ " Vim filetype plugin " Language: eRuby -" Maintainer: Doug Kearns -" Info: $Id: eruby.vim,v 1.6 2007/04/16 17:03:36 tpope Exp $ +" Maintainer: Tim Pope +" Info: $Id: eruby.vim,v 1.7 2007/04/17 18:18:24 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns " Only do this when not done yet for this buffer -if (exists("b:did_ftplugin")) +if exists("b:did_ftplugin") finish endif @@ -19,21 +19,45 @@ let s:undo_ftplugin = "" let s:browsefilter = "All Files (*.*)\t*.*\n" let s:match_words = "" -runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim -unlet b:did_ftplugin +if !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$','',''),'\.\zs\w\+$') + endif + if b:eruby_subtype == 'rhtml' + let b:eruby_subtype = 'html' + elseif b:eruby_subtype == 'rb' + let b:eruby_subtype = 'ruby' + elseif b:eruby_subtype == 'yml' + let b:eruby_subtype = 'yaml' + elseif b:eruby_subtype == 'txt' + " Conventional; not a real file type + let b:eruby_subtype = 'text' + elseif b:eruby_subtype == '' + let b:eruby_subtype == 'html' + endif +endif + +if exists("b:eruby_subtype") && b:eruby_subtype != '' + 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 +endif +unlet! b:did_ftplugin " Override our defaults if these were set by an included ftplugin. if exists("b:undo_ftplugin") - let s:undo_ftplugin = b:undo_ftplugin - unlet b:undo_ftplugin + let s:undo_ftplugin = b:undo_ftplugin + unlet b:undo_ftplugin endif if exists("b:browsefilter") - let s:browsefilter = b:browsefilter - unlet b:browsefilter + let s:browsefilter = b:browsefilter + unlet b:browsefilter endif if exists("b:match_words") - let s:match_words = b:match_words - unlet b:match_words + let s:match_words = b:match_words + unlet b:match_words endif runtime! ftplugin/ruby.vim ftplugin/ruby_*.vim ftplugin/ruby/*.vim @@ -41,23 +65,23 @@ let b:did_ftplugin = 1 " Combine the new set of values with those previously included. if exists("b:undo_ftplugin") - let s:undo_ftplugin = b:undo_ftplugin . " | " . s:undo_ftplugin + let s:undo_ftplugin = b:undo_ftplugin . " | " . s:undo_ftplugin endif if exists ("b:browsefilter") - let s:browsefilter = substitute(b:browsefilter,'\cAll Files (\*\.\*)\t\*\.\*\n','','') . s:browsefilter + let s:browsefilter = substitute(b:browsefilter,'\cAll Files (\*\.\*)\t\*\.\*\n','','') . s:browsefilter endif if exists("b:match_words") - let s:match_words = b:match_words . ',' . s:match_words + let s:match_words = b:match_words . ',' . s:match_words endif " 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 + let b:browsefilter="eRuby Files (*.erb, *.rhtml)\t*.erb;*.rhtml\n" . s:browsefilter endif " Load the combined list of match_words for matchit.vim if exists("loaded_matchit") - let b:match_words = s:match_words + let b:match_words = s:match_words endif " TODO: comments= diff --git a/syntax/eruby.vim b/syntax/eruby.vim index ddb8b940..9320e26b 100644 --- a/syntax/eruby.vim +++ b/syntax/eruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: eRuby -" Maintainer: Tim Pope -" Info: $Id: eruby.vim,v 1.12 2007/04/16 17:03:36 tpope Exp $ +" Maintainer: Tim Pope +" Info: $Id: eruby.vim,v 1.13 2007/04/17 18:18:24 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -14,35 +14,31 @@ if !exists("main_syntax") let main_syntax = 'eruby' endif -if !exists("b:eruby_subtype") +if !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\+') - " Check extension if main_syntax wasn't set. main_syntax can be set if this - " file is included from yet another syntax file. - if main_syntax == 'eruby' && b:eruby_subtype == '' + if b:eruby_subtype == '' let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\.erb$','',''),'\.\zs\w\+$') endif if b:eruby_subtype == 'rhtml' let b:eruby_subtype = 'html' + elseif b:eruby_subtype == 'rb' + let b:eruby_subtype = 'ruby' elseif b:eruby_subtype == 'yml' let b:eruby_subtype = 'yaml' elseif b:eruby_subtype == 'txt' " Conventional; not a real file type let b:eruby_subtype = 'text' - elseif b:eruby_subtype == '' && main_syntax == 'eruby' + elseif b:eruby_subtype == '' let b:eruby_subtype == 'html' endif endif -if version < 600 - syn include @rubyTop :p:h/ruby.vim -else - if b:eruby_subtype != '' - exe "runtime! syntax/".b:eruby_subtype.".vim" - unlet! b:current_syntax - endif - syn include @rubyTop syntax/ruby.vim +if exists("b:eruby_subtype") && b:eruby_subtype != '' + exe "runtime! syntax/".b:eruby_subtype.".vim" + unlet! b:current_syntax endif +syn include @rubyTop syntax/ruby.vim syn cluster erubyRegions contains=erubyOneLiner,erubyBlock,erubyExpression,erubyComment diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 8068ca24..9a2adb48 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.130 2007/04/03 11:25:25 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.131 2007/04/17 18:18:24 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -116,11 +116,16 @@ syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\[" end="\][iom syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r(" end=")[iomx]*" skip="\\\\\|\\)" contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimEscape fold " Generalized Single Quoted String, Symbol and Array of Strings -syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]{" end="}" skip="\\\\\|\\}" fold contains=rubyNestedCurlyBraces,rubyDelimEscape -syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]<" end=">" skip="\\\\\|\\>" fold contains=rubyNestedAngleBrackets,rubyDelimEscape -syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw]\[" end="\]" skip="\\\\\|\\\]" fold contains=rubyNestedSquareBrackets,rubyDelimEscape -syn region rubyString matchgroup=rubyStringDelimiter start="%[qsw](" end=")" skip="\\\\\|\\)" fold contains=rubyNestedParentheses,rubyDelimEscape +syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]{" end="}" skip="\\\\\|\\}" fold contains=rubyNestedCurlyBraces,rubyDelimEscape +syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]<" end=">" skip="\\\\\|\\>" fold contains=rubyNestedAngleBrackets,rubyDelimEscape +syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]\[" end="\]" skip="\\\\\|\\\]" fold contains=rubyNestedSquareBrackets,rubyDelimEscape +syn region rubyString matchgroup=rubyStringDelimiter start="%[qw](" end=")" skip="\\\\\|\\)" fold contains=rubyNestedParentheses,rubyDelimEscape +syn region rubySymbol start="%[s]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold +syn region rubySymbol start="%[s]{" end="}" skip="\\\\\|\\}" fold contains=rubyNestedCurlyBraces,rubyDelimEscape +syn region rubySymbol start="%[s]<" end=">" skip="\\\\\|\\>" fold contains=rubyNestedAngleBrackets,rubyDelimEscape +syn region rubySymbol start="%[s]\[" end="\]" skip="\\\\\|\\\]" fold contains=rubyNestedSquareBrackets,rubyDelimEscape +syn region rubySymbol start="%[s](" end=")" skip="\\\\\|\\)" fold contains=rubyNestedParentheses,rubyDelimEscape " Generalized Double Quoted String and Array of Strings and Shell Command Output " Note: %= is not matched here as the beginning of a double quoted string From 42c895c07408d7d39a0b6df7216642c291aca2f8 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Fri, 20 Apr 2007 13:54:56 +0000 Subject: [PATCH 367/411] Refined eRuby subtype detection --- ChangeLog | 5 +++++ ftplugin/eruby.vim | 6 ++++-- syntax/eruby.vim | 6 ++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index ff684d57..ddf15b00 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-04-20 Tim Pope + + * ftplugin/eruby.vim: refined subtype detection + * syntax/eruby.vim: refined subtype detection + 2007-04-17 Tim Pope * syntax/ruby.vim: highlight %s() as a symbol, not a string diff --git a/ftplugin/eruby.vim b/ftplugin/eruby.vim index 8a0faeb9..8ccfd5ba 100644 --- a/ftplugin/eruby.vim +++ b/ftplugin/eruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: eRuby " Maintainer: Tim Pope -" Info: $Id: eruby.vim,v 1.7 2007/04/17 18:18:24 tpope Exp $ +" Info: $Id: eruby.vim,v 1.8 2007/04/20 13:54:56 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -23,7 +23,7 @@ if !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$','',''),'\.\zs\w\+$') + let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\)\+$','',''),'\.\zs\w\+$') endif if b:eruby_subtype == 'rhtml' let b:eruby_subtype = 'html' @@ -31,6 +31,8 @@ if !exists("b:eruby_subtype") let b:eruby_subtype = 'ruby' elseif b:eruby_subtype == 'yml' let b:eruby_subtype = 'yaml' + elseif b:eruby_subtype == 'js' + let b:eruby_subtype = 'javascript' elseif b:eruby_subtype == 'txt' " Conventional; not a real file type let b:eruby_subtype = 'text' diff --git a/syntax/eruby.vim b/syntax/eruby.vim index 9320e26b..479d43d2 100644 --- a/syntax/eruby.vim +++ b/syntax/eruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: eRuby " Maintainer: Tim Pope -" Info: $Id: eruby.vim,v 1.13 2007/04/17 18:18:24 tpope Exp $ +" Info: $Id: eruby.vim,v 1.14 2007/04/20 13:54:56 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -18,7 +18,7 @@ if !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$','',''),'\.\zs\w\+$') + let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\)\+$','',''),'\.\zs\w\+$') endif if b:eruby_subtype == 'rhtml' let b:eruby_subtype = 'html' @@ -26,6 +26,8 @@ if !exists("b:eruby_subtype") && main_syntax == 'eruby' let b:eruby_subtype = 'ruby' elseif b:eruby_subtype == 'yml' let b:eruby_subtype = 'yaml' + elseif b:eruby_subtype == 'js' + let b:eruby_subtype = 'javascript' elseif b:eruby_subtype == 'txt' " Conventional; not a real file type let b:eruby_subtype = 'text' From b0e103ab730887e1963b7f986bcc259b4aed00cb Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Wed, 25 Apr 2007 18:00:58 +0000 Subject: [PATCH 368/411] Fixed eruby subtype detection bug --- ChangeLog | 5 +++++ ftplugin/eruby.vim | 4 ++-- syntax/eruby.vim | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index ddf15b00..6414e0dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-04-24 Tim Pope + + * ftplugin/eruby.vim: fixed typo in subtype detection + * syntax/eruby.vim: fixed typo in subtype detection + 2007-04-20 Tim Pope * ftplugin/eruby.vim: refined subtype detection diff --git a/ftplugin/eruby.vim b/ftplugin/eruby.vim index 8ccfd5ba..f9972da5 100644 --- a/ftplugin/eruby.vim +++ b/ftplugin/eruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: eRuby " Maintainer: Tim Pope -" Info: $Id: eruby.vim,v 1.8 2007/04/20 13:54:56 tpope Exp $ +" Info: $Id: eruby.vim,v 1.9 2007/04/25 18:00:58 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -37,7 +37,7 @@ if !exists("b:eruby_subtype") " Conventional; not a real file type let b:eruby_subtype = 'text' elseif b:eruby_subtype == '' - let b:eruby_subtype == 'html' + let b:eruby_subtype = 'html' endif endif diff --git a/syntax/eruby.vim b/syntax/eruby.vim index 479d43d2..9c697c28 100644 --- a/syntax/eruby.vim +++ b/syntax/eruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: eRuby " Maintainer: Tim Pope -" Info: $Id: eruby.vim,v 1.14 2007/04/20 13:54:56 tpope Exp $ +" Info: $Id: eruby.vim,v 1.15 2007/04/25 18:00:59 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -32,7 +32,7 @@ if !exists("b:eruby_subtype") && main_syntax == 'eruby' " Conventional; not a real file type let b:eruby_subtype = 'text' elseif b:eruby_subtype == '' - let b:eruby_subtype == 'html' + let b:eruby_subtype = 'html' endif endif From d92297f917492a0585892ebb6510e71339eb076c Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sat, 5 May 2007 07:12:30 +0000 Subject: [PATCH 369/411] Minor ruby syntax fixes --- ChangeLog | 13 ++++++++---- syntax/ruby.vim | 56 ++++++++++++++++++++++++------------------------- 2 files changed, 37 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6414e0dc..558cf61d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,12 +1,17 @@ +2007-05-05 Tim Pope + + * syntax/ruby.vim: eliminated some false positves for here docs, + symbols, ASCII codes, and conditionals as statement modifiers + * syntax/ruby.vim: added "neus" to regexp flags + 2007-04-24 Tim Pope - * ftplugin/eruby.vim: fixed typo in subtype detection - * syntax/eruby.vim: fixed typo in subtype detection + * ftplugin/eruby.vim, syntax/eruby.vim: fixed typo in subtype + detection 2007-04-20 Tim Pope - * ftplugin/eruby.vim: refined subtype detection - * syntax/eruby.vim: refined subtype detection + * ftplugin/eruby.vim, syntax/eruby.vim: refined subtype detection 2007-04-17 Tim Pope diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 9a2adb48..ff855ab3 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.131 2007/04/17 18:18:24 tpope Exp $ +" Info: $Id: ruby.vim,v 1.132 2007/05/05 07:12:30 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -61,7 +61,7 @@ syn cluster rubyStringSpecial contains=rubyInterpolation,rubyNoInterpolation,ru syn cluster rubyExtendedStringSpecial contains=@rubyStringSpecial,rubyNestedParentheses,rubyNestedCurlyBraces,rubyNestedAngleBrackets,rubyNestedSquareBrackets " Numbers and ASCII Codes -syn match rubyASCIICode "\w\@" display syn match rubyInteger "\<\%(0[dD]\)\=\%(0\|[1-9]\d*\%(_\d\+\)*\)\>" display syn match rubyInteger "\<0[oO]\=\o\+\%(_\o\+\)*\>" display @@ -77,12 +77,12 @@ syn match rubyConstant "\%(\%([.@$]\@\|::\ syn match rubyClassVariable "@@\h\w*" display syn match rubyInstanceVariable "@\h\w*" display syn match rubyGlobalVariable "$\%(\h\w*\|-.\)" -syn match rubySymbol ":\@\|<=\|<\|===\|==\|=\~\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)" -syn match rubySymbol ":\@_,;:!?/.'"@$*\&+0]\)" -syn match rubySymbol ":\@\|<=\|<\|===\|==\|=\~\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)" +syn match rubySymbol "[]})\"':]\@_,;:!?/.'"@$*\&+0]\)" +syn match rubySymbol "[]})\"':]\@\|{\)\s*\)\@<=|" end="|" oneline display contains=rubyBlockParameter @@ -100,8 +100,8 @@ syn match rubyPredefinedConstant "\%(\%(\.\@" " Normal Regular Expression -syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\|else\)\|[;\~=!|&(,[>]\)\s*\)\@<=/" end="/[iomx]*" skip="\\\\\|\\/" contains=@rubyStringSpecial fold -syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\<\%(split\|scan\|gsub\|sub\)\s*\)\@<=/" end="/[iomx]*" skip="\\\\\|\\/" contains=@rubyStringSpecial fold +syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\|else\)\|[;\~=!|&(,[>]\)\s*\)\@<=/" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyStringSpecial fold +syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\<\%(split\|scan\|gsub\|sub\)\s*\)\@<=/" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyStringSpecial fold " Normal String and Shell Command Output syn region rubyString matchgroup=rubyStringDelimiter start="\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial fold @@ -109,11 +109,11 @@ syn region rubyString matchgroup=rubyStringDelimiter start="'" end="'" skip="\\ syn region rubyString matchgroup=rubyStringDelimiter start="`" end="`" skip="\\\\\|\\`" contains=@rubyStringSpecial fold " Generalized Regular Expression -syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1[iomx]*" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold -syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r{" end="}[iomx]*" skip="\\\\\|\\}" contains=@rubyStringSpecial,rubyNestedCurlyBraces,rubyDelimEscape fold -syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r<" end=">[iomx]*" skip="\\\\\|\\>" contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold -syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\[" end="\][iomx]*" skip="\\\\\|\\\]" contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimEscape fold -syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r(" end=")[iomx]*" skip="\\\\\|\\)" contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimEscape fold +syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1[iomxneus]*" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold +syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r{" end="}[iomxneus]*" skip="\\\\\|\\}" contains=@rubyStringSpecial,rubyNestedCurlyBraces,rubyDelimEscape fold +syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r<" end=">[iomxneus]*" skip="\\\\\|\\>" contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold +syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\[" end="\][iomxneus]*" skip="\\\\\|\\\]" contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimEscape fold +syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r(" end=")[iomxneus]*" skip="\\\\\|\\)" contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimEscape fold " Generalized Single Quoted String, Symbol and Array of Strings syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold @@ -137,20 +137,20 @@ syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\[" e syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=(" end=")" skip="\\\\\|\\)" contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimEscape fold " Here Document -syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%(\.\|::\)\)\_s*\)\@" end="\" contains=TOP fold syn region rubyCaseExpression matchgroup=rubyConditional start="\" end="\" contains=TOP fold - syn region rubyConditionalExpression matchgroup=rubyConditional start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\" contains=TOP fold + syn region rubyConditionalExpression matchgroup=rubyConditional start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+=-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\" contains=TOP fold syn keyword rubyConditional then else when contained containedin=rubyCaseExpression syn keyword rubyConditional then else elsif contained containedin=rubyConditionalExpression From d72d0a33bdc8cb45ab0de401ec5af91720e6838d Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sun, 6 May 2007 05:37:19 +0000 Subject: [PATCH 370/411] Punctuation variables in strings --- ChangeLog | 5 +++++ syntax/ruby.vim | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 558cf61d..7731915c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-05-06 Tim Pope + + * syntax/ruby.vim: Highlight punctuation variables in string + interpolation, and flag invalid ones as errors + 2007-05-05 Tim Pope * syntax/ruby.vim: eliminated some false positves for here docs, diff --git a/syntax/ruby.vim b/syntax/ruby.vim index ff855ab3..9af3f040 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.132 2007/05/05 07:12:30 tpope Exp $ +" Info: $Id: ruby.vim,v 1.133 2007/05/06 05:37:19 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -42,9 +42,12 @@ syn match rubyEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\) syn region rubyInterpolation matchgroup=rubyInterpolationDelimiter start="#{" end="}" contained contains=TOP syn match rubyInterpolation "#\%(\$\|@@\=\)\w\+" display contained contains=rubyInterpolationDelimiter,rubyInstanceVariable,rubyClassVariable,rubyGlobalVariable,rubyPredefinedVariable syn match rubyInterpolationDelimiter "#\ze\%(\$\|@@\=\)\w\+" display contained +syn match rubyInterpolation "#\$\%(-\w\|\W\)" display contained contains=rubyInterpolationDelimiter,rubyPredefinedVariable,rubyInvalidVariable +syn match rubyInterpolationDelimiter "#\ze\$\%(-\w\|\W\)" display contained syn region rubyNoInterpolation start="\\#{" end="}" contained syn match rubyNoInterpolation "\\#{" display contained syn match rubyNoInterpolation "\\#\%(\$\|@@\=\)\w\+" display contained +syn match rubyNoInterpolation "\\#\$\W" display contained syn match rubyDelimEscape "\\[(<{\[)>}\]]" transparent display contained contains=NONE @@ -87,6 +90,7 @@ syn region rubySymbol start="[]})\"':]\@\|{\)\s*\)\@<=|" end="|" oneline display contains=rubyBlockParameter +syn match rubyInvalidVariable "$[^ A-Za-z-]" syn match rubyPredefinedVariable #$[!$&"'*+,./0:;<=>?@\`~1-9]# syn match rubyPredefinedVariable "$_\>" display syn match rubyPredefinedVariable "$-[0FIKadilpvw]\>" display @@ -311,6 +315,7 @@ hi def link rubyRegexp rubyString hi def link rubyString String hi def link rubyTodo Todo +hi def link rubyInvalidVariable Error hi def link rubyError Error hi def link rubySpaceError rubyError From 504f01e3d00c18215d868fd4a00116cbcc1b18e5 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sun, 6 May 2007 16:05:40 +0000 Subject: [PATCH 371/411] default eruby subtype option --- ChangeLog | 4 ++++ ftplugin/eruby.vim | 8 ++++++-- syntax/eruby.vim | 8 ++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7731915c..6aa76c57 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-05-06 Tim Pope + + * ftplugin/eruby.vim, syntax/eruby.vim: added a default suptype option + 2007-05-06 Tim Pope * syntax/ruby.vim: Highlight punctuation variables in string diff --git a/ftplugin/eruby.vim b/ftplugin/eruby.vim index f9972da5..0d873232 100644 --- a/ftplugin/eruby.vim +++ b/ftplugin/eruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: eRuby " Maintainer: Tim Pope -" Info: $Id: eruby.vim,v 1.9 2007/04/25 18:00:58 tpope Exp $ +" Info: $Id: eruby.vim,v 1.10 2007/05/06 16:05:40 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -19,6 +19,10 @@ let s:undo_ftplugin = "" let s:browsefilter = "All Files (*.*)\t*.*\n" let s:match_words = "" +if !exists("g:eruby_default_subtype") + let g:eruby_default_subtype = "html" +endif + if !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\+') @@ -37,7 +41,7 @@ if !exists("b:eruby_subtype") " Conventional; not a real file type let b:eruby_subtype = 'text' elseif b:eruby_subtype == '' - let b:eruby_subtype = 'html' + let b:eruby_subtype = g:eruby_default_subtype endif endif diff --git a/syntax/eruby.vim b/syntax/eruby.vim index 9c697c28..4b5650b6 100644 --- a/syntax/eruby.vim +++ b/syntax/eruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: eRuby " Maintainer: Tim Pope -" Info: $Id: eruby.vim,v 1.15 2007/04/25 18:00:59 tpope Exp $ +" Info: $Id: eruby.vim,v 1.16 2007/05/06 16:05:40 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -14,6 +14,10 @@ if !exists("main_syntax") let main_syntax = 'eruby' endif +if !exists("g:eruby_default_subtype") + let g:eruby_default_subtype = "html" +endif + if !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\+') @@ -32,7 +36,7 @@ if !exists("b:eruby_subtype") && main_syntax == 'eruby' " Conventional; not a real file type let b:eruby_subtype = 'text' elseif b:eruby_subtype == '' - let b:eruby_subtype = 'html' + let b:eruby_subtype = g:eruby_default_subtype endif endif From 3e679b8301ab7c77327875057688845912479b0b Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sun, 6 May 2007 16:38:39 +0000 Subject: [PATCH 372/411] ruby mappings --- ChangeLog | 8 ++++++-- ftplugin/ruby.vim | 47 +++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 49 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6aa76c57..479e2e4c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,11 @@ 2007-05-06 Tim Pope - * ftplugin/eruby.vim, syntax/eruby.vim: added a default suptype option - + * ftplugin/ruby.vim: maps for [[, ]], [], ][, [m, ]m, [M, ]M + +2007-05-06 Tim Pope + + * ftplugin/eruby.vim, syntax/eruby.vim: added a default subtype option + 2007-05-06 Tim Pope * syntax/ruby.vim: Highlight punctuation variables in string diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index 6af47a45..ef908bce 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.38 2007/04/16 15:15:01 tpope Exp $ +" Info: $Id: ruby.vim,v 1.39 2007/05/06 16:38:40 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -96,9 +96,26 @@ if has("gui_win32") && !exists("b:browsefilter") endif let b:undo_ftplugin = "setl fo< inc< inex< sua< def< com< cms< path< 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" + \."| unlet! b:browsefilter b:match_ignorecase b:match_words b:match_skip" + \."| if exists('&ofu') && has('ruby') | setl ofu< | endif" + \."| if has('balloon_eval') && exists('+bexpr') | setl bexpr< | endif" + +if !exists("g:no_plugin_maps") && !exists("g:no_ruby_maps") + + noremap [m :call searchsyn('\','rubyDefine','b') + noremap ]m :call searchsyn('\','rubyDefine','') + noremap [M :call searchsyn('\','rubyDefine','b') + noremap ]M :call searchsyn('\','rubyDefine','') + + noremap [[ :call searchsyn('\<\%(class\module\)\>','rubyModule\rubyClass','b') + noremap ]] :call searchsyn('\<\%(class\module\)\>','rubyModule\rubyClass','') + noremap [] :call searchsyn('\','rubyModule\rubyClass','b') + noremap ][ :call searchsyn('\','rubyModule\rubyClass','') + + let b:undo_ftplugin = b:undo_ftplugin + \."| sil! exe 'unmap [[' | sil! exe 'unmap ]]' | sil! exe 'unmap []' | sil! exe 'unmap ]['" + \."| sil! exe 'unmap [m' | sil! exe 'unmap ]m' | sil! exe 'unmap [M' | sil! exe 'unmap ]M'" +endif let &cpo = s:cpo_save unlet s:cpo_save @@ -157,6 +174,28 @@ function! RubyBalloonexpr() endif endfunction +function! s:searchsyn(pattern,syn,flags) + norm! m' + let i = 0 + let cnt = v:count ? v:count : 1 + while i < cnt + let i = i + 1 + let line = line('.') + let col = col('.') + let pos = search(a:pattern,'W'.a:flags) + while pos != 0 && s:synname() !~# a:syn + let pos = search(a:pattern,'W'.a:flags) + endwhile + if pos == 0 + call cursor(line,col) + return + endif + endwhile +endfunction + +function! s:synname() + return synIDattr(synID(line('.'),col('.'),0),'name') +endfunction " " Instructions for enabling "matchit" support: From f77ecc31da9d88cf883918ce4966168e67b48cfe Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sun, 6 May 2007 17:55:04 +0000 Subject: [PATCH 373/411] NEWS; allow for eruby nesting --- ChangeLog | 7 +++++++ NEWS | 54 ++++++++++++++++++++++++++++++++++++++++++++++++ syntax/eruby.vim | 17 ++++++++++----- syntax/ruby.vim | 4 ++-- 4 files changed, 75 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 479e2e4c..7484d8fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-05-06 Tim Pope + + * NEWS: update documentation for next release + * syntax/eruby.vim: allow for nesting (foo.erb.erb) + * syntax/ruby.vim: removed : from rubyOptionalDoLine (falsely matches + on symbols, and the syntax is deprecated anyways) + 2007-05-06 Tim Pope * ftplugin/ruby.vim: maps for [[, ]], [], ][, [m, ]m, [M, ]M diff --git a/NEWS b/NEWS index cef08a08..74aa0b79 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,57 @@ += 2007.05.07 + +== Ruby Syntax Highlighting + +Highlight OPTIMIZE alongside FIXME and TODO. + +Multiline array literals can now be folded. + +== Ruby Filetype Support + +Added mappings for [[, ]], [], ][, [m, ]m, [M, and ]M. The first four bounce +between class and module declarations, and the last four between method +declarations. + +== eRuby Syntax Highlighting + +Tim Pope has taken over maintenance of the eRuby syntax file. The subtype of +the file is now determined dynamically from the filename, rather than being +hardwired to HTML. It can be overridden with b:eruby_subtype. + +== eRuby Filetype Support + +Tim Pope has taken over maintenance of the eRuby filetype plugin. Like with +the syntax file, the subtype is now determined dynamically. + +== eRuby Indenting + +As with the syntax file and filetype plugin, the subtype is now determined +dynamically. + +== Bug Fixes + +Ruby syntax file + - when ruby_operators is set, highlight scope and range operators, and don't + match '>' in =>' + - regexp literals are highlighted after the 'else' keyword + - don't match [!=?] as part of a sigil prefixed symbol name + - allow text to appear after, and on the same line, as '=begin' in + rubyDocumentation regions + - highlight %s() ans a symbol, not a string + - eliminated some false positves for here docs, symbols, ASCII codes, and + conditionals as statement modifiers + - added "neus" to regexp flags + - Highlight punctuation variables in string interpolation, and flag invalid + ones as errors + - removed : from rubyOptionalDoLine (falsely matches on symbols) + +Ruby filetype plugin + - eliminated some false positives with the matchit patterns + +Ruby indent plugin + - ignore instance, class, and global variables named "end" + + = 2007.03.02 == Omni Completion diff --git a/syntax/eruby.vim b/syntax/eruby.vim index 4b5650b6..d663c0f5 100644 --- a/syntax/eruby.vim +++ b/syntax/eruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: eRuby " Maintainer: Tim Pope -" Info: $Id: eruby.vim,v 1.16 2007/05/06 16:05:40 tpope Exp $ +" Info: $Id: eruby.vim,v 1.17 2007/05/06 17:55:04 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -40,6 +40,13 @@ if !exists("b:eruby_subtype") && main_syntax == 'eruby' endif endif +if !exists("b:eruby_nest_level") + let b:eruby_nest_level = strlen(substitute(substitute(substitute(expand("%:t"),'@','','g'),'\c\.erb\>','@','g'),'[^@]','','g')) +endif +if !b:eruby_nest_level + let b:eruby_nest_level = 1 +endif + if exists("b:eruby_subtype") && b:eruby_subtype != '' exe "runtime! syntax/".b:eruby_subtype.".vim" unlet! b:current_syntax @@ -48,10 +55,10 @@ syn include @rubyTop syntax/ruby.vim syn cluster erubyRegions contains=erubyOneLiner,erubyBlock,erubyExpression,erubyComment -syn region erubyOneLiner matchgroup=erubyDelimiter start="^%%\@!" end="$" contains=@rubyTop containedin=ALLBUT,@erbRegions keepend oneline -syn region erubyBlock matchgroup=erubyDelimiter start="<%%\@!-\=" end="-\=%>" contains=@rubyTop containedin=ALLBUT,@erbRegions -syn region erubyExpression matchgroup=erubyDelimiter start="<%=" end="-\=%>" contains=@rubyTop containedin=ALLBUT,@erbRegions -syn region erubyComment matchgroup=erubyDelimiter start="<%#" end="-\=%>" contains=rubyTodo,@Spell containedin=ALLBUT,@erbRegions keepend +exe 'syn region erubyOneLiner matchgroup=erubyDelimiter start="^%\{1,'.b:eruby_nest_level.'\}%\@!" end="$" contains=@rubyTop containedin=ALLBUT,@erbRegions keepend oneline' +exe 'syn region erubyBlock matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}%\@!-\=" end="-\=%>" contains=@rubyTop containedin=ALLBUT,@erbRegions' +exe 'syn region erubyExpression matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}=" end="-\=%>" contains=@rubyTop containedin=ALLBUT,@erbRegions' +exe 'syn region erubyComment matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}#" end="-\=%>" contains=rubyTodo,@Spell containedin=ALLBUT,@erbRegions keepend' " Define the default highlighting. " For version 5.7 and earlier: only when not done already diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 9af3f040..1eb27bec 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.133 2007/05/06 05:37:19 tpope Exp $ +" Info: $Id: ruby.vim,v 1.134 2007/05/06 17:55:04 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -198,7 +198,7 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") syn keyword rubyConditional then else elsif contained containedin=rubyConditionalExpression " statements with optional 'do' - syn region rubyOptionalDoLine matchgroup=rubyRepeat start="\" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" matchgroup=rubyOptionalDo end="\%(\\|:\)" end="\ze\%(;\|$\)" oneline contains=TOP + syn region rubyOptionalDoLine matchgroup=rubyRepeat start="\" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" matchgroup=rubyOptionalDo end="\%(\\)" end="\ze\%(;\|$\)" oneline contains=TOP syn region rubyRepeatExpression start="\" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" matchgroup=rubyRepeat end="\" contains=TOP nextgroup=rubyOptionalDoLine fold if !exists("ruby_minlines") From 6b6ef749836daf605d61d00df6b3f207e40fa6bf Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sun, 6 May 2007 23:56:12 +0000 Subject: [PATCH 374/411] Last minute updates before release --- ChangeLog | 5 +++++ doc/ft-ruby-syntax.txt | 4 ++-- ftdetect/ruby.vim | 11 +++++++---- syntax/eruby.vim | 4 ++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7484d8fb..b8cc550b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-05-06 Tim Pope + + * doc/ft-ruby-syntax.txt: bring into sync with upstream + * ftdetect/ruby.vim: Rails extensions + 2007-05-06 Tim Pope * NEWS: update documentation for next release diff --git a/doc/ft-ruby-syntax.txt b/doc/ft-ruby-syntax.txt index 54d20633..04ab1636 100644 --- a/doc/ft-ruby-syntax.txt +++ b/doc/ft-ruby-syntax.txt @@ -1,4 +1,4 @@ -RUBY *ruby.vim* *ruby-syntax* +RUBY *ruby.vim* *ft-ruby-syntax* There are a number of options to the Ruby syntax highlighting. @@ -16,7 +16,7 @@ scrolling backwards, which are fixed when redrawing with CTRL-L, try setting the "ruby_minlines" variable to a value larger than 50: > :let ruby_minlines = 100 -> +< Ideally, this value should be a number of lines large enough to embrace your largest class or module. diff --git a/ftdetect/ruby.vim b/ftdetect/ruby.vim index 1353f905..15f5eaab 100644 --- a/ftdetect/ruby.vim +++ b/ftdetect/ruby.vim @@ -1,11 +1,14 @@ " Ruby -au BufNewFile,BufRead *.rb,*.rbw,*.rjs,*.rxml,*.gem,*.gemspec set filetype=ruby +au BufNewFile,BufRead *.rb,*.rbw,*.gem,*.gemspec set filetype=ruby + +" Ruby on Rails +au BufNewFile,BufRead *.builder,*.rxml,*.rjs set filetype=ruby " Rakefile -au BufNewFile,BufRead [rR]akefile* 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 " eRuby -au BufNewFile,BufRead *.erb,*.rhtml set filetype=eruby +au BufNewFile,BufRead *.erb,*.rhtml set filetype=eruby diff --git a/syntax/eruby.vim b/syntax/eruby.vim index d663c0f5..6b8d74b8 100644 --- a/syntax/eruby.vim +++ b/syntax/eruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: eRuby " Maintainer: Tim Pope -" Info: $Id: eruby.vim,v 1.17 2007/05/06 17:55:04 tpope Exp $ +" Info: $Id: eruby.vim,v 1.18 2007/05/06 23:56:12 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -41,7 +41,7 @@ if !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\>','@','g'),'[^@]','','g')) + let b:eruby_nest_level = strlen(substitute(substitute(substitute(expand("%:t"),'@','','g'),'\c\.\%(erb\|rhtml\)\>','@','g'),'[^@]','','g')) endif if !b:eruby_nest_level let b:eruby_nest_level = 1 From fd3871b8f16f138d2b5ec51f97dceb66b843635b Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Thu, 10 May 2007 01:36:57 +0000 Subject: [PATCH 375/411] module_function keyword --- ChangeLog | 4 ++++ syntax/ruby.vim | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b8cc550b..faafd558 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-05-09 Tim Pope + + * syntax/ruby.vim: added module_function keyword + 2007-05-06 Tim Pope * doc/ft-ruby-syntax.txt: bring into sync with upstream diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 1eb27bec..3ac90446 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.134 2007/05/06 17:55:04 tpope Exp $ +" Info: $Id: ruby.vim,v 1.135 2007/05/10 01:36:57 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -226,7 +226,7 @@ syn keyword rubyBeginEnd BEGIN END " Special Methods if !exists("ruby_no_special_methods") - syn keyword rubyAccess public protected private + syn keyword rubyAccess public protected private module_function syn keyword rubyAttribute attr attr_accessor attr_reader attr_writer syn match rubyControl "\<\%(exit!\|\%(abort\|at_exit\|exit\|fork\|loop\|trap\)\>\)" syn keyword rubyEval eval class_eval instance_eval module_eval From 2ba6f57c38df83c38bb62ab9391d55fd24a1910b Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sat, 12 May 2007 15:40:55 +0000 Subject: [PATCH 376/411] Cleaned up docs --- ChangeLog | 5 +++++ doc/ft-ruby-syntax.txt | 29 ----------------------------- indent/eruby.vim | 9 +++++++-- 3 files changed, 12 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index faafd558..48682506 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-05-11 Tim Pope + + * indent/eruby.vim: GetRubyIndent() takes an argument for debugging + * doc/ft-ruby-syntax.txt: clean up some cruft + 2007-05-09 Tim Pope * syntax/ruby.vim: added module_function keyword diff --git a/doc/ft-ruby-syntax.txt b/doc/ft-ruby-syntax.txt index 04ab1636..ba21ac35 100644 --- a/doc/ft-ruby-syntax.txt +++ b/doc/ft-ruby-syntax.txt @@ -20,23 +20,6 @@ the "ruby_minlines" variable to a value larger than 50: > Ideally, this value should be a number of lines large enough to embrace your largest class or module. -Highlighting of special identifiers can be disabled by removing the -rubyIdentifier highlighting: > - - :hi link rubyIdentifier NONE -< -This will prevent highlighting of special identifiers like "ConstantName", -"$global_var", "@@class_var", "@instance_var", "| block_param |", and -":symbol". - -Significant methods of Kernel, Module and Object are highlighted by default. -This can be disabled by defining "ruby_no_special_methods": > - - :let ruby_no_special_methods = 1 -< -This will prevent highlighting of important methods such as "require", "attr", -"private", "raise" and "proc". - Ruby operators can be highlighted. This is enabled by defining "ruby_operators": > @@ -51,17 +34,5 @@ as errors. This can be refined by defining "ruby_no_trail_space_error" and "ruby_no_tab_space_error" which will ignore trailing whitespace and tabs after spaces respectively. -Folding can be enabled by defining "ruby_fold": > - - :let ruby_fold = 1 -< -This will set the 'foldmethod' option to "syntax" and allow folding of -classes, modules, methods, code blocks, heredocs and comments. - -Folding of multiline comments can be disabled by defining -"ruby_no_comment_fold": > - - :let ruby_no_comment_fold = 1 -< vim:tw=78:sw=4:ts=8:ft=help:norl: diff --git a/indent/eruby.vim b/indent/eruby.vim index 8aac09b8..0d6dd7e4 100644 --- a/indent/eruby.vim +++ b/indent/eruby.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: eRuby " Maintainer: Tim Pope -" Info: $Id: eruby.vim,v 1.9 2007/04/16 17:03:36 tpope Exp $ +" Info: $Id: eruby.vim,v 1.10 2007/05/12 15:40:56 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -40,7 +40,12 @@ if exists("*GetErubyIndent") finish endif -function! GetErubyIndent() +function! GetErubyIndent(...) + if a:0 && a:1 == '.' + let v:lnum = line('.') + elseif a:0 =~ '^\d' + let v:lnum = a:1 + endif let vcol = col('.') call cursor(v:lnum,1) let inruby = searchpair('<%','','%>') From 86235d518ab0209f95c68ab26c2f6a749e6a6cab Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Mon, 14 May 2007 20:09:06 +0000 Subject: [PATCH 377/411] Fix some ruby syntax bugs --- ChangeLog | 5 +++++ syntax/ruby.vim | 10 +++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 48682506..6d2ea464 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-05-14 Tim Pope + + * syntax/ruby.vim: fixed problem highlighting [foo[:bar]] + * syntax/ruby.vim: don't highlight = in {:foo=>"bar"} + 2007-05-11 Tim Pope * indent/eruby.vim: GetRubyIndent() takes an argument for debugging diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 3ac90446..14ea4c45 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.135 2007/05/10 01:36:57 tpope Exp $ +" Info: $Id: ruby.vim,v 1.136 2007/05/14 20:09:06 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -54,11 +54,7 @@ syn match rubyDelimEscape "\\[(<{\[)>}\]]" transparent display contained contain syn region rubyNestedParentheses start="(" end=")" skip="\\\\\|\\)" transparent contained contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimEscape syn region rubyNestedCurlyBraces start="{" end="}" skip="\\\\\|\\}" transparent contained contains=@rubyStringSpecial,rubyNestedCurlyBraces,rubyDelimEscape syn region rubyNestedAngleBrackets start="<" end=">" skip="\\\\\|\\>" transparent contained contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimEscape -if exists("ruby_operators") - syn region rubyNestedSquareBrackets start="\[" end="\]" skip="\\\\\|\\\]" transparent contained contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimEscape -else - syn region rubyNestedSquareBrackets start="\[" end="\]" skip="\\\\\|\\\]" transparent containedin=rubyArrayLiteral contained contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimEscape -endif +syn region rubyNestedSquareBrackets start="\[" end="\]" skip="\\\\\|\\\]" transparent contained contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimEscape syn cluster rubyStringSpecial contains=rubyInterpolation,rubyNoInterpolation,rubyEscape syn cluster rubyExtendedStringSpecial contains=@rubyStringSpecial,rubyNestedParentheses,rubyNestedCurlyBraces,rubyNestedAngleBrackets,rubyNestedSquareBrackets @@ -83,7 +79,7 @@ syn match rubyGlobalVariable "$\%(\h\w*\|-.\)" syn match rubySymbol "[]})\"':]\@\|<=\|<\|===\|==\|=\~\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)" syn match rubySymbol "[]})\"':]\@_,;:!?/.'"@$*\&+0]\)" syn match rubySymbol "[]})\"':]\@\@!\)\=" syn region rubySymbol start="[]})\"':]\@ Date: Tue, 15 May 2007 17:10:57 +0000 Subject: [PATCH 378/411] Handle %%> properly --- ChangeLog | 4 ++++ syntax/eruby.vim | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6d2ea464..8cbb600a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-05-15 Tim Pope + + * syntax/eruby.vim: handle %%> properly + 2007-05-14 Tim Pope * syntax/ruby.vim: fixed problem highlighting [foo[:bar]] diff --git a/syntax/eruby.vim b/syntax/eruby.vim index 6b8d74b8..12e4e7e1 100644 --- a/syntax/eruby.vim +++ b/syntax/eruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: eRuby " Maintainer: Tim Pope -" Info: $Id: eruby.vim,v 1.18 2007/05/06 23:56:12 tpope Exp $ +" Info: $Id: eruby.vim,v 1.19 2007/05/15 17:10:58 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -56,9 +56,9 @@ syn include @rubyTop syntax/ruby.vim syn cluster erubyRegions contains=erubyOneLiner,erubyBlock,erubyExpression,erubyComment exe 'syn region erubyOneLiner matchgroup=erubyDelimiter start="^%\{1,'.b:eruby_nest_level.'\}%\@!" end="$" contains=@rubyTop containedin=ALLBUT,@erbRegions keepend oneline' -exe 'syn region erubyBlock matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}%\@!-\=" end="-\=%>" contains=@rubyTop containedin=ALLBUT,@erbRegions' -exe 'syn region erubyExpression matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}=" end="-\=%>" contains=@rubyTop containedin=ALLBUT,@erbRegions' -exe 'syn region erubyComment matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}#" end="-\=%>" contains=rubyTodo,@Spell containedin=ALLBUT,@erbRegions keepend' +exe 'syn region erubyBlock matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}%\@!-\=" end="-\=%\@" contains=@rubyTop containedin=ALLBUT,@erbRegions keepend' +exe 'syn region erubyExpression matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}=" end="-\=%\@" contains=@rubyTop containedin=ALLBUT,@erbRegions keepend' +exe 'syn region erubyComment matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}#" end="-\=%\@" contains=rubyTodo,@Spell containedin=ALLBUT,@erbRegions keepend' " Define the default highlighting. " For version 5.7 and earlier: only when not done already From 6a78bcbc093d956678cb700530e3658aead13639 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Wed, 16 May 2007 16:06:10 +0000 Subject: [PATCH 379/411] Reverted to ALLBUT --- syntax/ruby.vim | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 14ea4c45..56c38319 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.136 2007/05/14 20:09:06 tpope Exp $ +" Info: $Id: ruby.vim,v 1.137 2007/05/16 16:06:10 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -19,6 +19,8 @@ if has("folding") && exists("ruby_fold") setlocal foldmethod=syntax endif +syn cluster rubyNotTop contains=@rubyExtendedStringSpecial,@rubyDeclaration,rubyConditional,rubyTodo + if exists("ruby_space_errors") if !exists("ruby_no_trail_space_error") syn match rubySpaceError display excludenl "\s\+$" @@ -32,14 +34,14 @@ endif if exists("ruby_operators") syn match rubyOperator "\%([~!^&|*/%+-]\|\%(class\s*\)\@\|<=\|\%(<\|\>\|>=\|=\@\|\*\*\|\.\.\.\|\.\.\|::\)" syn match rubyPseudoOperator "\%(-=\|/=\|\*\*=\|\*=\|&&=\|&=\|&&\|||=\||=\|||\|%=\|+=\|!\~\|!=\)" - syn region rubyBracketOperator matchgroup=rubyOperator start="\%([_[:lower:]]\w*[?!=]\=\|[})]\)\@<=\[\s*" end="\s*]" contains=TOP + syn region rubyBracketOperator matchgroup=rubyOperator start="\%([_[:lower:]]\w*[?!=]\=\|[})]\)\@<=\[\s*" end="\s*]" contains=ALLBUT,@rubyNotTop endif " Expression Substitution and Backslash Notation syn match rubyEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display syn match rubyEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display -syn region rubyInterpolation matchgroup=rubyInterpolationDelimiter start="#{" end="}" contained contains=TOP +syn region rubyInterpolation matchgroup=rubyInterpolationDelimiter start="#{" end="}" contained contains=ALLBUT,@rubyNotTop syn match rubyInterpolation "#\%(\$\|@@\=\)\w\+" display contained contains=rubyInterpolationDelimiter,rubyInstanceVariable,rubyClassVariable,rubyGlobalVariable,rubyPredefinedVariable syn match rubyInterpolationDelimiter "#\ze\%(\$\|@@\=\)\w\+" display contained syn match rubyInterpolation "#\$\%(-\w\|\W\)" display contained contains=rubyInterpolationDelimiter,rubyPredefinedVariable,rubyInvalidVariable @@ -137,10 +139,10 @@ syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\[" e syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=(" end=")" skip="\\\\\|\\)" contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimEscape fold " Here Document -syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@>\|[<>]=\=\|<=>\|===\|==\|=\~\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration +syn cluster rubyDeclaration contains=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration,rubyClassDeclaration,rubyModuleDeclaration,rubyFunction + " Expensive Mode - match 'end' with the appropriate opening keyword for syntax " based folding and special highlighting of module/class/method definitions if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") @@ -172,30 +176,30 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") syn match rubyDefine "\" nextgroup=rubyMethodDeclaration skipwhite skipnl syn match rubyClass "\" nextgroup=rubyClassDeclaration skipwhite skipnl syn match rubyModule "\" nextgroup=rubyModuleDeclaration skipwhite skipnl - syn region rubyBlock start="\" matchgroup=rubyDefine end="\%(\" contains=TOP fold - syn region rubyBlock start="\" matchgroup=rubyClass end="\" contains=TOP fold - syn region rubyBlock start="\" matchgroup=rubyModule end="\" contains=TOP fold + syn region rubyBlock start="\" matchgroup=rubyDefine end="\%(\" contains=ALLBUT,@rubyNotTop fold + syn region rubyBlock start="\" matchgroup=rubyClass end="\" contains=ALLBUT,@rubyNotTop fold + syn region rubyBlock start="\" matchgroup=rubyModule end="\" contains=ALLBUT,@rubyNotTop fold " modifiers syn match rubyConditionalModifier "\<\%(if\|unless\)\>" display syn match rubyRepeatModifier "\<\%(while\|until\)\>" display - syn region rubyDoBlock matchgroup=rubyControl start="\" end="\" contains=TOP fold + syn region rubyDoBlock matchgroup=rubyControl start="\" end="\" contains=ALLBUT,@rubyNotTop fold " curly bracket block or hash literal - syn region rubyCurlyBlock start="{" end="}" contains=TOP fold - syn region rubyArrayLiteral matchgroup=rubyArrayDelimiter start="\%(\w\|[\]})]\)\@" end="\" contains=TOP fold - syn region rubyCaseExpression matchgroup=rubyConditional start="\" end="\" contains=TOP fold - syn region rubyConditionalExpression matchgroup=rubyConditional start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+=-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\" contains=TOP fold + syn region rubyBlockExpression matchgroup=rubyControl start="\" end="\" contains=ALLBUT,@rubyNotTop fold + syn region rubyCaseExpression matchgroup=rubyConditional start="\" end="\" contains=ALLBUT,@rubyNotTop fold + syn region rubyConditionalExpression matchgroup=rubyConditional start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+=-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\" contains=ALLBUT,@rubyNotTop fold syn keyword rubyConditional then else when contained containedin=rubyCaseExpression syn keyword rubyConditional then else elsif contained containedin=rubyConditionalExpression " statements with optional 'do' - syn region rubyOptionalDoLine matchgroup=rubyRepeat start="\" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" matchgroup=rubyOptionalDo end="\%(\\)" end="\ze\%(;\|$\)" oneline contains=TOP - syn region rubyRepeatExpression start="\" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" matchgroup=rubyRepeat end="\" contains=TOP nextgroup=rubyOptionalDoLine fold + syn region rubyOptionalDoLine matchgroup=rubyRepeat start="\" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" matchgroup=rubyOptionalDo end="\%(\\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@rubyNotTop + syn region rubyRepeatExpression start="\" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" matchgroup=rubyRepeat end="\" contains=ALLBUT,@rubyNotTop nextgroup=rubyOptionalDoLine fold if !exists("ruby_minlines") let ruby_minlines = 50 From 3c55ab5b5bcfa5e95fa254a4b51e0c3501f88452 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Tue, 22 May 2007 19:57:21 +0000 Subject: [PATCH 380/411] Module syntax match change; detect irbrc --- ChangeLog | 10 ++++++++++ ftdetect/ruby.vim | 3 +++ syntax/ruby.vim | 4 ++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8cbb600a..bf982c76 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2007-05-22 Tim Pope + + * syntax/ruby.vim: made module declaration match mirror class + declaration match + * ftdetect/ruby.vim: added .irbrc + +2007-05-16 Tim Pope + + * syntax/ruby.vim: revert from using TOP to ALLBUT + 2007-05-15 Tim Pope * syntax/eruby.vim: handle %%> properly diff --git a/ftdetect/ruby.vim b/ftdetect/ruby.vim index 15f5eaab..2b8931ab 100644 --- a/ftdetect/ruby.vim +++ b/ftdetect/ruby.vim @@ -10,5 +10,8 @@ au BufNewFile,BufRead [rR]akefile,*.rake set filetype=ruby " Rantfile au BufNewFile,BufRead [rR]antfile,*.rant set filetype=ruby +" IRB config +au BufNewFile,BufRead .irbrc set filetype=ruby + " eRuby au BufNewFile,BufRead *.erb,*.rhtml set filetype=eruby diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 56c38319..2400d584 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.137 2007/05/16 16:06:10 tpope Exp $ +" Info: $Id: ruby.vim,v 1.138 2007/05/22 19:57:22 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -162,7 +162,7 @@ syn match rubyAliasDeclaration "[^[:space:];#.()]\+" contained contains=rub 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 -syn match rubyModuleDeclaration "[^[:space:];#]\+" contained contains=rubyConstant +syn match rubyModuleDeclaration "[^[:space:];#<]\+" contained contains=rubyConstant syn match rubyFunction "\<[_[:alpha:]][_[:alnum:]]*[?!=]\=[[:alnum:].:?!=]\@!" contained containedin=rubyMethodDeclaration syn match rubyFunction "\%(\s\|^\)\@<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2 syn match rubyFunction "\%([[:space:].]\|^\)\@<=\%(\[\]=\=\|\*\*\|[+-]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|==\|=\~\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration From abe063526f62108d5bdcfb2c7a65fe5b122be8b4 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Fri, 25 May 2007 15:09:41 +0000 Subject: [PATCH 381/411] String related fixes --- ChangeLog | 5 +++++ indent/ruby.vim | 17 +++++++++-------- syntax/ruby.vim | 18 +++++++++--------- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index bf982c76..1cf0bc3b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-05-25 Tim Pope + + * syntax/ruby.vim: cleaned up string highlighting + * indent/ruby.vim: lines starting with strings are no longer ignored + 2007-05-22 Tim Pope * syntax/ruby.vim: made module declaration match mirror class diff --git a/indent/ruby.vim b/indent/ruby.vim index a660d6b2..a9b6c9e5 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Ruby " Maintainer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.40 2007/03/20 13:54:25 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.41 2007/05/25 15:09:43 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -39,15 +39,16 @@ let s:syng_strcom = '\' + \ '\' " Regex of syntax group names that are strings or documentation. +" Delimiters excluded. let s:syng_stringdoc = - \'\' + \'\' " Expression used to check whether we should skip a match with searchpair(). let s:skip_expr = - \ "synIDattr(synID(line('.'),col('.'),0),'name') =~ '".s:syng_strcom."'" + \ "synIDattr(synID(line('.'),col('.'),1),'name') =~ '".s:syng_strcom."'" " Regex used for words that, at the start of a line, add a level of indent. let s:ruby_indent_keywords = '^\s*\zs\<\%(module\|class\|def\|if\|for' . @@ -97,17 +98,17 @@ let s:block_regex = " 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, 0), 'name') =~ s:syng_strcom + return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_strcom endfunction " Check if the character at lnum:col is inside a string. function s:IsInString(lnum, col) - return synIDattr(synID(a:lnum, a:col, 0), 'name') =~ s:syng_string + return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_string 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, 0), 'name') =~ s:syng_stringdoc + return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_stringdoc endfunction " Find line above 'lnum' that isn't empty, in a comment, or in a string. @@ -250,7 +251,7 @@ function GetRubyIndent() " If we are in a multi-line string or line-comment, don't do anything to it. if s:IsInStringOrDocumentation(v:lnum, matchend(line, '^\s*') + 1) - return indent('.') + "return indent('.') endif " 3.3. Work on the previous line. {{{2 diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 2400d584..4901aade 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.138 2007/05/22 19:57:22 tpope Exp $ +" Info: $Id: ruby.vim,v 1.139 2007/05/25 15:09:44 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -38,8 +38,8 @@ if exists("ruby_operators") endif " Expression Substitution and Backslash Notation -syn match rubyEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display -syn match rubyEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display +syn match rubyStringEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display +syn match rubyStringEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display syn region rubyInterpolation matchgroup=rubyInterpolationDelimiter start="#{" end="}" contained contains=ALLBUT,@rubyNotTop syn match rubyInterpolation "#\%(\$\|@@\=\)\w\+" display contained contains=rubyInterpolationDelimiter,rubyInstanceVariable,rubyClassVariable,rubyGlobalVariable,rubyPredefinedVariable @@ -53,12 +53,12 @@ syn match rubyNoInterpolation "\\#\$\W" display contained syn match rubyDelimEscape "\\[(<{\[)>}\]]" transparent display contained contains=NONE -syn region rubyNestedParentheses start="(" end=")" skip="\\\\\|\\)" transparent contained contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimEscape -syn region rubyNestedCurlyBraces start="{" end="}" skip="\\\\\|\\}" transparent contained contains=@rubyStringSpecial,rubyNestedCurlyBraces,rubyDelimEscape -syn region rubyNestedAngleBrackets start="<" end=">" skip="\\\\\|\\>" transparent contained contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimEscape -syn region rubyNestedSquareBrackets start="\[" end="\]" skip="\\\\\|\\\]" transparent contained contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimEscape +syn region rubyNestedParentheses start="(" skip="\\\\\|\\)" matchgroup=rubyString end=")" transparent contained +syn region rubyNestedCurlyBraces start="{" skip="\\\\\|\\}" matchgroup=rubyString end="}" transparent contained +syn region rubyNestedAngleBrackets start="<" skip="\\\\\|\\>" matchgroup=rubyString end=">" transparent contained +syn region rubyNestedSquareBrackets start="\[" skip="\\\\\|\\\]" matchgroup=rubyString end="\]" transparent contained -syn cluster rubyStringSpecial contains=rubyInterpolation,rubyNoInterpolation,rubyEscape +syn cluster rubyStringSpecial contains=rubyInterpolation,rubyNoInterpolation,rubyStringEscape syn cluster rubyExtendedStringSpecial contains=@rubyStringSpecial,rubyNestedParentheses,rubyNestedCurlyBraces,rubyNestedAngleBrackets,rubyNestedSquareBrackets " Numbers and ASCII Codes @@ -305,7 +305,7 @@ hi def link rubyComment Comment hi def link rubyData Comment hi def link rubyDataDirective Delimiter hi def link rubyDocumentation Comment -hi def link rubyEscape Special +hi def link rubyStringEscape Special hi def link rubyInterpolationDelimiter Delimiter hi def link rubyNoInterpolation rubyString hi def link rubySharpBang PreProc From 4b2422fc6176de8140aeee0132a9ba66ed82cc78 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Fri, 25 May 2007 15:57:41 +0000 Subject: [PATCH 382/411] removed string delimiter from patterns --- ChangeLog | 4 ++++ indent/ruby.vim | 11 +++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1cf0bc3b..9397fe01 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-05-25 Tim Pope + + * indent/ruby.vim: removed string delimiters from string matches + 2007-05-25 Tim Pope * syntax/ruby.vim: cleaned up string highlighting diff --git a/indent/ruby.vim b/indent/ruby.vim index a9b6c9e5..9626665b 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Ruby " Maintainer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.41 2007/05/25 15:09:43 tpope Exp $ +" Info: $Id: ruby.vim,v 1.42 2007/05/25 15:57:41 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -34,15 +34,14 @@ set cpo&vim " ============ " Regex of syntax group names that are or delimit string or are comments. -let s:syng_strcom = '\' +let s:syng_strcom = '\' " Regex of syntax group names that are strings. let s:syng_string = - \ '\' + \ '\' " Regex of syntax group names that are strings or documentation. -" Delimiters excluded. let s:syng_stringdoc = \'\' @@ -251,7 +250,7 @@ function GetRubyIndent() " If we are in a multi-line string or line-comment, don't do anything to it. if s:IsInStringOrDocumentation(v:lnum, matchend(line, '^\s*') + 1) - "return indent('.') + return indent('.') endif " 3.3. Work on the previous line. {{{2 From 1f5748de3ba7800b160492ffbdf18c26756c6750 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sat, 26 May 2007 05:30:49 +0000 Subject: [PATCH 383/411] Fixed class highlighting --- ChangeLog | 4 ++++ syntax/ruby.vim | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9397fe01..17886966 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-05-26 Tim Pope + + * syntax/ruby.vim: added rubyBlockParameter to @rubyNoTop + 2007-05-25 Tim Pope * indent/ruby.vim: removed string delimiters from string matches diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 4901aade..09d0b759 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.139 2007/05/25 15:09:44 tpope Exp $ +" Info: $Id: ruby.vim,v 1.140 2007/05/26 05:30:50 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -167,7 +167,7 @@ syn match rubyFunction "\<[_[:alpha:]][_[:alnum:]]*[?!=]\=[[:alnum:].:?!=]\@!" syn match rubyFunction "\%(\s\|^\)\@<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2 syn match rubyFunction "\%([[:space:].]\|^\)\@<=\%(\[\]=\=\|\*\*\|[+-]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|==\|=\~\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration -syn cluster rubyDeclaration contains=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration,rubyClassDeclaration,rubyModuleDeclaration,rubyFunction +syn cluster rubyDeclaration contains=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration,rubyModuleDeclaration,rubyClassDeclaration,rubyFunction,rubyBlockParameter " Expensive Mode - match 'end' with the appropriate opening keyword for syntax " based folding and special highlighting of module/class/method definitions From 0feddcbff5426682551f204e40c382f297025ded Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Mon, 4 Jun 2007 17:35:35 +0000 Subject: [PATCH 384/411] fixed %s highlighting --- ChangeLog | 4 ++++ syntax/ruby.vim | 13 +++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 17886966..e296be7b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-06-04 Tim Pope + + * syntax/ruby.vim: fixed %s() highlighting + 2007-05-26 Tim Pope * syntax/ruby.vim: added rubyBlockParameter to @rubyNoTop diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 09d0b759..7a187310 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.140 2007/05/26 05:30:50 tpope Exp $ +" Info: $Id: ruby.vim,v 1.141 2007/06/04 17:35:38 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -123,11 +123,11 @@ syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]{" end=" syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]<" end=">" skip="\\\\\|\\>" fold contains=rubyNestedAngleBrackets,rubyDelimEscape syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]\[" end="\]" skip="\\\\\|\\\]" fold contains=rubyNestedSquareBrackets,rubyDelimEscape syn region rubyString matchgroup=rubyStringDelimiter start="%[qw](" end=")" skip="\\\\\|\\)" fold contains=rubyNestedParentheses,rubyDelimEscape -syn region rubySymbol start="%[s]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold -syn region rubySymbol start="%[s]{" end="}" skip="\\\\\|\\}" fold contains=rubyNestedCurlyBraces,rubyDelimEscape -syn region rubySymbol start="%[s]<" end=">" skip="\\\\\|\\>" fold contains=rubyNestedAngleBrackets,rubyDelimEscape -syn region rubySymbol start="%[s]\[" end="\]" skip="\\\\\|\\\]" fold contains=rubyNestedSquareBrackets,rubyDelimEscape -syn region rubySymbol start="%[s](" end=")" skip="\\\\\|\\)" fold contains=rubyNestedParentheses,rubyDelimEscape +syn region rubySymbol matchgroup=rubySymbolDelimiter start="%[s]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold +syn region rubySymbol matchgroup=rubySymbolDelimiter start="%[s]{" end="}" skip="\\\\\|\\}" fold contains=rubyNestedCurlyBraces,rubyDelimEscape +syn region rubySymbol matchgroup=rubySymbolDelimiter start="%[s]<" end=">" skip="\\\\\|\\>" fold contains=rubyNestedAngleBrackets,rubyDelimEscape +syn region rubySymbol matchgroup=rubySymbolDelimiter start="%[s]\[" end="\]" skip="\\\\\|\\\]" fold contains=rubyNestedSquareBrackets,rubyDelimEscape +syn region rubySymbol matchgroup=rubySymbolDelimiter start="%[s](" end=")" skip="\\\\\|\\)" fold contains=rubyNestedParentheses,rubyDelimEscape " Generalized Double Quoted String and Array of Strings and Shell Command Output " Note: %= is not matched here as the beginning of a double quoted string @@ -310,6 +310,7 @@ hi def link rubyInterpolationDelimiter Delimiter hi def link rubyNoInterpolation rubyString hi def link rubySharpBang PreProc hi def link rubyRegexpDelimiter rubyStringDelimiter +hi def link rubySymbolDelimiter rubyStringDelimiter hi def link rubyStringDelimiter Delimiter hi def link rubyRegexp rubyString hi def link rubyString String From 48ff2854a32c8eb69e20b6a94f932e3fa861e4d7 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Fri, 22 Jun 2007 16:01:58 +0000 Subject: [PATCH 385/411] operator highlighting in class declarations --- ChangeLog | 5 +++++ syntax/ruby.vim | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index e296be7b..9d767c3d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-06-22 Tim Pope + + * syntax/ruby.vim: include operator highlighting in class/module + declarations (for ::) + 2007-06-04 Tim Pope * syntax/ruby.vim: fixed %s() highlighting diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 7a187310..9aab1571 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.141 2007/06/04 17:35:38 tpope Exp $ +" Info: $Id: ruby.vim,v 1.142 2007/06/22 16:01:58 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -34,7 +34,7 @@ endif if exists("ruby_operators") syn match rubyOperator "\%([~!^&|*/%+-]\|\%(class\s*\)\@\|<=\|\%(<\|\>\|>=\|=\@\|\*\*\|\.\.\.\|\.\.\|::\)" syn match rubyPseudoOperator "\%(-=\|/=\|\*\*=\|\*=\|&&=\|&=\|&&\|||=\||=\|||\|%=\|+=\|!\~\|!=\)" - syn region rubyBracketOperator matchgroup=rubyOperator start="\%([_[:lower:]]\w*[?!=]\=\|[})]\)\@<=\[\s*" end="\s*]" contains=ALLBUT,@rubyNotTop + syn region rubyBracketOperator matchgroup=rubyOperator start="\%(\w[?!]\=\|[]})]\)\@<=\[\s*" end="\s*]" contains=ALLBUT,@rubyNotTop endif " Expression Substitution and Backslash Notation @@ -161,8 +161,8 @@ end 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 -syn match rubyModuleDeclaration "[^[:space:];#<]\+" contained contains=rubyConstant +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\|^\)\@<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2 syn match rubyFunction "\%([[:space:].]\|^\)\@<=\%(\[\]=\=\|\*\*\|[+-]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|==\|=\~\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration From 26f1b508b472351e7cb22cbc82dbf5026f6cb2be Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sat, 14 Jul 2007 17:38:33 +0000 Subject: [PATCH 386/411] Fixed ALLBUT clauses to refer to right group --- ChangeLog | 4 ++++ syntax/eruby.vim | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9d767c3d..febcf778 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-07-14 Tim Pope + + * syntax/eruby.vim: fixed ALLBUT clauses to refer to right group + 2007-06-22 Tim Pope * syntax/ruby.vim: include operator highlighting in class/module diff --git a/syntax/eruby.vim b/syntax/eruby.vim index 12e4e7e1..08062ed1 100644 --- a/syntax/eruby.vim +++ b/syntax/eruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: eRuby " Maintainer: Tim Pope -" Info: $Id: eruby.vim,v 1.19 2007/05/15 17:10:58 tpope Exp $ +" Info: $Id: eruby.vim,v 1.20 2007/07/14 17:38:33 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -55,10 +55,10 @@ syn include @rubyTop syntax/ruby.vim syn cluster erubyRegions contains=erubyOneLiner,erubyBlock,erubyExpression,erubyComment -exe 'syn region erubyOneLiner matchgroup=erubyDelimiter start="^%\{1,'.b:eruby_nest_level.'\}%\@!" end="$" contains=@rubyTop containedin=ALLBUT,@erbRegions keepend oneline' -exe 'syn region erubyBlock matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}%\@!-\=" end="-\=%\@" contains=@rubyTop containedin=ALLBUT,@erbRegions keepend' -exe 'syn region erubyExpression matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}=" end="-\=%\@" contains=@rubyTop containedin=ALLBUT,@erbRegions keepend' -exe 'syn region erubyComment matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}#" end="-\=%\@" contains=rubyTodo,@Spell containedin=ALLBUT,@erbRegions keepend' +exe 'syn region erubyOneLiner matchgroup=erubyDelimiter start="^%\{1,'.b:eruby_nest_level.'\}%\@!" end="$" contains=@rubyTop containedin=ALLBUT,@erubyRegions keepend oneline' +exe 'syn region erubyBlock matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}%\@!-\=" end="-\=%\@" contains=@rubyTop containedin=ALLBUT,@erubyRegions keepend' +exe 'syn region erubyExpression matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}=" end="-\=%\@" contains=@rubyTop containedin=ALLBUT,@erubyRegions keepend' +exe 'syn region erubyComment matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}#" end="-\=%\@" contains=rubyTodo,@Spell containedin=ALLBUT,@erubyRegions keepend' " Define the default highlighting. " For version 5.7 and earlier: only when not done already From 38f2224a191d154964e78e93d11173db951489fd Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Mon, 16 Jul 2007 17:45:19 +0000 Subject: [PATCH 387/411] prevent symbols like :for from indenting --- ChangeLog | 4 ++++ indent/ruby.vim | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index febcf778..1b2621f7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-07-16 Tim Pope + + * indent/ruby.vim: prevent symbols like :for from indenting + 2007-07-14 Tim Pope * syntax/eruby.vim: fixed ALLBUT clauses to refer to right group diff --git a/indent/ruby.vim b/indent/ruby.vim index 9626665b..c613e1a6 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Ruby " Maintainer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.42 2007/05/25 15:57:41 tpope Exp $ +" Info: $Id: ruby.vim,v 1.43 2007/07/16 17:45:20 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -53,7 +53,7 @@ let s:skip_expr = let s:ruby_indent_keywords = '^\s*\zs\<\%(module\|class\|def\|if\|for' . \ '\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure' . \ '\|rescue\)\>' . - \ '\|\%([*+/,=:-]\|<<\|>>\)\s*\zs' . + \ '\|\%([*+/,=-]\|<<\|>>\|:\s\)\s*\zs' . \ '\<\%(if\|for\|while\|until\|case\|unless\|begin\)\>' " Regex used for words that, at the start of a line, remove a level of indent. @@ -65,7 +65,7 @@ let s:ruby_deindent_keywords = " TODO: the do here should be restricted somewhat (only at end of line)? let s:end_start_regex = '^\s*\zs\<\%(module\|class\|def\|if\|for' . \ '\|while\|until\|case\|unless\|begin\)\>' . - \ '\|\%([*+/,=:-]\|<<\|>>\)\s*\zs' . + \ '\|\%([*+/,=-]\|<<\|>>\|:\s\)\s*\zs' . \ '\<\%(if\|for\|while\|until\|case\|unless\|begin\)\>' . \ '\|\' From 4d5dac937868bef96149a82a6403d32e74662791 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Mon, 30 Jul 2007 22:08:12 +0000 Subject: [PATCH 388/411] Highlight undef like def --- ChangeLog | 4 ++++ syntax/ruby.vim | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1b2621f7..3d70a686 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-07-30 Tim Pope + + * syntax/ruby.vim: highlight undef like def + 2007-07-16 Tim Pope * indent/ruby.vim: prevent symbols like :for from indenting diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 9aab1571..680eaa35 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.142 2007/06/22 16:01:58 tpope Exp $ +" Info: $Id: ruby.vim,v 1.143 2007/07/30 22:08:13 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -174,6 +174,7 @@ syn cluster rubyDeclaration contains=rubyAliasDeclaration,rubyAliasDeclaration2, if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") syn match rubyDefine "\" nextgroup=rubyAliasDeclaration skipwhite skipnl syn match rubyDefine "\" nextgroup=rubyMethodDeclaration skipwhite skipnl + syn match rubyDefine "\" nextgroup=rubyFunction skipwhite skipnl syn match rubyClass "\" nextgroup=rubyClassDeclaration skipwhite skipnl syn match rubyModule "\" nextgroup=rubyModuleDeclaration skipwhite skipnl syn region rubyBlock start="\" matchgroup=rubyDefine end="\%(\" contains=ALLBUT,@rubyNotTop fold @@ -211,7 +212,7 @@ else syn match rubyControl "\" nextgroup=rubyClassDeclaration skipwhite skipnl syn match rubyControl "\" nextgroup=rubyModuleDeclaration skipwhite skipnl syn keyword rubyControl case begin do for if unless while until else elsif then when end - syn keyword rubyKeyword alias + syn keyword rubyKeyword alias undef endif " Keywords @@ -219,7 +220,7 @@ endif " begin case class def do end for if module unless until while syn keyword rubyControl and break ensure in next not or redo rescue retry return syn match rubyOperator "\ Date: Tue, 7 Aug 2007 15:41:50 +0000 Subject: [PATCH 389/411] fix while/until/for match in skip regexp --- ChangeLog | 4 ++++ indent/ruby.vim | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3d70a686..d4142ea2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-08-07 Tim Pope + + * indent/ruby.vim: fix while/until/for match in skip regexp + 2007-07-30 Tim Pope * syntax/ruby.vim: highlight undef like def diff --git a/indent/ruby.vim b/indent/ruby.vim index c613e1a6..923c406c 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Ruby " Maintainer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.43 2007/07/16 17:45:20 tpope Exp $ +" Info: $Id: ruby.vim,v 1.44 2007/08/07 15:41:50 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -78,7 +78,7 @@ let s:end_end_regex = '\%(^\|[^.:@$]\)\@<=\' " Expression used for searchpair() call for finding match for 'end' keyword. let s:end_skip_expr = s:skip_expr . \ ' || (expand("") == "do"' . - \ ' && getline(".") =~ "^\\s*\\")' + \ ' && getline(".") =~ "^\\s*\\<\\(while\\|until\\|for\\)\\>")' " Regex that defines continuation lines, not including (, {, or [. let s:continuation_regex = '\%([\\*+/.,=:-]\|\W[|&?]\|||\|&&\)\s*\%(#.*\)\=$' From d55dc9f089cf25bab6eae93eeb77b5bc3e2635c7 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Thu, 6 Sep 2007 16:56:14 +0000 Subject: [PATCH 390/411] Highlight negative sign; remove Vim 5.x stuff --- ChangeLog | 5 +++++ syntax/eruby.vim | 17 +++-------------- syntax/ruby.vim | 14 +++++++------- 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index d4142ea2..92041d87 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-09-06 Tim Pope + + * syntax/eruby.vim: remove Vim 5.x specific sections + * syntax/ruby.vim: highlight negative sign in numbers + 2007-08-07 Tim Pope * indent/ruby.vim: fix while/until/for match in skip regexp diff --git a/syntax/eruby.vim b/syntax/eruby.vim index 08062ed1..536f28e1 100644 --- a/syntax/eruby.vim +++ b/syntax/eruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: eRuby " Maintainer: Tim Pope -" Info: $Id: eruby.vim,v 1.20 2007/07/14 17:38:33 tpope Exp $ +" Info: $Id: eruby.vim,v 1.21 2007/09/06 16:56:15 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -61,21 +61,10 @@ exe 'syn region erubyExpression matchgroup=erubyDelimiter start="<%\{1,'.b:erub exe 'syn region erubyComment matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}#" end="-\=%\@" contains=rubyTodo,@Spell containedin=ALLBUT,@erubyRegions keepend' " Define the default highlighting. -" For version 5.7 and earlier: only when not done already -" For version 5.8 and later: only when an item doesn't have highlighting yet -if version >= 508 || !exists("did_eruby_syntax_inits") - if version < 508 - let did_ruby_syntax_inits = 1 - command -nargs=+ HiLink hi link - else - command -nargs=+ HiLink hi def link - endif - HiLink erubyDelimiter Delimiter - HiLink erubyComment Comment +hi def link erubyDelimiter Delimiter +hi def link erubyComment Comment - delcommand HiLink -endif let b:current_syntax = 'eruby' if main_syntax == 'eruby' diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 680eaa35..408fad13 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.143 2007/07/30 22:08:13 tpope Exp $ +" Info: $Id: ruby.vim,v 1.144 2007/09/06 16:56:15 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -63,12 +63,12 @@ syn cluster rubyExtendedStringSpecial contains=@rubyStringSpecial,rubyNestedPare " Numbers and ASCII Codes syn match rubyASCIICode "\%(\w\|[]})\"'/]\)\@" display -syn match rubyInteger "\<\%(0[dD]\)\=\%(0\|[1-9]\d*\%(_\d\+\)*\)\>" display -syn match rubyInteger "\<0[oO]\=\o\+\%(_\o\+\)*\>" display -syn match rubyInteger "\<0[bB][01]\+\%(_[01]\+\)*\>" display -syn match rubyFloat "\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\.\d\+\%(_\d\+\)*\>" display -syn match rubyFloat "\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE][-+]\=\d\+\%(_\d\+\)*\)\>" display +syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@" display +syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@" display +syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@" display +syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@" display +syn match rubyFloat "\%(\%(\w\|[]})\"']\s*\)\@" display +syn match rubyFloat "\%(\%(\w\|[]})\"']\s*\)\@" display " Identifiers syn match rubyLocalVariableOrMethod "\<[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent From 031477c8848951d01746c46dbed450de7db187a4 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Fri, 14 Sep 2007 14:40:11 +0000 Subject: [PATCH 391/411] Added rspec compiler plugin --- ChangeLog | 4 ++++ compiler/rspec.vim | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 compiler/rspec.vim diff --git a/ChangeLog b/ChangeLog index 92041d87..f1a25c3d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-09-14 Tim Pope + + * compiler/rspec.vim: new compiler plugin for rspec + 2007-09-06 Tim Pope * syntax/eruby.vim: remove Vim 5.x specific sections diff --git a/compiler/rspec.vim b/compiler/rspec.vim new file mode 100644 index 00000000..023220b5 --- /dev/null +++ b/compiler/rspec.vim @@ -0,0 +1,41 @@ +" Vim compiler file +" Language: RSpec +" Maintainer: Tim Pope +" Info: $Id: rspec.vim,v 1.1 2007/09/14 14:40:11 tpope Exp $ +" URL: http://vim-ruby.rubyforge.org +" Anon CVS: See above site +" Release Coordinator: Doug Kearns + +if exists("current_compiler") + finish +endif +let current_compiler = "rspec" + +if exists(":CompilerSet") != 2 " older Vim always used :setlocal + command -nargs=* CompilerSet setlocal +endif + +let s:cpo_save = &cpo +set cpo-=C + +CompilerSet makeprg=spec + +CompilerSet errorformat= + \%+W'%.%#'\ FAILED, + \%+I'%.%#'\ FIXED, + \%-Cexpected:%.%#, + \%-C\ \ \ \ \ got:%.%#, + \%E%.%#:in\ `load':\ %f:%l:%m, + \%C%f:%l:, + \%W%f:%l:\ warning:\ %m, + \%E%f:%l:in\ %*[^:]:\ %m, + \%E%f:%l:\ %m, + \%-Z%\tfrom\ %f:%l, + \%-Z%p^%.%#, + \%-C%.%#, + \%-G%.%# + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: nowrap sw=2 sts=2 ts=8 ff=unix: From bf9d743bf443f62f6df3e7e8a6b96cedafcc57aa Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Mon, 1 Oct 2007 18:25:49 +0000 Subject: [PATCH 392/411] Removed some false positives (e.g., include?, nil?) --- ChangeLog | 4 ++++ syntax/ruby.vim | 45 ++++++++++++++++++++++++++------------------- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index f1a25c3d..6bb9062c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-10-01 Tim Pope + + * syntax/ruby.vim: removed some false positives (e.g., include?, nil?) + 2007-09-14 Tim Pope * compiler/rspec.vim: new compiler plugin for rspec diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 408fad13..db04ea2e 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.144 2007/09/06 16:56:15 tpope Exp $ +" Info: $Id: ruby.vim,v 1.145 2007/10/01 18:25:49 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -193,14 +193,14 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") " statements without 'do' syn region rubyBlockExpression matchgroup=rubyControl start="\" end="\" contains=ALLBUT,@rubyNotTop fold syn region rubyCaseExpression matchgroup=rubyConditional start="\" end="\" contains=ALLBUT,@rubyNotTop fold - syn region rubyConditionalExpression matchgroup=rubyConditional start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+=-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\" contains=ALLBUT,@rubyNotTop fold + syn region rubyConditionalExpression matchgroup=rubyConditional start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+=-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" end="\" contains=ALLBUT,@rubyNotTop fold - syn keyword rubyConditional then else when contained containedin=rubyCaseExpression - syn keyword rubyConditional then else elsif contained containedin=rubyConditionalExpression + syn match rubyConditional "\<\%(then\|else\|when\)\>[?!]\@!" contained containedin=rubyCaseExpression + syn match rubyConditional "\<\%(then\|else\|elsif\)\>[?!]\@!" contained containedin=rubyConditionalExpression " statements with optional 'do' - syn region rubyOptionalDoLine matchgroup=rubyRepeat start="\" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" matchgroup=rubyOptionalDo end="\%(\\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@rubyNotTop - syn region rubyRepeatExpression start="\" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" matchgroup=rubyRepeat end="\" contains=ALLBUT,@rubyNotTop nextgroup=rubyOptionalDoLine fold + syn region rubyOptionalDoLine matchgroup=rubyRepeat start="\[?!]\@!" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" matchgroup=rubyOptionalDo end="\%(\\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@rubyNotTop + syn region rubyRepeatExpression start="\[?!]\@!" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@" matchgroup=rubyRepeat end="\" contains=ALLBUT,@rubyNotTop nextgroup=rubyOptionalDoLine fold if !exists("ruby_minlines") let ruby_minlines = 50 @@ -208,31 +208,35 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") exec "syn sync minlines=" . ruby_minlines else - syn match rubyControl "\" nextgroup=rubyMethodDeclaration skipwhite skipnl - syn match rubyControl "\" nextgroup=rubyClassDeclaration skipwhite skipnl - syn match rubyControl "\" nextgroup=rubyModuleDeclaration skipwhite skipnl - syn keyword rubyControl case begin do for if unless while until else elsif then when end - syn keyword rubyKeyword alias undef + syn match rubyControl "\[?!]\@!" nextgroup=rubyMethodDeclaration skipwhite skipnl + syn match rubyControl "\[?!]\@!" nextgroup=rubyClassDeclaration skipwhite skipnl + syn match rubyControl "\[?!]\@!" nextgroup=rubyModuleDeclaration skipwhite skipnl + syn match rubyControl "\<\%(case\|begin\|do\|for\|if\|unless\|while\|until\|else\|elsif\|then\|when\|end\)\>[?!]\@!" + syn match rubyKeyword "\<\%(alias\|undef\)\>[?!]\@!" endif " Keywords " Note: the following keywords have already been defined: " begin case class def do end for if module unless until while -syn keyword rubyControl and break ensure in next not or redo rescue retry return +syn match rubyControl "\<\%(and\|break\|ensure\|in\|next\|not\|or\|redo\|rescue\|retry\|return\)\>[?!]\@!" syn match rubyOperator "\[?!]\@!" +syn match rubyBoolean "\<\%(true\|false\)\>[?!]\@!" +syn match rubyPseudoVariable "\<\%(nil\|self\|__FILE__\|__LINE__\)\>[?!]\@!" +syn match rubyBeginEnd "\<\%(BEGIN\|END\)\>[?!]\@!" " Special Methods if !exists("ruby_no_special_methods") syn keyword rubyAccess public protected private module_function - syn keyword rubyAttribute attr attr_accessor attr_reader attr_writer - syn match rubyControl "\<\%(exit!\|\%(abort\|at_exit\|exit\|fork\|loop\|trap\)\>\)" + " attr is a common variable name + syn match rubyAttribute "\%(\%(^\|;\)\s*\)\@<=attr\>\(\s*[.=]\)\@!" + syn keyword rubyAttribute attr_accessor attr_reader attr_writer + 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 - syn keyword rubyInclude autoload extend include load require + " false positive with 'include?' + syn match rubyInclude "\[?!]\@!" + syn keyword rubyInclude autoload extend load require syn keyword rubyKeyword callcc caller lambda proc endif @@ -253,6 +257,9 @@ syn match rubyKeywordAsMethod "\%(\%(\.\@" transparent contains=NONE syn match rubyKeywordAsMethod "\%(\%(\.\@" transparent contains=NONE +syn match rubyKeywordAsMethod "\<\%(alias\|begin\|case\|class\|def\|do\|end\)[?!]" transparent contains=NONE +syn match rubyKeywordAsMethod "\<\%(if\|module\|undef\|unless\|until\|while\)[?!]" transparent contains=NONE + syn match rubyKeywordAsMethod "\%(\%(\.\@" transparent contains=NONE syn match rubyKeywordAsMethod "\%(\%(\.\@" transparent contains=NONE syn match rubyKeywordAsMethod "\%(\%(\.\@" transparent contains=NONE From 70b8d4482ec889885997c49c2df43527faae818e Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Mon, 17 Dec 2007 18:35:15 +0000 Subject: [PATCH 393/411] Treat <%- like <% when indenting --- ChangeLog | 4 ++++ indent/eruby.vim | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6bb9062c..9f4fe27b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-12-17 Tim Pope + + * indent/eruby.vim: treat <%- like <% + 2007-10-01 Tim Pope * syntax/ruby.vim: removed some false positives (e.g., include?, nil?) diff --git a/indent/eruby.vim b/indent/eruby.vim index 0d6dd7e4..de344a8f 100644 --- a/indent/eruby.vim +++ b/indent/eruby.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: eRuby " Maintainer: Tim Pope -" Info: $Id: eruby.vim,v 1.10 2007/05/12 15:40:56 tpope Exp $ +" Info: $Id: eruby.vim,v 1.11 2007/12/17 18:35:15 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -58,15 +58,15 @@ function! GetErubyIndent(...) let lnum = prevnonblank(v:lnum-1) let line = getline(lnum) let cline = getline(v:lnum) - if cline =~# '<%\s*\%(end\|else\|\%(ensure\|rescue\|elsif\|when\).\{-\}\)\s*\%(-\=%>\|$\)' + if cline =~# '<%-\=\s*\%(end\|else\|\%(ensure\|rescue\|elsif\|when\).\{-\}\)\s*\%(-\=%>\|$\)' let ind = ind - &sw endif if line =~# '\' let ind = ind + &sw - elseif line =~# '<%\s*\%(module\|class\|def\|if\|for\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure\|rescue\)\>.*%>' + elseif line =~# '<%-\=\s*\%(module\|class\|def\|if\|for\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure\|rescue\)\>.*%>' let ind = ind + &sw endif - if line =~# '^\s*<%[=#]\=\s*$' && cline !~# '^\s*end\>' + if line =~# '^\s*<%[=#-]\=\s*$' && cline !~# '^\s*end\>' let ind = ind + &sw endif if cline =~# '^\s*-\=%>\s*$' From 7d5781c004c7ca292a5393f55fc3c8510af2cdf6 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Mon, 21 Jan 2008 15:15:19 +0000 Subject: [PATCH 394/411] Indent { and } like do and end in eruby --- ChangeLog | 4 ++++ indent/eruby.vim | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9f4fe27b..194a23a6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-01-21 Tim Pope + + * indent/eruby.vim: indent { and } like do and end + 2007-12-17 Tim Pope * indent/eruby.vim: treat <%- like <% diff --git a/indent/eruby.vim b/indent/eruby.vim index de344a8f..16f4146c 100644 --- a/indent/eruby.vim +++ b/indent/eruby.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: eRuby " Maintainer: Tim Pope -" Info: $Id: eruby.vim,v 1.11 2007/12/17 18:35:15 tpope Exp $ +" Info: $Id: eruby.vim,v 1.12 2008/01/21 15:15:19 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -58,10 +58,10 @@ function! GetErubyIndent(...) let lnum = prevnonblank(v:lnum-1) let line = getline(lnum) let cline = getline(v:lnum) - if cline =~# '<%-\=\s*\%(end\|else\|\%(ensure\|rescue\|elsif\|when\).\{-\}\)\s*\%(-\=%>\|$\)' + if cline =~# '<%-\=\s*\%(}\|end\|else\|\%(ensure\|rescue\|elsif\|when\).\{-\}\)\s*\%(-\=%>\|$\)' let ind = ind - &sw endif - if line =~# '\' + if line =~# '\%({\|\' let ind = ind + &sw elseif line =~# '<%-\=\s*\%(module\|class\|def\|if\|for\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure\|rescue\)\>.*%>' let ind = ind + &sw From 5c44604819978516fa2983f6caab75c5aeb87d21 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Tue, 22 Jan 2008 15:23:18 +0000 Subject: [PATCH 395/411] per Bram's advice, use 'W' searchpair flag in indent/eruby.vim --- ChangeLog | 4 ++++ indent/eruby.vim | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 194a23a6..d71b7a83 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-01-21 Tim Pope + + * indent/eruby.vim: per Bram's advice, use 'W' searchpair flag + 2008-01-21 Tim Pope * indent/eruby.vim: indent { and } like do and end diff --git a/indent/eruby.vim b/indent/eruby.vim index 16f4146c..2e3db3ca 100644 --- a/indent/eruby.vim +++ b/indent/eruby.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: eRuby " Maintainer: Tim Pope -" Info: $Id: eruby.vim,v 1.12 2008/01/21 15:15:19 tpope Exp $ +" Info: $Id: eruby.vim,v 1.13 2008/01/22 15:23:18 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -48,7 +48,7 @@ function! GetErubyIndent(...) endif let vcol = col('.') call cursor(v:lnum,1) - let inruby = searchpair('<%','','%>') + let inruby = searchpair('<%','','%>','W') call cursor(v:lnum,vcol) if inruby && getline(v:lnum) !~ '^<%' let ind = GetRubyIndent() From d6a379409336da47de8b07cbc3f3db959f0fb60c Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Fri, 25 Jan 2008 17:37:21 +0000 Subject: [PATCH 396/411] Better regexp support --- ChangeLog | 4 ++++ syntax/ruby.vim | 53 +++++++++++++++++++++++++++++++++++++------------ 2 files changed, 44 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index d71b7a83..30dbeb25 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-01-25 Tim Pope + + * syntax/ruby.vim: highlight several regexp constructs + 2008-01-21 Tim Pope * indent/eruby.vim: per Bram's advice, use 'W' searchpair flag diff --git a/syntax/ruby.vim b/syntax/ruby.vim index db04ea2e..f092ccce 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.145 2007/10/01 18:25:49 tpope Exp $ +" Info: $Id: ruby.vim,v 1.146 2008/01/25 17:37:22 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -19,7 +19,7 @@ if has("folding") && exists("ruby_fold") setlocal foldmethod=syntax endif -syn cluster rubyNotTop contains=@rubyExtendedStringSpecial,@rubyDeclaration,rubyConditional,rubyTodo +syn cluster rubyNotTop contains=@rubyExtendedStringSpecial,@rubyRegexpSpecial,@rubyDeclaration,rubyConditional,rubyTodo if exists("ruby_space_errors") if !exists("ruby_no_trail_space_error") @@ -58,8 +58,27 @@ syn region rubyNestedCurlyBraces start="{" skip="\\\\\|\\}" matchgroup=rubyStrin syn region rubyNestedAngleBrackets start="<" skip="\\\\\|\\>" matchgroup=rubyString end=">" transparent contained syn region rubyNestedSquareBrackets start="\[" skip="\\\\\|\\\]" matchgroup=rubyString end="\]" transparent contained +" These are mostly Oniguruma ready +syn region rubyRegexpComment matchgroup=rubyRegexpSpecial start="(?#" skip="\\)" end=")" contained +syn region rubyRegexpParens matchgroup=rubyRegexpSpecial start="(\(?:\|?<\=[=!]\|?>\|?<[a-z_]\w*>\|?[imx]*-[imx]*:\=\|\%(?#\)\@!\)" skip="\\)" end=")" contained transparent contains=@rubyRegexpSpecial +syn region rubyRegexpBrackets matchgroup=rubyRegexpCharClass start="\[\^\=" skip="\\\]" end="\]" contained transparent contains=rubyStringEscape,rubyRegexpEscape,rubyRegexpCharClass oneline +syn match rubyRegexpCharClass "\\[DdHhSsWw]" contained display +syn match rubyRegexpCharClass "\[:\^\=\%(alnum\|alpha\|ascii\|blank\|cntrl\|digit\|graph\|lower\|print\|punct\|space\|upper\|xdigit\):\]" contained +syn match rubyRegexpEscape "\\[].*?+^$|\\(){}[]" contained display +syn match rubyRegexpQuantifier "[*?+][?+]\=" contained display +syn match rubyRegexpQuantifier "{\d\+\%(,\d*\)\=}?\=" contained display +syn match rubyRegexpAnchor "[$^]\|\\[ABbGZz]" contained display +syn match rubyRegexpDot "\." contained display +syn match rubyRegexpSpecial "|" contained display +syn match rubyRegexpSpecial "\\[1-9]\d\=\d\@!" contained display +syn match rubyRegexpSpecial "\\k<\%([a-z_]\w*\|-\=\d\+\)\%([+-]\d\+\)\=>" contained display +syn match rubyRegexpSpecial "\\k'\%([a-z_]\w*\|-\=\d\+\)\%([+-]\d\+\)\='" contained display +syn match rubyRegexpSpecial "\\g<\%([a-z_]\w*\|-\=\d\+\)>" contained display +syn match rubyRegexpSpecial "\\g'\%([a-z_]\w*\|-\=\d\+\)'" contained display + syn cluster rubyStringSpecial contains=rubyInterpolation,rubyNoInterpolation,rubyStringEscape syn cluster rubyExtendedStringSpecial contains=@rubyStringSpecial,rubyNestedParentheses,rubyNestedCurlyBraces,rubyNestedAngleBrackets,rubyNestedSquareBrackets +syn cluster rubyRegexpSpecial contains=rubyInterpolation,rubyNoInterpolation,rubyStringEscape,rubyRegexpSpecial,rubyRegexpEscape,rubyRegexpBrackets,rubyRegexpCharClass,rubyRegexpDot,rubyRegexpQuantifier,rubyRegexpAnchor,rubyRegexpParens,rubyRegexpComment " Numbers and ASCII Codes syn match rubyASCIICode "\%(\w\|[]})\"'/]\)\@" " Normal Regular Expression -syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\|else\)\|[;\~=!|&(,[>]\)\s*\)\@<=/" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyStringSpecial fold -syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\<\%(split\|scan\|gsub\|sub\)\s*\)\@<=/" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyStringSpecial fold +syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\|else\)\|[;\~=!|&(,[>]\)\s*\)\@<=/" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial fold +syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\<\%(split\|scan\|gsub\|sub\)\s*\)\@<=/" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial fold + +" Generalized Regular Expression +syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1[iomxneus]*" skip="\\\\\|\\\z1" contains=@rubyRegexpSpecial fold +syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r{" end="}[iomxneus]*" skip="\\\\\|\\}" contains=@rubyRegexpSpecial fold +syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r<" end=">[iomxneus]*" skip="\\\\\|\\>" contains=@rubyRegexpSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold +syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\[" end="\][iomxneus]*" skip="\\\\\|\\\]" contains=@rubyRegexpSpecial fold +syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r(" end=")[iomxneus]*" skip="\\\\\|\\)" contains=@rubyRegexpSpecial fold " Normal String and Shell Command Output syn region rubyString matchgroup=rubyStringDelimiter start="\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial fold syn region rubyString matchgroup=rubyStringDelimiter start="'" end="'" skip="\\\\\|\\'" fold syn region rubyString matchgroup=rubyStringDelimiter start="`" end="`" skip="\\\\\|\\`" contains=@rubyStringSpecial fold -" Generalized Regular Expression -syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1[iomxneus]*" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold -syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r{" end="}[iomxneus]*" skip="\\\\\|\\}" contains=@rubyStringSpecial,rubyNestedCurlyBraces,rubyDelimEscape fold -syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r<" end=">[iomxneus]*" skip="\\\\\|\\>" contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold -syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\[" end="\][iomxneus]*" skip="\\\\\|\\\]" contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimEscape fold -syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r(" end=")[iomxneus]*" skip="\\\\\|\\)" contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimEscape fold - " Generalized Single Quoted String, Symbol and Array of Strings syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]{" end="}" skip="\\\\\|\\}" fold contains=rubyNestedCurlyBraces,rubyDelimEscape @@ -313,6 +332,8 @@ hi def link rubyComment Comment hi def link rubyData Comment hi def link rubyDataDirective Delimiter hi def link rubyDocumentation Comment +hi def link rubyTodo Todo + hi def link rubyStringEscape Special hi def link rubyInterpolationDelimiter Delimiter hi def link rubyNoInterpolation rubyString @@ -320,9 +341,15 @@ hi def link rubySharpBang PreProc hi def link rubyRegexpDelimiter rubyStringDelimiter hi def link rubySymbolDelimiter rubyStringDelimiter hi def link rubyStringDelimiter Delimiter -hi def link rubyRegexp rubyString hi def link rubyString String -hi def link rubyTodo Todo +hi def link rubyRegexpEscape rubyRegexpSpecial +hi def link rubyRegexpQuantifier rubyRegexpSpecial +hi def link rubyRegexpAnchor rubyRegexpSpecial +hi def link rubyRegexpDot rubyRegexpCharClass +hi def link rubyRegexpCharClass rubyRegexpSpecial +hi def link rubyRegexpSpecial Special +hi def link rubyRegexpComment Comment +hi def link rubyRegexp rubyString hi def link rubyInvalidVariable Error hi def link rubyError Error From c154970b596057de446ce864ddf4e9f59cc1ab84 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Mon, 28 Jan 2008 21:46:17 +0000 Subject: [PATCH 397/411] better heuristic for regexps as method arguments --- ChangeLog | 4 ++++ syntax/ruby.vim | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 30dbeb25..53895f16 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-01-28 Tim Pope + + * syntax/ruby.vim: better heuristic for regexps as method arguments + 2008-01-25 Tim Pope * syntax/ruby.vim: highlight several regexp constructs diff --git a/syntax/ruby.vim b/syntax/ruby.vim index f092ccce..9ab5d348 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.146 2008/01/25 17:37:22 tpope Exp $ +" Info: $Id: ruby.vim,v 1.147 2008/01/28 21:46:18 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -122,7 +122,7 @@ syn match rubyPredefinedConstant "\%(\%(\.\@]\)\s*\)\@<=/" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial fold -syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\<\%(split\|scan\|gsub\|sub\)\s*\)\@<=/" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial fold +syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/\s\@!" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial fold " Generalized Regular Expression syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1[iomxneus]*" skip="\\\\\|\\\z1" contains=@rubyRegexpSpecial fold From f94b983db0448e4b9f16309b179f109d61ad1aff Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Thu, 31 Jan 2008 23:23:08 +0000 Subject: [PATCH 398/411] setlocal, not set indentexpr --- ChangeLog | 4 ++++ indent/eruby.vim | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 53895f16..5ab95167 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-01-31 Tim Pope + + * indent/eruby.vim: setlocal, not set indentexpr + 2008-01-28 Tim Pope * syntax/ruby.vim: better heuristic for regexps as method arguments diff --git a/indent/eruby.vim b/indent/eruby.vim index 2e3db3ca..38b4b06e 100644 --- a/indent/eruby.vim +++ b/indent/eruby.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: eRuby " Maintainer: Tim Pope -" Info: $Id: eruby.vim,v 1.13 2008/01/22 15:23:18 tpope Exp $ +" Info: $Id: eruby.vim,v 1.14 2008/01/31 23:23:08 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -12,7 +12,7 @@ endif runtime! indent/ruby.vim unlet! b:did_indent -set indentexpr= +setlocal indentexpr= if exists("b:eruby_subtype") exe "runtime! indent/".b:eruby_subtype.".vim" From cadbf3123e85d4d4f895a8dc8b27186edb3b1705 Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Sat, 2 Feb 2008 04:13:55 +0000 Subject: [PATCH 399/411] switch vim variable checking to a more rubyish method --- ChangeLog | 5 +++++ autoload/rubycomplete.vim | 16 ++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5ab95167..a5f3ceb9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-02-01 Mark Guzman + + * autoload/rubycomplete.vim: switch vim variable checking to a more + rubyish method + 2008-01-31 Tim Pope * indent/eruby.vim: setlocal, not set indentexpr diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index e7b6ae70..572f519e 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.39 2006/12/13 21:20:47 segy Exp $ +" Info: $Id: rubycomplete.vim,v 1.40 2008/02/02 04:13:55 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -301,7 +301,7 @@ class VimRubyCompletion def get_buffer_entity(name, vimfun) loading_allowed = VIM::evaluate("exists('g:rubycomplete_buffer_loading') && g:rubycomplete_buffer_loading") - return nil if loading_allowed != '1' + return nil if loading_allowed.to_i.zero? return nil if /(\"|\')+/.match( name ) buf = VIM::Buffer.current nums = eval( VIM::evaluate( vimfun % name ) ) @@ -368,7 +368,7 @@ class VimRubyCompletion # this will be a little expensive. loading_allowed = VIM::evaluate("exists('g:rubycomplete_buffer_loading') && g:rubycomplete_buffer_loading") allow_aggressive_load = VIM::evaluate("exists('g:rubycomplete_classes_in_global') && g:rubycomplete_classes_in_global") - return [] if allow_aggressive_load != '1' || loading_allowed != '1' + return [] if allow_aggressive_load.to_i.zero? || loading_allowed.to_i.zero? buf = VIM::Buffer.current eob = buf.length @@ -401,7 +401,7 @@ class VimRubyCompletion def load_rails allow_rails = VIM::evaluate("exists('g:rubycomplete_rails') && g:rubycomplete_rails") - return if allow_rails != '1' + return if allow_rails.to_i.zero? buf_path = VIM::evaluate('expand("%:p")') file_name = VIM::evaluate('expand("%:t")') @@ -461,7 +461,7 @@ class VimRubyCompletion def get_rails_helpers allow_rails = VIM::evaluate("exists('g:rubycomplete_rails') && g:rubycomplete_rails") rails_loaded = VIM::evaluate('s:rubycomplete_rails_loaded') - return [] if allow_rails != '1' || rails_loaded != '1' + return [] if allow_rails.to_i.zero? || rails_loaded.to_i.zero? buf_path = VIM::evaluate('expand("%:p")') buf_path.gsub!( /\\/, "/" ) @@ -511,7 +511,7 @@ class VimRubyCompletion def add_rails_columns( cls ) allow_rails = VIM::evaluate("exists('g:rubycomplete_rails') && g:rubycomplete_rails") rails_loaded = VIM::evaluate('s:rubycomplete_rails_loaded') - return [] if allow_rails != '1' || rails_loaded != '1' + return [] if allow_rails.to_i.zero? || rails_loaded.to_i.zero? begin eval( "#{cls}.establish_connection" ) @@ -534,7 +534,7 @@ class VimRubyCompletion def get_rails_view_methods allow_rails = VIM::evaluate("exists('g:rubycomplete_rails') && g:rubycomplete_rails") rails_loaded = VIM::evaluate('s:rubycomplete_rails_loaded') - return [] if allow_rails != '1' || rails_loaded != '1' + return [] if allow_rails.to_i.zero? || rails_loaded.to_i.zero? buf_path = VIM::evaluate('expand("%:p")') buf_path.gsub!( /\\/, "/" ) @@ -580,7 +580,7 @@ class VimRubyCompletion def get_completions(base) loading_allowed = VIM::evaluate("exists('g:rubycomplete_buffer_loading') && g:rubycomplete_buffer_loading") - if loading_allowed == '1' + if loading_allowed.to_i == 1 load_requires load_rails end From bd9cbd4d4bf457b51730604d5c3241c74101c3f5 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Wed, 13 Feb 2008 20:09:35 +0000 Subject: [PATCH 400/411] keepend on // regexps and add \/ escape --- ChangeLog | 6 +++++- syntax/ruby.vim | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index a5f3ceb9..cb727dc3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,8 @@ -2008-02-01 Mark Guzman +2008-02-13 Tim Pope + + * syntax/ruby.vim: keepend on // regexps and add \/ escape + +2008-02-01 Mark Guzman * autoload/rubycomplete.vim: switch vim variable checking to a more rubyish method diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 9ab5d348..a491f199 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.147 2008/01/28 21:46:18 tpope Exp $ +" Info: $Id: ruby.vim,v 1.148 2008/02/13 20:09:35 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -64,7 +64,7 @@ syn region rubyRegexpParens matchgroup=rubyRegexpSpecial start="(\(?:\|?<\=[=! syn region rubyRegexpBrackets matchgroup=rubyRegexpCharClass start="\[\^\=" skip="\\\]" end="\]" contained transparent contains=rubyStringEscape,rubyRegexpEscape,rubyRegexpCharClass oneline syn match rubyRegexpCharClass "\\[DdHhSsWw]" contained display syn match rubyRegexpCharClass "\[:\^\=\%(alnum\|alpha\|ascii\|blank\|cntrl\|digit\|graph\|lower\|print\|punct\|space\|upper\|xdigit\):\]" contained -syn match rubyRegexpEscape "\\[].*?+^$|\\(){}[]" contained display +syn match rubyRegexpEscape "\\[].*?+^$|\\/(){}[]" contained display syn match rubyRegexpQuantifier "[*?+][?+]\=" contained display syn match rubyRegexpQuantifier "{\d\+\%(,\d*\)\=}?\=" contained display syn match rubyRegexpAnchor "[$^]\|\\[ABbGZz]" contained display @@ -121,11 +121,11 @@ syn match rubyPredefinedConstant "\%(\%(\.\@" " Normal Regular Expression -syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\|else\)\|[;\~=!|&(,[>]\)\s*\)\@<=/" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial fold +syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\|else\)\|[;\~=!|&(,[>]\)\s*\)\@<=/" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial keepend fold syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/\s\@!" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial fold " Generalized Regular Expression -syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1[iomxneus]*" skip="\\\\\|\\\z1" contains=@rubyRegexpSpecial fold +syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1[iomxneus]*" skip="\\\\\|\\\z1" contains=@rubyRegexpSpecial fold syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r{" end="}[iomxneus]*" skip="\\\\\|\\}" contains=@rubyRegexpSpecial fold syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r<" end=">[iomxneus]*" skip="\\\\\|\\>" contains=@rubyRegexpSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\[" end="\][iomxneus]*" skip="\\\\\|\\\]" contains=@rubyRegexpSpecial fold From b24e60aa3d611adfa4a7767312a5fbafb2a0a6ee Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sun, 17 Feb 2008 20:46:35 +0000 Subject: [PATCH 401/411] copy previous string indent inside strings --- ChangeLog | 6 +++++- indent/ruby.vim | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index cb727dc3..cfe2c5ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,8 @@ -2008-02-13 Tim Pope +2008-02-17 Tim Pope + + * indent/ruby.vim: Copy previous string indent inside strings + +2008-02-13 Tim Pope * syntax/ruby.vim: keepend on // regexps and add \/ escape diff --git a/indent/ruby.vim b/indent/ruby.vim index 923c406c..309bd652 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Ruby " Maintainer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.44 2007/08/07 15:41:50 tpope Exp $ +" Info: $Id: ruby.vim,v 1.45 2008/02/17 20:46:36 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -259,6 +259,11 @@ function GetRubyIndent() " Find a non-blank, non-multi-line string line above the current line. let lnum = s:PrevNonBlankNonString(v:lnum - 1) + " If the line is empty and inside a string, use the previous line. + if line =~ '^\s*$' && lnum != prevnonblank(v:lnum - 1) + return indent(prevnonblank(v:lnum)) + endif + " At the start of the file use zero indent. if lnum == 0 return 0 From 59944a515917f661ed31c45d689e6566b1ac2c15 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sun, 20 Apr 2008 20:58:02 +0000 Subject: [PATCH 402/411] syntax/ruby.vim: don't highlight x /= y as a regexp --- ChangeLog | 4 ++++ syntax/ruby.vim | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index cfe2c5ba..3bb05777 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-04-20 Tim Pope + + * syntax/ruby.vim: don't highlight x /= y as regexp + 2008-02-17 Tim Pope * indent/ruby.vim: Copy previous string indent inside strings diff --git a/syntax/ruby.vim b/syntax/ruby.vim index a491f199..e45a3f14 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.148 2008/02/13 20:09:35 tpope Exp $ +" Info: $Id: ruby.vim,v 1.149 2008/04/20 20:58:02 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -122,7 +122,7 @@ syn match rubyPredefinedConstant "\%(\%(\.\@]\)\s*\)\@<=/" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial keepend fold -syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/\s\@!" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial fold +syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/[ \t=]\@!" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial fold " Generalized Regular Expression syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1[iomxneus]*" skip="\\\\\|\\\z1" contains=@rubyRegexpSpecial fold From 26579a4b038e72624ff5020ebbc85c76df0b9d1c Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sun, 20 Apr 2008 21:14:58 +0000 Subject: [PATCH 403/411] Fix bogus dates in changelog --- ChangeLog | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3bb05777..812880b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -236,12 +236,12 @@ * syntax/ruby.vim: allow regexp literals to be highlighted after the 'else' keyword -2002-03-09 Tim Pope +2007-03-09 Tim Pope * syntax/ruby.vim: Added OPTIMIZE alongside FIXME and TODO. Mirrors Edge Rails' new annotations extractor tasks. -2002-03-09 Tim Pope +2007-03-09 Tim Pope * ftplugin/ruby.vim: Skip class= and for= with matchit (really belongs in ftplugin/eruby.vim). @@ -271,7 +271,7 @@ * NEWS: update documentation for next release -2002-03-02 Tim Pope +2007-03-02 Tim Pope * syntax/ruby.vim: Cope with (nonsensical) inclusion of : in iskeyword. From 6add666e515ec48f9aeacf8d37f6a5c0aa694c47 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Mon, 21 Apr 2008 08:32:04 +0000 Subject: [PATCH 404/411] eruby indenting edge case fixes --- ChangeLog | 5 +++++ indent/eruby.vim | 4 ++-- indent/ruby.vim | 6 +++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 812880b1..8b06046e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-04-21 Tim Pope + + * indent/eruby.vim: don't let ruby indent %> lines + * indent/ruby.vim: hack around <%= and <%- from eruby + 2008-04-20 Tim Pope * syntax/ruby.vim: don't highlight x /= y as regexp diff --git a/indent/eruby.vim b/indent/eruby.vim index 38b4b06e..b7de1442 100644 --- a/indent/eruby.vim +++ b/indent/eruby.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: eRuby " Maintainer: Tim Pope -" Info: $Id: eruby.vim,v 1.14 2008/01/31 23:23:08 tpope Exp $ +" Info: $Id: eruby.vim,v 1.15 2008/04/21 08:32:04 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -50,7 +50,7 @@ function! GetErubyIndent(...) call cursor(v:lnum,1) let inruby = searchpair('<%','','%>','W') call cursor(v:lnum,vcol) - if inruby && getline(v:lnum) !~ '^<%' + if inruby && getline(v:lnum) !~ '^<%\|^\s*-\=%>' let ind = GetRubyIndent() else exe "let ind = ".b:eruby_subtype_indentexpr diff --git a/indent/ruby.vim b/indent/ruby.vim index 309bd652..d3d1e64a 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Ruby " Maintainer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.45 2008/02/17 20:46:36 tpope Exp $ +" Info: $Id: ruby.vim,v 1.46 2008/04/21 08:32:04 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -81,12 +81,12 @@ let s:end_skip_expr = s:skip_expr . \ ' && getline(".") =~ "^\\s*\\<\\(while\\|until\\|for\\)\\>")' " Regex that defines continuation lines, not including (, {, or [. -let s:continuation_regex = '\%([\\*+/.,=:-]\|\W[|&?]\|||\|&&\)\s*\%(#.*\)\=$' +let s:continuation_regex = '\%([\\*+/.,:]\|\%(<%\)\@ Date: Fri, 25 Apr 2008 15:13:59 +0000 Subject: [PATCH 405/411] Guard against recursion in eruby files --- ChangeLog | 4 ++++ ftplugin/eruby.vim | 4 ++-- syntax/eruby.vim | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8b06046e..ec3b7c33 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-04-25 Tim Pope + + * ftplugin/eruby.vim, syntax/eruby.vim: guard against recursion + 2008-04-21 Tim Pope * indent/eruby.vim: don't let ruby indent %> lines diff --git a/ftplugin/eruby.vim b/ftplugin/eruby.vim index 0d873232..62477528 100644 --- a/ftplugin/eruby.vim +++ b/ftplugin/eruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: eRuby " Maintainer: Tim Pope -" Info: $Id: eruby.vim,v 1.10 2007/05/06 16:05:40 tpope Exp $ +" Info: $Id: eruby.vim,v 1.11 2008/04/25 15:14:00 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -27,7 +27,7 @@ if !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\)\+$','',''),'\.\zs\w\+$') + let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\)\+$','',''),'\.\zs\w\+$') endif if b:eruby_subtype == 'rhtml' let b:eruby_subtype = 'html' diff --git a/syntax/eruby.vim b/syntax/eruby.vim index 536f28e1..a15e58bc 100644 --- a/syntax/eruby.vim +++ b/syntax/eruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: eRuby " Maintainer: Tim Pope -" Info: $Id: eruby.vim,v 1.21 2007/09/06 16:56:15 tpope Exp $ +" Info: $Id: eruby.vim,v 1.22 2008/04/25 15:14:00 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -22,7 +22,7 @@ if !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\)\+$','',''),'\.\zs\w\+$') + let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\)\+$','',''),'\.\zs\w\+$') endif if b:eruby_subtype == 'rhtml' let b:eruby_subtype = 'html' From b20a8abb03e2e86f525ff9a0c43f49128cb39182 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sun, 29 Jun 2008 04:04:09 +0000 Subject: [PATCH 406/411] Don't match $_foo as invalid variable --- ChangeLog | 4 ++++ syntax/ruby.vim | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ec3b7c33..f1ae27c4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-06-29 Tim Pope + + * syntax/ruby.vim: don't match $_foo as an invalid variable + 2008-04-25 Tim Pope * ftplugin/eruby.vim, syntax/eruby.vim: guard against recursion diff --git a/syntax/ruby.vim b/syntax/ruby.vim index e45a3f14..e6c20131 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.149 2008/04/20 20:58:02 tpope Exp $ +" Info: $Id: ruby.vim,v 1.150 2008/06/29 04:04:13 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -107,7 +107,7 @@ syn region rubySymbol start="[]})\"':]\@\|{\)\s*\)\@<=|" end="|" oneline display contains=rubyBlockParameter -syn match rubyInvalidVariable "$[^ A-Za-z-]" +syn match rubyInvalidVariable "$[^ A-Za-z_-]" syn match rubyPredefinedVariable #$[!$&"'*+,./0:;<=>?@\`~1-9]# syn match rubyPredefinedVariable "$_\>" display syn match rubyPredefinedVariable "$-[0FIKadilpvw]\>" display From 776162c197da89f0c4c13a57bb0c7f8b5870c27c Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sun, 29 Jun 2008 04:18:42 +0000 Subject: [PATCH 407/411] indent/eruby.vim: fix quirk in optional argument handling --- ChangeLog | 4 ++++ compiler/eruby.vim | 4 ++-- compiler/rspec.vim | 4 ++-- compiler/ruby.vim | 4 ++-- compiler/rubyunit.vim | 4 ++-- ftplugin/eruby.vim | 4 ++-- ftplugin/ruby.vim | 4 ++-- indent/eruby.vim | 6 +++--- indent/ruby.vim | 4 ++-- syntax/eruby.vim | 4 ++-- syntax/ruby.vim | 4 ++-- 11 files changed, 25 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index f1ae27c4..3030ec50 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-06-29 Tim Pope + + * indent/eruby.vim: fix quirk in optional argument handling + 2008-06-29 Tim Pope * syntax/ruby.vim: don't match $_foo as an invalid variable diff --git a/compiler/eruby.vim b/compiler/eruby.vim index 928ace37..1a681362 100644 --- a/compiler/eruby.vim +++ b/compiler/eruby.vim @@ -1,7 +1,7 @@ " Vim compiler file " Language: eRuby " Maintainer: Doug Kearns -" Info: $Id: eruby.vim,v 1.6 2006/04/15 12:01:18 dkearns Exp $ +" Info: $Id: eruby.vim,v 1.7 2008/06/29 04:18:42 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -38,4 +38,4 @@ CompilerSet errorformat= let &cpo = s:cpo_save unlet s:cpo_save -" vim: nowrap sw=2 sts=2 ts=8 ff=unix: +" vim: nowrap sw=2 sts=2 ts=8: diff --git a/compiler/rspec.vim b/compiler/rspec.vim index 023220b5..c185bc79 100644 --- a/compiler/rspec.vim +++ b/compiler/rspec.vim @@ -1,7 +1,7 @@ " Vim compiler file " Language: RSpec " Maintainer: Tim Pope -" Info: $Id: rspec.vim,v 1.1 2007/09/14 14:40:11 tpope Exp $ +" Info: $Id: rspec.vim,v 1.2 2008/06/29 04:18:42 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -38,4 +38,4 @@ CompilerSet errorformat= let &cpo = s:cpo_save unlet s:cpo_save -" vim: nowrap sw=2 sts=2 ts=8 ff=unix: +" vim: nowrap sw=2 sts=2 ts=8: diff --git a/compiler/ruby.vim b/compiler/ruby.vim index 467de776..ff3b3c70 100644 --- a/compiler/ruby.vim +++ b/compiler/ruby.vim @@ -2,7 +2,7 @@ " Language: Ruby " Function: Syntax check and/or error reporting " Maintainer: Tim Hammerquist -" Info: $Id: ruby.vim,v 1.12 2006/04/15 12:01:18 dkearns Exp $ +" Info: $Id: ruby.vim,v 1.13 2008/06/29 04:18:43 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -65,4 +65,4 @@ CompilerSet errorformat= let &cpo = s:cpo_save unlet s:cpo_save -" vim: nowrap sw=2 sts=2 ts=8 ff=unix: +" vim: nowrap sw=2 sts=2 ts=8: diff --git a/compiler/rubyunit.vim b/compiler/rubyunit.vim index 9ccaf533..dd5d4cb8 100644 --- a/compiler/rubyunit.vim +++ b/compiler/rubyunit.vim @@ -1,7 +1,7 @@ " Vim compiler file " Language: Test::Unit - Ruby Unit Testing Framework " Maintainer: Doug Kearns -" Info: $Id: rubyunit.vim,v 1.11 2006/04/15 12:01:18 dkearns Exp $ +" Info: $Id: rubyunit.vim,v 1.12 2008/06/29 04:18:43 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -32,4 +32,4 @@ CompilerSet errorformat=\%W\ %\\+%\\d%\\+)\ Failure:, let &cpo = s:cpo_save unlet s:cpo_save -" vim: nowrap sw=2 sts=2 ts=8 ff=unix: +" vim: nowrap sw=2 sts=2 ts=8: diff --git a/ftplugin/eruby.vim b/ftplugin/eruby.vim index 62477528..9e121c20 100644 --- a/ftplugin/eruby.vim +++ b/ftplugin/eruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: eRuby " Maintainer: Tim Pope -" Info: $Id: eruby.vim,v 1.11 2008/04/25 15:14:00 tpope Exp $ +" Info: $Id: eruby.vim,v 1.12 2008/06/29 04:18:43 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -98,4 +98,4 @@ let b:undo_ftplugin = "setl cms< " let &cpo = s:save_cpo -" vim: nowrap sw=2 sts=2 ts=8 ff=unix: +" vim: nowrap sw=2 sts=2 ts=8: diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index ef908bce..7dfdfb5a 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id: ruby.vim,v 1.39 2007/05/06 16:38:40 tpope Exp $ +" Info: $Id: ruby.vim,v 1.40 2008/06/29 04:18:43 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -227,4 +227,4 @@ endfunction " differs on Windows. Email gsinclair@soyabean.com.au if you need help. " -" vim: nowrap sw=2 sts=2 ts=8 ff=unix: +" vim: nowrap sw=2 sts=2 ts=8: diff --git a/indent/eruby.vim b/indent/eruby.vim index b7de1442..931eaac3 100644 --- a/indent/eruby.vim +++ b/indent/eruby.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: eRuby " Maintainer: Tim Pope -" Info: $Id: eruby.vim,v 1.15 2008/04/21 08:32:04 tpope Exp $ +" Info: $Id: eruby.vim,v 1.16 2008/06/29 04:18:43 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -43,7 +43,7 @@ endif function! GetErubyIndent(...) if a:0 && a:1 == '.' let v:lnum = line('.') - elseif a:0 =~ '^\d' + elseif a:0 && a:1 =~ '^\d' let v:lnum = a:1 endif let vcol = col('.') @@ -75,4 +75,4 @@ function! GetErubyIndent(...) return ind endfunction -" vim:set sw=2 sts=2 ts=8 noet ff=unix: +" vim:set sw=2 sts=2 ts=8 noet: diff --git a/indent/ruby.vim b/indent/ruby.vim index d3d1e64a..4a3012f9 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Ruby " Maintainer: Nikolai Weibull -" Info: $Id: ruby.vim,v 1.46 2008/04/21 08:32:04 tpope Exp $ +" Info: $Id: ruby.vim,v 1.47 2008/06/29 04:18:43 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -375,4 +375,4 @@ endfunction let &cpo = s:cpo_save unlet s:cpo_save -" vim:set sw=2 sts=2 ts=8 noet ff=unix: +" vim:set sw=2 sts=2 ts=8 noet: diff --git a/syntax/eruby.vim b/syntax/eruby.vim index a15e58bc..1e45ffd4 100644 --- a/syntax/eruby.vim +++ b/syntax/eruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: eRuby " Maintainer: Tim Pope -" Info: $Id: eruby.vim,v 1.22 2008/04/25 15:14:00 tpope Exp $ +" Info: $Id: eruby.vim,v 1.23 2008/06/29 04:18:43 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -71,4 +71,4 @@ if main_syntax == 'eruby' unlet main_syntax endif -" vim: nowrap sw=2 sts=2 ts=8 ff=unix: +" vim: nowrap sw=2 sts=2 ts=8: diff --git a/syntax/ruby.vim b/syntax/ruby.vim index e6c20131..c5c1b945 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.150 2008/06/29 04:04:13 tpope Exp $ +" Info: $Id: ruby.vim,v 1.151 2008/06/29 04:18:43 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -357,4 +357,4 @@ hi def link rubySpaceError rubyError let b:current_syntax = "ruby" -" vim: nowrap sw=2 sts=2 ts=8 noet ff=unix: +" vim: nowrap sw=2 sts=2 ts=8 noet: From d9a0623668b22599d7991f665b5f53611dac1b2a Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sun, 29 Jun 2008 04:33:40 +0000 Subject: [PATCH 408/411] revert highlighting of - as number --- ChangeLog | 4 ++++ syntax/ruby.vim | 14 +++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3030ec50..945d2b0a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-06-29 Tim Pope + + * syntax/ruby.vim: revert highlighting of - as number + 2008-06-29 Tim Pope * indent/eruby.vim: fix quirk in optional argument handling diff --git a/syntax/ruby.vim b/syntax/ruby.vim index c5c1b945..f82b4c2c 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Ruby " Maintainer: Doug Kearns -" Info: $Id: ruby.vim,v 1.151 2008/06/29 04:18:43 tpope Exp $ +" Info: $Id: ruby.vim,v 1.152 2008/06/29 04:33:41 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -82,12 +82,12 @@ syn cluster rubyRegexpSpecial contains=rubyInterpolation,rubyNoInterpolation,ru " Numbers and ASCII Codes syn match rubyASCIICode "\%(\w\|[]})\"'/]\)\@" display -syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@" display -syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@" display -syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@" display -syn match rubyFloat "\%(\%(\w\|[]})\"']\s*\)\@" display -syn match rubyFloat "\%(\%(\w\|[]})\"']\s*\)\@" display +syn match rubyInteger "\<0[xX]\x\+\%(_\x\+\)*\>" display +syn match rubyInteger "\<\%(0[dD]\)\=\%(0\|[1-9]\d*\%(_\d\+\)*\)\>" display +syn match rubyInteger "\<0[oO]\=\o\+\%(_\o\+\)*\>" display +syn match rubyInteger "\<0[bB][01]\+\%(_[01]\+\)*\>" display +syn match rubyFloat "\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\.\d\+\%(_\d\+\)*\>" display +syn match rubyFloat "\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE][-+]\=\d\+\%(_\d\+\)*\)\>" display " Identifiers syn match rubyLocalVariableOrMethod "\<[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent From 4a2519a0116fe872fef43bda08d4a51b2e59737e Mon Sep 17 00:00:00 2001 From: Mark Guzman Date: Mon, 30 Jun 2008 06:50:44 +0000 Subject: [PATCH 409/411] resolve a typo in the configuration initialization section --- ChangeLog | 5 +++++ autoload/rubycomplete.vim | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 945d2b0a..7f68f00d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-06-29 Mark Guzman + + * autoload/rubycomplete.vim: resolve a typo in the configuration initialization + section + 2008-06-29 Tim Pope * syntax/ruby.vim: revert highlighting of - as number diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 572f519e..86baa0d2 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id: rubycomplete.vim,v 1.40 2008/02/02 04:13:55 segy Exp $ +" Info: $Id: rubycomplete.vim,v 1.41 2008/06/30 06:50:45 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns @@ -36,7 +36,7 @@ if !exists("g:rubycomplete_classes_in_global") endif if !exists("g:rubycomplete_buffer_loading") - let g:rubycomplete_classes_in_global = 0 + let g:rubycomplete_buffer_loading = 0 endif if !exists("g:rubycomplete_include_object") From 3d98d14a5105d0a00532bca8606520547f4785f9 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 8 Jul 2008 06:11:35 +0000 Subject: [PATCH 410/411] begin updating NEWS for the pending release --- ChangeLog | 4 ++++ NEWS | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7f68f00d..e39fcc32 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-07-08 Doug Kearns + + * NEWS: begin updating for the pending release + 2008-06-29 Mark Guzman * autoload/rubycomplete.vim: resolve a typo in the configuration initialization diff --git a/NEWS b/NEWS index 74aa0b79..c0371f3f 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,10 @@ += 2008.07.XX + +== Filetype Detection + +The IRB RC file (.irbrc) is now detected as being a Ruby file. + + = 2007.05.07 == Ruby Syntax Highlighting From 58eb7d247662eace49791d0ad0403ccfe4b3e7dd Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 15 Jul 2008 19:37:52 +0000 Subject: [PATCH 411/411] update the references to RubyGarden's VimRubySupport page --- ChangeLog | 5 +++++ FAQ | 2 +- README | 2 +- etc/website/index.html | 4 ++-- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index e39fcc32..88e53f4e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-07-15 Doug Kearns + + * FAQ, README, etc/website/index.html: update the references to + RubyGarden's VimRubySupport page + 2008-07-08 Doug Kearns * NEWS: begin updating for the pending release diff --git a/FAQ b/FAQ index 9054e853..8548d072 100644 --- a/FAQ +++ b/FAQ @@ -191,7 +191,7 @@ appropriate. Try creating these lines of code and hitting SHIFT-ENTER: For other suggestions, search the web or look at: > - http://rubygarden.org/ruby?VimRubySupport + http://www.rubygarden.org/Ruby/page/show/VimRubySupport *vim-ruby-faq-X* How can I report a bug? *vim-ruby-bug-reporting* diff --git a/README b/README index 645a76fc..c302328a 100644 --- a/README +++ b/README @@ -46,7 +46,7 @@ How you get these files into Vim: RubyForge is to get the latest version of them. Understanding the configuration files: - - See www.rubygarden.org/ruby?VimRubySupport + - 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. diff --git a/etc/website/index.html b/etc/website/index.html index 372a167b..45dbd936 100644 --- a/etc/website/index.html +++ b/etc/website/index.html @@ -32,7 +32,7 @@

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

README @@ -89,7 +89,7 @@

RubyForge is to get the latest version of them. Understanding the configuration files: - - See www.rubygarden.org/ruby?VimRubySupport + - 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.