-
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.
- _fasd_preexec() and fasd_cd are autoloadable functions - Backported some PRs from clvv/fasd - [clvv/fasd#54] Correction of newline print statement in fasd_cd - [clvv/fasd#75] fasd_cd: return 1 in case no dir was found - *Partial* [clvv/fasd#77] XDG Compliance - [clvv/fasd#99] Do not "eval" in zsh's _fasd_preexec
- Loading branch information
1 parent
9ccecfd
commit e67806b
Showing
3 changed files
with
49 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,38 @@ | ||
# | ||
# Fasd Configuration | ||
# | ||
|
||
(( $+commands[fasd] )) || return 1 | ||
|
||
# _fasd_config="${XDG_CONFIG_HOME:-"$HOME/.config"}/fasd/config" | ||
_FASD_DATA="${XDG_CACHE_HOME:-"$HOME/.cache"}/fasd/fasd" | ||
_fasd_cache="${XDG_CACHE_HOME:-"$HOME/.cache"}/fasd/init" | ||
_fasd_hooks="$(print zsh-{c,w}comp{,-install})" | ||
|
||
### Initialize fasd | ||
|
||
for dir ($_FASD_DATA $_fasd_cache) { | ||
[[ -d ${dir:h} ]] || mkdir -p ${dir:h} | ||
} | ||
|
||
# Cache initialization code if needed | ||
if [[ "$commands[fasd]" -nt "$_fasd_cache" || ! -s "$_fasd_cache" ]]; then | ||
fasd --init ${=_fasd_hooks} >| "$_fasd_cache" | ||
fi | ||
source "$_fasd_cache" | ||
|
||
### Aliases | ||
|
||
# Standard | ||
alias a='fasd -a' | ||
alias s='fasd -si' | ||
alias sd='fasd -sid' | ||
alias sf='fasd -sif' | ||
alias d='fasd -d' | ||
alias f='fasd -f' | ||
alias z='fasd_cd -d' | ||
alias zz='fasd_cd -d -i' | ||
|
||
# Extra | ||
alias v='f -e $EDITOR' | ||
|
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 @@ | ||
{ fasd --proc $(fasd --sanitize "$2") } >> "$_FASD_SINK" 2>&1 |
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,10 @@ | ||
# function to execute built-in cd | ||
if [ $# -le 1 ]; then | ||
fasd "$@" | ||
else | ||
local _fasd_ret="$(fasd -e 'printf %s' "$@")" | ||
[ -z "$_fasd_ret" ] && return 1 | ||
[ -d "$_fasd_ret" ] && cd "$_fasd_ret" || printf '%s\n' "$_fasd_ret" | ||
fi | ||
|
||
# vim: ft=zsh |