Initial Push.
This commit is contained in:
25
home/.local/usr/bin/project-picker.sh
Executable file
25
home/.local/usr/bin/project-picker.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Set the directory where your projects are located
|
||||
PROJECTS_DIR="${HOME}/Projects/"
|
||||
|
||||
# Use fzf to select a directory
|
||||
folder=$(find "$PROJECTS_DIR" -type d -maxdepth 1 | \
|
||||
fzf --delimiter / --with-nth=-1 --keep-right \
|
||||
--prompt="Projects " \
|
||||
--tmux left,40 --reverse \
|
||||
)
|
||||
|
||||
# Check if a directory was selected
|
||||
if [[ -n "$folder" ]]; then
|
||||
projectname="${folder##*/}"
|
||||
# Check if a tmux window with the project name already exists
|
||||
if tmux list-windows -F "#{window_name}" | grep -q "^$projectname$"; then
|
||||
tmux select-window -t "$projectname"
|
||||
else
|
||||
# Create a new tmux window with the project name and open nvim in the folder
|
||||
# tmux new-window -n "$projectname" "cd '$folder' &&"
|
||||
tmux new-window -n "$projectname" "cd '$folder' && nvim"
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user