Compare commits

...

9 Commits

Author SHA1 Message Date
Vonfry
d0ba9b933d
Merge 4c7ac6ff2e into 6e564503f1 2025-01-10 11:15:30 -06:00
Indrajit Raychaudhuri
6e564503f1 general: Apply quote styling consistency
Remove redundant quotes from comparisons and
variable expansions where they are not needed.

Also add style nits to comments and code.
2025-01-10 11:09:08 -06:00
Vonfry
4c7ac6ff2e
gpg module: the original grep expression cannot work on macos, make it simple for checking 2020-06-28 15:29:50 +08:00
Vonfry
2fc2920349
Merge branch 'master' into nixos-gpg-module-fix 2020-06-28 15:06:36 +08:00
Vonfry
7d32a08454
remove export after ln, because some tools will check the socket path
such as pam ssh auth on NixOS.
2019-01-26 14:59:21 +08:00
Vonfry
2e1b45c048
gpg modules: use gpgconf for other variable 2019-01-26 11:17:20 +08:00
Vonfry
a170d5b2b2
gpg module: grep conditon fix 2019-01-26 11:11:31 +08:00
Vonfry
5ebe88bfe0
gpg-module: unset socket variable 2019-01-26 11:02:42 +08:00
Vonfry
d66a0998d4
Fix gpg module condition
Fix gpg module grep regex expression, because of matching failed when `GPG_AGENT_INFO` is empty. 

And use gpgconf to get socket file instead of `$GNUPGHOME`.

fix: sorin-ionescu/prezto#1681
2019-01-26 11:00:37 +08:00
8 changed files with 30 additions and 28 deletions

View File

@ -173,7 +173,7 @@ if [[ -s "${ZDOTDIR:-$HOME}/.zpreztorc" ]]; then
fi
# Disable color and theme in dumb terminals.
if [[ "$TERM" == 'dumb' ]]; then
if [[ $TERM == dumb ]]; then
zstyle ':prezto:*:*' color 'no'
zstyle ':prezto:module:prompt' theme 'off'
fi

View File

@ -7,7 +7,7 @@
#
# Return if requirements are not found.
if [[ $TERM == 'dumb' ]]; then
if [[ $TERM == dumb ]]; then
return 1
fi

View File

@ -14,7 +14,7 @@
# paste had a regression. Additionally, 5.2 added bracketed-paste-url-magic
# which is generally better than url-quote-magic so we load that when possible.
autoload -Uz is-at-least
if [[ ${ZSH_VERSION} != 5.1.1 && ${TERM} != "dumb" ]]; then
if [[ $ZSH_VERSION != 5.1.1 && $TERM != dumb ]]; then
if is-at-least 5.2; then
autoload -Uz bracketed-paste-url-magic
zle -N bracketed-paste bracketed-paste-url-magic
@ -34,7 +34,8 @@ setopt COMBINING_CHARS # Combine zero-length punctuation characters (accent
# with the base character.
setopt INTERACTIVE_COMMENTS # Enable comments in interactive shell.
setopt RC_QUOTES # Allow 'Henry''s Garage' instead of 'Henry'\''s Garage'.
unsetopt MAIL_WARNING # Don't print a warning message if a mail file has been accessed.
unsetopt MAIL_WARNING # Don't print a warning message if a mail file has
# been accessed.
# Allow mapping Ctrl+S and Ctrl+Q shortcuts
[[ -r ${TTY:-} && -w ${TTY:-} && $+commands[stty] == 1 ]] && stty -ixon <$TTY >$TTY

View File

