Skip to content

Commit

Permalink
trying out the vim-ruby gem:
Browse files Browse the repository at this point in the history
sudo gem install vim-ruby
vim-ruby-install.rb
  • Loading branch information
marcjeanson committed Mar 16, 2009
1 parent 807dfe6 commit 5435936
Show file tree
Hide file tree
Showing 11 changed files with 2,146 additions and 0 deletions.
802 changes: 802 additions & 0 deletions autoload/rubycomplete.vim

Large diffs are not rendered by default.

41 changes: 41 additions & 0 deletions compiler/eruby.vim
@@ -0,0 +1,41 @@
" Vim compiler file
" Language: eRuby
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" 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 <dougkearns@gmail.com>

if exists("current_compiler")
finish
endif
let current_compiler = "eruby"

if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif

let s:cpo_save = &cpo
set cpo-=C

if exists("eruby_compiler") && eruby_compiler == "eruby"
CompilerSet makeprg=eruby
else
CompilerSet makeprg=erb
endif

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

" vim: nowrap sw=2 sts=2 ts=8 ff=unix:
68 changes: 68 additions & 0 deletions compiler/ruby.vim
@@ -0,0 +1,68 @@
" Vim compiler file
" Language: Ruby
" Function: Syntax check and/or error reporting
" Maintainer: Tim Hammerquist <timh at rubyforge.org>
" 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 <dougkearns@gmail.com>
" ----------------------------------------------------------------------------
"
" Changelog:
" 0.2: script saves and restores 'cpoptions' value to prevent problems with
" line continuations
" 0.1: initial release
"
" Contributors:
" Hugh Sasse <hgs@dmu.ac.uk>
" Doug Kearns <djkea2@gus.gscit.monash.edu.au>
"
" 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"

if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif

let s:cpo_save = &cpo
set cpo-=C

" default settings runs script normally
" add '-c' switch to run syntax check only:
"
" CompilerSet makeprg=ruby\ -wc\ $*
"
" or add '-c' at :make command line:
"
" :make -c %<CR>
"
CompilerSet makeprg=ruby\ -w\ $*

CompilerSet errorformat=
\%+E%f:%l:\ parse\ error,
\%W%f:%l:\ warning:\ %m,
\%E%f:%l:in\ %*[^:]:\ %m,
\%E%f:%l:\ %m,
\%-C%\tfrom\ %f:%l:in\ %.%#,
\%-Z%\tfrom\ %f:%l,
\%-Z%p^,
\%-G%.%#

let &cpo = s:cpo_save
unlet s:cpo_save

" vim: nowrap sw=2 sts=2 ts=8 ff=unix:
35 changes: 35 additions & 0 deletions compiler/rubyunit.vim
@@ -0,0 +1,35 @@
" Vim compiler file
" Language: Test::Unit - Ruby Unit Testing Framework
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" 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 <dougkearns@gmail.com>

if exists("current_compiler")
finish
endif
let current_compiler = "rubyunit"

if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif

let s:cpo_save = &cpo
set cpo-=C

CompilerSet makeprg=testrb

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

" vim: nowrap sw=2 sts=2 ts=8 ff=unix:
14 changes: 14 additions & 0 deletions ftdetect/ruby.vim
@@ -0,0 +1,14 @@
" 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,*.rake set filetype=ruby

" Rantfile
au BufNewFile,BufRead [rR]antfile,*.rant set filetype=ruby

" eRuby
au BufNewFile,BufRead *.erb,*.rhtml set filetype=eruby
101 changes: 101 additions & 0 deletions ftplugin/eruby.vim
@@ -0,0 +1,101 @@
" Vim filetype plugin
" Language: eRuby
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
" 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 <dougkearns@gmail.com>

" 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 = "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\+')
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 == 'js'
let b:eruby_subtype = 'javascript'
elseif b:eruby_subtype == 'txt'
" Conventional; not a real file type
let b:eruby_subtype = 'text'
elseif b:eruby_subtype == ''
let b:eruby_subtype = g:eruby_default_subtype
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
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 = 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
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
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: nowrap sw=2 sts=2 ts=8 ff=unix:

0 comments on commit 5435936

Please sign in to comment.