From 6805877c40c7b4dce55c170ab7005872098c053f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20La=C3=ADn?= Date: Thu, 3 Oct 2024 14:55:30 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(bin):=20increment=20the=20zoxi?= =?UTF-8?q?de=20score=20in=20the=20dev=20script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .local/bin/dev | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.local/bin/dev b/.local/bin/dev index 3a9a2f70..770d1023 100755 --- a/.local/bin/dev +++ b/.local/bin/dev @@ -2,7 +2,7 @@ # Constants gfetch="gfetch -d churn contributors --no-color-palette --no-title" -eza="eza --header --icons --all --color=always --group-directories-first --hyperlink" +ls="eza --header --icons --all --color=always --group-directories-first --hyperlink" projects_dir="$HOME/dev" projects_command="find $projects_dir -mindepth 2 -maxdepth 2 -type d" fzf_command="fzf --height=100%" @@ -19,9 +19,10 @@ yaml_config() { tmuxp_load() { if [[ -n "$TMUX" ]]; then tmuxp load -d "$selected_dir" + zoxide_score else tmuxp load "$selected_dir" - + zoxide_score fi tmux switch-client -t "$tab_title" } @@ -38,6 +39,8 @@ handle_tmuxp() { if [[ -n "$yaml_file" ]]; then yaml_config "$XDG_CONFIG_HOME/tmuxp/$yaml_file.yaml" "$selected_dir" tmuxp_load + else + handle_tmux fi fi fi @@ -50,13 +53,15 @@ handle_tmux() { else tmux new-session -s "$tab_title" -c "$selected_dir" fi + zoxide_score } handle_kitty() { kitty @ set-tab-title "$tab_title" cd "$selected_dir" + zoxide_score $gfetch - $eza + $ls } handle_editor() { @@ -67,11 +72,15 @@ handle_editor() { fi } +zoxide_score() { + zoxide add "$selected_dir" +} + selected_dir=$($projects_command | $fzf_command --prompt='Select a directory: ' \ --header='CTRL-P: Projects / CTRL-Z: Zoxide' \ --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 && $eza {} || $eza {}") + --preview "$gfetch {} 2>&1 | grep -v 'Error: Could not find a git repository in' || true && $ls {} || $ls {}") tab_title=$(basename "$selected_dir") @@ -89,5 +98,6 @@ if [[ -n "$selected_dir" ]]; then fi else $EDITOR -r "$selected_dir" + zoxide_score fi fi