Live data from Hacker News

Writing an editor in less than 1000 lines of code, just for fun

antirez.com

81–90 of 146 posts

Re: Writing an editor in less than 1000 lines of code, just for fun

#81
post #46
post #38

Earlier quoted context omitted.

> I know k is up, because I constantly k in bash What is ESC-k supposed to do in Bash?

The poster probably changed his bash to use vi editing mode with set -o vi. In this mode, k would put the text of the last command entered back on the prompt.

I do switch deadline to vi mode, since that's the editor I use the most.

I'm always surprised by people who are on the vi/vim side of vi/emacs debates but then use the defaults emacs mode in deadline!

Re: Writing an editor in less than 1000 lines of code, just for fun

#83
post #39
post #24

From the github page, "Kilo is a small text editor in less than 1K lines of code. [..] The project [..] was written in just a few hours" Either this has to be a unstructured mess of copy and paste and not worth anyones time or the author is lying about the time he used on this. Both alternatives are unappealing.

Or you're making assumptions based on your own skills? Have you seen what e.g. Notch can do in a few hours of live coding?

If you create a screencast I assume you give it your best. Look at the typing skills demonstrated in the screencast accompanying this project, https://asciinema.org/a/90r2i9bq8po03nazhqtsifksb

Judging from the screencast he use around 10 seconds per line. That would be, (10s * 1000 loc)/3600 = 2.7 hours just to type 1000 lines of code. Programming is of course not typing, but a mental activity first and foremost. Let's say he is incredible smart [1] and helped by copy and past, so on average he uses 90 seconds to program one line. That is, 25 hours. Of course it will take a few days to create a 1000 line C program that does anything useful.

And of course I know that "a few hours" is just something one say to look cool. I just don't think it is cool.

1. His naive redlock and following discussion on HN a while ago was not convincing, https://news.ycombinator.com/item?id=11065933

Re: Writing an editor in less than 1000 lines of code, just for fun

#84
post #39
post #24

From the github page, "Kilo is a small text editor in less than 1K lines of code. [..] The project [..] was written in just a few hours" Either this has to be a unstructured mess of copy and paste and not worth anyones time or the author is lying about the time he used on this. Both alternatives are unappealing.

Or you're making assumptions based on your own skills? Have you seen what e.g. Notch can do in a few hours of live coding?

Just out of curiosity, where can I see what Notch can do in a few hours of code? Is there some screencast of him coding?

Re: Writing an editor in less than 1000 lines of code, just for fun

#85

Earlier quoted context omitted.

> In your car, do you move the turn signal lever up or down to indicate a right turn? You rotate it the same direction you're about to rotate the wheel. The vi navigation keys have no such convenient correspondence.

The J kinda looks like an arrow pointing down. If you squint.

I also like what Someone (literally their username, lol) pointed out on another comment, that you can think of K as "klimb" to move up.

Re: Writing an editor in less than 1000 lines of code, just for fun

#86
post #18

Earlier quoted context omitted.

Yeah but that is so much less usable. Quick, which one is up?

Just look at your keyboard :-) ( https://en.m.wikipedia.org/wiki/ADM-3A#Legacy ) I always try to remember them by noting that the leftmost key moves left, the rightmost key moves right (not too hard), and that 'K climbs' (using alliteration to remember that). That leaves 'J' for cursor down. In practice, though, I use the cursor keys. Luckily, they work on the editors/systems I work on nowadays. Side effect is that I…

Off-topic: I love your username. See https://news.ycombinator.com/item?id=12068116

Re: Writing an editor in less than 1000 lines of code, just for fun

#87
post #39

Earlier quoted context omitted.

Or you're making assumptions based on your own skills? Have you seen what e.g. Notch can do in a few hours of live coding?

Just out of curiosity, where can I see what Notch can do in a few hours of code? Is there some screencast of him coding?

For example, https://www.youtube.com/watch?v=KcfFJ6pNEZk Keep in mind, this is 48 hours and he had created a "few" games before this.

Re: Writing an editor in less than 1000 lines of code, just for fun

#88

Earlier quoted context omitted.

That issue basically forced me to switch from plain-text to html emails, and thence to the slippery slope of using italics and the OCD of syntax highlighting my code snippets..

I dread the slow insinuation of "the web" into email. Specifically, the need to use a rendering engine like Blink or Gecko to read an email. Is there anything I can do to tempt you to switch back to plain-text emails?

In my defense, I still eschew html as far as possible. Even when I use html the messages are multipart, and the text versions usually are complete. I do this thing when I reply where I open the gmail menu, switch to plain text and then switch back to html. This has the effect of stripping out all styling from the message I am replying to, replacing html block quotes with conventional '>'s, and so on. That makes it easier for me to quote passages and so on.

I think of it as 99%[1] text/html with format=flowed, and if gmail ever added format=flowed to text mode[2] I'd switch back in a heartbeat.

[1] The remaining 1% of the time I'm composing something long enough that it has more in common with publishing than 1-1 communication.

[2] I wouldn't hold my breath: http://productforums.google.com/d/topic/gmail/Z42NibAOzjc/di.... More likely I'll stop using gmail one of these years..

Re: Writing an editor in less than 1000 lines of code, just for fun

#89

What challenges might you have if you wanted to implement something like this inside a game framework like Unity or MonoGame with C#, where it renders everything via DirectX or OpenGL?

If you were looking to do this and wanted a text library that is more flexible than MonoGame's bitmap fonts, I maintain the QuickFont library for text rendering with OpenTK: https://github.com/opcon/quickfont. It doesn't have very good unicode support though.

Re: Writing an editor in less than 1000 lines of code, just for fun

#90

@Antirez please please please let this thing have a future: there is a great need for a modern, simple and usabile CLI editor.

I think the whole point of this post was that it's a lot of fun to write code if you know it's not going to be taken seriously or used in the long-term, so what you're asking seems to be the exact opposite of why this was created.
Post reply on HN