Wednesday, February 23, 2011

Entering command mode in shells with vi bindings

If you use zsh or bash with vi key bindings, you know that by default the shell is in insert mode.  Every time you need to run some editing command you would first press Esc to enter command mode.  I recently found that just pressing Alt along with the first key in your command will put you in command mode.

For example, if you want to go up in command history, press Alt+k.  That will put you in command mode and take you to the previously run command.  From there on, pressing k will scroll up the command history.  One very useful shortcut I use is Alt+I (which is Alt+Shift+i): this is equivalent to Ctrl+a in Emacs mode or pressing the Home key.

Tuesday, February 22, 2011

Quick access to frequently visited directories

Define hashes for directories you frequently cd to from the command line, and access them as ~hash_name.  For example, my .zshrc has:
hash -d fx=~/dload/app/comm/firefox
hash -d prog=~/d/prog
hash -d personal=~/d/personal
cd ~fx will take me to ~/dload/app/comm/firefox, cd ~prog will take me to ~/d/prog, and so on.

Changing Compiz's Alt+Tab animation

By default Compiz uses "Static Application Switcher" module for handling Alt+Tab.  At least that's how it's on Ubuntu.  When pressing Alt+Tab, the UI would show only the target window and hide everything else.  But this doesn't quite match my mental model of the windows I have on the screen.  (It could be because I don't maximize most of my windows and have them all overlapped.  So at any time I have several windows scattered on the desktop.)

I disabled Static Application Switcher and selected Application Switcher instead.  While this preserved the window layout, the animation was jarring.  Setting the value of "Zoom" parameter to 0.0 will disabled the zoom effect and everything is good now.

PS: You need to install compizconfig-settings-manager package.  After installation open System > Preferences > CompizConfig Settings Manager or run ccsm command.