Tuesday, May 13, 2008

Zsh Alias Suffixing

Here's a handy feature I just noticed with Zsh. You can specify a suffix when creating an alias, and execute an arbitrary command on the given file suffix.

alias -s php=vim
alias -s java=vim
alias -s pl=vim

Now typing "foo.php" on the command-line will open the file in vim automatically. You can get fancy and do stuff like:

alias -s org=firefox-2

Type "vim.org", and your browser goes to the URL.

No comments: