rg

Table of Contents

1. Searching

  • Make rg not respect ignore rules etc.
rg -u # --no-ignore
rg -uu # --no-ignore --hidden
rg -uuu # --no-ignore --hidden --binary
  • Search only files matching a particular glob

    rg foo -g 'README.*'
    
  • Exclude files matching a particular glob

    rg foo -g '!*.min.js'
    
  • search only HTML and CSS files

    rg -thtml -tcss foobar
    
  • Search everything except for js files

    rg -Tjs foobar
    
  • Make rg follow symlinks🌟 (this drove me nuts on nixos where my fish config was stored as symlinks!)

    rg -L doobar
    

2. Regex tips

  • \b for word boundary. eg. \braft
  • \b(var|let|const)\b

Created: 2024-07-16 Tue 16:44

Validate