diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-10-01 22:00:38 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-10-01 22:00:38 +0200 |
commit | 1002bb13947af892d05af57cda1db2b4832719b3 (patch) | |
tree | dcd853831f5ca62591d0329ee3900359697343c6 /config/essentials/shell/functions.sh | |
parent | 419918fc0efa2e18cf05f24b8d6e0d7a178cac73 (diff) |
checkpoint
Diffstat (limited to 'config/essentials/shell/functions.sh')
-rw-r--r-- | config/essentials/shell/functions.sh | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/config/essentials/shell/functions.sh b/config/essentials/shell/functions.sh index 1413fd8..319a04f 100644 --- a/config/essentials/shell/functions.sh +++ b/config/essentials/shell/functions.sh @@ -347,12 +347,35 @@ nvim_bindings() { rm "$tmp" } -prj () { +prj() { pfx="$HOME/proj" d="$(find "$pfx" -mindepth 1 -maxdepth 1 -type d | sed "s@$pfx/@@" |fzf)" [ -d "$pfx/$d" ] || return 1 cd "$pfx/$d" } +prje() { + prj || return 1 + f="$(git ls-files | fzf)" + if [ -f "$f" ] + then + "$EDITOR" "$f" + else + cd - + fi +} +nprj() { + if [ "$1" ] + then + p="$1" + else + printf '>' + p="$(head -n1)" + [ "$p" ] || exit 1 + fi + + mkdir -p "$HOME/proj/$p" + cd "$HOME/proj/$p" +} edit_git_file () { GIT_WORK_TREE="$1" GIT_DIR="$1"/.git git rev-parse --show-toplevel > /dev/null 2>&1 || return 1 |