Initial Push.
This commit is contained in:
24
home/.local/usr/bin/dotfile-picker.sh
Executable file
24
home/.local/usr/bin/dotfile-picker.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Set the directory where your dotfiles are located
|
||||
DOTFILES_DIR="${HOME}/.dotfiles"
|
||||
|
||||
# Use fzf to select a file
|
||||
file=$(find "$DOTFILES_DIR" -type f -name "*.*" | \
|
||||
fzf --delimiter / --with-nth=-1 --keep-right \
|
||||
--prompt="Dotfiles " \
|
||||
--tmux left,40 --reverse \
|
||||
)
|
||||
|
||||
# Check if a directory was selected
|
||||
if [[ -n "$file" ]]; then
|
||||
projectname="${file##*/}"
|
||||
escprojectname = $(printf '%q' "$projectname")
|
||||
# Check if a tmux window with the project name already exists
|
||||
if tmux list-windows -F "#{window_name}" | grep -q "^$escprojectname$"; 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" "nvim '$file'"
|
||||
fi
|
||||
fi
|
||||
Reference in New Issue
Block a user