fb80eb8e05e13cfb224114688fc7d20960e26b5f
- Author
- Ivan Dario Piernagorda Peña <48845582+IVAN-DPP@users.noreply.github.com>
- Committer
- GitHub <noreply@github.com>
- Date
Message
emacs: add ansi-term directory tracking (#9218)
Diff
1diff --git a/plugins/emacs/emacs.plugin.zsh b/plugins/emacs/emacs.plugin.zsh
2index db0ab13af291cd38b2579560235c23e7fdea8f64..0b602d12adf738e30f0be3603ab02e8efe87fa53 100644
3--- a/plugins/emacs/emacs.plugin.zsh
4+++ b/plugins/emacs/emacs.plugin.zsh
5@@ -26,6 +26,16 @@ if "$ZSH/tools/require_tool.sh" emacsclient 24 2>/dev/null ; then
6 # create a new X frame
7 alias eframe='emacsclient --alternate-editor "" --create-frame'
8
9+ # Emacs ANSI Term tracking
10+ if [[ -n "$INSIDE_EMACS" ]]; then
11+ chpwd_emacs() { print -P "\033AnSiTc %d"; }
12+ print -P "\033AnSiTc %d" # Track current working directory
13+ print -P "\033AnSiTu %n" # Track username
14+
15+ # add chpwd hook
16+ autoload -Uz add-zsh-hook
17+ add-zsh-hook chpwd chpwd_emacs
18+ fi
19
20 # Write to standard output the path to the file
21 # opened in the current buffer.