2017-06-13 17:33:16 +02:00
|
|
|
#!/usr/bin/env zsh
|
|
|
|
|
|
|
|
|
2017-06-25 21:43:38 +02:00
|
|
|
# Have zsh export variables for Emacs to track the cwd
|
|
|
|
if [ -n "$INSIDE_EMACS" ]; then
|
|
|
|
chpwd() { print -P "\033AnSiTc %d" }
|
|
|
|
print -P "\033AnSiTu %n"
|
|
|
|
print -P "\033AnSiTc %d"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Custom emacs pager support
|
2017-06-13 17:33:16 +02:00
|
|
|
if [ -n "$INSIDE_EMACS" ]; then
|
|
|
|
export PAGER="create-shell-pager.sh"
|
|
|
|
else
|
|
|
|
export PAGER="less"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2017-06-25 21:43:38 +02:00
|
|
|
# Edit commit messages, etc from ansi-term in emacs
|
2017-06-13 17:33:16 +02:00
|
|
|
if [ -n "$INSIDE_EMACS" ]; then
|
2017-06-15 23:18:58 +02:00
|
|
|
export EDITOR="edit-file-in-emacs.sh"
|
2017-06-13 17:33:16 +02:00
|
|
|
else
|
2017-06-25 21:43:38 +02:00
|
|
|
export EDITOR="command vim"
|
2017-06-13 17:33:16 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
2017-06-25 21:43:38 +02:00
|
|
|
# Calls to vim from within ansi-term trigger emacs find-file
|
2017-06-15 23:18:58 +02:00
|
|
|
vim () {
|
|
|
|
if [ -n "$INSIDE_EMACS" ]; then
|
|
|
|
emacsclient -e "(find-file-other-window \"$1\")"
|
|
|
|
else
|
2017-06-25 21:43:38 +02:00
|
|
|
command vim "$1"
|
2017-06-15 23:18:58 +02:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-25 21:43:38 +02:00
|
|
|
# Calls to man from within ansi-term trigger emacs man
|
2017-06-13 17:33:16 +02:00
|
|
|
man () {
|
|
|
|
if [ -n "$INSIDE_EMACS" ]; then
|
|
|
|
emacsclient -e "(man \"$1\")"
|
|
|
|
else
|
|
|
|
command man "$1"
|
|
|
|
fi
|
|
|
|
}
|