In reply to
I’m not much of a one-liner collector but I like this one:
vim +copen -q <(grep -r -n .)
which searches for some string and opens all instances in vim’s quickfix list (and opens the quickfix window too). Navigate the list with :cn and :cn. Complex-ish edits are the obvious use case, but I use this for browsing logs too.
Neovim improves on this with nvim -q - and [q/]q, and plenty of fuzzy finder plugins can do a better version using ripgrep, but this basic one works on any system that has gnu grep and vim.
Edit:
This isn’t exactly a command, but I can’t imagine not knowing about this anymore:
$ man grep
/ -n # double space before the dash!
brings you directly to the documentation of the -n option. Not the useless synopsis or any other paragraphs that mention -n in passing, but the actual doc for this option (OK, very occasionally it fails due to word wrap, but assuming the option is documented then it works 99% of the time).
View full thread on lemmy.blahaj.zone
0
0
0
Loading comments...