skip to Main Content

Just finished full installation of Nim language to my Debian GNU/linux and feel a bit confused, not finding any development kits or at least console commands to try some scripting… Isn’t it supposed to be included into instalation packages?

So I’ll be thankfull to any advice how to choose between all aviable IDE or interfaces for coding with Nim on Linux.

2

Answers


  1. Nim isn’t included in any development kits as far as I’m concerned. There are a lot of editors with Nim addons though. That includes most popular editors like VSCode, emacs or vim.

    If you wanted to you could just use a terminal as an interface with a simple editor.

    Login or Signup to reply.
  2. Nim’s main entry point is the nim command. As long as you have that, you can compile and run nim programs all right:

    $ cat > test.nim
    echo "Hello nim!"
    $ nim c -r test.nim
    CC: stdlib_io.nim
    CC: stdlib_system.nim
    CC: test.nim
    Hint:  [Link]
    Hint: 14205 LOC; 1.218 sec; 20.496MiB peakmem; Debug build; proj: /private/tmp/t/test.nim; out: /private/tmp/t/test [SuccessX]
    Hint: /private/tmp/t/test  [Exec]
    Hello nim!
    $ 
    

    You can also embed that as a shebang into an executable hi.nim file and run it:

    #!/usr/bin/env nim c --hints:off -r
    
    echo "Hi nim scripting!"
    

    But you will get a compiled binary without the .nim extension along the original file, so it’s kind of awkward for scripting.

    UPDATE: As suggested by @shirleyquirk you can also save .nims files with a special shebang that will run them as NimScript, which has some limitations compared to normal Nim code but should be fine for most if not all typical scripts.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search