ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Nim​Plus

by vanyle ST4

Nim plugin for Sublime Text 4 with IDE like features

Details

Installs

  • Total 1K
  • Win 694
  • Mac 205
  • Linux 496
Dec 21 Dec 20 Dec 19 Dec 18 Dec 17 Dec 16 Dec 15 Dec 14 Dec 13 Dec 12 Dec 11 Dec 10 Dec 9 Dec 8 Dec 7 Dec 6 Dec 5 Dec 4 Dec 3 Dec 2 Dec 1 Nov 30 Nov 29 Nov 28 Nov 27 Nov 26 Nov 25 Nov 24 Nov 23 Nov 22 Nov 21 Nov 20 Nov 19 Nov 18 Nov 17 Nov 16 Nov 15 Nov 14 Nov 13 Nov 12 Nov 11 Nov 10 Nov 9 Nov 8 Nov 7 Nov 6
Windows 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1 2 2 0 0 0 0 0 0 0 0 0 2 0 1 0 0 0 0 0 0 0 1 0 4
Mac 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Linux 1 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 1 0

Readme

Source
raw.​githubusercontent.​com

NimPlus

(Formerly named SublimeNim)

Nim Programming Language plugin for Sublime Text 4

Requires version 4073 or higher.

  • Q: Why not use NimLime ?
  • A: NimLime dropped support for NimSuggest and Nimble. It now focuses on providing language highlighting support. The goal of NimPlus is to have IDE like support for Nim including autocompletion, type information tooltips and more (see the Features section)

We currently support Window and Linux. Other OS might work but aren't tested.

Features

  • Syntax highlighting
  • Highlight errors (Using nim check)
  • Show tooltips with type informations
  • Goto Definition (link inside tooltip)
  • Autocompletion (based on nimsuggest)
  • Shows your documentation
  • Keyboard shortcuts for building and generating documentation
  • Prettify your code with nimpretty

demo

Installation

Package Control is required. Find how to install it here: https://packagecontrol.io/installation If you have other packages installed, you probably also have already installed Package Control.

  1. Ctrl+Shift+P
  2. Select Package Control: Add repository
  3. Enter URL: https://github.com/vanyle/NimPlus
  4. Install package
  5. NimPlus
  6. Enter

Settings, Usage and Tips

To see what NimPlus is capable of, open the Command Palette (Ctrl+Shift+P ), and type NimPlus. This will list most NimPlus features.

You can install the ANSIescape package to enjoy the syntax coloring of the terminal when building. This is optional.

Depending on how much you want Sublime to behave as an IDE or as a text editor, you can toggle the following features. You can see all the toggles inside your preference file.

Open it with: Preferences > Package Settings > NimPlus > Settings - Default

Error highlighting

Toggle with nimplus.savecheck

After saving, will check the current file for errors. See screenshot above.

Tooltips

Toggle with nimplus.hoverdescription

Will show the types and the docstring of the variable and procedure you hover over.

Auto completion

Toggle with nimplus.autocomplete

Will propose completion options based on nimsuggest's sug feature.

You need to enable autocompletion in Sublime Text settings

Build shortcuts

Ctrl+B : Compile and Run the current nimble project

Ctrl+Shift+B : Compile the current nimble project

You can change these with:
Preferences > Package Settings > NimPlus > Key Bindings - Default

Possible configuration:

[
    {
        "keys":["ctrl+b"],
        "command":"run_nim" // put run_nim or run_nimble depending on if you use nim more as a scripting tool or for big projects.
    },
    {
        "keys":["ctrl+shift+b"],
        "command":"compile_nim" // same here
    },

]

When building, the result will be shown inside the Sublime Text terminal. You might want to change this behavior. The first settings controls the regular builds and the second setting controls the nimble builds. The compilation will always occur inside the Sublime Text terminal, only the run command can be customized.

// possible values:
// `[]` => Use the Sublime Text terminal (readonly)
// `["wt"]` => Use Windows Terminal
// `["start","cmd","/k"]` => Please use something more modern ...
// `["start","powershell","-Command"]` => Use Powershell
{
    // other values ...
    "nimplus.nim.console":["wt"],
    "nimplus.nimble.console":["wt"]
}

By default, NimPlus does not use the Build System integrated into Sublime Text. Instead, NimPlus uses custom commands that perform the building. This allows us to control what terminal is used to run the command and other options.

If you prefer using Build System, comment the lines inside the Key Bindings - Default files to disable the Custom Sublime Nim building and check the option in:

Tools > Build System > Nim

Note that the Build System does not support nimble.

Usage with Terminus

Terminus is a package that adds a real terminal inside Sublime Text with colored output and interaction and evverything.

If it is installed, you can run your programs inside of it instead of the default output panel with the config switch “js "nimplus.use_terminus”: true

Contributing
------------

Pull requests are **not** welcome.
I might still merge them if I feel like it thou.
Open an issue if you have a problem.