NIMGREP(1)
π NIMGREP(1) π
okay bestie, this is the User Commands manual page for nimgrep, and it is about to make your search-and-replace era iconic. β¨
πΈ NAME πΈ
nimgrep - Nimgrep. That's the whole name, no cap. π
π¦ DESCRIPTION π¦
So this utility is literally nimgrep - Nim Grep Searching and Replacement Utility Version 2.0.0, and the copyright line is (c) 2012-2020 Andreas Rumpf. Respect the icon who made it. π
Here's the usage tea β:
- β¨ To search:
nimgrep [options] PATTERN [(FILE/DIRECTORY)*/-]
- π To replace:
nimgrep [options] PATTERN --replace REPLACEMENT
(FILE/DIRECTORY)*/-
- π To list file names:
nimgrep [options] --filenames [PATTERN] [(FILE/DIRECTORY)*]
Positional arguments, from left to right, bestie:
- PATTERN is either Regex (default) or Peg if
--pegis specified. PATTERN and REPLACEMENT should be skipped when--stdinis specified. π«Ά - REPLACEMENT supports
$1,$#notations for captured groups in PATTERN.
π DANGER:--replacemode DOES NOT ask confirmation unless--confirmis specified!
- Final arguments are a list of paths (FILE/DIRECTORY) or a standalone minus
-or not specified (empty):- empty: current directory
.is assumed (not with--replace)
- empty: current directory
π Note: so when no FILE/DIRECTORY/- is specified nimgrep does not read the pipe, but searches files in the current dir instead!
-: read buffer once from stdin: pipe or terminal input; in--replacemode the result is directed to stdout; it's not compatible with--stdin,--filenames, or--confirmπ
For any given DIRECTORY nimgrep searches only its immediate files without traversing subdirectories unless --recursive is specified. πΏ
In replacement mode we require all 3 positional arguments to avoid damaging. π‘οΈ
β¨ OPTIONS β¨
π Mode of operation π
--find,-fβ find the PATTERN (default)--replace,-!β replace the PATTERN to REPLACEMENT, rewriting the files--confirmβ confirm each occurrence/replacement; there is a chance to abort any time without touching the file--filenamesβ just list filenames. Provide a PATTERN to find it in the filenames (not in the contents of a file) or run with empty pattern to just list all files:
nimgrep --filenames
# In current dir
nimgrep --filenames "" DIRECTORY
# Note empty pattern "", lists all files in DIRECTORY
π§ Interpret patterns π§
--pegβ PATTERN and PAT are Peg--reβ PATTERN and PAT are regular expressions (default)--rex,-xβ use the "extended" syntax for the regular expression so that whitespace is not significant--word,-wβ matches should have word boundaries (buggy for pegs!)--ignoreCase,-iβ be case-insensitive in PATTERN and PAT--ignoreStyle,-yβ be style insensitive in PATTERN and PAT
π Note: PATTERN and patterns PAT (see below in other options) are all either Regex or Peg simultaneously and options--rex,--word,--ignoreCase, and--ignoreStyleare applied to all of them.
π File system walk π
--recursive,-rβ process directories recursively--followβ follow all symlinks when processing recursively--sortTime,-s[:asc|desc]β order files by the last modification time (default: off): ascending (recent files go last) or descending
π Filter files (based on filesystem paths) π
π‘ Hint: Instead ofnotyou can type justnfor negative options below.
--ex[tensions]:EX1|EX2|...β only search the files with the given extension(s), empty one (--ex) means files with missing extension--notex[tensions]:EX1|EX2|...β exclude files having given extension(s), use empty one to skip files with no extension (like some binary files are)--fi[lename]:PATβ search only files whose name matches pattern PAT--notfi[lename]:PATβ skip files whose name matches pattern PAT--di[rname]:PATβ select files that in their path have a directory name that matches pattern PAT--notdi[rname]:PATβ do not descend into directories whose name (not path) matches pattern PAT--dirp[ath]:PATβ select only files whose whole relative directory path matches pattern PAT--notdirp[ath]:PATβ skip files whose whole relative directory path matches pattern PAT
π Filter files (based on file contents) π
--inF[ile]:PATβ select files containing a (not displayed) match of PAT--notinF[ile]:PATβ skip files containing a match of PAT--bin:on|off|onlyβ process binary files? (detected by\0in first 1K bytes) (default: on - binary and text files treated the same way)--text,-tβ process only text files, the same as--bin:off
π Filter matches π
--inC[ontext]:PATβ select only matches containing a match of PAT in their surrounding context (multiline with-c,-a,-b)--notinC[ontext]:PATβ skip matches not containing a match of PAT in their surrounding context
π Represent results π
--nocolorβ output will be given without any colors--color[:on]β force color even if output is redirected (default: auto)--colorTheme:THEMEβ select color THEME fromsimple(default),bnw(black and white),ack, orgnu(GNU grep)--countβ only print counts of matches for files that matched--context:N,-c:Nβ print N lines of leading context before every match and N lines of trailing context after it (default N: 0)--afterContext:N,-a:Nβ print N lines of trailing context after every match--beforeContext:N,-b:Nβ print N lines of leading context before every match--group,-gβ group matches by file--newLine,-lβ display every matching line starting from a new line--cols[:N]β limit max displayed columns/width of output lines from files by N characters, cropping overflows (default: off)--cols:auto,-%β calculate columns from terminal width for every line--onlyAscii,-@β display only printable ASCII Latin characters0x20-0x7Esubstitutions:0 -> ^@,1 -> ^A, ...0x1F -> ^_,0x7F -> '7F, ...,0xFF -> 'FF
π¦ Miscellaneous π¦
--threads:N,-j:Nβ speed up search by N additional workers (default: 0, off)--stdinβ read PATTERN from stdin (to avoid the shell's confusing quoting rules) and, if--replacegiven, REPLACEMENT--verboseβ be verbose: list every processed file--help,-hβ shows this help--version,-vβ shows the version
Peace out bestie π β this page is from nimgrep 2.2.12, dated September 2026, and its manual is NIMGREP(1). Slay and happy grepping! β¨
π¦ where this page comes from
- arch rolling: nim 2.2.12-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms