问题
It could be a windows saved file opened in unix/linux problem and I am not quite sure how to solve it.
When I open a file which was previously saved by another developer using windows, my vim buffer some times shows
Trying char-by-char conversion...
In the middle of my file and I am unable to edit the code/text/characters right below this message in my buffer.
Why does it do that and how do I prevent this from happening?
回答1:
This message comes from the Vim function mac_string_convert() in src/os_mac_conv.c. It is accompanied by the following comment:
conversion failed for the whole string, but maybe it will work for each character
Seems like the file you're editing contains a byte sequence that cannot be converted to Vim's internal encoding. It's hard to offer help without more details, but often, these help:
- Ensure that you have
:set encoding=utf-8 - Check
:set filencodings?and ensure that the file you're trying to open is covered, or explicitly specify an encoding with:edit ++enc=... file - The
8g8command can find an illegal UTF-8 sequence, so that you can remove it, in case the file is corrupted. Binary mode:set binary/:edit ++binmay also help.
来源:https://stackoverflow.com/questions/14454901/vim-buffer-trying-char-by-char-conversion