Tuesday, October 23, 2012

Re: why is it so difficult to start using vim (may be just for me).

On 9/26/12, Deepak adhikari <adhikarideep@gmail.com> wrote:
> ...
> basically what I exactly wanted is>>
>
> remove BOM from utf-8 encoded file, remove 2nd line of the text file which
> was imported from windows machine.
> ...

The BOM is handled by option 'bomb' (:help bomb).
To remove BOM
:set nobomb
:w
To add BOM
:set bomb
:w
To check if BOM is present
:echo &bomb
or
:set bomb?

There several other important settings that deal with encodings and file
formats: enc, fenc, fencs, ff.

There is also a specific command form for forcing a particular encoding
or file format (:help ++). For instance, to reload the current file in
cp1251 encoding (force fenc cp1251)
:e ++enc=cp1251

Dealing with encodings and file formats is less intuitive in Vim than in
many other editors. Commercial Windows editors typically have options in
the Save As GUI dialog to change file encoding, add/remove BOM, change
line endings. There is usually menu Reload for reloading file in a
different encoding. Encodings are referred to by their descriptive
names, e.g., Windows Cyrillic for cp1251. In Vim, you have to know that
it is cp1251. The status line shows encoding and file format by default,
although this can also be easily done in Vim by configuring
'statusline'.

Regards,
Vlad

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: