Last active
August 31, 2018 08:55
-
-
Save AeroCross/5ca7d2a47e21a9b51835f6c382f56ff4 to your computer and use it in GitHub Desktop.
Recursively and incrementally search a directory and open the file in Visual Studio Code
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
# depends on fzf and ag | |
function search_file_contents() { | |
ag --nobreak --numbers --column --noheading . | \ | |
fzf --exact --delimiter=: --nth=2.. | \ | |
cut -d : -f 1-2 | \ | |
xargs -n 1 code -g $1 | |
} | |
alias f=search_file_contents | |
# without leaving fzf (pressing enter) | |
function search_file_contents() { | |
ag --nobreak --numbers --column --noheading . | \ | |
fzf --exact --delimiter=: --nth=2.. --bind 'enter:execute#echo {} | cut -d : -f 1-3 | xargs -n 1 code -g $1#' | |
} | |
alias f=search_file_contents |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment