`
lovecontry
  • 浏览: 1035648 次
文章分类
社区版块
存档分类
最新评论

[经验总结]Windows Vim打开utf-8文件乱码问题的解决方法

 
阅读更多
<!-- /*<! [CDATA[*/ body { color: #000; background-color: #fff; margin: 0px 10%; min-width: 720px; font-family: Verdana, sans-serif; counter-reset: chapter section subsection subsubsection paragraph lchapter lsection lsubsection lsubsubsection lparagraph} div.footnote { border-left: 1px solid #000; margin-left: 0em; clear: both } div.ftext { position: relative; margin-left: 50px } div.fnumber { float: left; width: 40px; padding: 0em; margin-left: 0.5em; margin-top: 0em } div.fnumber a { margin: 0px; padding: 0px } div.ctext { position: relative; margin-left: 100px } div.cnumber { float: left; width: 90px; padding: 0em; margin-left: 0.5em; margin-top: 0em } div.cnumber a { margin: 0px; padding: 0px } div.tip { border: 2px solid #0d0; margin: 0.5em 2em 1em 2em; padding: 0em 1em } div.warning, div.caution, div.danger, div.error { border: 2px solid #f00; margin: 0.5em 2em 1em 2em; padding: 0em 1em } div.note, div.hint, div.important { border: 2px solid #000; margin: 0.5em 2em 1em 2em; padding: 0em 1em } div.figure { display: block; padding: 1em; width: 400px; clear: both} div.topic { margin: 2em } div.vstsidebar, div.sidebar { border: 2px solid #aaa; color: #000; background-color: #ffffee; float: right; width: 40%; margin-left: 1em; margin-right: -1em; padding: 1em } span.strike { text-decoration: line-through } span.big { font-size: large } span.small { font-size: small } span.title { font-style: italic } span.notetitle { font-size: large; font-weight: 900; font-family: Verdana, sans-serif } p.toc { font-size: large; font-weight: 900 } p.notesubtitle { font-weight: 900; font-family: Verdana, sans-serif } p.attribution { font-style: italic; margin-left: 8em; text-indent: -1.4em } .vstright { float: right; margin: 1em } .vstleft { float: left; margin: 1em } .vstcenter { margin: 1em auto } blockquote.pull { font-size: large } p.rubric { font-size: large; margin-left: 2em } dd.normal { margin-bottom: 0.5em } dt.option { float: left; margin: 0em 0em 5px 2em; padding: 0px; font-family: monospace } dd.option { padding: 0px; margin: 0em 0em 5px 10em; text-indent: 0.5em } dd.option > p { margin: 0px } dd.normal > p { margin: 0px } table { border-collapse: collapse; margin: 0.5em 0em } thead, tfoot { text-align: center; font-weight: bold } td { border: 1px solid #000; padding: 0.25em; _top: 0%; vertical-align: top } td blockquote p{ margin: 0px; padding: 0px} td blockquote { margin: 0px; padding: 0px} table.vstbless td { border: 0px solid #000; padding: 0.25em; _top: 0%; vertical-align: top } td > p { margin: 0px } table.field { border: 0px solid #000; margin-left: 2em; padding: 0.25em; _top: 0%; vertical-align: top } td.fkey { font-weight: 900 } td.fval { border: 0px solid #000; padding: 0.25em; _top: 0%; vertical-align: top } td.fkey { font-weight: 900; border: 0px solid #000; padding: 0.25em; _top: 0%; vertical-align: top } td.fdkey { text-align: center; font-weight: 900 } td.fdval { text-align: center; font-style: italic } td.fakey { text-align: center; font-weight: 900 } td.faval { border: 0px solid #000; padding: 0.25em; _top: 0%; vertical-align: top } hr { width: 100%; margin: 1.5em auto } h1 { text-align: center; clear: both } h2, h3, h4, h5, h6 { text-align: left; margin-top: 1em; clear: both } h2 { counter-reset: section subsection subsubsection paragraph } h3 { counter-reset: subsection subsubsection paragraph } h4 { counter-reset: subsubsection paragraph } h5 { counter-reset: paragraph } h1 a { color: #000; background-color: transparent } h2 a { color: #000; background-color: transparent } h3 a { color: #000; background-color: transparent } h4 a { color: #000; background-color: transparent } h5 a { color: #000; background-color: transparent } h6 a { color: #000; background-color: transparent } p.subh1 { text-align: center; font-size: 120%; font-variant: small-caps } p.subh2, p.subh3, p.subh4, p.subh5, p.subh6 { text-align: left; font-size: 120%; font-variant: small-caps } h2:before { content: counter(chapter)" "; counter-increment: chapter } h3:before { content: counter(chapter)"."counter(section)" "; counter-increment: section } h4:before { content: counter(chapter)"."counter(section)"."counter(subsection)" "; counter-increment: subsection } h5:before { content: counter(chapter)"."counter(section)"."counter(subsection)"."counter(subsubsection)" "; counter-increment: subsubsection } h6:before { content: counter(chapter)"."counter(section)"."counter(subsection)"."counter(subsubsection)"."counter(paragraph)" "; counter-increment: paragraph} li.h1 { margin-left: 0em } li.h2 { margin-left: 1em; counter-reset: lsection lsubsection lsubsubsection lparagraph } li.h3 { margin-left: 2em; counter-reset: lsubsection lsubsubsection lparagraph } li.h4 { margin-left: 3em; counter-reset: lsubsubsection lparagraph } li.h5 { margin-left: 4em; counter-reset: lparagraph } li.h2:before { content: counter(lchapter)" "; counter-increment: lchapter } li.h3:before { content: counter(lchapter)"."counter(lsection)" "; counter-increment: lsection } li.h4:before { content: counter(lchapter)"."counter(lsection)"."counter(lsubsection)" "; counter-increment: lsubsection } li.h5:before { content: counter(lchapter)"."counter(lsection)"."counter(lsubsection)"."counter(lsubsubsection)" "; counter-increment: lsubsubsection } li.h6:before { content: counter(lchapter)"."counter(lsection)"."counter(lsubsection)"."counter(lsubsubsection)"."counter(lparagraph)" "; counter-increment: lparagraph} li.h6 { margin-left: 5em } ol, ul { margin-bottom: 0.5em; margin-top: 0.5em } ol.loweralpha { list-style-type: lower-alpha } ol.upperalpha { list-style-type: upper-alpha } ol.lowerroman { list-style-type: lower-roman } ol.upperroman { list-style-type: upper-roman } ol.decimal { list-style-type: decimal } ul.square { list-style-type: square } ul.circle { list-style-type: circle } ul.disc { list-style-type: disc } li > p { margin: 0em } img { border: 1px solid #000; padding: 0em; display: block; margin: 1em auto } img.inline { border: 1px solid #000; padding: 0em; margin: 0em; display: inline } pre { color: #000; background-color: #eee; margin-left: 2em; clear: both; overflow: auto } div.unknown { font-family: monospace; color: #000; background-color: #fff; margin: 1em; padding: 1em; clear: both; border: 3px solid red} pre.quoted { color: #000; background-color: #eee; margin-left: 0em; clear: both; overflow: auto } pre.rawlatex { color: #000; background-color: #ddd; border: 1px solid #000; padding: 0.1em; clear: both; overflow: auto } pre.address { font-family: Verdana, sans-serif; display: inline; margin: 0px; color: #000; background-color: #fff; overflow: auto } span.target { text-decoration: underline } div.vstfooter hr { width: 100%; margin: 0px } div.vstfooter p { margin: 0px } /*]]>*/ -->
Author: Thinkhy
Date: 2010.02.06.
Keyword: Vim encoding fencview utf-8

Windows下使用VIM有个麻烦事就是经常会遇到乱码,VIM无论怎么配置都不能同时对cp936和utf-8同时支持得很好,很多时候只能先利用记事本的另存功能换个编码保存才能打开。只到在水木VIM版看到有网友推荐的fencview插件,才算比较完美的解决Vim打开utf-8编码文件的问题。

fencview

(1) [ 插件的名称 ]

fencview.vim

(2) [ 插件的功能 ]

我就来推荐一下我自己的插件^_^新版本完善以后就会更新到vim.org FencView.vim : View a multi-byte encoded file in different encodings. script karma Rating 30/12, Downloaded by 139 created by Ming Bai script type utility description Install: Copy FencView.vim to your plugin directory. Usage: Select a encoding from the Tools/Encoding menu just like what you did in Firefox/IE or you can use ":FencView" command to open the encoding list window and "Enter" key to select the encoding under cursor to reload the file. ScreenShot: http://mbbill.googlepages.com/fenc.png

(3) [ 插件的下载地址 ]

http://www.vim.org/scripts/script.php?script_id=1708

(4) [ 备注或特别提醒 ] 在Windows系统,fencview插件仅对utf-8识别保持较高的准确度,对gbk和utf-16的识别正确率还有待提高。

(5) [ 推荐人id ] mbbill


fencview插件安装非常简单,将下载的fencview.vim文件拷到(~/vimfile)。安装完再配置文件_vimrc, 添加一行:

let g:fencview_autodetect = 1

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics