Copyright 2005, by The Rubyists (bougyman,trey,deathsyn)* Licensed under the Gnu Public License, which should be included in licence/GPL.txt.

If you did not receive this licence file you can contact the author for a copy at bougy dot man at gmail dot com, or see the latest version at www.gnu.org/copyleft/gpl.html.

This is a little command wrapper for screen + vim to give you a nice IDE session for rails development. Console junkies should like it, but through the use of Escreen it can be GUI friendly as well.

After installing the gem, change to a rails_root and run the command:

RailsEditor

The gem install should have linked RailsEditor to a location in your run path Then you’ll have ./script/editor available

./script/editor -? for usage (from the RAILS_ROOT).

BASIC USAGE

This is most likely only useful for console junkies, but may help for any vim user in a pinch that has to make console edits (ssh or what-not).

On startup (./script/editor) you’ll have a variety of windows set up for rails dev. Many will have VIM sessions in File Browser mode, others will be shells dedicated to a certain task. Screen 0 is for watching logs, screen 1 will run a console that will restart itself on exit. The ide gets more powerful for experienced ‘screen’ users with split screen modes and other goodies.

GENERAL SCREEN TIPS Screen is a terminal interface which allows one to have multiple virtual terminals within it. Think of it as a window manager for console. It accepts commands by first typing the escape key then the screen command. The default escape key for screen is CTRL-a, generally represented as C-a in the screen manpage, so we’ll do so here. Common commands follow:

* To switch to a certain screen window:           C-a # 
    where # is the number of the window 
    you wish to go to.  
* To switch to the last window you were in:       C-a a
* To split the screen horizontally:               C-a S
* To cycle between screen splits:                 C-a <TAB>
* To go into scrollback/copy mode:                C-a <ESC>
  * Moving in copy/scrollback mode:               Arrows or hjkl, plus PGUP/PGDN and 
                                                    general vim movement 
                                                    (ctrl-u pgup, ctrl-d pgdn)
  * Start Copying Text in copy/scrollback mode:   <ENTER>
  * Moving/Highlighting once copying has started: Same as in copy/scrollback mode
  * Copy highlighed selection to screen's buffer: <ENTER>
  * Copy highlighted to screen's buffer and 
      the /tmp/screen-exchange file:              >
  * Paste the contents of buffer to terminal:     C-a ]

See man screen for a full descriptiong. Some things we like to do is change the default escape key (to Ctrl-f, Ctrl-j, Ctrl-y) to something more friendly as a keystroke. This is accomplished by C-a :escape ^Yy<ENTER>, in the case of Ctrl-y. You can set this permanently by modifying config/.screenrc.code.erb.

VIM ADDITIONS

* In any ruby file, typing 'def' in insert mode followed by a space will fill in the
  'end' for you.  
* Syntax highlighting has been added for .rjs files which isn't presently part of vim.
* In .rhtml files, '%= ' will make <%= %> and '%% ' will make <% -%>.  
* Also included is taglist.vim, a nice tidy taglist browser.  To enable it in vim, 
    simply type :TlistToggle.  You must have exuberant ctags installed for this to 
    work.  
* To get the help for Tlist, cd to .vim/plugins and open vim, then type
    :helptags and hit enter.  You'll then have its help in :help taglist.

SPLIT SCREEN

A new caption line will appear when you split screens in ‘screen’ (C-a S). At this time there is no way to remove the hardstatus global statusline automatically, so i’ve bound F8 and F9 to turning on and off (respectively) the hardstatus line to avoid duplicate statusbars.

  • tj vanderpoel,trey dempsey,kevin berry