mirror of
https://github.com/dcarrillo/prezto.git
synced 2025-07-02 05:09:25 +00:00
Compare commits
2 Commits
issue/656-
...
module/zaw
Author | SHA1 | Date | |
---|---|---|---|
8e95c547d6 | |||
36ade25eb6 |
6
.gitmodules
vendored
6
.gitmodules
vendored
@ -7,6 +7,6 @@
|
|||||||
[submodule "modules/completion/external"]
|
[submodule "modules/completion/external"]
|
||||||
path = modules/completion/external
|
path = modules/completion/external
|
||||||
url = https://github.com/zsh-users/zsh-completions.git
|
url = https://github.com/zsh-users/zsh-completions.git
|
||||||
[submodule "modules/z/external"]
|
[submodule "modules/zaw/external"]
|
||||||
path = modules/z/external
|
path = modules/zaw/external
|
||||||
url = https://github.com/rupa/z.git
|
url = git://github.com/zsh-users/zaw.git
|
||||||
|
@ -193,3 +193,8 @@ Yum
|
|||||||
|
|
||||||
Defines yum aliases.
|
Defines yum aliases.
|
||||||
|
|
||||||
|
Zaw
|
||||||
|
---
|
||||||
|
|
||||||
|
Integrates zaw into Prezto.
|
||||||
|
|
||||||
|
39
modules/fasd/README.md
Normal file
39
modules/fasd/README.md
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
Fasd
|
||||||
|
====
|
||||||
|
|
||||||
|
[Fasd][1] is a command-line productivity booster, inspired by tools like
|
||||||
|
[autojump][2], [z][3] and [v][4], it offers quick access to files and
|
||||||
|
directories by keeping track of files and directories that were previously
|
||||||
|
accessed.
|
||||||
|
|
||||||
|
For completion to work, this module must be loaded **after** the *completion*
|
||||||
|
module.
|
||||||
|
|
||||||
|
The Prezto Fasd configuration differs from the default. The default aliases have
|
||||||
|
been disabled.
|
||||||
|
|
||||||
|
Aliases
|
||||||
|
-------
|
||||||
|
|
||||||
|
- `j` changes the current working directory interactively.
|
||||||
|
|
||||||
|
Completion
|
||||||
|
----------
|
||||||
|
|
||||||
|
Type `,`, `f,`, `d,` in front of a comma-separated query or type `,,`, `,,f`,
|
||||||
|
`,,d` at the end of a comma-separated query then hit <kbd>tab</kbd>.
|
||||||
|
|
||||||
|
Authors
|
||||||
|
-------
|
||||||
|
|
||||||
|
*The authors of this module should be contacted via the [issue tracker][5].*
|
||||||
|
|
||||||
|
- [Wei Dai](https://github.com/clvv)
|
||||||
|
- [Sorin Ionescu](https://github.com/sorin-ionescu)
|
||||||
|
|
||||||
|
[1]: https://github.com/clvv/fasd
|
||||||
|
[2]: https://github.com/joelthelion/autojump
|
||||||
|
[3]: https://github.com/rupa/z
|
||||||
|
[4]: https://github.com/rupa/v
|
||||||
|
[5]: https://github.com/sorin-ionescu/prezto/issues
|
||||||
|
|
54
modules/fasd/init.zsh
Normal file
54
modules/fasd/init.zsh
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
#
|
||||||
|
# Maintains a frequently used file and directory list for fast access.
|
||||||
|
#
|
||||||
|
# Authors:
|
||||||
|
# Wei Dai <x@wei23.net>
|
||||||
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||||
|
#
|
||||||
|
|
||||||
|
# Load dependencies.
|
||||||
|
pmodload 'editor'
|
||||||
|
|
||||||
|
# Return if requirements are not found.
|
||||||
|
if (( ! $+commands[fasd] )); then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# Initialization
|
||||||
|
#
|
||||||
|
|
||||||
|
cache_file="${0:h}/cache.zsh"
|
||||||
|
if [[ "${commands[fasd]}" -nt "$cache_file" || ! -s "$cache_file" ]]; then
|
||||||
|
# Set the base init arguments.
|
||||||
|
init_args=(zsh-hook)
|
||||||
|
|
||||||
|
# Set fasd completion init arguments, if applicable.
|
||||||
|
if zstyle -t ':prezto:module:completion' loaded; then
|
||||||
|
init_args+=(zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Cache init code.
|
||||||
|
fasd --init "$init_args[@]" >! "$cache_file" 2> /dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
source "$cache_file"
|
||||||
|
|
||||||
|
unset cache_file init_args
|
||||||
|
|
||||||
|
function fasd_cd {
|
||||||
|
local fasd_ret="$(fasd -d "$@")"
|
||||||
|
if [[ -d "$fasd_ret" ]]; then
|
||||||
|
cd "$fasd_ret"
|
||||||
|
else
|
||||||
|
print "$fasd_ret"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Aliases
|
||||||
|
#
|
||||||
|
|
||||||
|
# Changes the current working directory interactively.
|
||||||
|
alias j='fasd_cd -i'
|
||||||
|
|
@ -72,7 +72,7 @@ alias pacman-remove-orphans="${_pacman_sudo}${_pacman_frontend} --remove --recur
|
|||||||
# Synchronizes the local package and Arch Build System databases against the
|
# Synchronizes the local package and Arch Build System databases against the
|
||||||
# repositories.
|
# repositories.
|
||||||
if (( $+commands[abs] )); then
|
if (( $+commands[abs] )); then
|
||||||
alias pacu="${_pacman_sudo}${_pacman_frontend} --sync --refresh && ${_pacman_sudo}abs"
|
alias pacu="${_pacman_sudo}${_pacman_frontend} --sync --refresh && sudo abs"
|
||||||
else
|
else
|
||||||
alias pacu="${_pacman_sudo}${_pacman_frontend} --sync --refresh"
|
alias pacu="${_pacman_sudo}${_pacman_frontend} --sync --refresh"
|
||||||
fi
|
fi
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
Z
|
|
||||||
=
|
|
||||||
|
|
||||||
Integrates [z][1] into Prezto, which maintains a frequently used directory
|
|
||||||
list for fast directory changes.
|
|
||||||
|
|
||||||
Aliases
|
|
||||||
-------
|
|
||||||
|
|
||||||
- `j` changes the current working directory to the most *frecent* match.
|
|
||||||
|
|
||||||
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/rupa/z
|
|
||||||
[2]: https://github.com/sorin-ionescu/prezto/issues
|
|
||||||
|
|
Submodule modules/z/external deleted from 9bf5feb86a
@ -1,19 +0,0 @@
|
|||||||
#
|
|
||||||
# Maintains a frequently used directory list for fast directory changes.
|
|
||||||
#
|
|
||||||
# Authors:
|
|
||||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
|
||||||
#
|
|
||||||
|
|
||||||
# Set the directory changing command.
|
|
||||||
_Z_CMD='j'
|
|
||||||
|
|
||||||
# Prevent symbolic link resolution.
|
|
||||||
_Z_NO_RESOLVE_SYMLINKS=1
|
|
||||||
|
|
||||||
# Source module files.
|
|
||||||
source "${0:h}/external/z.sh"
|
|
||||||
|
|
||||||
# Cleanup.
|
|
||||||
unset _Z_{CMD,NO_RESOLVE_SYMLINKS}
|
|
||||||
|
|
77
modules/zaw/README.md
Normal file
77
modules/zaw/README.md
Normal file
@ -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
|
||||||
|
|
1
modules/zaw/external
Submodule
1
modules/zaw/external
Submodule
Submodule modules/zaw/external added at c3308b675d
69
modules/zaw/init.zsh
Normal file
69
modules/zaw/init.zsh
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
#
|
||||||
|
# Integrates zaw into Prezto.
|
||||||
|
#
|
||||||
|
# Authors:
|
||||||
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||||
|
#
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
@ -152,3 +152,32 @@ zstyle ':prezto:module:prompt' theme 'sorin'
|
|||||||
|
|
||||||
# Auto start a session when Zsh is launched in a SSH connection.
|
# Auto start a session when Zsh is launched in a SSH connection.
|
||||||
# zstyle ':prezto:module:tmux:auto-start' remote 'yes'
|
# 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'
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user