From 6fac7bc1914d4727e5cacdb46a2d12955ab8a12e Mon Sep 17 00:00:00 2001 From: Mazin Bokhari Date: Wed, 12 Jul 2017 22:43:29 -0700 Subject: [PATCH] Updated Examples (markdown) --- Examples.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Examples.md b/Examples.md index 2d2d542..b03dc39 100644 --- a/Examples.md +++ b/Examples.md @@ -515,6 +515,16 @@ v() { } ``` +Suggested by [@mazinbokhari](https://github.com/mazinbokhari/dotfiles) +``` +# fasd & fzf change directory - open best matched file using `fasd` if given argument, filter output of `fasd` using `fzf` else +v() { + [ $# -gt 0 ] && fasd -f -e ${EDITOR} "$*" && return + local file + file="$(fasd -Rfl "$1" | fzf -1 -0 --no-sort +m)" && vi "${file}" || return 1 +} +``` + ### cd #### Integration with [zsh-interactive-cd](https://github.com/changyuheng/zsh-interactive-cd). @@ -580,6 +590,17 @@ z() { } ``` +Suggested by [@mazinbokhari](https://github.com/mazinbokhari/dotfiles) +``` +# fasd & fzf change directory - jump using `fasd` if given argument, filter output of `fasd` using `fzf` else +z() { + [ $# -gt 0 ] && fasd_cd -d "$*" && return + local dir + dir="$(fasd -Rdl "$1" | fzf -1 -0 --no-sort +m)" && cd "${dir}" || return 1 +} +``` + + ### Shell bookmarks Yet another useful application for `fzf`: shell bookmarks. It looks as follows: