commit
ff34c6b272
23
README.md
23
README.md
@ -177,20 +177,35 @@ zsh widgets
|
|||||||
-----------
|
-----------
|
||||||
|
|
||||||
```sh
|
```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() {
|
fzf-file-widget() {
|
||||||
LBUFFER+=$(
|
local FILES
|
||||||
|
local IFS="
|
||||||
|
"
|
||||||
|
FILES=($(
|
||||||
find * -path '*/\.*' -prune \
|
find * -path '*/\.*' -prune \
|
||||||
-o -type f -print \
|
-o -type f -print \
|
||||||
-o -type l -print 2> /dev/null | fzf)
|
-o -type l -print 2> /dev/null | fzf -m))
|
||||||
|
unset IFS
|
||||||
|
FILES=$FILES:q
|
||||||
|
LBUFFER="${LBUFFER%% #} $FILES"
|
||||||
zle redisplay
|
zle redisplay
|
||||||
}
|
}
|
||||||
zle -N fzf-file-widget
|
zle -N fzf-file-widget
|
||||||
bindkey '^T' 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
|
# CTRL-R - Paste the selected command from history into the command line
|
||||||
fzf-history-widget() {
|
fzf-history-widget() {
|
||||||
LBUFFER+=$(history | fzf +s | sed "s/ *[0-9]* *//")
|
LBUFFER=$(history | fzf +s | sed "s/ *[0-9]* *//")
|
||||||
zle redisplay
|
zle redisplay
|
||||||
}
|
}
|
||||||
zle -N fzf-history-widget
|
zle -N fzf-history-widget
|
||||||
|
Loading…
Reference in New Issue
Block a user