feat(revamp): add zsh and neovim configs, add an install script and a dependencies list
This commit is contained in:
@@ -0,0 +1,115 @@
|
||||
# History Substring Search
|
||||
|
||||
Integrates [`zsh-history-substring-search`][1] into Prezto, which implements the
|
||||
[Fish shell][2]'s history search feature, where the user can type in any part of
|
||||
a previously entered command and press up and down to cycle through matching
|
||||
commands.
|
||||
|
||||
If this module is used in conjunction with the [_`syntax-highlighting`_][3]
|
||||
module, this module must be loaded _after_ the _`syntax-highlighting`_ module.
|
||||
|
||||
Additionally, if this module is used in conjunction with the
|
||||
[_`autosuggestions`_][4] module, this module must be loaded _before_ the
|
||||
_`autosuggestions`_ module.
|
||||
|
||||
To elaborate, the relative order of loading the modules would be
|
||||
_`syntax-highlighting`_, _`history-substring-search`_ and _`autosuggestions`_.
|
||||
|
||||
## Contributors
|
||||
|
||||
New features and bug fixes should be submitted to the
|
||||
[`zsh-history-substring-search`][1] project according to its rules and
|
||||
regulations. This module will be synchronized against it.
|
||||
|
||||
## Settings
|
||||
|
||||
### Case Sensitivity
|
||||
|
||||
To enable case-sensitivity for this module only, add the following line to
|
||||
_`${ZDOTDIR:-$HOME}/.zpreztorc`_:
|
||||
|
||||
```sh
|
||||
zstyle ':prezto:module:history-substring-search' case-sensitive 'yes'
|
||||
```
|
||||
|
||||
### Highlighting
|
||||
|
||||
If colors are enabled, _history-substring-search_ will automatically highlight
|
||||
positive results.
|
||||
|
||||
To disable highlighting for this module only, add the following line to
|
||||
_`${ZDOTDIR:-$HOME}/.zpreztorc`_:
|
||||
|
||||
```sh
|
||||
zstyle ':prezto:module:history-substring-search' color 'no'
|
||||
```
|
||||
|
||||
To set the query found color, add the following line to
|
||||
_`${ZDOTDIR:-$HOME}/.zpreztorc`_:
|
||||
|
||||
```sh
|
||||
zstyle ':prezto:module:history-substring-search:color' found ''
|
||||
```
|
||||
|
||||
To set the query not found color, add the following line to
|
||||
_`${ZDOTDIR:-$HOME}/.zpreztorc`_:
|
||||
|
||||
```sh
|
||||
zstyle ':prezto:module:history-substring-search:color' not-found ''
|
||||
```
|
||||
|
||||
To set the search globbing flags, add the following line to
|
||||
_`${ZDOTDIR:-$HOME}/.zpreztorc`_:
|
||||
|
||||
```sh
|
||||
zstyle ':prezto:module:history-substring-search' globbing-flags ''
|
||||
```
|
||||
|
||||
### Case sensitive search
|
||||
|
||||
To set the search case-sensitivity, add the following line to
|
||||
_`${ZDOTDIR:-$HOME}/.zpreztorc`_:
|
||||
|
||||
```sh
|
||||
zstyle ':prezto:module:history-substring-search' case-sensitive 'yes'
|
||||
```
|
||||
|
||||
### Fuzzy search
|
||||
|
||||
To enable search for fuzzy matches, add the following line to
|
||||
_`${ZDOTDIR:-$HOME}/.zpreztorc`_:
|
||||
|
||||
```sh
|
||||
zstyle ':prezto:module:history-substring-search' fuzzy 'yes'
|
||||
```
|
||||
|
||||
### Unique results
|
||||
|
||||
To enable unique results, add the following line to
|
||||
_`${ZDOTDIR:-$HOME}/.zpreztorc`_:
|
||||
|
||||
```sh
|
||||
zstyle ':prezto:module:history-substring-search' unique 'yes'
|
||||
```
|
||||
|
||||
### Prefixed search
|
||||
|
||||
To enable prefixed search matches, add the following line to
|
||||
_`${ZDOTDIR:-$HOME}/.zpreztorc`_:
|
||||
|
||||
```sh
|
||||
zstyle ':prezto:module:history-substring-search' prefixed 'yes'
|
||||
```
|
||||
|
||||
## Authors
|
||||
|
||||
_The authors of this module should be contacted via the [issue tracker][5]._
|
||||
|
||||
- [Suraj N. Kurapati](https://github.com/sunaku)
|
||||
- [Sorin Ionescu](https://github.com/sorin-ionescu)
|
||||
|
||||
[1]: https://github.com/zsh-users/zsh-history-substring-search
|
||||
[2]: https://fishshell.com
|
||||
[3]: ../syntax-highlighting#readme
|
||||
[4]: ../autosuggestions#readme
|
||||
[5]: https://github.com/sorin-ionescu/prezto/issues
|
||||
@@ -0,0 +1,73 @@
|
||||
#
|
||||
# Integrates history-substring-search into Prezto.
|
||||
#
|
||||
# Authors:
|
||||
# Suraj N. Kurapati <sunaku@gmail.com>
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
# Load dependencies.
|
||||
pmodload 'editor'
|
||||
|
||||
# Source module files.
|
||||
if (( ! $+functions[history-substring-search-up] )); then
|
||||
source "${0:h}/external/zsh-history-substring-search.zsh" || return 1
|
||||
fi
|
||||
|
||||
#
|
||||
# Search
|
||||
#
|
||||
|
||||
zstyle -s ':prezto:module:history-substring-search:color' found \
|
||||
'HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND' \
|
||||
|| HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='bg=magenta,fg=white,bold'
|
||||
|
||||
zstyle -s ':prezto:module:history-substring-search:color' not-found \
|
||||
'HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND' \
|
||||
|| HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=white,bold'
|
||||
|
||||
zstyle -s ':prezto:module:history-substring-search' globbing-flags \
|
||||
'HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS' \
|
||||
|| HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS='i'
|
||||
|
||||
if zstyle -t ':prezto:module:history-substring-search' case-sensitive; then
|
||||
HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS="${HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS//i}"
|
||||
fi
|
||||
|
||||
if ! zstyle -t ':prezto:module:history-substring-search' color; then
|
||||
unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_{FOUND,NOT_FOUND}
|
||||
fi
|
||||
|
||||
if zstyle -t ':prezto:module:history-substring-search' fuzzy; then
|
||||
HISTORY_SUBSTRING_SEARCH_FUZZY=1
|
||||
fi
|
||||
|
||||
if zstyle -t ':prezto:module:history-substring-search' unique; then
|
||||
HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE=1
|
||||
fi
|
||||
|
||||
if zstyle -t ':prezto:module:history-substring-search' prefixed; then
|
||||
HISTORY_SUBSTRING_SEARCH_PREFIXED=1
|
||||
fi
|
||||
|
||||
#
|
||||
# Key Bindings
|
||||
#
|
||||
|
||||
if [[ -n "$key_info" ]]; then
|
||||
# Emacs
|
||||
bindkey -M emacs "$key_info[Control]P" history-substring-search-up
|
||||
bindkey -M emacs "$key_info[Control]N" history-substring-search-down
|
||||
|
||||
# Vi
|
||||
bindkey -M vicmd "k" history-substring-search-up
|
||||
bindkey -M vicmd "j" history-substring-search-down
|
||||
|
||||
# Emacs and Vi
|
||||
for keymap in 'emacs' 'viins'; do
|
||||
bindkey -M "$keymap" "$key_info[Up]" history-substring-search-up
|
||||
bindkey -M "$keymap" "$key_info[Down]" history-substring-search-down
|
||||
done
|
||||
|
||||
unset keymap
|
||||
fi
|
||||
Reference in New Issue
Block a user