Re: IPython Syntax Highlighting for the Nice Editor (and JOE)
Matthias Bussonnier <[email protected]> Wed, 22 Feb 2017 21:37:52 -0800
| Newsgroups | gmane.comp.python.ipython.devel |
|---|---|
| Message-ID | <CANJQusX66umDAH2UbCAe2dtSPFeHniOhP8pWPpQMtTKy+km8HQ@mail.gmail.com> |
Sweet ! Thanks for sharing !, I'm not even sure IPython has the correct highlighting everywhere ! -- M On Wed, Feb 22, 2017 at 7:41 PM, Carl Smith <[email protected]> wrote: > 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: > > @line_magic > > def appserver(args): > > > path, port = server_argparse(args) > > % dev_appserverpy $path --port $port > > > @line_magic > > 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): > > https://gist.github.com/carlsmith/fb451f9a8f5a6e699e3eaeda40d3918a > > 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 . > > Best, > -- Carl Smith > [email protected] > > > > _______________________________________________ > IPython-dev mailing list > [email protected] > https://mail.scipy.org/mailman/listinfo/ipython-dev >