diff --git a/.config/fish/functions/cdzc.fish b/.config/fish/functions/cdzc.fish deleted file mode 100644 index 2a30f784..00000000 --- a/.config/fish/functions/cdzc.fish +++ /dev/null @@ -1,10 +0,0 @@ -function cdzc --description 'Open directories from zoxide in vscode' - set selected_dir (zi) - - if test -n "$selected_dir" - cd "$selected_dir" - codium -r . - else - commandline -f repaint - end -end diff --git a/.config/yazi/yazi.toml b/.config/yazi/yazi.toml index 1b9c651a..cf066f2a 100644 --- a/.config/yazi/yazi.toml +++ b/.config/yazi/yazi.toml @@ -17,6 +17,7 @@ folder = [ ] text = [ + { run = '$EDITOR "$@"', block = true, desc = "$EDITOR", for = "linux" }, { run = 'nvim "$@"', block = true, desc = "neovim", for = "linux" }, { run = 'kitty --detach nvim "$@"', block = true, desc = "neovim (detached)", for = "linux" }, { run = 'codium "$@"', orphan = true, desc = "vscodium", for = "linux" }, diff --git a/.local/bin/dev b/.local/bin/dev index 8b9357bb..3a9a2f70 100755 --- a/.local/bin/dev +++ b/.local/bin/dev @@ -59,6 +59,14 @@ handle_kitty() { $eza } +handle_editor() { + if [[ "$EDITOR" == "nvim" || "$EDITOR" == "vim" ]]; then + echo "terminal" + elif [[ "$EDITOR" == "code" || "$EDITOR" == "codium" ]]; then + echo "gui" + fi +} + selected_dir=$($projects_command | $fzf_command --prompt='Select a directory: ' \ --header='CTRL-P: Projects / CTRL-Z: Zoxide' \ --bind "ctrl-p:reload($projects_command)" \ @@ -68,13 +76,18 @@ selected_dir=$($projects_command | $fzf_command --prompt='Select a directory: ' tab_title=$(basename "$selected_dir") if [[ -n "$selected_dir" ]]; then - if command -v tmux &>/dev/null; then - if command -v tmuxp &>/dev/null; then - handle_tmuxp - else - handle_tmux + editor_type=$(handle_editor) + if [[ $editor_type == "terminal" ]]; then + if command -v tmux &>/dev/null; then + if command -v tmuxp &>/dev/null; then + handle_tmuxp + else + handle_tmux + fi + elif [[ "$TERM" == "xterm-kitty" ]]; then + handle_kitty fi - elif [[ "$TERM" == "xterm-kitty" ]]; then - handle_kitty + else + $EDITOR -r "$selected_dir" fi fi