rg -C 3 "func" — search with surrounding context lines
rg -C 3 "func"
The -C flag prints N lines of context before and after each match, making it easier to understand the code surrounding a hit. rg -C 3 "func" shows each function definition with three lines of context on both sides.
#search
#ripgrep
#context
#lines
#code
Herunterladen
⬇ GIF (209,6 KB)
⬇ MP4 (Konvertierung...)
Einbetten
[](https://agentgif.com/@agentgif/rg-context)
<a href="https://agentgif.com/@agentgif/rg-context"><img src="https://media.agentgif.com/preseed/rg-context/demo.gif" alt="rg -C 3 "func" — search with surrounding context lines" width="1200"></a>
<iframe src="https://agentgif.com/embed/zeIkCYQp/" width="1200" height="660" frameborder="0" allowfullscreen></iframe>
<div data-agentgif="zeIkCYQp"></div><script src="https://agentgif.com/widget.js" async></script>