Underline text at curor if matching path exists
This commit is contained in:
parent
2bf1933f2d
commit
899c83d0cd
@ -24,6 +24,14 @@ ZLE_DEFAULT='fg=white,bold'
|
|||||||
|
|
||||||
ZLE_TOKENS_FOLLOWED_BY_COMMANDS=('|' '||' ';' '&' '&&' 'sudo' 'start' 'time' 'strace' '§')
|
ZLE_TOKENS_FOLLOWED_BY_COMMANDS=('|' '||' ';' '&' '&&' 'sudo' 'start' 'time' 'strace' '§')
|
||||||
|
|
||||||
|
_check_path() {
|
||||||
|
[ -z "$arg" ] && return 1
|
||||||
|
[ -e $arg ] && return 0
|
||||||
|
[ ! -e "`dirname $arg`" ] && return 1
|
||||||
|
[ ${#BUFFER} = $end_pos -a -n "`print $arg*`" ] && return 0
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
# Recolorize the current ZLE buffer.
|
# Recolorize the current ZLE buffer.
|
||||||
colorize-zle-buffer() {
|
colorize-zle-buffer() {
|
||||||
region_highlight=()
|
region_highlight=()
|
||||||
@ -43,7 +51,7 @@ colorize-zle-buffer() {
|
|||||||
*"$cmd is"*) style=$ZLE_COMMAND_STYLE;;
|
*"$cmd is"*) style=$ZLE_COMMAND_STYLE;;
|
||||||
*)
|
*)
|
||||||
style=$ZLE_COMMAND_UNKNOWN_TOKEN_STYLE
|
style=$ZLE_COMMAND_UNKNOWN_TOKEN_STYLE
|
||||||
[ -e "$arg" ] && style=$ZLE_PATH_STYLE
|
_check_path && style=$ZLE_PATH_STYLE
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
@ -56,7 +64,7 @@ colorize-zle-buffer() {
|
|||||||
*"*"*) style=$ZLE_GLOBING;;
|
*"*"*) style=$ZLE_GLOBING;;
|
||||||
*)
|
*)
|
||||||
style=$ZLE_DEFAULT
|
style=$ZLE_DEFAULT
|
||||||
[ -e "$arg" ] && style=$ZLE_PATH_STYLE
|
_check_path && style=$ZLE_PATH_STYLE
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user