1
0
Fork 0

zsh config cleanup

This commit is contained in:
Luca Bilke 2024-06-10 23:26:33 +02:00
parent 1b42384566
commit 63b040cda2
3 changed files with 12 additions and 18 deletions

View File

@ -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 reset_beam() { echo -ne '\e[5 q'; }
function lfwrap() { function lfwrap() {
LF_DIRFILE="/tmp/lfdir.$(uuidgen)" LF_DIRFILE="$(mktemp -u)"
env EMBEDDED=true lfX \
-last-dir-path="$LF_DIRFILE" \ env lfX -last-dir-path="$LF_DIRFILE" \
-command "set promptfmt \"$(zsh -c 'source $ZDOTDIR/configs/prompt; source $ZDOTDIR/configs/hashes; print -P $LF_PROMPT')\"" -command "set promptfmt \"$(zsh -c 'source $ZDOTDIR/configs/prompt; source $ZDOTDIR/configs/hashes; print -P $LF_PROMPT')\""
dir="$(cat "$LF_DIRFILE")" dir="$(cat "$LF_DIRFILE")"
rm "$LF_DIRFILE" rm "$LF_DIRFILE" &>/dev/null
if [ -d "$dir" ]; then if [ -d "$dir" ]; then
if [ "$dir" != "$(pwd)" ]; then if [ "$dir" != "$(pwd)" ]; then
cd "$dir" cd "$dir"
fi fi
fi fi
zle reset-prompt zle reset-prompt
zle redisplay zle redisplay
write_title_wd write_title_wd
@ -60,12 +63,6 @@ function lg() {
} }
zle -N lg zle -N lg
function refresh_xrdb_st() {
killall -USR1 st
}
zle -N refresh_xrdb_st
# Useful functions for usage in the shell # Useful functions for usage in the shell
function xsi() { function xsi() {
xpkg -a | \ xpkg -a | \
@ -79,10 +76,9 @@ function ntfy() {
notify-send -u critical "$1 failed! " "exited with code: $?" notify-send -u critical "$1 failed! " "exited with code: $?"
} }
function togglebg () { function togglefg () {
zle push-input -w zle push-input -w
zle clear-screen -w
BUFFER="fg" BUFFER="fg"
zle accept-line -w zle accept-line -w
} }
zle -N togglebg zle -N togglefg

View File

@ -10,8 +10,6 @@ autoload -Uz colors && colors
autoload -Uz edit-command-line && zle -N edit-command-line autoload -Uz edit-command-line && zle -N edit-command-line
autoload -Uz add-zsh-hook autoload -Uz add-zsh-hook
autoload -Uz compinit autoload -Uz compinit
autoload -Uz edit-command-line
zstyle ':completion:*:git-checkout:*' sort false zstyle ':completion:*:git-checkout:*' sort false
zstyle ':completion:*:descriptions' format '[%d]' 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:*' fzf-command ftb-tmux-popup
zstyle ':fzf-tab:*' switch-group '<' '>' 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 zmodload zsh/complist
compinit compinit

View File

@ -12,8 +12,8 @@ bindkey -M menuselect 'j' vi-down-line-or-history
# Widgets # Widgets
bindkey '^e' lfwrap bindkey '^e' lfwrap
bindkey '^g' lg bindkey '^g' lg
bindkey '^z' togglebg bindkey '^z' togglefg
bindkey '^[[15~' refresh_xrdb_st bindkey '^s' toggle-fzf-tab
bindkey -M vicmd '^v' edit-command-line bindkey -M vicmd '^v' edit-command-line
bindkey '^?' backward-delete-char bindkey '^?' backward-delete-char