How to type Chinese or Japanese with TextMate?
Sometimes I have to write scripts, html pages, etc. with Chinese, Japanese, Korean, etc. strings. The problem is that within TextMate I cannot use e.g. Kotoeri (the Japanese Input Editor) because I don't see what I'm typing. In order to avoid to change to an other program I wrote a very easy code snippet with CocoaDialog's textbox feature.
Here is one way to use my suggestion:
- open the Bundle Editor - Show all - go to the folder 'TextMate' (or whatever) - add a new command 'inputCJK' (or whatever) Command data - Save: nothing - Command(s):
# open CocoaDialog's textbox res=$(CocoaDialog textbox \ --title "Input CJK" \ --informative-text "Write up here..." \ --selected \ --scroll-top top \ --editable \ --no-newline \ --button1 "Insert" \ --button2 "Cancel") # If user canceled exit. [[ $( (tail -r <<<"$res") | tail -n1) == "2" ]] && \ exit_discard # delete first line res=$(sed '1,1d' <<<"$res") # print the content of the textbox echo -n "$res"
Input: None Output: Insert as Snippet Activation: Key Equivalent shift+option+i (or whatever) Scope: leave it empty
With the help of this script you are able to use Kotoeri or other IME within TM indirectly. I know that isn't the most elegant way but for writing small scripts using some Japanese, Chinese strings is quite good. Of course, TM has some problems to display Chinese characaters but, as I mentioned before, for smaller things it is sufficient. ;)
Hopefully the very tiny script is useful for others as well. Feedback is highly welcomed.
Many greetings,
Hans-Jörg Bibiko
---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program.