zsh: reduce config if TERM == dumb
Fixes TRAMP hangs when connecting to some machines
This commit is contained in:
parent
e74fb44280
commit
60e3a4abaa
|
@ -16,44 +16,46 @@ if ! zgen saved; then
|
||||||
zgen save
|
zgen save
|
||||||
fi
|
fi
|
||||||
|
|
||||||
source $ZDOTDIR/prompt.zsh
|
|
||||||
source $ZDOTDIR/config.zsh
|
source $ZDOTDIR/config.zsh
|
||||||
source $ZDOTDIR/keybinds.zsh
|
if [[ $TERM != dumb ]]; then
|
||||||
source $ZDOTDIR/completion.zsh
|
source $ZDOTDIR/prompt.zsh
|
||||||
source $ZDOTDIR/aliases.zsh
|
source $ZDOTDIR/keybinds.zsh
|
||||||
for file in $XDG_CONFIG_HOME/zsh/rc.d/aliases.*.zsh(N); do
|
source $ZDOTDIR/completion.zsh
|
||||||
source $file
|
source $ZDOTDIR/aliases.zsh
|
||||||
done
|
for file in $XDG_CONFIG_HOME/zsh/rc.d/aliases.*.zsh(N); do
|
||||||
|
source $file
|
||||||
|
done
|
||||||
|
|
||||||
##
|
##
|
||||||
function _cache {
|
function _cache {
|
||||||
command -v "$1" >/dev/null || return 1
|
command -v "$1" >/dev/null || return 1
|
||||||
local cache_dir="$XDG_CACHE_HOME/${SHELL##*/}"
|
local cache_dir="$XDG_CACHE_HOME/${SHELL##*/}"
|
||||||
local cache="$cache_dir/$1"
|
local cache="$cache_dir/$1"
|
||||||
if [[ ! -f $cache || ! -s $cache ]]; then
|
if [[ ! -f $cache || ! -s $cache ]]; then
|
||||||
echo "Caching $1"
|
echo "Caching $1"
|
||||||
mkdir -p $cache_dir
|
mkdir -p $cache_dir
|
||||||
"$@" >$cache
|
"$@" >$cache
|
||||||
|
fi
|
||||||
|
source $cache || rm -f $cache
|
||||||
|
}
|
||||||
|
|
||||||
|
# fd > find
|
||||||
|
if command -v fd >/dev/null; then
|
||||||
|
export FZF_DEFAULT_OPTS="--reverse --ansi"
|
||||||
|
export FZF_DEFAULT_COMMAND="fd ."
|
||||||
|
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
|
||||||
|
export FZF_ALT_C_COMMAND="fd -t d . $HOME"
|
||||||
fi
|
fi
|
||||||
source $cache || rm -f $cache
|
|
||||||
}
|
|
||||||
|
|
||||||
# fd > find
|
_cache fasd --init posix-alias zsh-{hook,{c,w}comp{,-install}}
|
||||||
if command -v fd >/dev/null; then
|
_cache direnv hook zsh
|
||||||
export FZF_DEFAULT_OPTS="--reverse --ansi"
|
|
||||||
export FZF_DEFAULT_COMMAND="fd ."
|
|
||||||
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
|
##
|
||||||
export FZF_ALT_C_COMMAND="fd -t d . $HOME"
|
autoload -Uz compinit && compinit -u -d $ZSH_CACHE/zcompdump
|
||||||
|
autopair-init
|
||||||
|
|
||||||
|
|
||||||
|
# If you have host-local configuration, this is where you'd put it
|
||||||
|
[ -f ~/.config/zsh/rc ] && source ~/.config/zsh/rc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_cache fasd --init posix-alias zsh-{hook,{c,w}comp{,-install}}
|
|
||||||
_cache direnv hook zsh
|
|
||||||
|
|
||||||
|
|
||||||
##
|
|
||||||
autoload -Uz compinit && compinit -u -d $ZSH_CACHE/zcompdump
|
|
||||||
autopair-init
|
|
||||||
|
|
||||||
|
|
||||||
# If you have host-local configuration, this is where you'd put it
|
|
||||||
[ -f ~/.config/zsh/rc ] && source ~/.config/zsh/rc
|
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
# Stop term/shell echoing back my input
|
# Stop TRAMP (in Emacs) from hanging or term/shell from echoing back commands
|
||||||
if [[ -n $INSIDE_EMACS ]]; then
|
if [[ $TERM == dumb || -n $INSIDE_EMACS ]]; then
|
||||||
unsetopt zle
|
unsetopt zle
|
||||||
|
unsetopt prompt_cr
|
||||||
|
unsetopt prompt_subst
|
||||||
|
whence -w precmd >/dev/null && unfunction precmd
|
||||||
|
whence -w preexec >/dev/null && unfunction preexec
|
||||||
|
PS1='$ '
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## General
|
## General
|
||||||
|
|
Loading…
Reference in a new issue