This post originated from an RSS feed registered with Ruby Buzz
by Jan Lelis.
Original Post: RubyBuntu -3- Be one with your command line!
Feed Title: rbJ*_*L.net
Feed URL: http://feeds.feedburner.com/rbJL
Feed Description: Hi, I am a fan of Ruby and like to explore it and the world around ;).
So I started this blog, where I am publishing code snippets, tutorials for beginners as well as general thoughts about Ruby, the web or programming in general.
Most Ruby programmers know: Many things can be done in much less time on the command line. To become more productive, you should take the 10 minutes to configure some basic settings.
Tweak your terminal
Why use complicated shortcuts for often used functionality? Adjust them to your needs at Edit/Keyboard Shortcuts…. Here are my recommendations:
Action
Shortcut Key
New Tab
Ctrl+Return
New Window
Ctrl+Alt+Return
Move Tab to the Left
Ctrl+Shift+Left
Move Tab to the Right
Ctrl+Shift+Right
Switch to Next Tab
Ctrl+Right
Switch to Previous Tab
Ctrl+Left
After that, go to Edit/Profile Preferences and set some nice colors. I like orange on black with the Tango theme and a little bit transparency. Other useful settings include increasing the scrollback lines and hiding the menubar.
More convenience
Do yourself a faviour by maintaining shell aliases. Just add some lines to your ~/.bashrc or ~/.bash_aliases with this syntax:
alias rs='script/server'
alias rsp='script/server production'
alias ai='sudo apt-get install'
alias sth='some other --command' ...
Another thing, that really makes live easier when using the console, is the Tab key and its auto completion… So why don’t use it for rake? There is a handy rake auto completion available in the ubuntu-on-rails ppa repository. You can add the ppa and install the completion with these commands:
Now you already have a friendly console environment. But there are still things to improve about the Ruby programmer’s favourite console: irb.
Sometimes you get complex return values, where it might be a little bit complicated to get the essence of the return value. But it can be simplified by two very nice gems: wirble and hirb.
wirble makes your irb sessions colorful (colors are great!). hirb, however, lets you view many instances of big objects in a nice table – perfect for Active Record models!
sudo gem install wirble hirb
You can both auto-activate them for each irb session (and activate simple indention) by adding the following lines to your ~/.irbrc file: