Akatombo Web Log
Thursday, August 17, 2006
Entering Japanese in TextMate
One of the big problems with TextMate for me is the lack of ability to handle Japanese text correctly. Anyone who uses it with Japanese will know what I’m talking about. Japanese text entry can pretty much cause the application to freeze, though I find that tapping a combination of space, escape, and enter will eventually unstick it and insert a bunch of junk into my file, which I can then erase. That is the biggest problem, and is the one for which I have found a partial solution. The other problem is that it can’t seem to handle rendering the font correctly and every character starts halfway through the one proceeding it, making reading virtually impossible.
I’ll explain my half solution here and propose a possible hack that could make this work better and keep you from accidentally freezing your app when Mac OS X decides it is time to jump into Japanese entry mode without asking.
The solution is very simple: when you use find and replace window Japanese text is handled fine. So hitting cmd-f before entering Japanese text, then cmd-a to select all, cmd-c to copy, cmd-w to close the find window, and cmd-v to paste the text into the document you were on at the insertion point gets Japanese text into the document without problem. That may sound like a long list of keyboard shortcuts, but they are all natural, muscle-memory shortcuts for me and, I’d guess, for most power users. Still it remains a pain in the posterior, and since no other applications require a workflow like this I end up with a Japanese-text-frozen text mate about half the time. There has to be a better way!
A proposal for the other half
I can think of a number of things that could be done to automate the workflow described above, but let me describe the one that seems to me most likely to be achievable through the use of existing tools (It may even be poossiblw with bundles though it was beyond me to figure out in the brief time I looked into it):
I envision some type of environment monitor that can be set on a per-app basis that would allow the firing of actions before certain actions when in certain environments. This app would be configured as follows for text mate. When in TextMate in an Asian-character input mode and the active window a document, a character producing keystroke would open up the find and replace dialog before sending the keystroke through. When the active window is the find and replace dialog and in an Asian-character input mode, switching to an non-Asian-character input mode or hitting cmd-w would execute the following: cmd-a,cmd-c,cmd-w,cmd-v,switch input mode if that was what triggered the sequence.
This idea is a total kludge, but would certainly make my life easier. Like I say, there are a ton of other ways to do pretty much the same thing (a find and replace document wouldn’t even have to be the external editor). In addition you’d really want any selected text to be copied to the external editor, and a lot of other little niceties, but as it sounds like it will be quite a while until Allan even thinks about making TextMate handle Asian fonts, I need all the help I can get as soon as I can get it, so that I can quit jumping between editors.
It’s an interresting solution but I would rather seeing full support in TextMate.
I wonder how many sales he could be doing in Japan if he simply add japanese support into TextMate
I lot of extra sales IMHO.September 12th, 2006 03:11 AM
Oh I totally agree with you, but I’ve discussed it with him, and it is coming at some point, but is a fair way down on the list of priorities and won’t be implemented until after the next major release at earliest.
I like the bundles feature enough that I bought it anyway, but without that I wouldn’t have made the purchased. (In fact, I purchased once and got a refund because of that, but went back and repurchased it for a project that was mostly code and not much Japanese text)
I also guess that the additional sales in Japan would be fairly moderate without the menus also being localized, but this isn’t just a Japan issue. China and other double byte locations are also affected so I’d expect much larger sales increases, even without the localization, in places like Hong Kong.September 12th, 2006 03:20 AM
Might I suggest another editor, if ever need be?
It’s only available for Linux/FreeBSD as of now. but will be available within the next few months for both Windows and Mac OS X. It’s free as in Open Source. its called Quanta. More info available at http://quanta.kdewebdev.org/September 12th, 2006 04:27 AM
Thanks. The script actions look similar to textmate bundles at first glance which would be cool. I don’t think I’d use it much unless it was a fully native mac os x app though. If it required X, I don’t think it would fit into my workflow very well. Also for people coming from a unix/bsd with emacs environment aquaemacs is very good, and I am very pleased with it, but I am not expert enough in emacs to really take advantage of all of its power, and I find the made for gui apps a bit easier on that front. If I hear about Quanta being released for Mac OS X at some point I’ll definitely give it a look.September 12th, 2006 04:36 AM
Quanta and all of KDE4 won’t require X11. I’m not a big fan of using X11 on OS X either.
its full native.
there is beta packages available at http://ranger.users.finkproject.org/kde/
but Quanta is not in there yet, as far as I can tell.
this will bring a lot of Open Source applications into OS X and Windows. The Stable version should be available somewhere in the first Quarter of 2007.September 12th, 2006 04:44 AM
Very interesting! Thanks for the pointer.September 12th, 2006 05:10 AM
- Posted by momendo
This is easy to work around. Open up textedit and type your japanese there. Then cut & paste into Textmate.September 30th, 2006 11:20 PM
- Posted by dc
i wonder what os-x editors japanese folks are mostly using for ruby?
i tend to use textwrangler for editing japanese. its a decent editor in itself…
on windows there are peggy and a whole bunch of “we preserve your encoding” tools…
i guess TM2 will be Leopard and above, so hope there are some new text panels that make it easier for him to add japanese…November 25th, 2006 11:33 AM
I don’t really know what Japanese ruby programmers use on OSX I would imagine it is bbedit. I don’t know many OSX using Japanese programmers.November 25th, 2006 11:44 AM
- Posted by kaye miyamoto
�｡i need japanese textmate.i want japanese who speak english.im kaye 16 years old.December 8th, 2006 04:31 PM
ウルトラボブDecember 16th, 2006 12:20 PM
- Posted by dc
i think she means penpalDecember 16th, 2006 12:27 PM
HA! I bet you are right! I was having a bit of trouble deciphering until you pointed out that possibility.
テキストメートというのはテキストエディターのソフトです。多分あなたが探してるのはペンパル(Pen pal)じゃないかと思います。その事であまり役にたつ事が出来ません。Good luck in finding a pen pal.December 16th, 2006 01:04 PM