View file encodings in vim

Source: Internet
Author: User
: Set fileencoding

You can display the file encoding format. If you just want to see other encoded files or if you want to solve the problem of viewing files garbled with Vim, add the following to the ~/.VIMRC file:

Set Encoding=utf-8 Fileencodings=utf-8

This allows vim to automatically identify the file encoding (which automatically identifies the UTF-8 or GBK encoded file), in fact, in accordance with the fileencodings provided by the encoding list to try, if not found the appropriate encoding, the latin-1 (ASCII) encoding opened.

Opens a file with the specified encoding

such as opening files in Windows that are saved in ANSI

Vim file.txt-c "E ++enc=gb18030"
File Encoding Conversion

Convert file encoding directly into Vim, such as converting a file to Utf-8 format

: Set Fileencoding=utf-8

View file formats

: Set FileFormat?

Set file format to Unix

: Set Fileformat=unix

Reprinted from: http://www.cnblogs.com/sparkbj/p/6212427.html

View file encodings in vim

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.