Created
May 16, 2025 17:12
-
-
Save fontka/a8f025f4c804012ef127f4a60dec962b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/sh | |
# USAGE: | |
# run 'todo' to search for TAGS recursively and open in quickfix | |
# redirect if you don't want to open VIM e.g. 'todo > cfile', 'todo | cat' | |
TAGS='TODO|FIXME|NOTE' | |
RMTABS_REGEX='s/\([0-9]\+:\)[\t| ]*/\1 /' | |
[ -t 1 ] && ( | |
vim -q <(fd -t f | xargs grep -nHE "$TAGS" | sed "$RMTABS_REGEX") \ | |
--cmd 'autocmd VimEnter * copen | bd2' # START WITH QUICKFIX WINDOW ONLY | |
# --cmd 'autocmd VimEnter * cw | wincmd b' # STARTS WITH FIRST MATCH BUFFER AND QUICKFIX | |
) || ( | |
fd -t f | xargs grep -nHE $TAGS | sed "$RMTABS_REGEX" | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment