Fix conditionals to use [[ and (( rather than [

This fixes a small issue in src/widgets.zsh which makes it so if you
alias [ to g[ (as is done in prezto if the gnu-utility module is loaded)
autosuggestions would fail.

The documentation for GNU test mentions that -o and -a should be avoided
if possible because it's not very clear. Also, with zsh and [[ -o
actually tests if an option is set, which makes this option even more
confusing.
This commit is contained in:
Kaleb Elwert
2017-07-17 13:45:48 -07:00
committed by Eric Freese
parent 9f1f322979
commit 940e10a691
7 changed files with 59 additions and 46 deletions

View File

@@ -63,7 +63,7 @@ _zsh_autosuggest_async_pty_create() {
typeset -h REPLY
# If we won't get a fd back from zpty, try to guess it
if [ $_ZSH_AUTOSUGGEST_ZPTY_RETURNS_FD -eq 0 ]; then
if (( ! $_ZSH_AUTOSUGGEST_ZPTY_RETURNS_FD )); then
integer -l zptyfd
exec {zptyfd}>&1 # Open a new file descriptor (above 10).
exec {zptyfd}>&- # Close it so it's free to be used by zpty.