Ever used irb and wished you had safed your commands or could edit them using Vi? Ever tried something new in irb, and then had to painfully copy and paste it to the .rb file? Slime.vim from Jonathan Palardy will be your new best friend.
Slime.vim lets you send highlighted text to a different terminal. This means you can write a few commands, send them to a terminal running irb, notice you want to change something in your first command, modify that line in Vi and resend it to irb, and so on.
Put slime.vim into ~/.vim/plugins
In one terminal:
1. start a named screen
2. name the window
You'll be prompted for the window's name, "Set window's title to:"
irb_window
3. start irb
In a different terminal, start vi and type irb commands, highlight one or multiple commands (ESC V to highlight the current line, ESC vip to highlight a paragraph), type C-c C-c to execute the highlighted text in the other terminal. The first time you'll be prompted for session and window, enter irb_session and irb_window (or whatever name you gave it).
This works for anything in your terminal, I like it for very long commands (using files in some crazy far away subdirectory), Singular, Macaulay2, mysql, and of course irb.
Slime.vim lets you send highlighted text to a different terminal. This means you can write a few commands, send them to a terminal running irb, notice you want to change something in your first command, modify that line in Vi and resend it to irb, and so on.
Put slime.vim into ~/.vim/plugins
In one terminal:
1. start a named screen
2. name the window
You'll be prompted for the window's name, "Set window's title to:"
irb_window
3. start irb
In a different terminal, start vi and type irb commands, highlight one or multiple commands (ESC V to highlight the current line, ESC vip to highlight a paragraph), type C-c C-c to execute the highlighted text in the other terminal. The first time you'll be prompted for session and window, enter irb_session and irb_window (or whatever name you gave it).
This works for anything in your terminal, I like it for very long commands (using files in some crazy far away subdirectory), Singular, Macaulay2, mysql, and of course irb.
This looks great. Is there any way to use it with GVIM? You might also be interested in a gem called Sketches with a different approach to essentially the same workflow.
ReplyDeletehttp://sketches.rubyforge.org/