-function selector-history () {
- selector --bash -u -c 7,4,0,3 -q <(history)
-}
-
-# M-r puts the selected history line in place of the current one
-
-bind '"\C-[r":"\C-a\C-kselector-history\C-m"'
-
-# M-t appends the selected history line and the end of the current one
-
-bind '"\C-[t":"\C-a\C-kselector-history\C-m\C-a\C-y\C-e"'
-
-######################################################################
-# Maintain a list of visited directories and provide a selector-based
-# command to go back to any of them.
-
-export SELECTOR_CD_HISTORY
-
-[[ "${SELECTOR_CD_HISTORY}" ]] || \
- SELECTOR_CD_HISTORY=${HOME}/.selector-cd-history
-
-function selector-cd () {
- if [[ -z "$1" ]]; then
- cd
- else
- cd "$1"
- fi
- echo $PWD | sed -e "s!${HOME}!~!" >> ${SELECTOR_CD_HISTORY}
-}
-
-function selector-cd-search () {
- PATH_TEMP=$(mktemp /tmp/selector-cd-path.XXXXXX)
- selector -t "cd" -l 10000 -d -i -c 7,4,0,7 -o ${PATH_TEMP} -q ${SELECTOR_CD_HISTORY}
- selector-cd "$(cat ${PATH_TEMP} | sed -e 's!~!'${HOME}'!')"
- \rm ${PATH_TEMP}
-}
-
-alias cd=selector-cd
-
-# M-c provides a dynamic list of directories to cd into
-
-bind '"\C-[c":"\C-a\C-kselector-cd-search\C-m"'