From 8f770890100cb16333bee72df4722dc3cbc04f97 Mon Sep 17 00:00:00 2001 From: Nils Gerstner Date: Mon, 27 Mar 2023 22:10:48 +0200 Subject: [PATCH] Add fuzzy project finder --- .bashrc | 13 +++++++------ bin/findProject.sh | 16 ++++++++++++++++ 2 files changed, 23 insertions(+), 6 deletions(-) create mode 100755 bin/findProject.sh diff --git a/.bashrc b/.bashrc index ba96fd4..b021457 100755 --- a/.bashrc +++ b/.bashrc @@ -101,6 +101,7 @@ if ! shopt -oq posix; then fi ###===== HOMEBREW =====## + test -d /opt/homebrew && export PATH=/opt/homebrew/bin:~/bin:$PATH ###===== MQ and IIB =====## @@ -131,12 +132,12 @@ alias l='ls -CF' alias ws='cd ~/Documents/Code' alias vcc='cd ~/Documents/Code/VOLVOCARS/' +alias fp='cd "$(findProject.sh)"' alias doc='cd ~/Documents' alias dw='cd ~/Downloads' -alias wn='cd ~/.config/nvim/' -alias cv='cd ~/.config/nvim/ ; vim init.norg lua/plugins.lua' +alias wn='cd ~/.config/nvim/'alias cv='cd ~/.config/nvim/ ; vim init.norg lua/plugins.lua' alias :q='exit' alias vim='nvim' @@ -168,9 +169,9 @@ sleepUntil() { # args [-q] [more days] export JAVA_HOME=$(/usr/libexec/java_home -v 19.0.2 -V 2>&1 |grep -oe "\S\+zulu\S\+$") test -d /opt/homebrew/opt/openjdk/bin && export PATH="/opt/homebrew/opt/openjdk/bin:$PATH" test -d /opt/homebrew/opt/curl/bin && export PATH="/opt/homebrew/opt/curl/bin:$PATH" -export PATH="/Users/nige/.cargo/bin:$PATH" +test -d ansible-setup/dotfiles/bin/ && export PATH="/Users/nige/.cargo/bin:$PATH" -export GOPATH=$HOME/go -which brew && export GOROOT="$(brew --prefix golang)/libexec" -export PATH="$PATH:${GOPATH}/bin:${GOROOT}/bin" +# export GOPATH=$HOME/go +# which brew && export GOROOT="$(brew --prefix golang)/libexec" +# export PATH="$PATH:${GOPATH}/bin:${GOROOT}/bin" export OPENAI_API_KEY='---------------------------------------------------' diff --git a/bin/findProject.sh b/bin/findProject.sh new file mode 100755 index 0000000..99a1297 --- /dev/null +++ b/bin/findProject.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +_find_root() { + fzf << EOF +/Users/nige/Documents/Code/BOLIDEN +/Users/nige/Documents/Code/VOLVOCARS +/Users/nige/Documents/Code/GERSTNER +/Users/nige/Documents/Code/REPLYTO +/Users/nige/Documents/Code/RISE +EOF +} + +root_dir="$(_find_root)" +base_name="$(find "${root_dir}" -type d -mindepth 1 -maxdepth 1 -exec basename {} + |fzf)" + +echo "${root_dir}/${base_name}"