Created
January 11, 2013 19:03
-
-
Save wx13/4513076 to your computer and use it in GitHub Desktop.
Current directory in window title; sup'd up 'cd' command.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Put the CWD in the window title. | |
function chtt { | |
echo -en "\033]2;$@\007" | |
} | |
export PROMPT_COMMAND='chtt $(pwd)' | |
# Put the CWD in the window title. | |
function chtt { | |
echo -en "\033]2;$@\007" | |
} | |
export PROMPT_COMMAND='chtt $(pwd)' | |
# | |
# Sup'd up cd command. | |
# | |
# ZSH style replacement | |
function cdx() | |
{ | |
if [[ "$#" == 2 ]] | |
then | |
cwd="$(pwd)" | |
nwd="${cwd%${1}*}${2}${cwd##*${1}}" | |
echo "${nwd}" | |
cd_save_hist "${nwd}" | |
else | |
cd_save_hist $@ | |
fi | |
} | |
# Expand path for command history. | |
function cd_save_hist() { | |
if [ -z "$1" ] | |
then | |
d="$HOME" | |
else | |
d="$1" | |
fi | |
builtin cd "$d" | |
dp=$(pwd) | |
history -s cd ${dp} | |
} | |
alias cd=cdx | |
alias cd0='builtin cd' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment