.nim

What is a .nim file?

Nim Source File · Code and data · Andreas Rumpf and the Nim team · 2008

A .nim file is Nim source code, a compiled language with Python-like indentation syntax and C-like speed. It compiles through C, giving small, fast binaries with easy interop.

Category
Code and data
MIME type
Type
Plain text
Is a .nim file safe to open? Caution. A .nim file is program source. Compiling and running it executes its code; review unfamiliar files first.

What is a .nim file used for?

Nim's pitch is 'looks like Python, runs like C': whitespace-based syntax and type inference on top of a compiler that emits C (or JavaScript), so programs are small, fast and portable.

It has a powerful macro system and optional garbage collection, which attracts systems programmers and game developers who want expressiveness without a heavy runtime.

What opens a .nim file?

The .nim format opens in the following apps, grouped by operating system. If one app does not work, try another from the same list.

Windows

  • VS Code (Nim extension)
  • any text editor

macOS

  • VS Code (Nim extension)
  • any text editor

Linux

  • VS Code (Nim extension)
  • any text editor

Open a .nim file step by step

  1. Confirm the file really is a .nim. Drop it into the WhatFileType identifier, which reads its signature in your browser without uploading anything.
  2. On Windows, open it with VS Code (Nim extension) or any text editor.
  3. On Mac, use VS Code (Nim extension) or any text editor.
  4. On Linux, try VS Code (Nim extension) or any text editor.
  5. Still stuck? Convert the .nim to exe (compiled), which opens more widely.

Why can't I open my .nim file?

Almost always because no installed app understands Nim. Install one of the apps above, or convert the file to a format your existing software already reads. If double-clicking opens the wrong program instead of nothing at all, the file association is set to the wrong app rather than the file being broken.

The other possibility is that the file is not really a .nim at all. Drop it into the file identifier to check it by its bytes instead of its name. Nothing is uploaded.

How to convert a .nim file

You can convert a .nim file to exe (compiled), js (compiled) using a conversion tool or the export menu of an app that opens it.

Nim has no fixed magic number, so there is no signature table on this page. Its bytes alone do not prove the format: identification relies on the extension, the structure of the content and the program that created it. The magic-numbers reference lists the formats that do carry one.

Frequently asked questions

What is a .nim file?

A .nim file is Nim source code, a compiled language with Python-like indentation syntax and C-like speed. It compiles through C, giving small, fast binaries with easy interop.

How do I run a .nim file?

Install Nim and run nim c -r file.nim, which compiles the file and runs the resulting binary in one step.

Is Nim as fast as C?

Close. Nim compiles to C and leans on the C compiler's optimizer, so well-written Nim generally lands in the same performance class as C and C++.

Why does Nim look like Python?

It deliberately borrows Python's indentation-based, low-punctuation syntax to stay readable, while remaining a statically typed, compiled language.

Related formats

Sources

Details on this page were checked against authoritative references. How sources are ranked and what is deliberately left out is set out in the methodology.