mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-19 00:53:42 -05:00
Add interactive search with example for subl
26
Examples.md
26
Examples.md
@@ -307,6 +307,32 @@ fif() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```sh
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
##
|
||||||
|
# Interactive search.
|
||||||
|
# Usage: `ff` or `ff <folder>`.
|
||||||
|
#
|
||||||
|
[[ -n $1 ]] && cd $1 # go to provided folder or noop
|
||||||
|
RG_DEFAULT_COMMAND="rg -i -l --hidden --no-ignore-vcs"
|
||||||
|
|
||||||
|
selected=$(
|
||||||
|
FZF_DEFAULT_COMMAND="rg --files" fzf \
|
||||||
|
-m \
|
||||||
|
-e \
|
||||||
|
--ansi \
|
||||||
|
--phony \
|
||||||
|
--reverse \
|
||||||
|
--bind "change:reload:$RG_DEFAULT_COMMAND {q} || true" \
|
||||||
|
--preview "rg -i --pretty --context 2 {q} {}" | cut -d":" -f1,2
|
||||||
|
)
|
||||||
|
|
||||||
|
[[ -n $selected ]] && subl $selected # open multiple files in editor
|
||||||
|
```
|
||||||
|
|
||||||
|
Suggested by [@knoxknox](https://github.com/knoxknox)
|
||||||
|
|
||||||
### Command history
|
### Command history
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|||||||
Reference in New Issue
Block a user