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

Updated Examples (markdown)

Guy Stan
2020-07-23 20:20:16 +01:00
parent 68df5039da
commit 8eeefb7157

@@ -297,7 +297,8 @@ fif() {
```sh
# alternative using ripgrep-all (rga) combined with fzf-tmux preview
# implementation below makes use of "open" on macOS, which can be replaced by other commands if needed.
# This requires ripgrep-all (rga) installed: https://github.com/phiresky/ripgrep-all
# This implementation below makes use of "open" on macOS, which can be replaced by other commands if needed.
# allows to search in PDFs, E-Books, Office documents, zip, tar.gz, etc. (see https://github.com/phiresky/ripgrep-all)
# find-in-file - usage: fif <searchTerm> or fif "string with spaces" or fif "regex"
fif() {
@@ -307,22 +308,6 @@ fif() {
}
```
Suggested by [@gbstan](https://github.com/gbstan)
```sh
# alternative using ripgrep-all (rga) combined with sk preview
# This requires sk (skim) installed: https://github.com/lotabout/skim
# This will open the selected entry with SublimeText at the precise line and column where the entry is
# skrga: rga + subl - usage: skrga or skrga match_in_content_of_files or skgra regex_match_in_content_of_files
# If you provide arguments to skrga you can then use ctrl+q on the list of matches to filter with patterns appearing in each of the lines returned by sk
skrga() {
local file
file="$(sk-tmux --bind "ctrl-p:toggle-preview" --ansi -i --cmd-query "$*" -c 'rga --ignore-case --color=always --line-number --column {}' --preview 'bat --color=always --style=header,numbers --highlight-line "$(echo {1}|cut -d: -f2)" --line-range "$(($(echo {1}|cut -d: -f2))):$(($(echo {1}|cut -d: -f2)+50))" "$(echo {1}|cut -d: -f1)"')"; [[ $? -eq 0 ]] && echo "opening $file" && subl "$(echo "$file"|cut -d: -f1):$(echo "$file"|cut -d: -f2):$(echo "$file"|cut -d: -f3)" || return 1;
}
```
Suggested by [@gbstan](https://github.com/gbstan)
```sh
#!/bin/bash