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…
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 ke…
Pure Python Vim clone
71–80 of 85 posts
Re: Pure Python Vim clone
#72Q: Why Python? A: The only alternative would be Haskell, but I still have to learn that. Wow, that would be interesting.
Yi[0] is an editor written in Haskell. [0]: https://github.com/yi-editor/yi
Re: Pure Python Vim clone
#73Earlier quoted context omitted.
Types. They Will Save You Tests™ :-)
I had actually gone and looked for Lua static type checkers. Some exist, but none that'll work with Lua 5.2. I had a really hilarious bug today where under some circumstances all the text in the display would be replaced by numbers. Small integers, each placed where the word should be. What had happened is that I'd added a layer of indirection; where previously, after line wrapping, the data structure for a rendered…
Re: Pure Python Vim clone
#74Is there any vim clone that actually have full support to vimfiles?
Does https://github.com/neovim/neovim not?
Every clone I see try to reproduce vim usage, but none really try to run vimfiles. I think running vimfiles is a must have for a clone to get real users.
Re: Pure Python Vim clone
#75Re: Pure Python Vim clone
#76Earlier quoted context omitted.
Types. They Will Save You Tests™ :-)
Here's some research on the topic, limited to just types- http://evanfarrer.blogspot.com/2012/06/unit-testing-isnt-eno... Types are one mechanism for static analysis. Better contracts (nullability, valid ranges, etc) goes much further.
Re: Pure Python Vim clone
#77Earlier quoted context omitted.
You know, I hear people use this excuse to justify bad behavior a lot. I once heard a bike messenger tell me that brakes gave him a false sense of security so that's why he didn't have a brake on his fixed gear bicycle.
OTOH, I also see a lot of people justifying their point with a single random anecdote. (But I agree wholeheartedly re: fixies and brakes.)
Re: Pure Python Vim clone
#78Earlier quoted context omitted.
I had actually gone and looked for Lua static type checkers. Some exist, but none that'll work with Lua 5.2. I had a really hilarious bug today where under some circumstances all the text in the display would be replaced by numbers. Small integers, each placed where the word should be. What had happened is that I'd added a layer of indirection; where previously, after line wrapping, the data structure for a rendered…
For your example bug I think you're wrong that static types would have made the bug impossible. What you need is strong type checking and a lack of auto-conversion. For example, in Java, this compiles: int[] bodies = {1, 2, 3}; for (int body : bodies) { String formatted_body = " " + body + " "; callMethodWithStrArg(formatted_body); } And if in this hypothetical case it was previously a `String[] bodies` and a `String…
I had totally forgotten that Java does it too, despite having done `""+i` lots of times as a cheap and easy and evil way to convert numbers to strings.
...I am currently rewriting a big chunk of the primary data storage to use immutable data structures, because it makes implementing Undo easier. I am having to fight the urge to redo it all in Haskell.
Re: Pure Python Vim clone
#79Earlier quoted context omitted.
Yi[0] is an editor written in Haskell. [0]: https://github.com/yi-editor/yi
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...