summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2013-11-10 16:11:29 -0800
committerJunegunn Choi <junegunn.c@gmail.com>2013-11-10 16:11:29 -0800
commitff34c6b2724f1f527a117a1a5df2e2b9d1358ee3 (patch)
tree176b54eef9a720fd58f007f05196b2db176a4849
parent1e9e5978374503c77508790f9dfb7704d309f506 (diff)
parentb2ac52462ccb678d0d5ae1a3d6dd4dab129377de (diff)
Merge pull request #5 from Vifon/zsh-widgets0.3.1
new zsh widgets
-rw-r--r--README.md27
1 files changed, 21 insertions, 6 deletions
diff --git a/README.md b/README.md
index efd6c80c..f14ec94f 100644
--- a/README.md
+++ b/README.md
@@ -177,20 +177,35 @@ zsh widgets
-----------
```sh
-# CTRL-T - Paste the selected file path into the command line
+# CTRL-T - Paste the selected file(s) path into the command line
fzf-file-widget() {
- LBUFFER+=$(
- find * -path '*/\.*' -prune \
- -o -type f -print \
- -o -type l -print 2> /dev/null | fzf)
+ local FILES
+ local IFS="
+"
+ FILES=($(
+ find * -path '*/\.*' -prune \
+ -o -type f -print \
+ -o -type l -print 2> /dev/null | fzf -m))
+ unset IFS
+ FILES=$FILES:q
+ LBUFFER="${LBUFFER%% #} $FILES"
zle redisplay
}
zle -N fzf-file-widget
bindkey '^T' fzf-file-widget
+# ALT-C - cd into the selected directory
+fzf-cd-widget() {
+ cd "${$(find * -path '*/\.*' -prune \
+ -o -type d -print 2> /dev/null | fzf):-.}"
+ zle reset-prompt
+}
+zle -N fzf-cd-widget
+bindkey '\ec' fzf-cd-widget
+
# CTRL-R - Paste the selected command from history into the command line
fzf-history-widget() {
- LBUFFER+=$(history | fzf +s | sed "s/ *[0-9]* *//")
+ LBUFFER=$(history | fzf +s | sed "s/ *[0-9]* *//")
zle redisplay
}
zle -N fzf-history-widget