2026/03/05(木) [n年前の日記]
#1 [nim] Nimのソースコードを整形したい
プログラミング言語 Nim のソースコードを整形したい。
nimpretty というツールがあるらしい。Nim と一緒に入ってた。
「--stdin」をつけると標準入力から読み取って標準出力に出してくれるらしい。普段使ってるエディタがバッファ内容を標準入力として出してくれる機能を持っているなら、フォーマッタをかけることが出来そう…。
nimpretty というツールがあるらしい。Nim と一緒に入ってた。
> nimpretty --help
nimpretty - Nim Pretty Printer Version 0.2
(c) 2017 Andreas Rumpf
Usage:
nimpretty [options] nimfiles...
Options:
--out:file set the output file (default: overwrite the input file)
--outDir:dir set the output dir (default: overwrite the input files)
--stdin read input from stdin and write output to stdout
--indent:N[=0] set the number of spaces that is used for indentation
--indent:0 means autodetection (default behaviour)
--maxLineLen:N set the desired maximum line length (default: 80)
--version show the version
--help show this help
「--stdin」をつけると標準入力から読み取って標準出力に出してくれるらしい。普段使ってるエディタがバッファ内容を標準入力として出してくれる機能を持っているなら、フォーマッタをかけることが出来そう…。
[ ツッコむ ]
以上です。