Installation

Binaries

Download binaries from the releases page.

Install via nimble

nph can be compiled or installed using nimble v0.16.4+:

# Install globally
nimble install nph

# Alternatively, clone and build:
git clone https://github.com/arnetheduck/nph.git
cd nph
nimble setup -l
nimble build

Nim version

nph requires an specific version of nim during the build process since it reuses parts of the compiler whose API frequently changes - this may lead to nim itself being built as part of the installation process!

For bonus points, replace nimpretty with a symlink to nph - similar command line options are supported ;)

Editor integration

  • VSCode (ext install NimLang.nimlang) extension via nimlangserver that supports nph out of the box
  • NeoVim - Install neoformat in your neovim setup then add the nim formating option with nph with this option in init.vim let g:neoformat_enabled_nim = ['nph']
  • Zed Editor - Use this in your editor settings
"languages": {
    "Nim": {
      "formatter": {
        "external": {
          "command": "nph",
          "arguments": ["-"]
        }
      }
    }
  }
  • vscode-nph (ext install arnetheduck.vscode-nph) for a formatting-only option for the official Nim extension.

Continuous integration

Check out the companion Github Action for a convenient CI option!