From 1d562af8927d932bc3329de3b06c94a966047238 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Mon, 30 Jan 2023 17:33:06 -0600 Subject: Add a bunch of stuff Forgot I had to `git add -f' these! --- bash/eat.bash | 5 +++++ bash/emacs.bash | 29 +++++++++++++++++++++++++++++ bash/rec.bash | 11 +++++++++++ bash/rlwrap.bash | 5 +++++ bash/termtitle.bash | 1 + bash/z.bash | 9 +++++++++ 6 files changed, 60 insertions(+) create mode 100644 bash/eat.bash create mode 100644 bash/emacs.bash create mode 100644 bash/rec.bash create mode 100644 bash/rlwrap.bash create mode 100644 bash/termtitle.bash create mode 100644 bash/z.bash (limited to 'bash') diff --git a/bash/eat.bash b/bash/eat.bash new file mode 100644 index 0000000..2f2b810 --- /dev/null +++ b/bash/eat.bash @@ -0,0 +1,5 @@ +## EAT/bash integration +# eat is https://codeberg.org/akib/emacs-eat + +test -n "$EAT_SHELL_INTEGRATION_DIR" && + . "$EAT_SHELL_INTEGRATION_DIR/bash" 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 @@ +# Shell-side configuration for Emacs-based shells + +setup_vterm() { + ## https://github.com/akermu/emacs-libvterm#shell-side-configuration + ## Make sure this is the last file loaded by ~/.bashrc! + + # Load the requisite code from the vterm install directory + if [[ "$INSIDE_EMACS" = 'vterm' ]] \ + && [[ -n ${EMACS_VTERM_PATH} ]] \ + && [[ -f ${EMACS_VTERM_PATH}/etc/emacs-vterm-bash.sh ]]; then + source ${EMACS_VTERM_PATH}/etc/emacs-vterm-bash.sh + fi + + # Extra commands for `vterm-eval-cmds' + find_file() { vterm_cmd find-file "$(realpath "${@:-.}")"; } + say() { vterm_cmd message "%s" "$*"; } +} + +setup_emacs_shell() { + export PAGER=cat + export PS1='\w \$ ' +} + +# CONSIDER: Could this go in ~/.profile ? +case "$INSIDE_EMACS" in + '') ;; # not inside emacs + vterm) setup_vterm ;; + *) setup_emacs_shell ;; +esac diff --git a/bash/rec.bash b/bash/rec.bash new file mode 100644 index 0000000..9fc854f --- /dev/null +++ b/bash/rec.bash @@ -0,0 +1,11 @@ +# Recutils bash integration +# https://www.gnu.org/software/recutils/ + +# enable shared library --- add other possible locations here +for lib in /usr/lib/recutils/bash-builtins/readrec.so ; do + if [ -f "$lib" ]; then + enable -f "$lib" readrec + break + fi +done + diff --git a/bash/rlwrap.bash b/bash/rlwrap.bash new file mode 100644 index 0000000..a8703a9 --- /dev/null +++ b/bash/rlwrap.bash @@ -0,0 +1,5 @@ +# rlwrap aliases + +if command -v rlwrap >/dev/null 2>&1; then + alias sh='rlwrap sh' +fi diff --git a/bash/termtitle.bash b/bash/termtitle.bash new file mode 100644 index 0000000..477f65d --- /dev/null +++ b/bash/termtitle.bash @@ -0,0 +1 @@ +# terminal title diff --git a/bash/z.bash b/bash/z.bash new file mode 100644 index 0000000..d84fd55 --- /dev/null +++ b/bash/z.bash @@ -0,0 +1,9 @@ +### z.lua integration +# https://github.com/skywind3000/z.lua + +zlua="$HOME/misc/z.lua/z.lua" + +if [ -f "$zlua" ]; then + export _ZL_DATA="${XDG_DATA_HOME:-$LOCAL_PREFIX/share}/zlua" + eval "$(lua "$zlua" --init bash enhanced once)" +fi -- cgit 1.4.1-21-gabe81