diff options
Diffstat (limited to 'config/essentials/shell')
-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 |