From 63b040cda2eb3c76480ffbc342c2b5aabf4b1326 Mon Sep 17 00:00:00 2001 From: Luca Bilke Date: Mon, 10 Jun 2024 23:26:33 +0200 Subject: [PATCH] zsh config cleanup --- .config/zsh/configs/1-functions | 22 +++++++++------------- .config/zsh/configs/2-setup | 4 +--- .config/zsh/configs/bindings | 4 ++-- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/.config/zsh/configs/1-functions b/.config/zsh/configs/1-functions index 7a614c771..8a8217794 100644 --- a/.config/zsh/configs/1-functions +++ b/.config/zsh/configs/1-functions @@ -16,17 +16,20 @@ function write_title_wd() { echo -ne "\033]0;$(print -P "%n@%m [%3~]")\007"; } function reset_beam() { echo -ne '\e[5 q'; } function lfwrap() { - LF_DIRFILE="/tmp/lfdir.$(uuidgen)" - env EMBEDDED=true lfX \ - -last-dir-path="$LF_DIRFILE" \ + LF_DIRFILE="$(mktemp -u)" + + env lfX -last-dir-path="$LF_DIRFILE" \ -command "set promptfmt \"$(zsh -c 'source $ZDOTDIR/configs/prompt; source $ZDOTDIR/configs/hashes; print -P $LF_PROMPT')\"" + dir="$(cat "$LF_DIRFILE")" - rm "$LF_DIRFILE" + rm "$LF_DIRFILE" &>/dev/null + if [ -d "$dir" ]; then if [ "$dir" != "$(pwd)" ]; then cd "$dir" fi fi + zle reset-prompt zle redisplay write_title_wd @@ -60,12 +63,6 @@ function lg() { } zle -N lg -function refresh_xrdb_st() { - killall -USR1 st -} -zle -N refresh_xrdb_st - - # Useful functions for usage in the shell function xsi() { xpkg -a | \ @@ -79,10 +76,9 @@ function ntfy() { notify-send -u critical "$1 failed! " "exited with code: $?" } -function togglebg () { +function togglefg () { zle push-input -w - zle clear-screen -w BUFFER="fg" zle accept-line -w } -zle -N togglebg +zle -N togglefg diff --git a/.config/zsh/configs/2-setup b/.config/zsh/configs/2-setup index f813a89ed..3b68ac33a 100644 --- a/.config/zsh/configs/2-setup +++ b/.config/zsh/configs/2-setup @@ -10,8 +10,6 @@ autoload -Uz colors && colors autoload -Uz edit-command-line && zle -N edit-command-line autoload -Uz add-zsh-hook autoload -Uz compinit -autoload -Uz edit-command-line - zstyle ':completion:*:git-checkout:*' sort false zstyle ':completion:*:descriptions' format '[%d]' @@ -21,7 +19,7 @@ zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' zstyle ':fzf-tab:*' fzf-command ftb-tmux-popup zstyle ':fzf-tab:*' switch-group '<' '>' -zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls -lhpANX --color=auto --group-directories-first $realpath' +zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls $realpath' zmodload zsh/complist compinit diff --git a/.config/zsh/configs/bindings b/.config/zsh/configs/bindings index 909b8a2f1..4a37c08b1 100644 --- a/.config/zsh/configs/bindings +++ b/.config/zsh/configs/bindings @@ -12,8 +12,8 @@ bindkey -M menuselect 'j' vi-down-line-or-history # Widgets bindkey '^e' lfwrap bindkey '^g' lg -bindkey '^z' togglebg -bindkey '^[[15~' refresh_xrdb_st +bindkey '^z' togglefg +bindkey '^s' toggle-fzf-tab bindkey -M vicmd '^v' edit-command-line bindkey '^?' backward-delete-char