diff --git a/.gitmodules b/.gitmodules index 7a7a7b5..a1fb1cf 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "modules/completion/external"] path = modules/completion/external url = https://github.com/zsh-users/zsh-completions.git +[submodule "modules/zaw/external"] + path = modules/zaw/external + url = git://github.com/zsh-users/zaw.git diff --git a/modules/README.md b/modules/README.md index 7527a8c..7bdc90c 100644 --- a/modules/README.md +++ b/modules/README.md @@ -193,3 +193,8 @@ Yum Defines yum aliases. +Zaw +--- + +Integrates zaw into Prezto. + diff --git a/modules/zaw/README.md b/modules/zaw/README.md new file mode 100644 index 0000000..7c1a242 --- /dev/null +++ b/modules/zaw/README.md @@ -0,0 +1,77 @@ +Zaw +=== + +Loads and configures Zaw from the [zaw][1] project. + +Contributors +------------ + +New features and bug fixes should be submitted to the [zaw][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 +*zpreztorc*: + + zstyle ':prezto:module:zaw' case-sensitive 'yes' + +### Highlighting + +If colors are enabled, *zaw* will automatically highlight positive results. + +To enable highlighting for this module only, add the following line to +*zpreztorc*: + + zstyle ':prezto:module:zaw' color 'yes' + +To change the error color, add the following line to *zpreztorc*: + + zstyle ':prezto:module:zaw:color' error 'bg=red,fg=white' + +To change the marked item color, add the following line to *zpreztorc*: + + zstyle ':prezto:module:zaw:color' marked 'bg=blue,fg=white' + +To change the matched item color, add the following line to *zpreztorc*: + + zstyle ':prezto:module:zaw:color' matched 'bg=magenta,fg=white' + +To change the selected item color, add the following line to *zpreztorc*: + + zstyle ':prezto:module:zaw:color' selected 'standout' + +To change the list title color, add the following line to *zpreztorc*: + + zstyle ':prezto:module:zaw:color' title 'fg=yellow' + +# Search + +To set the maximum number of items, add the following line to *zpreztorc*: + + zstyle ':prezto:module:zaw' max-lines 15 + +To rotate to the other side of the list when the cursor reaches the top or the +bottom, add the following line to *zpreztorc*: + + zstyle ':filter-select' rotate-list 'yes' + +To use extended search operators, add the following line to *zpreztorc*: + + zstyle ':prezto:module:zaw' extended-search 'yes' + +More details can be found in the [zaw][1] project's README. + +Authors +------- + +*The authors of this module should be contacted via the [issue tracker][2].* + + - [Sorin Ionescu](https://github.com/sorin-ionescu) + +[1]: https://github.com/zsh-users/zaw +[2]: https://github.com/sorin-ionescu/prezto/issues + diff --git a/modules/zaw/external b/modules/zaw/external new file mode 160000 index 0000000..c3308b6 --- /dev/null +++ b/modules/zaw/external @@ -0,0 +1 @@ +Subproject commit c3308b675de18a14c933544077a429ba94ea7101 diff --git a/modules/zaw/init.zsh b/modules/zaw/init.zsh new file mode 100644 index 0000000..62e0811 --- /dev/null +++ b/modules/zaw/init.zsh @@ -0,0 +1,69 @@ +# +# Integrates zaw into Prezto. +# +# Authors: +# Sorin Ionescu +# + +# Load dependencies. +pmodload 'editor' + +# Source module files. +source "${0:h}/external/zaw.zsh" || return 1 + +# +# Highlighting +# + +zstyle -s ':prezto:module:zaw:color' error 'REPLY' || REPLY='bg=red,fg=white' +zstyle ':filter-select:highlight' error "$REPLY" + +zstyle -s ':prezto:module:zaw:color' marked 'REPLY' || REPLY='bg=blue,fg=white' +zstyle ':filter-select:highlight' marked "$REPLY" + +zstyle -s ':prezto:module:zaw:color' matched 'REPLY' || REPLY='bg=magenta,fg=white' +zstyle ':filter-select:highlight' matched "$REPLY" + +zstyle -s ':prezto:module:zaw:color' selected 'REPLY' || REPLY='standout' +zstyle ':filter-select:highlight' selected "$REPLY" + +zstyle -s ':prezto:module:zaw:color' title 'REPLY' || REPLY='fg=yellow' +zstyle ':filter-select:highlight' title "$REPLY" + +if ! zstyle -t ':prezto:module:zaw' color; then + for style in error marked matched selected title; do + zstyle -d ':filter-select:highlight' "$style" + done +fi + +# +# Search +# + +zstyle -s ':prezto:module:zaw' max-lines 'REPLY' || REPLY=0 +zstyle ':filter-select' max-lines "$REPLY" + +zstyle -b ':filter-select' rotate-list 'REPLY' || REPLY='no' +zstyle ':filter-select' rotate-list "$REPLY" + +zstyle -b ':prezto:module:zaw' extended-search 'REPLY' || REPLY='no' +zstyle ':filter-select' extended-search "$REPLY" + +if ! zstyle -t ':prezto:module:zaw' case-sensitive; then + zstyle ':filter-select' case-insensitive 'yes' +fi + +# +# Key Bindings +# + +if [[ -n "$key_info" ]]; then + # Emacs + bindkey -M emacs "$key_info[Control]R" zaw-history + bindkey -M emacs "$key_info[Control]S" zaw-history + + # Vi + bindkey -M vicmd "/" zaw-history + bindkey -M vicmd "?" zaw-history +fi + diff --git a/runcoms/zpreztorc b/runcoms/zpreztorc index a54fdb0..3f24d1b 100644 --- a/runcoms/zpreztorc +++ b/runcoms/zpreztorc @@ -152,3 +152,32 @@ zstyle ':prezto:module:prompt' theme 'sorin' # Auto start a session when Zsh is launched in a SSH connection. # zstyle ':prezto:module:tmux:auto-start' remote 'yes' + +# +# Zaw +# + +# Set the error color. +# zstyle ':prezto:module:zaw:color' error 'bg=red,fg=white' + +# Set the marked item color. +# zstyle ':prezto:module:zaw:color' marked 'bg=blue,fg=white' + +# Set the matched item color. +# zstyle ':prezto:module:zaw:color' matched 'bg=magenta,fg=white' + +# Set the selected item color. +# zstyle ':prezto:module:zaw:color' selected 'standout' + +# Set the list title color. +# zstyle ':prezto:module:zaw:color' title 'fg=yellow' + +# Set the maximum number of items. +# zstyle ':prezto:module:zaw' max-lines 15 + +# Set list cursor rotation. +# zstyle ':filter-select' rotate-list 'yes' + +# Enable extended search operators. +# zstyle ':prezto:module:zaw' extended-search 'yes' +