Recent zsh stuff

This commit is contained in:
agryphus 2024-02-20 21:13:02 -05:00
parent ad764a2eea
commit 11887d795a
2 changed files with 34 additions and 3 deletions

View file

@ -24,7 +24,6 @@ export PAGER=
export GTK_THEME=Adwaita:dark
# Configuring input method
export GTK_IM_MODULE='fcitx'
export QT_IM_MODULE='fcitx'
export SDL_IM_MODULE='fcitx'
export XMODIFIERS='@im=fcitx'
@ -54,6 +53,7 @@ export TEXMFVAR="$XDG_CACHE_HOME/texlive/texmf-var"
export TLDR_CACHE_DIR="$XDG_CACHE_HOME/tldr"
export TMUX_TMPDIR="$XDG_RUNTIME_DIR"
export VIMINIT='let $MYVIMRC = !has("nvim") ? "$XDG_CONFIG_HOME/vim/vimrc" : "$XDG_CONFIG_HOME/nvim/init.lua" | so $MYVIMRC'
export WINEPREFIX="$XDG_DATA_HOME/wine"
export XINITRC="$XDG_CONFIG_HOME/X11/xinitrc"
export XSERVERRC="$XDG_CONFIG_HOME/X11/xserverrc"

View file

@ -3,6 +3,9 @@
[ -n "$EAT_SHELL_INTEGRATION_DIR" ] && \
source "$EAT_SHELL_INTEGRATION_DIR/zsh"
# Get it out of here
[ -d ~/Downloads ] && [ -z "$(ls ~/Downloads)" ] && rmdir ~/Downloads/
# ZSH Configurations
unsetopt autocd # Change directory just by typing its name (hurts performance)
setopt interactivecomments # Allow comments in interactive mode
@ -94,6 +97,27 @@ function colors {
done
}
function increase_opacity {
printf "\033]11;rgba:00/00/00/ff\007"
}
function decrease_opacity {
printf "\033]11;rgba:00/00/00/00\007"
}
function pwdterm {
# New terminal in the current working directory
setsid -f $TERMINAL -e $SHELL >/dev/null 2>&1 &
}
function ya() {
local tmp="$(mktemp -t "yazi-cwd.XXXXX")"
yazi "$@" --cwd-file="$tmp"
if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
cd -- "$cwd"
fi
rm -f -- "$tmp"
}
function lfcd {
tmp="$(mktemp)"
command lf -last-dir-path="$tmp" "$@"
@ -160,9 +184,16 @@ function nixstore () {
## KEYBINDS ##
bindkey -s '^e' 'lfcd\n'
zle -N increase_opacity
zle -N decrease_opacity
bindkey '^[s' decrease_opacity
bindkey '^[a' increase_opacity
bindkey -s '^e' 'ya\n'
bindkey -s '^n' 'nix_shell_menu'
bindkey -s '^[^M' 'nohup $TERMINAL -e $SHELL -c "cd $PWD && exec $SHELL" >/dev/null 2>&1 & \n'
zle -N pwdterm
bindkey '^[^M' pwdterm
# Enable completion features
autoload -Uz compinit