summaryrefslogtreecommitdiff
path: root/.bashrc
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2023-11-05 19:21:51 +0100
committerThomas Voss <mail@thomasvoss.com> 2023-11-05 19:21:51 +0100
commita67bc5647ede4433ffe6dfdeac36dc6fc716e971 (patch)
tree7d76ded4bce8a746844c76e8e514a0c9adfb51be /.bashrc
parent4d4fa986d7ada824ef91ae9074ab4e7cf84bb754 (diff)
bash: Add ‘jc’ to mimic ‘jr’ but for ~/.config
Diffstat (limited to '.bashrc')
-rw-r--r--.bashrc25
1 files changed, 19 insertions, 6 deletions
diff --git a/.bashrc b/.bashrc
index 5cef36e..93fcbd4 100644
--- a/.bashrc
+++ b/.bashrc
@@ -2,13 +2,26 @@
[[ $- != *i* ]] && return
[[ -f /etc/bashrc ]] && . /etc/bashrc
-function jr {
- local dir=`
- find "$REPODIR" -maxdepth 2 -path "$REPODIR/*/*" -printf '%P\n' \
+function __dir_search {
+ local qry="$1"
+ local base="$2"
+ shift 2
+
+ local dir=$(
+ find "$base" "$@" -printf '%P\n' \
+ | sed 1i. \
| sort -r \
- | fzf -q "$1"
- `
- [[ -n "$dir" ]] && cd "$REPODIR/$dir"
+ | fzf -q "$qry"
+ )
+ [[ -n "$dir" ]] && pushd "$base/$dir"
+}
+
+function jr {
+ __dir_search "$1" "$REPODIR" -mindepth 2 -maxdepth 2
+}
+
+function jc {
+ __dir_search "$1" "$XDG_CONFIG_HOME" -maxdepth 1 -type d
}
export BROWSER="firefox"