@ -11,16 +11,18 @@ if (( ! $+commands[gpg-agent] )); then
fi
# Set the default paths to gpg-agent files.
_gpg_agent_conf="${GNUPGHOME:-$HOME/.gnupg}/gpg-agent.conf"
_gpg_agent_conf="$(gpgconf --list-dir homedir)/gpg-agent.conf"
_gpg_agent_env="${XDG_CACHE_HOME:-$HOME/.cache}/prezto/gpg-agent.env"
_gpg_agent_socket="$(gpgconf --list-dir agent-socket)"
# Load environment variables from previous run
source "$_gpg_agent_env" 2> /dev/null
# Start gpg-agent if not started.
if [[ -z "$GPG_AGENT_INFO" && ! -S "${GNUPGHOME:-$HOME/.gnupg}/S.gpg-agent" ]]; then
if [[ -z "$GPG_AGENT_INFO" && ! -S "${_gpg_agent_socket}" ]]; then
# Start gpg-agent if not started.
if ! ps -U "$LOGNAME" -o pid,ucomm | grep -q -- "${${${(s.:.)GPG_AGENT_INFO}[2]}:--1} gpg-agent"; then
if ! ps -U "$LOGNAME" -o pid,ucomm | grep -q "gpg-agent"; then
mkdir -p "$_gpg_agent_env:h"
eval "$(gpg-agent --daemon | tee "$_gpg_agent_env")"
fi
@ -48,7 +50,7 @@ if grep '^enable-ssh-support' "$_gpg_agent_conf" &> /dev/null; then
fi
# Clean up.
unset _gpg_agent_{conf,env}
unset _gpg_agent_{conf,env,socket}
# Disable GUI prompts inside SSH.
if [[ -n "$SSH_CONNECTION" ]]; then

View File

@ -7,7 +7,7 @@
#
# Return if requirements are not found.
if [[ "$TERM" == 'dumb' ]]; then
if [[ $TERM == dumb ]]; then
return 1
fi

View File

@ -35,7 +35,6 @@ fi
if [[ -S "$SSH_AUTH_SOCK" && "$SSH_AUTH_SOCK" != "$_ssh_agent_sock" ]]; then
mkdir -p "$_ssh_agent_sock:h"
ln -sf "$SSH_AUTH_SOCK" "$_ssh_agent_sock"
export SSH_AUTH_SOCK="$_ssh_agent_sock"
fi
# Load identities.

View File

@ -7,7 +7,7 @@
#
# Return if requirements are not found.
if [[ "$TERM" == (dumb|linux|*bsd*|eterm*) ]]; then
if [[ $TERM == (dumb|linux|*bsd*|eterm*) ]]; then
return 1
fi
@ -60,7 +60,7 @@ function _terminal-set-titles-with-command {
local truncated_cmd="${cmd/(#m)?(#c15,)/${MATCH[1,12]}...}"
unset MATCH
if [[ "$TERM" == screen* ]]; then
if [[ $TERM == screen* ]]; then
set-multiplexer-title "$truncated_cmd"
fi
set-tab-title "$truncated_cmd"
@ -78,7 +78,7 @@ function _terminal-set-titles-with-path {
local truncated_path="${abbreviated_path/(#m)?(#c15,)/...${MATCH[-12,-1]}}"
unset MATCH
if [[ "$TERM" == screen* ]]; then
if [[ $TERM == screen* ]]; then
set-multiplexer-title "$truncated_path"
fi
set-tab-title "$truncated_path"
@ -89,7 +89,7 @@ function _terminal-set-titles-with-path {
autoload -Uz add-zsh-hook
# Set up the Apple Terminal.
if [[ "$TERM_PROGRAM" == 'Apple_Terminal' ]] \
if [[ $TERM_PROGRAM == Apple_Terminal ]] \
&& ( ! [[ -n "$STY" || -n "$TMUX" || -n "$DVTM" ]] )
then
# Sets the Terminal.app current working directory before the prompt is

View File

@ -14,6 +14,6 @@ SAYINGS=(
)
# Print a randomly-chosen message:
echo $SAYINGS[$(($RANDOM % ${#SAYINGS} + 1))]
echo $SAYINGS[$(($RANDOM % $#SAYINGS + 1))]
} >&2