Skip to content

Instantly share code, notes, and snippets.

@mkhattab
Created February 4, 2012 19:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mkhattab/1739578 to your computer and use it in GitHub Desktop.
Save mkhattab/1739578 to your computer and use it in GitHub Desktop.
Emacs Multi Term Shell
#Emacs ansi-term directory tracking
# track directory, username, and cwd for remote logons
if [ "$TERM" = "eterm-color" ]; then
function eterm-set-cwd {
$@
echo -e "\033AnSiTc" $(pwd)
}
# set hostname, user, and cwd
function eterm-reset {
echo -e "\033AnSiTu" $(whoami)
echo -e "\033AnSiTc" $(pwd)
echo -e "\033AnSiTh" $(hostname)
}
for temp in cd pushd popd; do
alias $temp="eterm-set-cwd $temp"
done
# set hostname, user, and cwd now
eterm-reset
fi
@omnisis
Copy link

omnisis commented Mar 7, 2015

Thanks dude, this was a lifesaver.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment