News for hackers. Stuff that matters.
Re:Pure Python Vim clone by amelius on Sunday April 26, 2015 @04:13PM (#9443097)
Why not decouple the following things:

- Core editor (internal representation, etc.)

- Key bindings (so you could easily create an emacs instead of a vi)

- Rendering

- Scripting language (for customized behavior)

Finally, make sure you thoroughly document these building blocks, so others can create really cool stuff with it. Also, think of possible use-cases when defining the modules. A smart architecture could allow for a collaborative editor, for example.

Re:Pure Python Vim clone by jonathan_s on Sunday April 26, 2015 @04:42PM (#9443186)
Hi, thanks for the suggestions! Actually, the internal representation, is completely separate from the layout. It's not in another repository, but it's decoupled.

The key bindings are also separate. Getting emacs bindings is not much more than changing this line [0]. Only adding the bindings for the window management and emacs command line is still to be done. (I know that emacs is actually much more than only its key bindings, but you know what I mean.)

The rendering is also independent. There are two backends: vt100 terminals and the windows console. (Honesly, my main focus is vt100, but any render back-end is possible. I think even graphical)

The same for the event loops by the way, it can run on a couple of event loops. For instance asyncio.

Documentation will follow. prompt-toolkit has already quite a lot of examples, and there's a lot of documentation in the code itself. But I agree that we should keep improving.

Cheers!

[0] https://github.com/jonathanslenders/pyvim/blob/master/pyvim/...

Re:Pure Python Vim clone by AnkhMorporkian on Sunday April 26, 2015 @09:42PM (#9444026)
I want to compliment you on your code. It's so rare to see clean python code. I am almost never able to be able to jump into a file in a module and understand exactly what's happening, but you fucking nailed it. Well done!
Re:Pure Python Vim clone by notfoss on Tuesday April 28, 2015 @03:56AM (#9450940)
I believe he follows pep8 ;)
Re:Pure Python Vim clone by amjith on Sunday April 26, 2015 @04:58PM (#9443233)
The prompt_toolkit (core library) which is the basis for pyvim (same author), is well structured and modular. https://github.com/jonathanslenders/python-prompt-toolkit

There are plenty of examples in the repo that cover most of the features in the library. The awesome thing is all of the examples fit in a single page, a testament to the power and simplicity of the library.

I built pgcli (https://github.com/dbcli/pgcli) almost entirely by reading the examples.

Re:Pure Python Vim clone by Svenstaro on Sunday April 26, 2015 @05:24PM (#9443325)
Will you please make pgcli compatible with the most recent prompt_toolkit release?
Re:Pure Python Vim clone by jonathan_s on Sunday April 26, 2015 @05:36PM (#9443372)
@amjith: we should do that indeed. If you don't have the time, I'll help you doing it later on.