Use secret to fetch username email by default, fallback to prompt

This commit is contained in:
js0ny 2025-11-08 09:19:19 +00:00
parent 6ee67769a6
commit f908912cea
9 changed files with 110 additions and 30 deletions

View file

@ -113,3 +113,25 @@ elif [ "$TERM_PROGRAM" = "WezTerm" ]; then
alias icat="wezterm imgcat"
fi
fi
edit-fzf() {
# 1. Declare a variable that is local to the function.
local _file
if command -v fd >/dev/null 2>&1; then
_file=$(fd --type f | fzf --height 40% --reverse -1 -q "$1")
else
# Fallback to 'find'
_file=$(find . -type f | fzf --height 40% --reverse -1 -q "$1")
fi
# In POSIX shell, if fzf is cancelled (Esc/Ctrl-C),
# the command substitution simply returns an empty string.
# So, we check if the variable '_file' is non-empty ('-n').
if [ -n "$_file" ]; then
"$EDITOR" "$_file"
else
echo "No file selected."
fi
}
alias ef="edit-fzf"

View file

@ -1,3 +1,4 @@
autoload -U compinit && compinit
### completion
### =================
@ -17,4 +18,3 @@ zstyle ':completion:*' list-colors ''${(s.:.)LS_COLORS}
# Complete . and .. special directories
zstyle ':completion:*' special-dirs true

View file

@ -43,6 +43,12 @@ for plugin in "${plugins[@]}"; do
fi
done
ZSH_HIGHLIGHT_HIGHLIGHTERS+=(main pattern brackets root)
ZSH_HIGHLIGHT_STYLES[path]='fg=cyan,underline'
ZSH_HIGHLIGHT_PATTERNS+=('rm -rf *' 'fg=blue,bold,bg=red')
export IPYTHONDIR="$XDG_CONFIG_HOME"/ipython
# https://unix.stackexchange.com/questions/33994/
# Use `set -k` to mark leading `#` as a comment character
set -k

View file

@ -6,7 +6,7 @@
# read key: `read`
# get current bindings: `bindkey`
# bindkey -v # Vi Keybindings
bindkey -e # Emacs Keybindings
bindkey '^H' backward-kill-word # Ctrl-Backspace
bindkey '^[^?' backward-kill-line # Alt-Backspace
@ -25,3 +25,10 @@ bindkey '^[[F' end-of-line # End
bindkey '^[[3~' delete-char # Delete
bindkey '^[[3;5~' kill-word # Ctrl-Delete
bindkey '^[[3;3~' kill-line # Alt-Delete
autoload -Uz edit-command-line
zle -N edit-command-line
bindkey '^X^E' edit-command-line
bindkey '^[e' edit-command-line
bindkey '^[v' edit-command-line