refactor(bin): dev script
Removed kitty handeling and start the notes-tasks workspace detached when launching a new session
This commit is contained in:
parent
4490efa17c
commit
39c59a0894
1 changed files with 12 additions and 33 deletions
|
@ -17,6 +17,7 @@ yaml_config() {
|
||||||
}
|
}
|
||||||
|
|
||||||
tmuxp_load() {
|
tmuxp_load() {
|
||||||
|
launch_docs
|
||||||
if [[ -n "$TMUX" ]]; then
|
if [[ -n "$TMUX" ]]; then
|
||||||
tmuxp load -d "$selected_dir"
|
tmuxp load -d "$selected_dir"
|
||||||
zoxide_score
|
zoxide_score
|
||||||
|
@ -24,6 +25,7 @@ tmuxp_load() {
|
||||||
tmuxp load "$selected_dir"
|
tmuxp load "$selected_dir"
|
||||||
zoxide_score
|
zoxide_score
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tmux switch-client -t "$tab_title"
|
tmux switch-client -t "$tab_title"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,50 +58,27 @@ handle_tmux() {
|
||||||
zoxide_score
|
zoxide_score
|
||||||
}
|
}
|
||||||
|
|
||||||
handle_kitty() {
|
|
||||||
kitty @ set-tab-title "$tab_title"
|
|
||||||
cd "$selected_dir"
|
|
||||||
zoxide_score
|
|
||||||
$gfetch
|
|
||||||
$ls
|
|
||||||
}
|
|
||||||
|
|
||||||
handle_editor() {
|
|
||||||
if [[ "$EDITOR" == "nvim" || "$EDITOR" == "vim" ]]; then
|
|
||||||
echo "terminal"
|
|
||||||
elif [[ "$EDITOR" == "code" || "$EDITOR" == "codium" ]]; then
|
|
||||||
echo "gui"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
zoxide_score() {
|
zoxide_score() {
|
||||||
if command -v zoxide &>/dev/null; then
|
if command -v zoxide &>/dev/null; then
|
||||||
zoxide add "$selected_dir"
|
zoxide add "$selected_dir"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
launch_docs() {
|
||||||
|
tmuxp load -d notes-tasks # Doesn't load if it exists already
|
||||||
|
}
|
||||||
|
|
||||||
selected_dir=$($projects_command | $fzf_command --prompt='Select a directory: ' \
|
selected_dir=$($projects_command | $fzf_command --prompt='Select a directory: ' \
|
||||||
--header='CTRL-P: Projects / CTRL-Z: Zoxide' \
|
--preview "$gfetch {} && $ls {} || $ls {}")
|
||||||
--bind "ctrl-p:reload($projects_command)" \
|
|
||||||
--bind "ctrl-z:reload(zoxide query -l)" \
|
|
||||||
--preview "$gfetch {} 2>&1 | grep -v 'Error: Could not find a git repository in' || true && $ls {} || $ls {}")
|
|
||||||
|
|
||||||
tab_title=$(basename "$selected_dir")
|
tab_title=$(basename "$selected_dir")
|
||||||
|
|
||||||
if [[ -n "$selected_dir" ]]; then
|
if [[ -n "$selected_dir" ]]; then
|
||||||
editor_type=$(handle_editor)
|
if command -v tmux &>/dev/null; then
|
||||||
if [[ $editor_type == "terminal" ]]; then
|
if command -v tmuxp &>/dev/null; then
|
||||||
if command -v tmux &>/dev/null; then
|
handle_tmuxp
|
||||||
if command -v tmuxp &>/dev/null; then
|
else
|
||||||
handle_tmuxp
|
handle_tmux
|
||||||
else
|
|
||||||
handle_tmux
|
|
||||||
fi
|
|
||||||
elif [[ "$TERM" == "xterm-kitty" ]]; then
|
|
||||||
handle_kitty
|
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
$EDITOR -r "$selected_dir"
|
|
||||||
zoxide_score
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Reference in a new issue