mirror of
https://github.com/dcarrillo/prezto.git
synced 2025-07-01 10:29:25 +00:00
Compare commits
2 Commits
issue/656-
...
pull/563-c
Author | SHA1 | Date | |
---|---|---|---|
c2d6b378a6 | |||
7823bb9985 |
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -7,6 +7,3 @@
|
||||
[submodule "modules/completion/external"]
|
||||
path = modules/completion/external
|
||||
url = https://github.com/zsh-users/zsh-completions.git
|
||||
[submodule "modules/z/external"]
|
||||
path = modules/z/external
|
||||
url = https://github.com/rupa/z.git
|
||||
|
@ -57,6 +57,17 @@ key_info=(
|
||||
'BackTab' "$terminfo[kcbt]"
|
||||
)
|
||||
|
||||
# Escape sequences from Debian's inputrc.
|
||||
key_info+=(
|
||||
'ControlLeft' '\e[1;5D \e[5D \e\e[D \eOd'
|
||||
'ControlRight' '\e[1;5C \e[5C \e\e[C \eOc'
|
||||
)
|
||||
|
||||
# if [[ "$TERM" == rxvt* ]]; then
|
||||
# key_info[ControlLeft]+=' \eOd'
|
||||
# key_info[ControlRight]+=' \eOc'
|
||||
# fi
|
||||
|
||||
# Set empty $key_info values to an invalid UTF-8 sequence to induce silent
|
||||
# bindkey failure.
|
||||
for key in "${(k)key_info[@]}"; do
|
||||
@ -206,10 +217,10 @@ bindkey -d
|
||||
# Emacs Key Bindings
|
||||
#
|
||||
|
||||
for key ("$key_info[Escape]"{B,b}) bindkey -M emacs "$key" emacs-backward-word
|
||||
for key ("$key_info[Escape]"{F,f}) bindkey -M emacs "$key" emacs-forward-word
|
||||
bindkey -M emacs "$key_info[Escape]$key_info[Left]" emacs-backward-word
|
||||
bindkey -M emacs "$key_info[Escape]$key_info[Right]" emacs-forward-word
|
||||
for key in "$key_info[Escape]"{B,b} "${(s: :)key_info[ControlLeft]}"
|
||||
bindkey -M emacs "$key" emacs-backward-word
|
||||
for key in "$key_info[Escape]"{F,f} "${(s: :)key_info[ControlRight]}"
|
||||
bindkey -M emacs "$key" emacs-forward-word
|
||||
|
||||
# Kill to the beginning of the line.
|
||||
for key in "$key_info[Escape]"{K,k}
|
||||
|
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'
|
||||
|
@ -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}
|
||||
|
Reference in New Issue
Block a user