Friday, November 16, 2007


Sometimes during a text-editing session, you may need to substitute binary characters like the infamous ^M out of your file. Or alternatively, you may just want to insert an internationalized character like ΓΌ. Vim makes this easy to do. During an editing session, typing :digraph will give you a list of available special characters. Pick the desired character from the list, go into insert mode, and press ctrl-k followed by the character code listed in the digraph table. To insert the umlauted u mentioned above I did ctrl-k u:. Note that this works when typing in ex commands too such as substitutions. A final bonus is you type a macro in insert mode, insert control characters as needed, such as ctrl-w k to jump up a window, yank the macro into a register, and execute as needed.

No comments: