2022-07-01 15:41:59 +00:00
|
|
|
#!/usr/bin/env zsh
|
|
|
|
#
|
|
|
|
# -*- mode: sh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
|
|
|
#
|
|
|
|
# Copyright (c) 2016-2020 Sebastian Gniazdowski and contributors
|
|
|
|
# Copyright (c) 2021-2022 zdharma-continuum and contributors
|
2017-06-13 04:50:47 +00:00
|
|
|
|
2016-05-26 07:14:39 +00:00
|
|
|
#
|
|
|
|
# No plugin manager is needed to use this file. All that is needed is adding:
|
|
|
|
# source {where-unpacked}/history-search-multi-word.plugin.zsh
|
|
|
|
# to ~/.zshrc.
|
|
|
|
#
|
|
|
|
|
2020-01-24 23:55:07 +00:00
|
|
|
# According to the standard:
|
2021-11-10 17:27:28 +00:00
|
|
|
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
|
2020-01-24 23:55:07 +00:00
|
|
|
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
|
|
|
|
0="${${(M)0:#/*}:-$PWD/$0}"
|
|
|
|
|
|
|
|
HSMW_REPO_DIR="${0:h}"
|
|
|
|
|
|
|
|
if [[ ${zsh_loaded_plugins[-1]} != */history-search-multi-word && -z ${fpath[(r)${0:h}]} ]]
|
|
|
|
then
|
2022-07-01 15:41:59 +00:00
|
|
|
fpath+=( "${0:h}" )
|
2016-05-26 07:14:39 +00:00
|
|
|
fi
|
|
|
|
|
2016-11-12 14:55:21 +00:00
|
|
|
autoload history-search-multi-word hsmw-context-main
|
2016-05-22 06:58:00 +00:00
|
|
|
zle -N history-search-multi-word
|
|
|
|
zle -N history-search-multi-word-backwards history-search-multi-word
|
2016-09-20 06:46:46 +00:00
|
|
|
zle -N history-search-multi-word-pbackwards history-search-multi-word
|
|
|
|
zle -N history-search-multi-word-pforwards history-search-multi-word
|
2020-01-21 21:26:11 +00:00
|
|
|
[[ ${+termcap[Co]} = 1 && ${termcap[Co]} = 256 ]] && {
|
2022-07-01 15:41:59 +00:00
|
|
|
zstyle -s ":history-search-multi-word" highlight-color tmp || \
|
|
|
|
zstyle ":history-search-multi-word" highlight-color "bg=17"
|
|
|
|
typeset -gA HSMW_HIGHLIGHT_STYLES
|
|
|
|
[[ ${HSMW_HIGHLIGHT_STYLES[variable]} = none ]] && \
|
|
|
|
HSMW_HIGHLIGHT_STYLES[variable]="fg=112"
|
2016-11-03 10:49:07 +00:00
|
|
|
}
|
2016-05-22 06:58:00 +00:00
|
|
|
bindkey "^R" history-search-multi-word
|