Vy – A Vim-like in Python made from scratch
github.com
github.com
git clone https://github.com/iogf/vy
cd vy
virtualenv .
./bin/pip install untwisted pygments
./bin/python setup.py install
You'll probably want to edit /vyapp/plugins/toggle_mode.py to use a KeyPress binding that is valid for your platform at this point, or you'll get: _tkinter.TclError: bad event type or keysym "Apostrophe"
...and finally, ./bin/vy
Right, now you can start playing wading your way through https://github.com/iogf/vy/blob/master/INTRO.md and try to understand the command syntax.Good luck!
Vim clones are a dime a dozen; this is actually an entirely different thing, and although I can't imagine actually using it for anything... it's interesting to see people work on different approaches to text editors.
A simple hackable python text editor may not be useful in the long term for anything (for all the reasons about distributing python and python performance limitations), but its certainly viable for prototyping interesting features.
Personally, I admit I'm not sure that the difference is significant for this particular project.
When you're writing all of the main parts of the editor in C, at this point, why are you using python at all?
Text editors are surprisingly demanding; they require complex bulk operations like search, replace and per word highlighting, which is not inconsiderable in magnitude.
Ever tried open a 100MB log file in vim?
Now try that in atom... and javascript is easily a magnitude or more faster than pure python.
I work with python and love it; its hackable, fun to write. ...but fast it is not.
And no branching out to C, or Cython or Fortran like Numpy is not the same as Python not having those limitations.
Not exactly relevant for a text editor, though.
That's not acceptable to me, even though it would be nice to have a hackable to the core editor. But we already have emacs for that, I suppose...
Yeah exactly emacs is hackable if you want to write lisp, which has a very small audience. So sure there is absolutely a desire for an editor written in a 'nice', hackable language like Python or JS (forgive me JS haters) to prosper.
For the record, while Python's pure interpreter is always going to be slow at this type of thing, JS's overhead factor compared to C is small enough that it's certainly possible to write an editor in it that feels just as fast as vim - maybe faster in some cases, e.g. since JavaScript engines JIT compile regexes and C regex libraries generally don't, or by making relatively slow operations asynchronous/multithreaded (while vim is highly synchronous). Atom seems to be just badly designed.
I think the problem with Atom speed is using the DOM / web stack, not Javascript itself.
> ..
> [..] on top of Tkinter that is such a great graphical toolkit.
Right. About as great as pulling teeth. Not that there's many alternatives, of course...
Sure, I'd rather use Qt for something large, but honestly, for a quick-and-dirty gui, it's hard to beat Tk. You can get something reasonably nice looking (at least with recent versions) and reasonably cross-platform very quickly.
The first thing that comes to mind are help tooltips (a.k.a. balloons). There are a few third-party libraries, but none of them that I'm aware of get it quite right (especially for tooltips on menu items).
There are couple of other common widgets as well, but I'm having trouble thinking of them at the moment.
At any rate, there aren't too many (and ttk helps immensely in this regard), but it's something you miss coming from Qt.
On the other hand, being able to put a minimal, but very usable gui together with just a few lines of code is a real strength of Tcl/Tk. (Though I usually use Python+Tkinter as I tend to write scientific applications.) There's a lot to be said for the right level simplicity vs batteries-included.
Tkinter is not a top GUI toolkit, but I use it all the time because it is built in to Python and requires no libraries. This is very valuable in my job. Thankfully it is fairly well documented and perfectly capable of useful desktop interfaces.
Which is not that big of an achievement considering it depends on pygments for syntax highlighting...
I'd suggest don't work trying to replace vim in the future. Work to learn and to fix any necessity that by some reason vim is not fulfilling for you. Then the world will say...
The project has a good architecture (plugins seem interesting). But it could use some tidying up.
> it could use some tidying up.
Yes.. def beta(area):
print 'shit'
area.chmode('BETA') > a great chance to substitute vim in the future.
Why? What's the advantage over vim?I found this part amusing: "What did Bram Moolenaar say". After using Vim for a few years, and seeing his design choices, I wouldn't personally be interested in his opinion of an editor!
I know every project must start somewhere but this doesn't seem to have considerable substance for a purported next gen vi(m), and given its heavy reliance on pre-made tools (like text areas), without much abstraction, it seems like it would be hard to get over the hump to make it competitive with existing editors.
for ind in chain:
val = execute(ind, event)
if val == True: opt = True
elif val == False: opt = False
return opt Q
Why Python?
A
The only alternative would be Haskell, but I still have to learn that.
That's... interesting. Would be nice if there was a reason given for that.