diff options
| author | Yigit Sever | 2021-10-08 00:05:34 +0300 |
|---|---|---|
| committer | Yigit Sever | 2021-10-08 00:05:34 +0300 |
| commit | 75d6e605a64d2f862942afb57f1ff5668d60ae52 (patch) | |
| tree | 8d9da281e33f1f58b5e5d063ec0de4e9a3777cb4 /.local/bin/rfv | |
| parent | 0287e6b35edab6c2694a8c59f5a5195e0de13014 (diff) | |
| download | dotfiles-75d6e605a64d2f862942afb57f1ff5668d60ae52.tar.gz dotfiles-75d6e605a64d2f862942afb57f1ff5668d60ae52.tar.bz2 dotfiles-75d6e605a64d2f862942afb57f1ff5668d60ae52.zip | |
bin: track bunch of scripts
Diffstat (limited to '.local/bin/rfv')
| -rwxr-xr-x | .local/bin/rfv | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/.local/bin/rfv b/.local/bin/rfv new file mode 100755 index 0000000..4c9a632 --- /dev/null +++ b/.local/bin/rfv | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | #!/usr/bin/env bash | ||
| 2 | |||
| 3 | # 1. Search for text in files using Ripgrep | ||
| 4 | # 2. Interactively narrow down the list using fzf | ||
| 5 | # 3. Open the file in Vim | ||
| 6 | IFS=: read -ra selected < <( | ||
| 7 | rg --color=always --line-number --no-heading --smart-case "${*:-}" | | ||
| 8 | fzf --ansi \ | ||
| 9 | --color "hl:-1:underline,hl+:-1:underline:reverse" \ | ||
| 10 | --delimiter : \ | ||
| 11 | --preview 'bat --color=always {1} --highlight-line {2}' \ | ||
| 12 | --preview-window='up:60%:+{2}+3/3:~3' | ||
| 13 | ) | ||
| 14 | [ -n "${selected[0]}" ] && nvim "${selected[0]}" "+${selected[1]}" | ||
