Posts

Showing posts from April, 2007

Wrapping Japanese text in Vim

Wrapping Japanese (well, any language in the CJK group) text in Vim can be tricky as there is seldom any whitespace where a line break can be inserted. A relatively decent solution is to use this script (currently dead). It will insert a line break where necessary while avoiding inserting a break in front of punctuation or other special symbols. Another quicker solution is to set the "m" and "B" format options: :set fo+=mB m will make it possible to break between any multi-byte characters, and B will prevent the insertion of space between multi-byte characters when joining lines with "gj" for example. This will quickly do the job, but with no regard for punctuation. Keep in mind that with both methods Cyrillic characters are treated as ordinary multi-byte characters. Therefore, it is not a good idea to have these settings automated if you are going to be handling Bulgarian for example. Considering the previous statement, it is easier to turn on/off the fo