News for hackers. Stuff that matters.
Re:Pure Python Vim clone by kgadek on Sunday April 26, 2015 @12:55PM (#9442357)

  Q: Why Python?
  A: The only alternative would be Haskell, but I still have to learn that.
Wow, that would be interesting.
Re:Pure Python Vim clone by fadsasda432 on Sunday April 26, 2015 @01:11PM (#9442437)
Hi, I once tried that, but I ran into problems with lazyness. In particular my data structure was rather simple (famous gap data structure), but editing "large" files (>1000LOC) became rather unpleasant (too big input-feedback latency).

However I managed to build a _very_ basic proof-of-concept editor (no dependencies) in just a few hundreds lines of code which I could explain, but until now I was too shy to share it as it did not involve magic abstract Haskell-foo ... ;)

Re:Pure Python Vim clone by codygman on Sunday April 26, 2015 @03:46PM (#9443018)
> I was too shy to share it as it did not involve magic abstract Haskell-foo

Please don't be, simple understandable Haskell code is very nice :)

Plus if there is a better way of doing it you get to find that out too.

Re:Pure Python Vim clone by implicit on Sunday April 26, 2015 @02:13PM (#9442684)
That's a shame!

"Gets the job done in just a few hundred lines of easily-explained code" is a terrific standard to meet.

"Magic abstract Haskell-fu" cannot improve such a program very much.

Re:Pure Python Vim clone by wz1000 on Sunday April 26, 2015 @01:26PM (#9442486)
Yi[0] is an editor written in Haskell.

[0]: https://github.com/yi-editor/yi

Re:Pure Python Vim clone by viraptor on Sunday April 26, 2015 @09:43PM (#9444029)
It's got an amazing (I'm not sure if that's in a good or bad way) system for reloading config. Config is code. Reconfiguration means recompiling. If you reload the config, you recompile yi and reexec it - file handles and other information is left laying around so you end up in exactly the same state as before. It's slightly scary from the programming side...
Re:Pure Python Vim clone by wz1000 on Monday April 27, 2015 @07:08AM (#9445475)
Xmonad does the same thing.
Re:Pure Python Vim clone by euid on Sunday April 26, 2015 @02:06PM (#9442649)
Emulates Vim quite nicely, too.
Re:Pure Python Vim clone by bsummer4 on Sunday April 26, 2015 @02:29PM (#9442745)
Not really, no. yi badly needs some more love.
Re:Pure Python Vim clone by codygman on Sunday April 26, 2015 @03:50PM (#9443035)
Care to elaborate on where it falls down emulating vim?
Re:Pure Python Vim clone by bsummer4 on Sunday April 26, 2015 @09:01PM (#9443914)
Yi is really nice, overall. The code is clean too.

I don't remember all of the issues, but there are a ton of small things that make the editor unusable to me. I used it for a couple of weeks, and I spent some time working on these issues, but never had PR-worthy code. Here's what I can remember off the top of my head:

- Startup time is very slow because of the way configuration works. In my local copy, I made a version without runtime configuration, and that solved this problem. This conflicts pretty badly with the whole architecture, so I didn't make a PR.

- :n :N don't work. Opening multiple files from the command line doesn't work.

- :cq doesn't work. I fixed this, but my fix was a hack, so I didn't make a PR.

- Operating on regions with '{' and '}' is off by one line in some directions.

- You can't replace regions with shell commands. For example, using '!}sort' to sort a paragraph.

Re:Pure Python Vim clone by codygman on Monday April 27, 2015 @05:46PM (#9449304)
Cool! I guess my evaluation of Yi/vim emulation was more cosmetic than I thought :)