mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-19 17:13:42 -05:00
add: a different ctr-t script
33
Examples.md
33
Examples.md
@@ -57,6 +57,39 @@ cdf() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
# Another CTRL-T script to select a directory and paste it into line
|
||||||
|
|
||||||
|
__fzf_select_dir ()
|
||||||
|
{
|
||||||
|
builtin typeset READLINE_LINE_NEW="$(
|
||||||
|
command find -L . \( -path '*/\.*' -o -fstype dev -o -fstype proc \) \
|
||||||
|
-prune \
|
||||||
|
-o -type f -print \
|
||||||
|
-o -type d -print \
|
||||||
|
-o -type l -print 2>/dev/null \
|
||||||
|
| command sed 1d \
|
||||||
|
| command cut -b3- \
|
||||||
|
| env fzf -m
|
||||||
|
)"
|
||||||
|
|
||||||
|
if
|
||||||
|
[[ -n $READLINE_LINE_NEW ]]
|
||||||
|
then
|
||||||
|
builtin bind '"\er": redraw-current-line'
|
||||||
|
builtin bind '"\e^": magic-space'
|
||||||
|
READLINE_LINE=${READLINE_LINE:+${READLINE_LINE:0:READLINE_POINT}}${READLINE_LINE_NEW}${READLINE_LINE:+${READLINE_LINE:READLINE_POINT}}
|
||||||
|
READLINE_POINT=$(( READLINE_POINT + ${#READLINE_LINE_NEW} ))
|
||||||
|
else
|
||||||
|
builtin bind '"\er":'
|
||||||
|
builtin bind '"\e^":'
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
builtin bind -x '"\C-x1": __fzf_select_dir'
|
||||||
|
builtin bind '"\C-t": "\C-x1\e^\er"'
|
||||||
|
```
|
||||||
|
|
||||||
### Searching file contents
|
### Searching file contents
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|||||||
Reference in New Issue
Block a user