Quantcast

IPython Syntax Highlighting for the Nice Editor (and JOE)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

IPython Syntax Highlighting for the Nice Editor (and JOE)

Carl Smith
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):


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



_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.scipy.org/mailman/listinfo/ipython-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: IPython Syntax Highlighting for the Nice Editor (and JOE)

Matthias Bussonnier
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 <[hidden email]> 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
> [hidden email]
>
>
>
> _______________________________________________
> IPython-dev mailing list
> [hidden email]
> https://mail.scipy.org/mailman/listinfo/ipython-dev
>
_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.scipy.org/mailman/listinfo/ipython-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: IPython Syntax Highlighting for the Nice Editor (and JOE)

Carl Smith
 
Thanks for sharing !, I'm not even sure IPython has the correct
highlighting everywhere !

​:) No problem.

_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.scipy.org/mailman/listinfo/ipython-dev
Loading...