zsh snippets

How to fix the iTerm keyboard bindings in OSX (readline configuration)

Tagged shortcuts, readline, keyboard, zsh  Languages bash

The keyboard bindings in iTerm on OSX Snow Leopard are fubar. To fix them either switch to Linux or put this in your zsh configuration:

bindkey "^r" history-incremental-search-backward
bindkey '^E' end-of-line
bindkey '^A' beginning-of-line
bindkey 'ƒ'  forward-word
bindkey '›'  backward-word
bindkey "^F" forward-char
bindkey "^B" backward-char
bindkey "^k" kill-line
bindkey "^u" backward-kill-line

How to get the latest version number from a list of git tags

Tagged bash, zsh, git, version  Languages bash

This will print the latest version number that a git repository has been tagged with:

$ git tag -l 'v*' | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n | tail -n 1

Note that some versions of the sort command have a —version-sort switch, and some don’t:

sort: unrecognized option `--version-sort'
Try `sort --help' for more information.