Created
December 17, 2022 16:14
-
-
Save evgenii-malov/1ca30049f3396295f9a00d02ca4823b2 to your computer and use it in GitHub Desktop.
fzf search in files with open is visual studio code (ctrl-o)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fif() { | |
rg \ | |
--column \ | |
--no-heading \ | |
--fixed-strings \ | |
--ignore-case \ | |
--hidden \ | |
--follow \ | |
--glob '!.git/*' \ | |
--glob '!.vscode-server/*' \ | |
"$1" \ | |
| awk -F ":" '/1/ {start = $2<5 ? 0 : $2 - 5; end = $2 + 5; print $1 " " $2 " " $3 " " start ":" end}' \ | |
| fzf \ | |
--bind 'ctrl-o:execute(code --goto {1}:{2}:{3})+cancel' \ | |
--preview 'batcat --wrap character --color always {1} --highlight-line {2} --line-range {4}' \ | |
--preview-window wrap | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment