Hacker News new | past | comments | ask | show | jobs | submit login
Why I Wrote a Programmer's Text Editor (rsms.me)
177 points by pgebhard on Jan 25, 2011 | hide | past | favorite | 58 comments



I can attest to the awesomeness of both Kod and Rasmus.

Especially Rasmus, I coded up the whole indentation feature and he had to completely rewrite everything I made because of efficiency issues (I'm not that great with objC yet) and he didn't even complain.

Great guy.


Don't sell yourself short. Just having a working prototype can be a god-send, no matter how inefficient.


It happened to be my second time ever coding in objC, so I'm fairly certain it was crap.

My later patches (think I've made two or three so far) got accepted without change :)

Hope I have time soon to make the automagic indentation feature that's possible with the new AST thingy. Also hope somebody hasn't beaten me to it yet :P


> It happened to be my second time ever coding in objC, so I'm fairly certain it was crap.

Your intellectual honesty and ability to judge your work dispassionately, as well as the fact that he accepted your work, lead me to believe that it might not have been crap.

See: Dunning Kruger effect. :)

http://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect


"If you can do a half-assed job of anything, you're a one-eyed man in a kingdom of the blind."

- Kurt Vonnegut


Is the font rendering on this guy's site screwed up for anyone else? The "t"'s have something wrong with them: http://ompldr.org/vNzVrZg/why_i_wrote_a_programmers_text_edi...

Firefox 3.6 on Linux.


He is using font face embedding of the 'Droid Serif'. Probably some issue with the typography conversion or with windows rendering the fonts badly (i get the weird t also in windows 7).


Seems to be an issue with the Droid font files. I'll look into it.


Looks okay on chrome 9 on ubuntu lts:

His two font choices Georgia: http://i.imgur.com/Lp6QL.png

Droid Serif: http://i.imgur.com/0Kja4.png


Yeah, it looks OK for me in Chromium (dev channel) & Opera as well.


As for screwness: when I try to enlarge fonts using FF 3.6 Ctrl-+, I suddently get a gray band on the right that hides half of the text.

I cannot read the default font, sorry.


I didn't notice, gray on white background is a bit hard to see.


Came in to say that his "t"s looked really weird. Chrome.


I think it is a bug in the font he's fetching.


Chrome 8.0 on Windows 7, yes.


I was particularly surprised by the behavior of the tab key:

https://github.com/rsms/kod/wiki/Indentation

In a nutshell, if you press tab while anywhere on a line, it indents. Shift-Tab de-dents the line. After thinking about it a bit, I think I could get used to it. I like that they're exploring ideas like this.

I would like preferences "CMD ," to be bound to something though even if it's to opening the configuration file itself. It's a bit disconcerting to not be given an explanation of why there are no preferences. I didn't understand the reasoning until I read this blog posting.


I think you're describing the type of behavior that emacs uses when you press tab, except it indents the line according to the default tab style associated with the file type. It's great for programming; I never have to worry about indentation because it's handled automatically.


I use smart-tab.el in emacs, the completion/tab handling is the most intuitive I've found.

http://www.emacswiki.org/emacs/TabCompletion#toc2

It expands if at the end of a word, and indents otherwise.


I'm really looking forward to seeing this project develop. It has the potential to spawn a whole host of "webby" editing components..

As Rasmus aluded, in-browser editors aren't really tractable right now, but if everything about Kod but the runtime is written in JS, you could imagine all sorts of interesting browser ports or hosted options down the road.


Love the chromium backend of it - I'd love it even more if it were merged with vim in a macvim-esque sort of way.


The description says its chromium-like, not that it used code from Chrome, unfortunately.


It do uses some Chromium code. See https://github.com/rsms/chromium-tabs


Cool! Detaching a tab into its own window (process?) is kinda magic for me.


Emacs would be awesome too. :-)


I disagree. Don't mix it. Just make port for linux so normal people can use it.


People who use Linux on the desktop are, statistically speaking, not even close to normal.


This is a programmers editor. From the population of people who use such editors, using Linux really isn't all that uncommon.


Sure. But for the power user, for the full-time developer, there's no point in going for something like Kod. Learning vim or emacs is actually not that hard.

As Rasmus points out in this blog post, he's aiming for a different crowd: people for whom programming is a secondary activity.


I would suggest that even among the population of simply "power users", Linux usage is not uncommon.


I initially read this as "people who use Linux are odd" and had a much needed chuckle. After reading it's descendants I don't think that's how you meant it, but thanks, nonetheless.


I agree. Both are amazingly powerful editors and seeing a nice/powerful GUI on top of it might make me switch over from a CLI. Time to branch this project.


This! Oh, this!


Can someone explain the relationship between Kod and node.js?

