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 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

View File

@ -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

View File

@ -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