Compare commits

...

2 Commits

Author SHA1 Message Date
Icedream 528c88a5a5
Reformat zshrc. 2022-06-13 15:30:03 +02:00
Icedream 616bad2615
Fix new-style completions. 2022-06-13 15:29:54 +02:00
1 changed files with 21 additions and 25 deletions

View File

@ -69,8 +69,13 @@ log() {
section "compat: bash completion" section "compat: bash completion"
if [ $ZSH_COMPAT_BASH_COMPLETION -gt 0 ] || [ $ZSH_PIPX -gt 0 ]; then if [ $ZSH_COMPAT_BASH_COMPLETION -gt 0 ] || [ $ZSH_PIPX -gt 0 ]; then
log "Enabling compatibility for bash completion scripts..." log "Enabling compatibility for bash completion scripts..."
autoload -U bashcompinit autoload -Uz bashcompinit compinit
bashcompinit bashcompinit
compinit
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
fpath=(/usr/local/share/zsh-completions $fpath)
fi fi
section_end section_end
@ -164,8 +169,7 @@ section_end
# symfony cli # symfony cli
section "symfony cli" section "symfony cli"
if [ $ZSH_SYMFONY_CLI -gt 0 ]; then if [ $ZSH_SYMFONY_CLI -gt 0 ]; then
if [ -n "$(command -v symfony)" ] if [ -n "$(command -v symfony)" ]; then
then
complete -C "$(command -v symfony) self:autocomplete" symfony complete -C "$(command -v symfony) self:autocomplete" symfony
fi fi
fi fi
@ -177,7 +181,6 @@ if [ $ZSH_THEFUCK -gt 0 ]; then
fi fi
section_end section_end
# Default terminal # Default terminal
section "term" section "term"
if [ $ZSH_DEFAULT_TERM -gt 0 ] && [ -z "$TERM" ]; then if [ $ZSH_DEFAULT_TERM -gt 0 ] && [ -z "$TERM" ]; then
@ -224,13 +227,11 @@ ssh_docker() {
base_path=/var/tmp/ssh-docker/$(sha1sum - <<<"$1" | awk '{print $1}') base_path=/var/tmp/ssh-docker/$(sha1sum - <<<"$1" | awk '{print $1}')
control_path="${base_path}.control" control_path="${base_path}.control"
sock_path="${base_path}.sock" sock_path="${base_path}.sock"
if [ -f "${sock_path}" ] if [ -f "${sock_path}" ]; then
then
echo "Socket path ${sock_path} already exists." >&2 echo "Socket path ${sock_path} already exists." >&2
return 1 return 1
fi fi
if [ -f "${control_path}" ] if [ -f "${control_path}" ]; then
then
echo "Control path ${control_path} already exists." >&2 echo "Control path ${control_path} already exists." >&2
return 1 return 1
fi fi
@ -244,8 +245,7 @@ ssh_docker() {
} }
ssh_docker_exit() { ssh_docker_exit() {
args=("$@") args=("$@")
if [ "${#args}" -gt 0 ] if [ "${#args}" -gt 0 ]; then
then
base_path=/var/tmp/ssh-docker/$(sha1sum - <<<"${args[-1]}" | awk '{print $1}') base_path=/var/tmp/ssh-docker/$(sha1sum - <<<"${args[-1]}" | awk '{print $1}')
control_path="${base_path}.control" control_path="${base_path}.control"
sock_path="${base_path}.sock" sock_path="${base_path}.sock"
@ -253,8 +253,7 @@ ssh_docker_exit() {
control_path="${DOCKER_SSH_CONTROL_PATH}" control_path="${DOCKER_SSH_CONTROL_PATH}"
sock_path="${DOCKER_SSH_SOCKET_PATH}" sock_path="${DOCKER_SSH_SOCKET_PATH}"
fi fi
if [ -z "${control_path}" ] if [ -z "${control_path}" ]; then
then
echo "No active Docker SSH forwarding found in environment." >&2 echo "No active Docker SSH forwarding found in environment." >&2
return 1 return 1
fi fi
@ -262,10 +261,8 @@ ssh_docker_exit() {
rm -f "${sock_path}" "${control_path}" rm -f "${sock_path}" "${control_path}"
} }
ssh_docker_cleanup() { ssh_docker_cleanup() {
for socket in /var/tmp/ssh-docker/*.sock for socket in /var/tmp/ssh-docker/*.sock; do
do if [ ! -e "$socket" ]; then
if [ ! -e "$socket" ]
then
continue continue
fi fi
control="$(basename "$socket" .control).sock" control="$(basename "$socket" .control).sock"
@ -308,4 +305,3 @@ section_end
section "Environment variables" section "Environment variables"
log "$(export)" log "$(export)"
section_end section_end