If you use more than one terminal during your workday, you've probably been annoyed that your shell history always seems incomplete. This is due to most shells overwriting existing history data in lieu of their own history when a session is closed. Fortunately, both bash and zsh support variables to avoid this behavior.
For bash, you should be able to just add the following to your bashrc:
shopt -s histappend
PROMPT_COMMAND='history -a'
For zsh, I use the following history related options:
setopt appendhistory histignoredups
setopt histignorespace extended_history
setopt inc_append_history share_history
Showing posts with label zsh. Show all posts
Showing posts with label zsh. Show all posts
Tuesday, August 19, 2008
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.
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.
Subscribe to:
Comments (Atom)