2019-02-27 18:47:56 +01:00
|
|
|
# From Google's ZSH Hacks
|
2019-03-04 18:53:16 +01:00
|
|
|
# NOTE: this file has since been modified by me.
|
2019-02-27 18:47:56 +01:00
|
|
|
|
|
|
|
# Improvement to fasd's existing `zz` alias
|
|
|
|
unalias zz
|
2019-03-04 18:53:16 +01:00
|
|
|
zz() {
|
2019-02-27 18:47:56 +01:00
|
|
|
# TODO: Add documentation
|
|
|
|
local dir
|
|
|
|
dir="$(fasd -Rdl "$1" | fzf --query="$1" -1 -0 --no-sort +m)" && cd "${dir}" || return 1
|
|
|
|
}
|
|
|
|
|
2019-03-04 18:53:16 +01:00
|
|
|
fv() {
|
2019-02-27 18:47:56 +01:00
|
|
|
# Usage: fv file pattern
|
|
|
|
# This is useful when you know the fuzzy name of the file you want to edit
|
|
|
|
local file
|
|
|
|
file="$(fzf --exact --height 40% --reverse --query="$1" --select-1 --exit-0)"
|
|
|
|
[[ -n "$file" ]] && vim "$file"
|
|
|
|
}
|
|
|
|
|
2019-03-04 18:53:16 +01:00
|
|
|
tb() {
|
2019-02-27 18:47:56 +01:00
|
|
|
# Toggle between blaze-bin and your source.
|
|
|
|
# Useful if you like to cd into the dir where your source lives.
|
|
|
|
if [[ $PWD =~ '(.*)/blaze-bin(.*)' ]]; then
|
|
|
|
cd "${match[1]}${match[2]}"
|
|
|
|
else
|
|
|
|
cd "${PWD/\/google3//google3/blaze-bin}"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2019-03-04 18:53:16 +01:00
|
|
|
tj() {
|
2019-02-27 18:47:56 +01:00
|
|
|
# Toggle between the source dir and test dir.
|
|
|
|
if [[ $PWD =~ '(.*)/javatests(.*)' ]]; then
|
|
|
|
cd "${match[1]}/java${match[2]}"
|
|
|
|
else
|
|
|
|
cd "${PWD/\/google3\/java//google3/javatests}"
|
|
|
|
fi
|
|
|
|
}
|