forked from sorin-ionescu/prezto
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# | ||
# Maintains a frequently used file and directory list for fast access. | ||
# | ||
# Authors: | ||
# Wei Dai <[email protected]> | ||
# Sorin Ionescu <[email protected]> | ||
# | ||
|
||
# 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' | ||
|