history-search-multi-word/history-search-multi-word.plugin.zsh

39 lines
1.4 KiB
Bash
Raw Normal View History

#!/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
#
# 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.
#
# 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
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
fpath+=( "${0:h}" )
fi
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
[[ ${+termcap[Co]} = 1 && ${termcap[Co]} = 256 ]] && {
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-05-22 06:58:00 +00:00
bindkey "^R" history-search-multi-word