From 1002bb13947af892d05af57cda1db2b4832719b3 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Tue, 1 Oct 2024 22:00:38 +0200 Subject: checkpoint --- config/essentials/shell/functions.sh | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'config/essentials/shell/functions.sh') 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 -- cgit v1.2.3