mieki256's diary



2026/03/05(木) [n年前の日記]

#1 [nim] Nimのソースコードを整形したい

プログラミング言語 Nim のソースコードを整形したい。

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」をつけると標準入力から読み取って標準出力に出してくれるらしい。普段使ってるエディタがバッファ内容を標準入力として出してくれる機能を持っているなら、フォーマッタをかけることが出来そう…。

以上です。

過去ログ表示

Prev - 2026/03 -
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31

カテゴリで表示

検索機能は Namazu for hns で提供されています。(詳細指定/ヘルプ


注意: 現在使用の日記自動生成システムは Version 2.19.6 です。
公開されている日記自動生成システムは Version 2.19.5 です。

Powered by hns-2.19.6, HyperNikkiSystem Project