about summary refs log tree commit diff stats
path: root/bash/emacs.bash
diff options
context:
space:
mode:
Diffstat (limited to 'bash/emacs.bash')
-rw-r--r--bash/emacs.bash29
1 files changed, 29 insertions, 0 deletions
diff --git a/bash/emacs.bash b/bash/emacs.bash new file mode 100644 index 0000000..188c64f --- /dev/null +++ b/bash/emacs.bash
@@ -0,0 +1,29 @@
1# Shell-side configuration for Emacs-based shells
2
3setup_vterm() {
4 ## https://github.com/akermu/emacs-libvterm#shell-side-configuration
5 ## Make sure this is the last file loaded by ~/.bashrc!
6
7 # Load the requisite code from the vterm install directory
8 if [[ "$INSIDE_EMACS" = 'vterm' ]] \
9 && [[ -n ${EMACS_VTERM_PATH} ]] \
10 && [[ -f ${EMACS_VTERM_PATH}/etc/emacs-vterm-bash.sh ]]; then
11 source ${EMACS_VTERM_PATH}/etc/emacs-vterm-bash.sh
12 fi
13
14 # Extra commands for `vterm-eval-cmds'
15 find_file() { vterm_cmd find-file "$(realpath "${@:-.}")"; }
16 say() { vterm_cmd message "%s" "$*"; }
17}
18
19setup_emacs_shell() {
20 export PAGER=cat
21 export PS1='\w \$ '
22}
23
24# CONSIDER: Could this go in ~/.profile ?
25case "$INSIDE_EMACS" in
26 '') ;; # not inside emacs
27 vterm) setup_vterm ;;
28 *) setup_emacs_shell ;;
29esac