Thursday, April 05, 2007

Gvim: encoding puzzles.

You can reload a file using a different encoding if vim wasn't able to detect the correct encoding:
:e ++enc=<encoding>
for example:
:e ++enc=utf-8

Choose a font type like Courier New.

You can achieve both of these by adding the following lines in your gvim startup configuration file .vimrc:

set enc=utf-8
set guifont=Courier_New:h11:cDEFAULT

How to comment multiple lines in vim?

Place cursor at the beginning of the first line you want to change.
Press Ctrl+v
Move the cursor down to the last line you want to change.
Press I (The capital letter after H and before J)
Type in the text you wish to insert
Press Esc

Now all lines selected should show the inserted text.

Want to insert new line in file?
try \r, like:
%s/,/,\r/gc

No comments: