mirror of
https://github.com/zdharma-continuum/history-search-multi-word
synced 2024-11-21 19:03:11 +00:00
*highlight: Don't highlight paths existing in CDPATH, unless it's cd
This commit is contained in:
parent
68348d09ee
commit
8e8969095b
1 changed files with 4 additions and 3 deletions
|
@ -222,7 +222,7 @@ __HSMW_HIGHLIGHT_TOKENS_TYPES=(
|
|||
# in_array_assignment true between 'a=(' and the matching ')'
|
||||
# braces_stack: "R" for round, "Q" for square, "Y" for curly
|
||||
# mybuf, cdpath_dir are used in sub-functions
|
||||
local start_pos=0 end_pos highlight_glob=1 arg style in_array_assignment=0 MATCH expanded_path braces_stack buf="$1" mybuf cdpath_dir
|
||||
local start_pos=0 end_pos highlight_glob=1 arg style in_array_assignment=0 MATCH expanded_path braces_stack buf="$1" mybuf cdpath_dir cur_cmd
|
||||
# arg_type can be 0, 1, 2 or 3, i.e. precommand, control flow, command separator
|
||||
# idx and end_idx are used in sub-functions
|
||||
# for this_word and next_word look below at commented integers and at state machine description
|
||||
|
@ -381,6 +381,7 @@ __HSMW_HIGHLIGHT_TOKENS_TYPES=(
|
|||
style=reserved-word # de facto a reserved word, although not de jure
|
||||
(( next_word = 1 ))
|
||||
elif (( this_word & 1 )) && (( in_redirection == 0 )); then # $arg is the command word
|
||||
cur_cmd="$arg"
|
||||
if (( arg_type == 1 )); then
|
||||
style=precommand
|
||||
elif [[ "$arg" = "sudo" ]]; then
|
||||
|
@ -613,8 +614,8 @@ __HSMW_HIGHLIGHT_TOKENS_TYPES=(
|
|||
[[ -z $expanded_path ]] && return 1
|
||||
[[ -e $expanded_path ]] && return 0
|
||||
|
||||
# Search the path in CDPATH
|
||||
for cdpath_dir in $cdpath ; do
|
||||
# Search the path in CDPATH, only for CD command
|
||||
[[ "$cur_cmd" = "cd" ]] && for cdpath_dir in $cdpath ; do
|
||||
[[ -e "$cdpath_dir/$expanded_path" ]] && return 0
|
||||
done
|
||||
|
||||
|
|
Loading…
Reference in a new issue