From 8f8147374047b719dfa9445e26d26b404c4eb791 Mon Sep 17 00:00:00 2001 From: Daniel Lundin Date: Thu, 8 Jun 2023 21:02:52 +0200 Subject: [PATCH] Fix up the tmux helpers for jj --- .zshrc | 2 +- bin/tmux-edit-helper | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.zshrc b/.zshrc index 77ac0ca..2830c55 100644 --- a/.zshrc +++ b/.zshrc @@ -90,7 +90,7 @@ typeset -gaU chpwd_functions chpwd_functions+=fre_chpwd _cwd_gitroot() { - _gitroot=$(git rev-parse --show-toplevel 2>/dev/null || sl root 2>/dev/null || pwd) + _gitroot=$(git rev-parse --show-toplevel 2>/dev/null || jj workspace root 2>/dev/null || pwd) _dir=$((echo "$_gitroot" && fd -td . "$_gitroot") | fzf-tmux -p 90%,40% -y 0) [ -n "$_dir" ] && cd $_dir zle && zle redraw-prompt diff --git a/bin/tmux-edit-helper b/bin/tmux-edit-helper index efe3e07..2a12394 100755 --- a/bin/tmux-edit-helper +++ b/bin/tmux-edit-helper @@ -1,15 +1,17 @@ #!/usr/bin/env bash set -fe -o pipefail -eval "$(direnv export bash)" +eval "$(direnv export bash 2>/dev/null)" + +PATH="$HOME/bin:$PATH" if [ -n "$1" ]; then _file=$(readlink -f "$@") else FZF=${FZF:-"fzf-tmux -p 90%,50% -y 0"} - _root=$(git rev-parse --show-toplevel 2>/dev/null || sl root 2>/dev/null || pwd) + _root=$(git rev-parse --show-toplevel 2>/dev/null || jj workspace root 2>/dev/null || pwd) _store=$(echo "$_root" | sha1sum | cut -d ' ' -f 1) - _file=$( ( (fre --store_name "$_store" --sorted | xargs -n 100 ls -d 2>/dev/null || true) && fd --type f --hidden --follow --exclude .git --exclude .sl --ignore-file "${_root}/.gitignore" . "$_root") | cat -n | sort -k2 -k1n | uniq -f1 | sort -nk1,1 | cut -f2- | sed -e "s#^${_root}/##" | $FZF --no-sort) + _file=$( ( (fre --store_name "$_store" --sorted | xargs -n 100 ls -d 2>/dev/null || true) && fd --type f --hidden --follow --exclude .git --exclude .jj --ignore-file "${_root}/.gitignore" . "$_root") | cat -n | sort -k2 -k1n | uniq -f1 | sort -nk1,1 | cut -f2- | sed -e "s#^${_root}/##" | $FZF --no-sort) _file="${_root}/${_file}" fre --store_name "$_store" --add "$_file" fi