https://github.com/arnetheduck/nph
  
  
    An opinionated code formatter for Nim 
    https://github.com/arnetheduck/nph
  
formatter nim
        Last synced: 7 months ago 
        JSON representation
    
An opinionated code formatter for Nim
- Host: GitHub
 - URL: https://github.com/arnetheduck/nph
 - Owner: arnetheduck
 - License: other
 - Created: 2023-12-10T10:40:02.000Z (almost 2 years ago)
 - Default Branch: master
 - Last Pushed: 2025-03-21T13:16:03.000Z (8 months ago)
 - Last Synced: 2025-03-31T04:04:51.506Z (7 months ago)
 - Topics: formatter, nim
 - Language: Nim
 - Homepage:
 - Size: 1.59 MB
 - Stars: 102
 - Watchers: 3
 - Forks: 12
 - Open Issues: 1
 - 
            Metadata Files:
            
- Readme: README.md
 - Changelog: CHANGELOG.md
 - License: copying.txt
 
 
Awesome Lists containing this project
README
          # nph
`nph` is an opinionated source code formatter for the Nim language, aiming to
take the drudgery of manual formatting out of your coding day.
Following the great tradition of [`black`](https://github.com/psf/black/),
[`prettier`](https://prettier.io/), [`clang-format`](https://clang.llvm.org/docs/ClangFormat.html)
and other AST-based formatters, it discards existing styling to create a
consistent and beautiful codebase.
## Documentation
Documentation is available [here](https://arnetheduck.github.io/nph/).
## Quickstart
Install `nph`, then run it on some files:
```sh
# Format the given files in-place
nph file0.nim file1.nim
# Format the given files, writing the formatted code to /tmp
nph file0.nim file1.nim --outdir:/tmp
# Format an entire directory
nph src/
# Use --check to verify that a file is formatted as `nph` would - useful in CI
nph --check somefile.nim || echo "Not formatted!"
# You can format stuff as part of a pipe using `-` as input:
echo "echo 1" | nph -
```
More information about features and style available from the [documentation](https://arnetheduck.github.io/nph/)
## Installation
Binaries are available from the [releases page](https://github.com/arnetheduck/nph/releases/tag/latest) on Github.
`nph` can be also compiled or installed using `nimble` v0.16.4+:
```sh
# Install globally
nimble install nph
# Alternatively, build in source folder:
nimble setup -l
nimble build
```
See the [installation instructions](https://arnetheduck.github.io/nph/installation.html) in the manual for more details.
## Editor integration
Editor integrations are described [in the manual](https://arnetheduck.github.io/nph/installation.html#editor-integration).
## Continuous integration
Check out the [companion Github Action](https://github.com/arnetheduck/nph-action) for a convenient CI option!