From: Markus Echterhoff Date: 2007-08-16T00:34:36+09:00 Subject: Re: Any recommendations on ruby editor On Friday 10 August 2007 18:52:43 harry pillei wrote: > Hi, > I am looking into investing in an editor for working with ruby(including > rails), any recommendations?. > Experience and feedback appreciated. > > thanks > Hari I use Gvim with the following extensions, which make it a charm to use. Here is a Screenshot. I turned off all Menus and Scrollbars, because I find them distractive. The advantage over console vim is scrolling with mousewheel and more coloschemes. With those plugins and a decent Colorscheme and some time to get used to the (cryptic seeming) usage, Gvim will be your best friend for years to come. Screenshot: http://mmisc.de/~tam/gvim.png, I'm following the example application in "Agile web development with rails 2nd ed." (which I mention in case you also look for a good book to learn rails). The Gvim colorscheme is a slightly modified "darkocean" (http://www.vim.org/scripts/script.php?script_id=384), I made the white a little more grey, so the contrast is not as hard and removed the different coloring of empty lines, because it confused me. %) Have a lot of fun, turning your vim into a powerful rails development IDE machine, that's actually fun to use! PS: Anybody got other useful vim plugins for RoR dev? 1) REdit Linked stacktraces (open gvim on click, bzw change the opened file) and "footnotes" on your development page. (script/plugin install http://svn.antono.info/redit) (rake redit:install) 2) BlockComment 1.1: (Un-)Comment everything you mark with one shortcut ".c" to comment, ".C" to uncomment (http://www.vim.org/scripts/script.php?script_id=473) 3) matchit : "%" lets you jump between if and end, between class and end, so see instantly where to go, even with bad indentation. (Ships with vim under: /usr/share/vim/macros/matchit.*) (else http://www.vim.org/scripts/script.php?script_id=39) 4) project 1.4.1: Sidebar with Project files (When used with rails.vim, type ":Rproject", it will be preconfigured) (http://www.vim.org/scripts/script.php?script_id=69) 5) rails.vim 2.00: A bunch of interesting stuff, read http://svn.tpope.net/rails/vim/railsvim/doc/rails.txt (http://www.vim.org/scripts/script.php?script_id=1567) 7) Autocomplete function names: rubycomplete 0.7: http://segfault.hasno.info/vim/rubycomplete.vim type the beginning, strg-x, strg-o to see a (ugly) list of possibilities. 6) snippetsEmu 1.1: The autocompletion snippet magic with tab. (http://www.vim.org/scripts/script.php?script_id=1318) (I needed to hack this a little. The tags ("<{" and "}>") conflict with html so I set it to something unneeded ("Ð" and "Æ"), (~/.vim/plugins/snippetsEmu.vim Lines 113 and 117) does look confusing, but works like a charm. Plus you really should change the default behavior for ruby files. There is one error in the ruby definition file (you'll have another '>' char and wonder why as well as annoying on the closure of your codeblock, which accumulate when you use it recursivly. For completion, here is my tweaked ~/.vim/after/ftplugin/ruby_snippets.vim: if !exists('loaded_snippet') || &cp finish endif let st = g:snip_start_tag let et = g:snip_end_tag let cd = g:snip_elem_delim exec "Snippet do do ".st.et."end".st.et exec "Snippet class class ".st."className".et." ".st.et."end".st.et exec "Snippet begin begin ".st.et."rescue ".st."Exception".et." => ".st."e".et."".st.et."end".st.et exec "Snippet each_with_index0 each_with_index do |".st."element".et.", ".st."index".et."| ".st."element".et.".".st.et."end".st.et exec "Snippet collect collect { |".st."element".et."| ".st."element".et.".".st.et." }".st.et exec "Snippet forin for ".st."element".et." in ".st."collection".et." ".st."element".et.".".st.et."end".st.et exec "Snippet doo do |".st."object".et."| ".st.et."end".st.et exec "Snippet : :".st."key".et." => \"".st."value".et."\"".st.et exec "Snippet def def ".st."methodName".et." ".st.et."end".st.et exec "Snippet case case ".st."object".et." when ".st."condition".et."".st.et."end".st.et exec "Snippet collecto collect do |".st."element".et."| ".st."element".et.".".st.et."end".st.et exec "Snippet each each { |".st."element".et."| ".st."element".et.".".st.et." }".st.et exec "Snippet each_with_index each_with_index { |".st."element".et.", ".st."idx".et."| ".st."element".et.".".st.et." }".st.et exec "Snippet if if ".st."condition".et." ".st.et."end".st.et exec "Snippet eacho each do |".st."element".et."| ".st."element".et.".".st.et."end".st.et exec "Snippet unless unless ".st."condition".et." ".st.et."end".st.et exec "Snippet ife if ".st."condition".et." ".st.et."else ".st.et."end".st.et exec "Snippet when when ".st."condition".et.st.et exec "Snippet selecto select do |".st."element".et."| ".st."element".et.".".st.et."end".st.et exec "Snippet injecto inject(".st."object".et.") do |".st."injection".et.", ".st."element".et."| ".st.et."end".st.et exec "Snippet reject { |".st."element".et."| ".st."element".et.".".st.et." }".st.et exec "Snippet rejecto reject do |".st."element".et."| ".st."element".et.".".st.et."end".st.et exec "Snippet inject inject(".st."object".et.") { |".st."injection".et.", ".st."element".et."| ".st.et." }".st.et exec "Snippet select select { |".st."element".et."| ".st."element".et.".".st.et." }".st.et