vim-ruby / vim-ruby Goto Github PK
View Code? Open in Web Editor NEWVim/Ruby Configuration Files
Vim/Ruby Configuration Files
I typed following command in prompt:
then got a error message:
ERROR: Could not find a valid gem 'vim-ruby' (>= 0) in any repository
My environment is windows xp and ruby's version is 1.9.3
how to solve it?Help would be appreciated
Thanks.
The following is valid rdoc:
=begin rdoc
blah blah blah
=end rdoc
the pattern to match the end tag doesn't handle arguments to the =end.
here is a patch to fix this:
--- a/syntax/ruby.vim
+++ b/syntax/ruby.vim
@@ -271,7 +271,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)@<!%(^\s#.\n))%((^\s#.*\
It appears that continuation lines will always use a mix of spaces and tabs (using the current tabstop width) to align text on successive lines. See:
class B
foob(:a,
:b,
:c
)
end
With a tabstop set to 4, the ":b" is indented one tab and 3 spaces.
It seems preferable to simply indent normally, and not mess with all this alignment business. The major problem is when tabstops are changed, the alignment gets all thrown off (the typical problem when aligning with tabs).
I am a huge vim noob, so if I've missed something basic in my futzing with various indentation options, please ignore this.
Thanks!
(confirmed against the latest dev version:
$gem list | grep vim
vim-ruby (2010.01.29)
)
Hello,
I have just installed vim and I am having some issue making the ruby completion work. every time I try to use this function on some simple ruby code (a string) it just crashes my vim.
Is anyone else also having this issue?
Environment:
Windows 7 x64 (with latest patches)
rubyinstaller-1.9.3-p0.exe
DevKit-tdm-32-4.5.2-20110712-1620-sfx.exe
gvim73_46.exe
Best regards,
Sebastian
Here is code with correct indentation:
#comment1
if
dostuff1
#comment2
else if
dostuff2
#comment3
else
dostuff3
end
case
#comment1
when
dostuff1
#comment2
when
dostuff2
end
Here is how Ruby.vim indents the code:
#comment1
if
dostuff1
#comment2
else if
dostuff2
#comment3
else
dostuff3
end
case
#comment1
when
dostuff1
#comment2
when
dostuff2
end
x =~ /[/
The next line should indent below the x, but it advances all the way to the bracket. Balancing the brackets doesn't have this problem (x =~ /[]/).
This might be related to issue #2.
Thanks for the vim-ruby plugin !!
I use bundler on many projects. When a Gemfile references a development gem on my local disk, vim-ruby doesn't detect its path, and I can't jump to the gem using 'gf'.
This gist has a little script that generates the missing paths from Gemfile.lock. I thought this might be interesting to others who use vim-ruby.
a(bcd.
gef)
instead of
a(bcd.
gef)
that is, indent continuation lines inside parentheses.
Registered .mobile.erb as an html subtype by adding this in .vimrc:
:autocmd BufNewFile,BufRead *.mobile.erb let b:eruby_subtype = 'html'
Syntax highlighting works, but indenting only works in the erb parts, not in the html parts.
file.html.erb:
<% each do -%>
<ul>
<div>
<% each do -%>
<li>
<span>
</span>
</li>
<% end -%>
</div>
</ul>
<% end -%>
file.mobile.erb:
<% each do -%>
<ul>
<div>
<% each do -%>
<li>
<span>
</span>
</li>
<% end -%>
</div>
</ul>
<% end -%>
Right now, there's block support for % via matchit, but no way to do other block-based actions, such as daB, viB, etc.
Also, it would be nice if it worked with surround.vim so that we could do csB}, cs{B, ysaB(, etc.
The original issue: https://github.com/vim-ruby/vim-ruby/issues/closed#issue/2
To reproduce, press ENTER after typing:
x = /x/
For example,
render :partial => 'foo/bar',
:collection => @bars.sort,
:locals => {
:delete_link => lambda {|rr|
check_box_tag 'remove_bar_from_collection[]', bar.to_s
}
}
While the indentation for the :locals
hash is correct, it's somehow broken for the lambda.
:setf text
):setf ruby
)Changing the filetype to text and back to ruby again seems to unregister the culprit that's slowing down insert mode in Ruby files. Any idea what the real problem is, and how to fix it? Thanks.
Attempting to use omnicompletion in Windows vim 7.3 in a ruby (.rb) file gives the following error:
NoMethodError: undefined method `line_number' for 15:Fixnum
If I try execute "ruby puts VIM::Buffer.current.line_number"
as an ex command I can replicate the error. execute "ruby puts VIM::Buffer.current"
returns 15.
Is there a way to separate the coloring of local variables and method calls? I would love to be able to color them differently so that they don't run together so much.
In order for set ftype=eruby.html to work, I had to invoke:
unlet b:eruby_subtype
New HTML5 tags, like for example
or are not correctly highlighted when opening an .erb file.a and
(b and
c) and
X
X is indented one character too far. This is because the code at the start of 3.4 returns the previous line’s indent, not the MSLs indent + &sw. This is because it prioritizes
a and
b and
c
over
a and
b and
c
The code should either take care to deal with parentheses messing up the indentation levels or simply indent two spaces and ignore the case where some fool has added more space than mandated by the indentation script.
Hello,
http://www.rubygarden.org/Ruby/page/show/VimRubySupport is not working anymore, maybe it's time to drop that how-to to github wiki or some other place which is still online ?
Blocks started by { directly after another block are currently not indented. Observe the difference:
var.func1(:param => 'value') do
var.func2(:param => 'value') do
puts "test"
end
end
var.func1(:param => 'value') {
var.func2(:param => 'value') {
puts "test"
}
}
This is with the d6f9955 release.
Shouldn't the indent file include 'else' in indentkeys?
Setting identkeys to include 'e' doesn't seem to work (at least for me in Vim 7.3). On the other hand, it seems to work if I change (just included '=else') the indentkeys line to:
setlocal indentkeys+==end,=else,=elsif,=when,=ensure,=rescue,==begin,==end
Also, why does indentkeys include the default "0{,0},0),0], ^F,o,O,e"? I agree that ^F, 'o' and 'O' are useful, but I couldn't understand the other ones nor I could test if they are working. Maybe I didn't understand the documentation correctly.
Writing hashes using the Ruby 1.9 hash key syntax with keywords as the key value do not properly get highlighted, e.g.
{ class: "hello", if: "world", def: "i am", include: "foo", case: "bar", end: "baz" }
are all incorrectly highlighted as keywords, rather than symbols. Further, this throws off the matching of end statements, e.g.
def hello
{ if: "world" }
end
where the end
is paired with the if
rather than the def
.
module Apple =begin rdoc some docs =end class Banana end end
If module is after the rdoc, then it indents properly
Thank you for the ruby vim tools!
This is more a question rather than an issue.
Is there any global variable that would allow me to disable support for the completefunc functionality?
I'm using neocomplcache and it stops working as soon as I open a rails buffer. I commented the lines that added the support from my rails-vim installation, but I was wondering if it was to much trouble just to add that variable (cleaner) or if there was another way to accomplish this.
Cheers.
BTW: Awesome plugin.
Hello,
A few months ago, I remember that i_CTRL-X_CTRL-U completion used to work in filetype=ruby buffers. Now it throws an error:
E764: Option 'completefunc' is not set
And it gives me this prompt:
-- ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)
How can I solve this?
Thanks for your consideration.
In Vim, :set ofu
shows me:
omnifunc=rubycomplete#Complete
And I have the following code in my ~/.vim/after/ftplugin/ruby.vim
file:
setlocal complete-=i
I am using the following Vim version with abfe860.
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Sep 30 2011 03:25:32)
Included patches: 1-322
Compiled by ArchLinux
Big version with GTK2 GUI. Features included (+) or not (-):
+arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent
+clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
+conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con_gui +diff
+digraphs +dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi
+file_in_path +find_in_path +float +folding -footer +fork() +gettext
-hangul_input +iconv +insert_expand +jumplist +keymap +langmap +libcall
+linebreak +lispindent +listcmds +localmap -lua +menu +mksession +modify_fname
+mouse +mouseshape +mouse_dec +mouse_gpm -mouse_jsbterm +mouse_netterm
-mouse_sysmouse +mouse_xterm +multi_byte +multi_lang -mzscheme +netbeans_intg
+path_extra +perl +persistent_undo +postscript +printer -profile +python/dyn
+python3/dyn +quickfix +reltime +rightleft +ruby +scrollbind +signs
+smartindent -sniff +startuptime +statusline -sun_workshop +syntax +tag_binary
+tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title
+toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo
+vreplace +wildignore +wildmenu +windows +writebackup +X11 -xfontset +xim
+xsmp_interact +xterm_clipboard -xterm_save
system vimrc file: "/etc/vimrc"
user vimrc file: "$HOME/.vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "/etc/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
system menu file: "$VIMRUNTIME/menu.vim"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -pthread -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng14 -I/usr/local/include -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=1
Linking: gcc -L. -Wl,--hash-style=gnu -Wl,--as-needed -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-rpath,/usr/lib/perl5/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,--hash-style=gnu -L/usr/local/lib -Wl,--as-needed -o vim -pthread -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0 -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE -lm -lncurses -lelf -lnsl -lacl -lattr -lgpm -ldl -Wl,-E -Wl,-rpath,/usr/lib/perl5/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,--hash-style=gnu -fstack-protector -L/usr/local/lib -L/usr/lib/perl5/core_perl/CORE -lperl -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc -lruby -lpthread -lrt -ldl -lcrypt -lm -L/usr/lib
Ubuntu 11.04, Rails 3.1.0.rc6, Vim 7.3 (2010 Aug 15, compiled Mar 24 2011 07:07:34)
Actually gem install vim-ruby does not work anymore. Could you please update this manual? I've onestly tried to follow it :)
E.g.
def foo
puts :bar
end
private :foo
# nothing here should be intented
Basically, if private
has any arguments, no following methods should be intented.
Ideally indentation after private
should be optional entirely, as there isn't conformity in the community about how that should be.
Let's say I'm typing this code:
x = y
end_char = next
Immediately after typing "d" in end_char, the line incorrectly unindents.
vim-ruby should wait to see if the user really did enter the "end" keyword, or if he or she is just in the middle of typing an identifier that begins with "end".
Adding
" Vagrantfile
au BufNewFile,BufRead [vV]agrantfile set filetype=ruby
to the ftdetect file makes Vagrant uses happy. :)
Would be great.
In <%= image_tag "logo.jpg", :alt => "Buy our stuff", :class => "superfly" %>
the highlighting stops at the first '=>'.
In the render() line below, only the first symbol (text) is being highlighted as a symbol. The second symbol (layout) is being highlighted like a method-call.
class WelcomeController < ApplicationController
def index
render text: 'welcome', layout: true
end
end
Please fix this. Thank you.
<% @message_action_links_delimter ||= "" %>
<% if browse == 'inbox' %>
<%= link_to('save',
message_move_url(:id => message,
:folder => Message::FOLDER_SAVED),
:class => 'actionLinkLite smallText',
:method => 'post') + @message_action_links_delimter
-%>
<% end %>
<% if browse == 'saved' %>
<%= link_to('unsave',
message_move_url(:id => message,
:folder => Message::FOLDER_INBOX),
:class => 'actionLinkLite smallText',
:method => 'post') + @message_action_links_delimter)
-%>
<% end %>
<% if %>
<%= link_to('trash',
message_move_url(:id => message,
:folder => Message::FOLDER_TRASH),
:class => 'actionLinkLite smallText', :confirm => 'Are you sure?', :method => 'post') + (browse == "trash" || browse == "sent" ? @message_action_links_delimter : "") if browse != "trash" && browse != "sent" %>
<% end %>
<% if browse == "trash" %>
<%=
link_to('untrash',
message_move_url(:id => message,
:folder => Message::FOLDER_INBOX,
:from_url => url_for(params)),
:class => 'actionLinkLite smallText',
:method => 'post')
-%>
<% end %>
<% if browse == "trash" || browse == "sent" %>
<%= link_to('delete',
message_destroy_url(:id => message,
:from_url => url_for()),
:class => 'actionLinkLite smallText',
:confirm => 'Are you sure?', :method => 'post')
-%>
<% end %>
Users with cic
for classes are mostly already have their implementation.
Users with cic
for comments are just having trouble.
I'm new to Wim but spent some time learning. I have ruby 1.8.7 and gvim 7.3.046 on win xp sp3. When you try to use the omni I get error in function 37_DefRuby: string 575, message E266 ... unable to load msvcrt-ruby191.dll
I have next string in .vimrc
...
syntax on
filetype plugin indent on
compiler ruby
au filetype ruby set omnifunc=rubycomplete#Complete
let g:rubycomplete_buffer_loading = 1
let g:rubycomplete_classes_in_global = 1
let g:rubycomplete_rails = 1
...
vim-ruby don't work with ruby less than 1.9.1, or I have insufficient configuration?
Using the new hash syntax, the colon characters do not get highlighted as symbols, e.g. with foo: bar
, only foo
is marked as a symbol.
Is there any reason the maps like [m are only defined for normal and visual modes? It would be nice to have those in operator-pending mode, too.
When I open a ruby file it takes a (relatively) very long while before Vim is fully loaded. I've been trying to see what could cause it with the --startuptime flag:
mvim --startuptime vim.out file.rb
In my situation loading the ruby indent file is taking a very long time. I was just wondering if others are experiencing this as well.
Here is some relevant output where you can see how long it takes to load and when it jumps on loading the indent file:
219.092 003.356 003.356: sourcing /Users/markmulder/.vim/syntax/ruby.vim
219.882 000.071 000.071: sourcing /usr/local/Cellar/macvim/7.3-57/MacVim.app/Contents/Resources/vim/runtime/syntax/ruby.vim
220.841 000.622 000.622: sourcing /Users/markmulder/.vim/indent/ruby.vim
221.398 000.054 000.054: sourcing /usr/local/Cellar/macvim/7.3-57/MacVim.app/Contents/Resources/vim/runtime/indent/ruby.vim
889.381 667.747 667.747: sourcing /Users/markmulder/.vim/ftplugin/ruby.vim
890.520 000.138 000.138: sourcing /usr/local/Cellar/macvim/7.3-57/MacVim.app/Contents/Resources/vim/runtime/ftplugin/ruby.vim
Thanks for the awesome scripts gentlemen. I'm not seeing this work at all as depicted in tutorials all over the internet… very odd. All my dotfiles are visible here.
I don't know if this is possible to do, but if I have the following code:
foo = %r{
something
goes
here
}x
more = {:stuff => "here"}
then everything after the %r{
is highlighted with the same thing.
I'm using thor a lot these days. How about you guys? How about adding detection for Thorfiles? I'm trying to clean up my ~/.vimrc a little, so here is a fork with detection baked in.
ashley-woodard/vim-ruby@97bb76716955c9117a695a8d758e6ce452510efd
pie = true if str =~ /pie/
The next line after this will get indented, even though it shouldn't. The culprit seems to be the / at the end of the line. I think the issue comes from here:
http://github.com/vim-ruby/vim-ruby/blob/master/indent/ruby.vim#L358-365
Test case:
opts.on('--coordinator host=HOST[,port=PORT]',
'Specify the HOST and the PORT of the coordinator') do |str|
h = sub_opts_to_hash(str)
end
I expect "end" to be aligned with "opts.on"
def foo(arg1, arg2) puts arg1 puts arg2 end foo <<EOD1, <<EOD2 foobar1 EOD1 foobar2 def foo EOD2
Here vim-ruby thinks the second heredoc is normal ruby code (for example def gets highlighted). For all kinds of stuff you can do with heredocs see:
http://blog.grayproductions.net/articles/working_with_multiline_strings
example:
the_new_hash_syntax = { color: 'red', size: 22 }
Here is a block of code with correct indentation:
text.scan(/#/).each do |match|
line1
line2
end
Here is how Ruby.vim indents the code:
text.scan(/#/).each do |match|
line1
line2
end
All lines subsequent to line2 are indented to the same level as line2.
The issue is caused by the hash (# usually means single line comment) symbol's presence in the regex.
When I open a ruby file, anything I set in path
is lost. It would be nice if the vim plugin would append to path.
Also, adding every gem to the path is slow. Maybe we could have a switch to disable this feature? Maybe just adding stdlib to the path would be better?
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.