[IPython-dev] IPython Syntax Highlighting for the Nice Editor (and JOE)

Carl Smith carl.input at gmail.com
Wed Feb 22 22:41:29 EST 2017

The Nice Editor (also known as ne) is a user-friendly alternative to Emacs
and Vim, hailed by *Linux Voice* as "the third best editor for Linux". It's
simple and fast, and feels really modern, like Sublime, not like nano. I
love it, and use it with IPython, so recently asked about adding a syntax
highlighter for editing IPython blocks and ipy files. The lead developer,
Sebastiano Vigna (vigna), was super helpful, and implemented it.

With IPython commands, you can highlight the bang or percent character one
colour and the actual command a different colour, and it works with =!
statements (and is not confused by Python's modulo and not-equals
operators). Nice could potentially highlight the commands as shell syntax,
but the simplicity of the current solution is *nice*. It looks like this:


*def **appserver*(args):

    path, port = server_argparse(args)

    *%* dev_appserverpy $path --port $port


*def **sonicboom*(port):

    *def **kill*(process):

        id = process.split()[1]

        *!* kill -9 $id

        *return* int(id)

    processes =*!* lsof -i tcp:$port

    graveyard = [ kill(process) *for* process *in* processes *if* "(LISTEN)"
*in* process ]

If you are interested in using this at the moment, the file you need is
here (as a gist):


JOE (Joe's Own Editor) uses the same syntax highlighting definitions, so
the file will work with that editor too.

There are links to HTML and PDF versions of the Nice Editor docs at
http://ne.di.unimi.it .

-- Carl Smith
carl.input at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20170223/bdd7d616/attachment.html>

More information about the IPython-dev mailing list