Skip to content

Commit

Permalink
reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
MenkeTechnologies committed Dec 10, 2021
1 parent 84b9276 commit 5178f3c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions zpwrExpandApi.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ function zpwrExpandParseWords(){
tmp[-1]=${tmp[-1]:gs/\'//}
fi

mywordsleft=(${(Az)tmp})
mywordsleft=( ${(Az)tmp} )
#zpwrLogDebug "my words left = $mywordsleft"

# we must find the first index of the partition
firstIndex=0

for (( i = $#mywordsleft; i >= 0; i-- )); do
# ;; ; | || && are partition separating chars
# we will split the command line and get the partition of the cursor
# regular aliases are valid in the first position of this partition
# ;; ; | || && are statement separating chars
# we will split the command line and get the statement of the cursor
# regular aliases are valid in the first position of this statement
case $mywordsleft[$i] in
';;' | \; | \| | '||' | '&&' | '(' | '{')
firstIndex=$((i+1))
Expand All @@ -61,13 +61,13 @@ function zpwrExpandParseWords(){
esac
done

ZPWR_EXPAND_WORDS_LPARTITION=($mywordsleft[$firstIndex,$#mywordsleft])
ZPWR_EXPAND_WORDS_LPARTITION=( $mywordsleft[$firstIndex,$#mywordsleft] )

ZPWR_VARS[ZPWR_EXPAND_WORDS_LPARTITION]=ZPWR_EXPAND_WORDS_LPARTITION

#zpwrLogDebug "lpartition = '${(P)ZPWR_VARS[ZPWR_EXPAND_WORDS_LPARTITION]}'"

lpartAry=(${(z)${(P)ZPWR_VARS[ZPWR_EXPAND_WORDS_LPARTITION]}})
lpartAry=( ${(z)${(P)ZPWR_VARS[ZPWR_EXPAND_WORDS_LPARTITION]}} )

ZPWR_VARS[firstword_partition]=${lpartAry[1]}

Expand All @@ -76,15 +76,15 @@ function zpwrExpandParseWords(){
#zpwrLogDebug "first word partition = ...$ZPWR_VARS[firstword_partition]..."
#zpwrLogDebug "last word lbuf before no dbl quotes and [-1] = ...$ZPWR_VARS[lastword_lbuffer]..."

lbufAry=(${(z)${ZPWR_VARS[lastword_lbuffer]}})
lbufAry=( ${(z)${ZPWR_VARS[lastword_lbuffer]}} )

ZPWR_VARS[lastword_lbuffer]=${lbufAry[-1]}
#zpwrLogDebug "last word lbuf after no dbl quotes and [-1] = ...$ZPWR_VARS[lastword_lbuffer]..."

#zpwrLogDebug "first word partition before spelling = ...$ZPWR_VARS[firstword_partition]..."
#zpwrLogDebug "last word lbuf before spelling = ...$ZPWR_VARS[lastword_lbuffer]..."

lastWordAry=(${(Az)${ZPWR_VARS[lastword_lbuffer]//[\[\]\{\}\(\)\']/}})
lastWordAry=( ${(Az)${ZPWR_VARS[lastword_lbuffer]//[\[\]\{\}\(\)\']/}} )
finalWord=${lastWordAry[-1]}
ZPWR_VARS[lastword_remove_special]=$finalWord

Expand Down
4 changes: 2 additions & 2 deletions zpwrExpandLib.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function zpwrExpandCorrectWord(){
fi
for key in ${(k)ZPWR_EXPAND_CORRECT_WORDS[@]}; do

badWords=("${(z)ZPWR_EXPAND_CORRECT_WORDS[$key]}")
badWords=( "${(z)ZPWR_EXPAND_CORRECT_WORDS[$key]}" )
for misspelling in $badWords[@];do

if [[ ${ZPWR_VARS[lastword_remove_special]} == $misspelling ]]; then
Expand All @@ -114,7 +114,7 @@ function zpwrExpandCorrectWord(){
# expand only when cursor is right of misspelled word
if [[ $ZPWR_EXPAND_PRE_CORRECT == (#b)(*[[:space:]]#)($misspelling) ]]; then
res1=${match[1]}
ZPWR_EXPAND_POST_CORRECT=("${(z):-$res1${key:gs/_/ /}}")
ZPWR_EXPAND_POST_CORRECT=( "${(z):-$res1${key:gs/_/ /}}" )
ZPWR_VARS[foundIncorrect]=true
# ZPWR_VARS[finished]=true
fi
Expand Down
2 changes: 1 addition & 1 deletion zsh-expand.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fi
ZPWR_VARS[builtinSkips]='(command|time|exec|eval|nocorrect|noglob)'

ZPWR_VARS[userBlacklist]=""
if (( $#ZPWR_EXPAND_BLACKLIST)); then
if (( $#ZPWR_EXPAND_BLACKLIST )); then
ZPWR_VARS[userBlacklist]="^(${(j:|:)ZPWR_EXPAND_BLACKLIST})$"
fi

Expand Down

0 comments on commit 5178f3c

Please sign in to comment.