Skip to content

Instantly share code, notes, and snippets.

View henrebotha's full-sized avatar
🕹️
2[HP] jc j.[HP] 2[MP] 236LK 66 2[HP]…

Henré Botha henrebotha

🕹️
2[HP] jc j.[HP] 2[MP] 236LK 66 2[HP]…
  • Haarlem, The Netherlands
View GitHub Profile
@henrebotha
henrebotha / dir-switch.zsh
Created October 7, 2020 09:01
Example script for switching working directory in shell & Vim using Tmux
#! /usr/bin/env zsh
# Call this script as ./dir-switch.zsh /desired/directory
set -e
trap 'echo ERROR at $0 $LINENO; return' ERR
active_window=$(tmux list-windows | rg '\(active\)' | sed 's/:.\+//g')
panes=("${(@f)$(tmux list-panes -F '#{pane_index}')}")
active_pane=$(tmux list-panes -F '#{pane_active} #{pane_index}' | rg '^1' | sed 's/^1 //g')