Skip to content

Commit

Permalink
Create zellij-tabula bash plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
bezbac committed Nov 16, 2024
1 parent 4e8d7df commit 9d02dfd
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions zellij-tabula.plugin.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export ZELLIJ_TABULA_ZSH_PLUGIN_VERSION="0.2.0"

# The code below is based on this github gist:
# https://gist.github.com/laggardkernel/6cb4e1664574212b125fbfd115fe90a4#chpwd-hook-in-bash

_chpwd_hook() {
shopt -s nullglob

local f

if [[ "$PREVPWD" != "$PWD" ]]; then
zellij pipe --name tabula -- "'$ZELLIJ_PANE_ID' '$PWD'"
fi

# refresh last working dir record
export PREVPWD="$PWD"
}

# add `;` after _chpwd_hook if PROMPT_COMMAND is not empty
PROMPT_COMMAND="_chpwd_hook${PROMPT_COMMAND:+;$PROMPT_COMMAND}"

0 comments on commit 9d02dfd

Please sign in to comment.