about summary refs log tree commit diff stats
path: root/.config
diff options
context:
space:
mode:
authorVitor Gonçalves <vitorg@tilde.team>2023-12-05 01:19:45 -0300
committerVitor Gonçalves <vitorg@tilde.team>2023-12-05 01:19:45 -0300
commit4b8982f309759d2558d0b7ca7db005cefeeef681 (patch)
tree852448a339b6462b5206fdc2fc0543d6c8047e2e /.config
parentd63c6bc8e4486a79529c983818e7a0ce70a8bd6f (diff)
downloaddots-4b8982f309759d2558d0b7ca7db005cefeeef681.tar.gz
bash_function: added pf
it's a simple function for me to find all my projects with three key
presses, and it shows me this nice fzf menu with all of them (yay!)
Diffstat (limited to '.config')
-rw-r--r--.config/bash/functions17
1 files changed, 12 insertions, 5 deletions
diff --git a/.config/bash/functions b/.config/bash/functions
index 9bc7c83..8a29018 100644
--- a/.config/bash/functions
+++ b/.config/bash/functions
@@ -1,25 +1,32 @@
 # vim: ft=sh
 
+pf() {
+    # project finder
+    root_dir="$HOME/docs/src"
+    selected_dir=$(find "$root_dir" -maxdepth 1 -type d | sed "s:$root_dir::;s:/::;/^$/ d" | fzf)
+    cd "$root_dir"/"$selected_dir" || return
+}
+
 xb() {
     # function for handling xbps in a nicer way
     case $1 in
         install | i)
-            sudo xbps-install ${@:2}
+            sudo xbps-install "${@:2}"
             ;;
         remove | r)
-            sudo xbps-remove -R ${@:2}
+            sudo xbps-remove -R "${@:2}"
             ;;
         query | q)
-            xbps-query ${@:2}
+            xbps-query "${@:2}"
             ;;
         search | s)
-            xbps-query -Rs ${@:2}
+            xbps-query -Rs "${@:2}"
             ;;
         upgrade | u)
             sudo xbps-install -Su
             ;;
         locate | l)
-            xlocate ${@:2}
+            xlocate "${@:2}"
             ;;
         *)
             printf "Usage:\n"