Skip to content

Commit

Permalink
Add support for emacs-vterm
Browse files Browse the repository at this point in the history
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
  • Loading branch information
mlaventure committed May 21, 2020
1 parent c454458 commit 64a0c16
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
30 changes: 29 additions & 1 deletion .bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ esac

# add .local/bin to PATH (used by local python package installed via `pip
# install --user <package>`)
export PATH=$PATH:~/.local/bin
export PATH="$PATH:${HOME}/.local/bin"

#
# Completion
Expand Down Expand Up @@ -106,6 +106,34 @@ if [ -f ~/.fzf.bash ]; then
fi
fi

#
# vterm support
#
function vterm_printf() {
if [ -n "$TMUX" ]; then
# Tell tmux to pass the escape sequences through
# (Source: http://permalink.gmane.org/gmane.comp.terminal-emulators.tmux.user/1324)
printf "\ePtmux;\e\e]%s\007\e\\" "$1"
elif [ "${TERM%%-*}" = "screen" ]; then
# GNU screen (screen, screen-256color, screen-256color-bce)
printf "\eP\e]%s\007\e\\" "$1"
else
printf "\e]%s\e\\" "$1"
fi
}

if [[ "$INSIDE_EMACS" = 'vterm' ]]; then
function clear() {
vterm_printf "51;Evterm-clear-scrollback";
tput clear;
}
fi

vterm_prompt_end() {
vterm_printf "51;A$(whoami)@$(hostname):$(pwd)"
}
PS1="$PS1'\[$(vterm_prompt_end)\]'"

#
# Direnv (must come last)
#
Expand Down
2 changes: 2 additions & 0 deletions .inputrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
$if Bash
set colored-stats on
$endif

"\e[1;5C": forward-word # ctrl + right
"\e[1;5D": backward-word # ctrl + left

0 comments on commit 64a0c16

Please sign in to comment.