feat(revamp): add zsh and neovim configs, add an install script and a dependencies list
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
# 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 shell completion to work, this module must be loaded _after_ the
|
||||
[_`completion`_][5] module.
|
||||
|
||||
The Prezto Fasd configuration differs from the default. The default aliases have
|
||||
been disabled.
|
||||
|
||||
## Installation
|
||||
|
||||
`fasd` is bundled with prezto as a git submodule. Alternatively, you can
|
||||
manually install `fasd`. If a manual installation is found, it will be used
|
||||
instead of the bundled version.
|
||||
|
||||
## Aliases
|
||||
|
||||
Aliases are enabled by default. To disable them, add the following to
|
||||
_`${ZDOTDIR:-$HOME}/.zpreztorc`_.
|
||||
|
||||
```sh
|
||||
zstyle ':prezto:module:fasd:alias' skip 'yes'
|
||||
```
|
||||
|
||||
- `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][6]._
|
||||
|
||||
- [Wei Dai](https://github.com/clvv)
|
||||
- [Sorin Ionescu](https://github.com/sorin-ionescu)
|
||||
|
||||
[1]: https://github.com/whjvenyl/fasd
|
||||
[2]: https://github.com/joelthelion/autojump
|
||||
[3]: https://github.com/rupa/z
|
||||
[4]: https://github.com/rupa/v
|
||||
[5]: ../completion#readme
|
||||
[6]: https://github.com/sorin-ionescu/prezto/issues
|
||||
@@ -0,0 +1,59 @@
|
||||
#
|
||||
# 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'
|
||||
|
||||
# If the command doesn't exist externally, we need to fall back to the bundled
|
||||
# submodule.
|
||||
if (( ! $+commands[fasd] )); then
|
||||
source "${0:h}/external/fasd" || return 1
|
||||
fi
|
||||
|
||||
#
|
||||
# Initialization
|
||||
#
|
||||
|
||||
cache_file="${XDG_CACHE_HOME:-$HOME/.cache}/prezto/fasd-cache.zsh"
|
||||
if [[ "${commands[fasd]}" -nt "$cache_file" \
|
||||
|| "${ZDOTDIR:-$HOME}/.zpreztorc" -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
|
||||
|
||||
mkdir -p "$cache_file:h"
|
||||
# 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
|
||||
#
|
||||
|
||||
if ! zstyle -t ':prezto:module:fasd:alias' skip; then
|
||||
# Changes the current working directory interactively.
|
||||
alias j='fasd_cd -i'
|
||||
fi
|
||||
Reference in New Issue
Block a user