m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-18 00:03:39 -05:00

Add missing function wrapper for vf and cf

Francis T. O'Donovan
2016-05-26 12:34:55 -04:00
parent 182b65aa13
commit 2a86b754e9

@@ -32,6 +32,7 @@ fo() {
# vf - fuzzy open with vim from anywhere # vf - fuzzy open with vim from anywhere
# ex: vf word1 word2 ... (even part of a file name) # ex: vf word1 word2 ... (even part of a file name)
# zsh autoload function # zsh autoload function
vf() {
local files local files
files=(${(f)"$(locate -Ai -0 $@ | grep -z -vE '~$' | fzf --read0 -0 -1 -m)"}) files=(${(f)"$(locate -Ai -0 $@ | grep -z -vE '~$' | fzf --read0 -0 -1 -m)"})
@@ -41,6 +42,7 @@ then
vim -- $files vim -- $files
print -l $files[1] print -l $files[1]
fi fi
}
``` ```
### Changing directory ### Changing directory
@@ -84,6 +86,7 @@ fdr() {
# cf - fuzzy cd from anywhere # cf - fuzzy cd from anywhere
# ex: cf word1 word2 ... (even part of a file name) # ex: cf word1 word2 ... (even part of a file name)
# zsh autoload function # zsh autoload function
cf() {
local file local file
file="$(locate -Ai -0 $@ | grep -z -vE '~$' | fzf --read0 -0 -1)" file="$(locate -Ai -0 $@ | grep -z -vE '~$' | fzf --read0 -0 -1)"
@@ -97,6 +100,7 @@ then
cd -- ${file:h} cd -- ${file:h}
fi fi
fi fi
}
``` ```
Suggested by [@harelba](https://github.com/harelba) and [@dimonomid](https://github.com/dimonomid): Suggested by [@harelba](https://github.com/harelba) and [@dimonomid](https://github.com/dimonomid):
@@ -112,7 +116,6 @@ cdf() {
```sh ```sh
# Another CTRL-T script to select a directory and paste it into line # Another CTRL-T script to select a directory and paste it into line
__fzf_select_dir () __fzf_select_dir ()
{ {
builtin typeset READLINE_LINE_NEW="$( builtin typeset READLINE_LINE_NEW="$(