The Kod website says it is "based on node.js", but I don't quite get that. I'm familiar with node.js as a server-side platform, but are we about to see a bunch of node.js desktop apps?


It's scriptable via javascript (because people generally get how to script with that) and is using node.js internally to run said javascript.


Exactly. Node.js is—just like Python, Ruby or LUA—an embed-able general-purpose JS runtime. You can simply link with libnode. Kod then uses a mix of libdispatch and libev constructs to perform inter-thread communication. The code for doing this is fairly orthogonally designed and can be found in the KNode* and node* source files.


I don't think anything is like Lua when it comes to embedding; I mean, it's what, 100k? Hard to top that.


I don't quite understand - are you saying that the lower the amount of lines of code, the easier it is to embed? Or better in some other way? Or something else entirely?


Lua strikes a very sweet balance, almost to its own detriment: you have an Schemish language, with huge user-base, at 100k. OTOH, since Lua is always an option, people put off using it until "necessary", and start their apps in cruft like C and C++.

The ease of embedding is not a matter of sice; both Python and Tcl are trivial to embed, almost as much as Lua. But they come with relatively larger footprint, and the quality of the languages themselves are not up to par (i.e. not "Schemish" enough)

This is ALL subjective anyway; by quality I mean what would please me personally. I already code in my ideal language.


Yes, Python was going to be my counterexample - it's very easy to embed yet much bigger than 100k lines.

The 'not Schemish enough' I don't understand - unless it's a passive aggressive way of saying that anything that is not Scheme or Scheme-like is not a good language, which is a boring discussion I'm not going to go into. Well unless there is a reason that Scheme-like languages have some specific advantages that make them especially suited to being embedded, in which case I'd like to learn.

Regarding size, I don't think that's much of a problem today (leaving aside embedded or mobile dev, which I don't think we're talking about). Maybe a huge VM can cause issues in some specific circumstances, but much of the size of 'bigger' languages is going to be in the standard library anyway, in which case it's preferable for a user to have a large enough selection to work with, depending on the application domain.


> Yes, Python was going to be my counterexample - it's very easy to embed yet much bigger than 100k lines.

He's not talking about lines of code – the lua interpreter/runtime is only approximately 150kB in size.


More like 200kb (17kloc), but that's still not bad. Heck, SQLite is ~500kb, and does anybody hesitate to embed that?

Lua has a pretty nice C API, too.


io[1] has 10k lines and is embeddable. It's somewhat similiar to Lua.

[1]: http://www.iolanguage.com/


Lua's performance is dramatically better, and it has a more mature toolchain.

I'm interested in io, too, but I've had trouble even getting it to build on BSD.


Tcl/TinyTcl, IO


Nice, just found Kod yesterday while browsing around Github and gave it a try. Really like the dark syntax highlighting, looks very pleasing. I seem to have a font-rendering issue though, the text looks kinda blurry.


This comment perfectly encapsulates the value proposition.


Look really nice. Too bad it's just OSX and as jjcm and xtacy pointed out, too bad it doesn't support vim or emacs bindings/integration in some way.

I really like your UI choices borrowing so heavily from Chrome, though. Really do... updates personal notes


> too bad it doesn't support vim or emacs bindings/integration in some way.

Well the bindings could probably be added[0], it's OSS and probably rather small still.

Emacs integration on the other hand, that would be rather harder.

[0] actually, since it uses standard Cocoa (text) controls it already has some Emacs-type bindings (C-a, C-e, C-f, C-b, C-k, C-p, C-n, ...) and you can define more (or redefine existing stuff) via DefaultKeyBinding.dict, just about any NSResponder action message (and there are quite a bunch of them) should be available for binding [1] And it even allows you to bind multiple actions to a single keystroke or to bind key sequences (à la Emacs's C-x C-s)

[1] http://xahlee.org/emacs/osx_keybinding.html


Cool. Thanks for the resource! I've never used OSX, so I didn't know you could rebind the window manager's controls. Good stuff.


Yeah that's one of those weird things in OSX which likely come from its NeXT roots: you can extremely easily configure/customize things you would never expect being able to touch on a non-OSS product.


What about TextMate? Is this aimed at a different crowd?


Does anyone know how the tabs are integrated into the system? Is it a library or did he just try to recreate the experience?


He used the Chromium Tabs: https://github.com/rsms/chromium-tabs


Hey thanks! I wish github had search through code bases!


Plan on putting it in the Mac App Store?


Eventually. Kod is still a very young and a relatively immature product, but as it stabilizes (in several aspects) we will make it available in the Mac App Store.


Interesting tale of the development of Kod, the Mac OS X code editor.


This is awesome, I recently switched to vim after Textmate just became too outdated, but the usability of VIM is just terrible. I love what I see in Kod, but I won't change just yet, when are you planning to start charging for it ? I'll change when I can pay for it.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: