
Vy – A Vim-like in Python made from scratch - ecthiender
https://github.com/iogf/vy
======
shadowmint
Curious, want to try it yourself before you flame it to death for being in
python 2 or claiming to be remotely plausible as a vim substitute?

    
    
      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](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.

~~~
jdimov9
Tell me again about those "python performance limitations".

~~~
dbbolton
Devil's advocate: relative to C (which vim is written in), Python 2 is
considerably slower, especially with CPython as its interpreter. Optimization
is also tougher.

Personally, I admit I'm not sure that the difference is significant for this
particular project.

~~~
Skunkleton
Honestly, python might perform better overall. Not because C is slower than
python (ha), but because python probably outperforms vim script. Especially
likely because vim plug-ins can be fairly complex.

~~~
duaneb
The actual operations on text buffers are going to be the hardest part to
implement in python performantly.

~~~
alexchamberlain
They're the bits you could push down to C and/or use one of many jiting
options.

~~~
shadowmint
Realistically this is like saying you could rewrite git in python and just
push the hard bits down into C; the problem is that you end up writing a
significant portion of both the core, and plugins, in C.

When you're writing all of the main parts of the editor in C, at this point,
why are you using python at all?

~~~
alexchamberlain
I'm not necessarily defending the rewrite here, but writing something like git
in Python, profiling then optimising the parts that are slow doesn't sound
like a bad idea.

------
emilssolmanis
> [..] on top of tkinter which is one of the most productive graphical
> toolkits.

> ..

> [..] 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...

~~~
jofer
Tkinter actually isn't _that_ bad. I've written several fairly large
applications with it. You have to re-invent the wheel for several things due
to its limited number of "widgets". It used to look very non-native, but
that's been largely fixed. Other than that, though, it has a worse reputation
than it deserves.

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.

~~~
bch
What sorts of widgets are missing that you are wishing (no pun intended) for.

~~~
jofer
Yay, puns! :)

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.

------
blux
> The source code of the syntax highlighting plugin is about 80 lines of code.

Which is not that big of an achievement considering it depends on pygments for
syntax highlighting...

------
michaelmrose
I don't believe Bram said it would replace vim I think he took something out
of context.

------
santiagobasulto
"I'm working on a ncurses based library with a symmetrical archicture to
python tkinter". That sounds nice.

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.

~~~
OJFord

        > it could use some tidying up.
    

Yes..

    
    
        def beta(area):
            print 'shit'
            area.chmode('BETA')

------
xmstr
Looks interesting but why not Python 3.x?

~~~
jdimov9
Because there is no good reason to use 3.x and 2.x is the natural choice that
makes perfect sense?

~~~
michaelmior
Why is 2.x the "natural choice"? I'm not saying it's a bad choice, but you
seem to be treating it as a given.

~~~
metalliqaz
Enormous install base.

------
OJFord

        > a great chance to substitute vim in the future.
    

Why? What's the advantage over vim?

~~~
kachnuv_ocasek
Presumably because of its modularity and extensibility. He was probably right,
just look at Neovim.

~~~
OJFord
Hm, maybe. I quite like the look of 'plugins', even the vi-ness is handled by
one. But it seems a strange thing to say in the readme - it's clearly a long
way off being close to a contender.

~~~
navait
Sometimes, to attract attention, you need to say things that will get people
riled up.

------
stevebmark
Interesting project. Vim is riddled with issues and we badly need a
replacement (coming from a dedicated Vim user). Currently VimR and NeoVim are
in the lead for tackling some of the hard problems (async calls, a real plugin
system, obvious features like fuzzy finder with good UI integration, etc).

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!

------
florianletsch
Hm, why do most of his files end with 10 to 15 blank lines of whitespace? Is
that a thing or was he just sloppy?

~~~
leetNightshade
I don't think it's "common", but people do it so they can scroll to the last
line and have it appear near the top of the page. It's a matter of personal
preference. Some editors allow you to scroll that far without the extra lines,
many don't.

~~~
thinkpad20
What editors don't do that? I'm only familiar with Emacs and Sublime which do.
I'd hate to use an editor that didn't. Hopefully he added that functionality
to Vy :)

~~~
OJFord
Vim does by default, which he seems to use judging by the .swp files present
in git..

~~~
ianff
.swp files in git is further evidence of sloppiness though.

~~~
OJFord
Yes, I absolutely agree. I'm sure I've been guilty of it (I'd rid them if I
noticed of course) but it's a pretty sloppy-looking project. Not holding my
breath for it to replace vim.

------
reikonomusha
Am I wrong in thinking that this is a Tk Text widget (or possibly several),
with a selection of functions atop? Plugins for the most part are just key
press callbacks which manipulate this Text widget and associated state?

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.

------
qznc
Looks similar to [http://www.vixn.org/](http://www.vixn.org/)

------
mden
Some of the cleanest code I've seen! Pretty fun skimming through files and
functions.

~~~
reikonomusha
There's lots of field mutation in the assortment of classes and functions with
no documentation. Also lots of stuff that resembles this:

    
    
        for ind in chain:
            val = execute(ind, event)
    
            if val == True:    opt = True
            elif val == False: opt = False
    
        return opt

------
synparb
pyvim
([https://github.com/jonathanslenders/pyvim](https://github.com/jonathanslenders/pyvim))
is also a pretty slick vim clone in python that uses the python prompt toolkit
([https://github.com/jonathanslenders/python-prompt-
toolkit](https://github.com/jonathanslenders/python-prompt-toolkit))

~~~
nunull

      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.

~~~
VMG
relevant: [https://github.com/yi-editor/yi](https://github.com/yi-editor/yi)

------
alphakiller
this is cool. [https://youtu.be/HXvjh1p7gSY](https://youtu.be/HXvjh1p7gSY)

