From a40d77786051011961cafbc3eb6e76e1c71784a1 Mon Sep 17 00:00:00 2001 From: Arlen Cuss Date: Sat, 8 Jan 2011 15:51:26 +1100 Subject: [PATCH] Use ${(Q)arg} to expand a level of quotes, such that files/directories with spaces in their name (escaped with backslash) are noticed correctly. --- README.md | 1 + zsh-syntax-highlighting.zsh | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 488993e..330c30d 100644 --- a/README.md +++ b/README.md @@ -87,3 +87,4 @@ This must be done **after** the script is sourced, otherwise your styles will be * [Takeshi Banse](https://github.com/hchbaw) * [Sorin Ionescu](https://github.com/SpookyET) * [Clayton Parker](https://github.com/claytron) + * [Arlen Cuss](https://github.com/celtic) diff --git a/zsh-syntax-highlighting.zsh b/zsh-syntax-highlighting.zsh index 5ce9e92..f118b74 100644 --- a/zsh-syntax-highlighting.zsh +++ b/zsh-syntax-highlighting.zsh @@ -74,10 +74,10 @@ zle_highlight=( # Check if the argument is a path. _zsh_check-path() { - [[ -z $arg ]] && return 1 - [[ -e $arg ]] && return 0 - [[ ! -e ${arg:h} ]] && return 1 - [[ ${#BUFFER} == $end_pos && -n $(print $arg*(N)) ]] && return 0 + [[ -z ${(Q)arg} ]] && return 1 + [[ -e ${(Q)arg} ]] && return 0 + [[ ! -e ${(Q)arg:h} ]] && return 1 + [[ ${#BUFFER} == $end_pos && -n $(print ${(Q)arg}*(N)) ]] && return 0 return 1 }