NimEdit User Manual

"Copying bad design is not good design."

NimEdit is a new editor / IDE written completely in Nim for Nim. Its design is minimalistic and yet it is one of the most powerful editors out there. Once you tried it for a while, you cannot go back to other tools.

Concepts

NimEdit consists of an "editor", a "prompt", a list of "tabs" as well as a "console":

You can right click on a tab to close it.

Shortcuts

CTRL+ASelect everything.
CTRL+BAbort the currently running program (break). Note that CTRL+C always copies.
CTRL+CCopy.
CTRL+VPaste.
CTRL+XCut.
CTRL+EExecute a Nim script. The currently selected Text is passed to the Nim script.
CTRL+FSearch a phrase in the input buffer. Use i after the search term to perform a case insensitive match, y for a style insensitive match, and b (or w) to make the search care about word boundaries.
CTRL+HSearch and replace. The same options as for search are available.
CTRL+ZUndo the previous edit operation.
CTRL+SHIFT+ZRedo the previous edit operation. Undo the undo command.
CTRL+GGoto line number.
CTRL+UUpdate the syntax highlighting and remove search result markers.
CTRL+OOpen a file.
CTRL+SSave the current file.
CTRL+NOpen a new buffer.
CTRL+QClose the current buffer.
CTRL+MOpen a minimap. The minimap contains a list of all declarations in the current Nim file.
CTRL+SpaceOpen auto-complete. If the caret is behind a dot, nimsuggest is queried.
ESCSwitch between editor and prompt.
F1Switch between editor and console.
F2Nimsuggest integration: Goto definitions/usages.
F3Goto next editing location. NimEdit automatically tracks the most recent locations that you edited. This feature replaces the common "bookmarks" feature found in other editors.
F5Rerun the most recently executed nim command. Scriptable.
F6-F12Scriptable.

Commands

Many shortcuts like CTRL+E give the focus to the "prompt". This prompt replaces many traditional UI elements with a command line interface. The syntax is simply "command arg1 ... argN". Arguments are seperated by whitespace. You can also use single quotes ('term') or double quotes ("term"). The standard escape sequences like \t are available within double quotes. Every command is case insensitive.

e, exec
Run a Nim script. Select some text, press CTRL+e, type "doQuote" (without the quotes), press ENTER to get an idea of what this does.
q, quit
Quit without any questions asked of whether you want to save any unsaved changes!
o, open
Open a file. Note that tab completion works, so enjoy.
s, save
Save the current file. If you give an argument the file will be "saved as" instead.
f, find phrase search_options
Find all occurances of a phrase in the current buffer.
r, replace phrase replacement search_options
Replace all occurances of a phrase in the current buffer. You will be asked about every replacement.

search_options is a string of single letters with no whitespace in between.

search_optionsmeaning
wRespect word boundaries. Note: Searches for single letters trigger this automatically. Use s to override this behaviour.
sDo not respect word boundaries.
pPrecise search, do not ignore case sensitivity.
fOnly search for the term in the active tab. Otherwise every tab is searched.
rComing soon: Regular expression based search.
lang
Set the programming language of the current buffer. Note that currently only a limited choice of programming languages is supported.
LF, CRLF, CR
Set the line endings of the file to LF or CRLF or CR. When the buffer is saved the next time, all line endings will be converted.
tab, tabs, tabsize
Set the tab size of the file to the specified number of spaces.
config
Open the configuration file. Note that configuration changes are applied as soon as the config is saved. Try to play with the colors and see what happens.
scripts
Open the NimScript support. Note that scripting changes are applied as soon as the config is saved.
project [projectname]
Set the project name that you are currently working on. The nimsuggest tool is called with this setting.
sug start
Restart nimsuggest.
sug stop
Stop nimsuggest.
sug debug
Enable nimsuggest debug mode, passes --debug to nimsuggest.
sug debug off
Disable nimsuggest debug mode.

NimScript integration

Type scripts into the prompt. Take a look at the implementation of what happens if F6 is pressed:

proc pressedF6*() =
  let w = getCurrentIdent(true)
  insert("<$1></$1>" % w)
  setCaret(getCaret() - w.len - "</>".len)

The API that NimEdit exposes is documented here: editor.html