Skip navigation.

zhouzhenwu's blog

Mainframe Japanese English DigitalCamera Fitness

Posts tagged with "VIM"

使用vim转换文件编码

:set fileencoding=utf-8

注意fileencoding与encoding的区别


Vim 有四个跟字符编码方式有关的选项,encoding、fileencoding、fileencodings、termencoding (这些选项可能的取值请参考 Vim 在线帮助 :help encoding-names),它们的意义如下:
encoding: Vim 内部使用的字符编码方式,包括 Vim 的 buffer (缓冲区)、菜单文本、消息文本等。用户手册上建议只在 .vimrc 中改变它的值,事实上似乎也只有在 .vimrc 中改变它的值才有意义。
fileencoding: Vim 中当前编辑的文件的字符编码方式,Vim 保存文件时也会将文件保存为这种字符编码方式 (不管是否新文件都如此)。
fileencodings: Vim 启动时会按照它所列出的字符编码方式逐一探测即将打开的文件的字符编码方式,并且将 fileencoding 设置为最终探测到的字符编码方式。因此最好将 Unicode 编码方式放到这个列表的最前面,将拉丁语系编码方式 latin1 放到最后面。
termencoding: Vim 所工作的终端 (或者 Windows 的 Console 窗口) 的字符编码方式。这个选项在 Windows 下对我们常用的 GUI 模式的 gVim 无效,而对 Console 模式的 Vim 而言就是 Windows 控制台的代码页,并且通常我们不需要改变它。

好了,解释完了这一堆容易让新手犯糊涂的参数,我们来看看 Vim 的多字符编码方式支持是如何工作的。
Vim 启动,根据 .vimrc 中设置的 encoding 的值来设置 buffer、菜单文本、消息文的字符编码方式。
读取需要编辑的文件,根据 fileencodings 中列出的字符编码方式逐一探测该文件编码方式。并设置 fileencoding 为探测到的,看起来是正确的 (注1) 字符编码方式。
对比 fileencoding 和 encoding 的值,若不同则调用 iconv 将文件内容转换为 encoding 所描述的字符编码方式,并且把转换后的内容放到为此文件开辟的 buffer 里,此时我们就可以开始编辑这个文件了。注意,完成这一步动作需要调用外部的 iconv.dll (注2),你需要保证这个文件存在于 $VIMRUNTIME 或者其他列在 PATH 环境变量中的目录里。
编辑完成后保存文件时,再次对比 fileencoding 和 encoding 的值。若不同,再次调用 iconv 将即将保存的 buffer 中的文本转换为 fileencoding 所描述的字符编码方式,并保存到指定的文件中。同样,这需要调用 iconv.dll

由于 Unicode 能够包含几乎所有的语言的字符,而且 Unicode 的 UTF-8 编码方式又是非常具有性价比的编码方式 (空间消耗比 UCS-2 小),因此建议 encoding 的值设置为 utf-8。这么做的另一个理由是 encoding 设置为 utf-8 时,Vim 自动探测文件的编码方式会更准确 (或许这个理由才是主要的 :wink:。我们在中文 Windows 里编辑的文件,为了兼顾与其他软件的兼容性,文件编码还是设置为 GB2312/GBK 比较合适,因此 fileencoding 建议设置为 chinese (chinese 是个别名,在 Unix 里表示 gb2312,在 Windows 里表示 cp936,也就是 GBK 的代码页)。

【推荐】vim的列值递增、减插件:VisIncr

Opera的页面内容过滤配置文件转移到MyIE的配置文件里去
遇到一个问题

opera是这种格式


*.265.com/*
*.51yes.com/*
*.7town.com/*
*.99count.com/*
*.9v.cn/*
*.a8.com/*
*.aliunion.*
*.all4ad.net/*
*.allyes.com/*
*.atdmt.com/*
*.chanet.com.cn/*
*.cn/adpuba/*
*.cnbeta.com/corporate/*
*.cnzz.com/*
*.com/ad/*
*.com/pagead/
*.doubleclick.net/*
*.edu.cn/ad/*
*.googlesyndication.com/*
*.lele.com/*


而MyIE却是这种格式


url1=*.ad.*
url2=*/ad.*
url3=*.unionsky.*
url4=*.googlesyndication.com/*
url5=*/newhuagg/*
url6=*.newhua.com/help/ad.htm
url7=http://flash.onlinedown.net/*
url8=http://www.onlinedown.net/jsmcc.gif
url9=http://www.ectrust.cn/seal/images/RedSign.jpg
url10=*/images.sohu.com/*
url11=http://images.chinaren.com/cs/sms/alumni3/images/s3.swf
url12=*.265.com/*
url13=*.51yes.com/*
url14=*.7town.com/*
url15=*.99count.com/*
url16=*.9v.cn/*
url17=*.a8.com/*
url18=*.aliunion.*
url19=*.all4ad.net/*
url20=*.allyes.com/*


就需要
1.每列前面加字符串 urlxx=
2.xx该为递增的数字列

1可以用vim的列操作快速完成
2则需要使用一个vim插件VisIncr:


VisIncr : Produce increasing/decreasing columns of numbers, dates, or daynames
http://www.vim.org/scripts/script.php?script_id=670


安装时才发现需要另两个插件支持,
1是最新版的vimbball,最少v18以上
http://www.vim.org/scripts/script.php?script_id=1502
2是calutil.vim,提供


http://mysite.verizon.net/astronaut/vim/index.html#VimFuncs
http://mysite.verizon.net/astronaut/vim/vbafiles/calutil.vba.gz
Calendar Utilities Updated 07/27/04 (v2)
Used by visincr.vim (which is described below), <calutil.vim> provides three calendar-related functions: DayOfWeek(y,m,d), Cal2Jul(y,m,d), and Jul2Cal(julday). DayOfWeek() converts a date to a day of week name, and the other two convert between dates and the Julian day. To extract this plugin, you'll need the new vimball plugin: vimball



选中xx列后:I

VIM使用小积累

一个好看的color scheme
http://www.vim.org/scripts/script.php?script_id=1693



Originally posted by cursorline的颜色设置:


发信人: runsnake (狂奔之蛇), 信区: VIM
标 题: Re: 关于cursorline的颜色设置
发信站: 水木社区 (Thu Dec 21 14:12:48 2006), 站内

如我的
set cursorline
hi CursorLine cterm=bold ctermfg=yellow ctermbg=DarkBlue



Originally posted by 工具条上加个按纽:


发信人: runsnake (狂奔之蛇), 信区: VIM
标 题: Re: 【求助】我想在gvim的工具条上加个按纽
发信站: 水木社区 (Mon Oct 9 21:42:58 2006), 站内

在.gvimrc中加入
an 20.4009 &Edit.wrap :set wrap! <CR>

【 在 zhouzhenwu (大胡子胖脑袋之暴走周扒皮) 的大作中提到: 】
: 实现按下按钮就相当于当前打开的文本切换自动换行
: 以前是用的快捷键F6
: :map <F6> <esc> :set wrap! <CR>



Originally posted by 去掉工具栏:


发信人: zzpdhr (zzp), 信区: VIM
标 题: Re: 如何去掉工具栏
发信站: 水木社区 (Wed Nov 15 21:01:12 2006), 站内

修改 guioptions
比如:
set guioptions=megrLt



Originally posted by 现在的_vimrc:


language en
set nocompatible
:set guioptions=megrLt
:colorscheme desert
:set foldcolumn=4
:set columns=101
:set nu!
:set nowrap
:set cursorline
:map <F5> :call ToggleSketch()<CR>
:map <F6> <esc> :set wrap! <CR>
:map <F9> :set encoding=cp932 guifont=MS_Gothic:h12:cSHIFTJIS syntax=cobol<CR>
:map <F10> :set encoding=cp936 guifont=Fixedsys:h9:cGB2312<CR>
:nnoremap <leader>sf :vimgrep <C-R><C-W> %<CR> :cw<CR>
:set guitablabel=%N/\ %t\ %

NewSMTH之VIM版推荐插件列表

发信人: runsnake (狂奔之蛇), 信区: VIM
标 题: 推荐插件列表
发信站: 水木社区 (Tue Dec 12 22:54:39 2006), 站内


****************************************************************
******* 版友推荐插件列表(用搜索快速定位到该插件描述部分)*******
****************************************************************

-------------------------------------------------------------------------
BufExplorer Taglist latex-suite word_complete Sketch
DrawIt Mark SearchComplete vcscommand switchtags
ccal.rb viki NERD_tree fencview matrix
taglis Tetris BlockComment
-------------------------------------------------------------------------

(1) [ 插件的名称 ]

BufExplorer

(2) [ 插件的功能 ]

方便切换 buffer,切换 buffer 后列表自动关闭。

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

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

(4) [ 备注或特别提醒 ]

装完后 Normal mode 下输入 \be 即可打开这个列表,
光标放在某一个文件上按回车可以打开这个文件。

(5) [ 推荐人id ]

Dieken

---------------------------------------------------------------------------

(1) [ 插件的名称 ]

Taglist

(2) [ 插件的功能 ]

实现类或者函数列表功能,支持 C/C++, Java, Perl, Python,
TCL, SQL, PHP 等语言,它可以在VIM中创建一个窗口,列出编辑
的源文件中的类、函数、变量定义列表,而且更方便的是这个列表
也插入在了右键菜单中,分类存放,访问非常方便。

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

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

(4) [ 备注或特别提醒 ]

依赖于 Exuberant Ctags,可以在 http://ctags.sourceforge.net 下载。

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

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

(4) [ 备注或特别提醒 ]

依赖于 Exuberant Ctags,可以在 http://ctags.sourceforge.net 下载。

(5) [ 推荐人id ]

Dieken

------------------------------------------------------------------------------

(1) [ 插件的名称 ]

word_complete

(2) [ 插件的功能 ]

Insert模式下在输入的时候自动补全单词,如果补全正确
可以按Tab键接受,否则可以不管它继续输入或者按Ctrl-n,
Ctrl-p切换补全。 注意是输入三个字符后才开始补全。

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

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

(4) [ 备注或特别提醒 ]

在 工具 菜单中选择 Word completion 开启这个功能。

(5) [ 推荐人id ]

Dieken

------------------------------------------------------------------------------

(1) [ 插件的名称 ]

Sketch

(2) [ 插件的功能 ]

在 VIM 里头画 ASCII 图,支持填充,剪切,拷贝等,非常有创意。

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

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

(4) [ 备注或特别提醒 ]

Draw with mouse: boxes, arrows, lines, fills.
Transparent/opaque drag and drop.

(5) [ 推荐人id ]

Dieken

----------------------------------------------------------------------------

(1) [ 插件的名称 ]

DrawIt

(2) [ 插件的功能 ]

方便的画连线图。

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

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

(4) [ 备注或特别提醒 ]

(5) [ 推荐人id ]

Dieken

--------------------------------------------------------------------------

(1) [ 插件的名称 ]

Mark

(2) [ 插件的功能 ]

同时高亮显示多次搜索结果,这个特性非常有利于显示代码
中某些变量或函数的调用位置。

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

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

(4) [ 备注或特别提醒 ]

类似的还有:
MultipleSearch
http://www.vim.org/scripts/script.php?script_id=479

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

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


(5) [ 推荐人id ]

Dieken

------------------------------------------------------------------------

(1) [ 插件的名称 ]

SearchComplete

(2) [ 插件的功能 ]

用 / 或者 ? 搜索时按 tab 补全要搜索的单词。

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

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

(4) [ 备注或特别提醒 ]

(5) [ 推荐人id ]

Dieken

------------------------------------------------------------------------

(1) [ 插件的名称 ]

vcscommand

(2) [ 插件的功能 ]

集成 cvs 和 svn 到 vim 中,可以在 vim 中看 log,diff,
annotate,commit 等等。需要安装 cvs 和 svn 的命令行版本。

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

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

(4) [ 备注或特别提醒 ]

(5) [ 推荐人id ]

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

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

(4) [ 备注或特别提醒 ]

(5) [ 推荐人id ]

Dieken

-----------------------------------------------------------------------

(1) [ 插件的名称 ]

switchtags

(2) [ 插件的功能 ]

根据当前编辑文件的全路径名切换 tags 选项,这样就可以
在 vim 中同时查看多个项目的代码时 Ctrl-] 不会互相串。

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

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

(4) [ 备注或特别提醒 ]

老早以前写的,也许有点用,推荐一下。
需要Perl 插件支持(官方提供的 gvim70.exe 包含这个)。

(5) [ 推荐人id ]

Dieken

-------------------------------------------------------------------------

(1) [ 插件的名称 ]

ccal.rb

(2) [ 插件的功能 ]

Add Chinese lunar calender functionality to calendar.vim

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

本版文章号:8906(若有变,请搜索版面)

(4) [Appendix]
* Feature
Support 200 years(1900-2100) lunar calendar calculation

* Requirements:
vim-ruby interface (For WinXP, if you do not wish to install Ruby, just put
msvcrt-ruby18.dll in PATH)

* Usage:
a) put ccal.rb in $VIM/vimfiles/plugin dir
b) Add following lines in .vimrc
c) Open calendar window via :Calendar or :CalendarH, place cursor on a date,
press 'gc'

"------------------------------------------------------------
" Lunar calendar function for calendar.vim plugin
"------------------------------------------------------------
function! s:GetLunarDate(day, month, year, week, dir)
ruby << EOF
$:.unshift(VIM::evaluate("expand('$VIM/vimfiles/plugin')"))
require 'ccal'
d, m, y = VIM::evaluate("a:day").to_i, VIM::evaluate("a:month").to_i,
VIM::evaluate("a:year").to_i
cc = Calendar::ChineseCalendar.new(y, m, d)
# print the pretty date text
season_color = case m
when 12, 1, 2: 'AliceBlue' # winter white
when 3..5: 'MediumSpringGreen' # spring green
when 6..8: 'DeepSkyBlue1' # summer night
when 9..11: '#eec080' # autumn gold
end

VIM::command("highlight DateColor gui=none guifg=#{season_color}")
VIM::command("echohl DateColor | echo '#{cc.chinese_format}' | echohl None")
EOF
endfunction

"------------------------------------------------------------
" customize calendar action
"------------------------------------------------------------
function! s:CalendarDoCustom(action)
let l:tmpvar = g:calendar_action
let g:calendar_action = a:action
exe "normal \<CR>"
let g:calendar_action = l:tmpvar
endfunction

" Use the following format to map new calendar actions
autocmd BufNewFile __Calendar nmap <buffer><silent>gc :call <SID>
CalendarDoCustom("<SID>GetLunarDate")<CR>

* Screenshot
附件

* Only tested on WinXP

-------------------------------------------------------------------------

(1) [ 插件的名称 ]

Viki/Deplate

(2) [ 插件的功能 ]

This plugin adds wiki-like hypertext capabilities to Vim.
You can use viki as a "minor" mode (i.e., as an add-on to any other mode)
or as a full-fledged wiki mode. There is also an add-on plugin for "

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

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

--------------------------------------------------------------------------

(1) [ 插件的名称 ]

NERD_tree

(2) [ 插件的功能 ]

The NERD tree allows you to explore your filesystem and to open files
and directories. It presents the filesystem to you in the form of a tree
which you manipulate with the keyboard and/or mouse.

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

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

(4) [ 备注或特别提醒 ]

The following features and functionality are provided by the NERD tree:
* Files and directories are displayed in a hierarchical tree structure
* Different highlighting is provided for the following types of nodes:
* files
* directories
* sym-links
* windows .lnk files
* read-only files

(5) [ 推荐人id ]

runsnake

------------------------------------------------------------------------

(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) [ 备注或特别提醒 ]

(5) [ 推荐人id ]

mbbill

-------------------------------------------------------------------------

(1) [ 插件的名称 ]

matrix

(2) [ 插件的功能 ]

是的,说的就是电影 Matrix!Vim 的脚本并不是都干“正经事”的

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

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

(4) [ 备注或特别提醒 ]

想看一下电影里那些酷酷的字符在 Vim 的窗口里翻滚吗?
发一个命令“:Matrix”即可按任意键退出

(5) [ 推荐人id ]

runsnake

---------------------------------------------------------------------------

(1) [ 插件的名称 ]

taglist

(2) [ 插件的功能 ]

程序员必备插件

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

本版文章号:8911(若有变动,请搜索本版)

(4) [ 备注或特别提醒 ]

附件taglist跟原版taglist几乎一模一样,不过允许用户自定义一个filter,
把要显示的tag name修改一下。filter的原形是FilterName(filetype, tagname),
返回值作为显示在taglist窗口中的标签。起因是我在用taglist查看Java native
函数时,由于Java native函数名是Java_packagename_ClassName_methodName的形式,
名称太长,在taglist窗口里看不到实际的函数名,于是就做了点手脚,把tag名字处
理了一下。

* 示例:
前述的filter可以定义为如下,放在vimrc中:

function! TagNameFilter(ft, tag)
let l:newtag = a:tag
" Filter the Java native method names, remove package qualification.
" (change Java_some_package_ClassName_methodName to ClassName_methodName)
if a:ft == 'c' && a:tag =~ 'Java_\(\w\+_\)\+'
let l:reserve_classname = 1 " indicate we need class name
let l:pad = matchstr(a:tag, '^\s*') " leading space is required by taglist
let l:idx = strridx(a:tag, '_')
if l:reserve_classname
let l:idx = strridx(a:tag, '_', l:idx - 1)
endif

let l:newtag = l:pad . strpart(a:tag, l:idx + 1)
endif

return l:newtag
endfunction

" if g:tag_name_filter is not set, fall back to default filter
let g:tag_name_filter = "TagNameFilter"

------------------------------------------------------------------------------

(1) [ 插件的名称 ]

Tetris

(2) [ 插件的功能 ]

俄罗斯方块游戏

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

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

(4) [ 备注或特别提醒 ]

呵呵,玩到100分就算很不错了。\te开始游戏,尽量不要在gui模式下玩

(5) [ 推荐人id ]

vimmer

----------------------------------------------------------------------------

(1) [ 插件的名称 ]

BlockComment

(2) [ 插件的功能 ]

块注释插件,几乎是原插件的重写

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

本版文章号:8914(若有变动,请搜索本版)

(4) [ 备注或特别提醒 ]
* Usage
\c Comment (linewise/blockwise)
\v UnComment (linewise/blockwise)
\b UnCommentBlock (Uncomment the whole commented block)
\d DeleteComment (Delete whole commented block)
\j Javadoc style Comment (No command to uncomment it yet)

It is easy to add new comment type, see CommentStr function in
BlockComment.vim

* Example
The \v command allows user uncomment part of a commented block:
/*--------- /*---------
* line1 * line1
* line2 place cursor on line2, => *---------*/
* line3 press \v line2 uncommented line2
*---------*/ /*---------
* line3
*---------*/

-------------------------------------------------------------------------


※ 修改:·runsnake 于 Dec 13 08:33:51 修改本文·[FROM: 221.3.149.*]
※ 来源:·水木社区 newsmth.net·[FROM: 221.3.149.*]

The 2007 Vim calendar

发信人: runsnake (狂奔之蛇), 信区: VIM
标 题: The 2007 Vim calendar
发信站: 水木社区 (Tue Dec 12 15:58:00 2006), 站内

Dear Vim users,

The traditional Vim calendar has been updated for 2007!

This is a desktop calendar for 2007, made from one sheet of paper.
After folding, one side contains a useful 12-month calendar.
On the other side there is brief information about ICCF-Holland,
Vim and A-A-P.

English, A4: http://www.moolenaar.net/2007_en_a4.pdf
English, Letter: http://www.moolenaar.net/2007_en_le.pdf
Dutch, A4: http://www.moolenaar.net/2007_nl_a4.pdf

Each file is in PDF and about 180 Kbyte.


I'm afraid the problem with scripts on www.vim.org has not been solved
yet. We are waiting for SourceForge support...


Happy holidays!

-- It is illegal for anyone to try and stop a child from playfully jumping over puddles of water. [real standing law in
--
问世间情为何物 直教生死相许 天南地北双飞客 老翅几回寒暑 欢乐趣,离别苦 就中更有痴儿女 君应有语,渺万里层云 千山暮?


※ 来源:·水木社区 newsmth.net·[FROM: 221.3.149.*]

VIM又学了几招

:echo &guifont
看当前字体
:set langmenu=none
菜单设置为英文
开头写个 language en
设置语言菜单、提示语言为英文
:set guifont=MS_Gothic:h12:cSHIFTJIS
设置guifont

:set guifont=*
弹出小窗选择字体


thanks eGust&happyvim

F10和F11快速更改字体显示
:map <F10> :set guifont=MS_Gothic:h12:cSHIFTJIS<CR>
:map <F11> :set guifont=Fixedsys:h9:cGB2312<CR



发信人: happyvim (那一夜的茶), 信区: NewSoftware
标 题: Re: 如何判断一个文件名的编码?
发信站: 水木社区 (Fri Nov 10 16:57:42 2006), 站内

vim的编码需要自己指定尝试的顺序的,我的是
set fileencodings=ucs-bom,utf-8,prc,latin1

vim只能做到区分UCS2,utf8和gbk/big5这样的双字节编码,至于是那种双字节编码,是区分不了的,只能靠肉眼来看啦

我以前做过不同编辑器编码识别能力的测试,能够自动区分big和gb2312的,只有emacs(ver 23)


【 在 zhouzhenwu (大胡子胖脑袋之暴走周扒皮) 的大作中提到: 】
: win下gvim7打开个内有日文的程序文本
: :set fileencoding后最下面只显示"fileencoding=",并没有提示啥编码,郁闷。
: ---不过vim要知道是啥编码的话就不会显示为乱码了。。。。
: ...................

--

※ 来源:·水木社区 newsmth.net·[FROM: 220.248.103.*]





发信人: eGust (简简单单), 信区: NewSoftware
标 题: Re: 如何判断一个文件名的编码?
发信站: 水木社区 (Fri Nov 10 16:43:46 2006), 站内

那个也就只能判断ansi或者utf-8,而且也是靠统计猜的
如果没有bom头的话连unicode都判断不出来
记事本的那个著名的歧视“联通”的“bug”就是把anis当成utf-8了
【 在 happyvim (那一夜的茶) 的大作中提到: 】
: 我用vim,:set fileencoding 就可以显示文件编码类型的
: 其实其他的强一点的编辑器都可以显示的,比如,emacs,EmEditor等等


--
趙靈兒低頭吟唱道
既不回頭 何必不忘
既然無緣 何須誓言
今日種種 似水無痕
明夕何夕 君已陌路


※ 来源:·水木社区 newsmth.net·[FROM: 218.21.242.*]

[小结]用过的对多encoding支持、切换最好的文本编辑器

,

freeware
1.首推vim,切换直接输入命令
:set encoding=cp932
2.二推emacs:
M-x revert-buffer-with-coding-system后再输入想切换的代码
3.pspad,notepad++,notepad2切换encoding都不行(可能是我没找到,老鸟找到了请指点!),
scite没用会,不知道行不行。

shareware:
1.首推EmEditor,可以在打开文件后不关闭文件直接切换encoding,最方便。
2.二推新版的EditPlus,昨晚试用发现在打开非常规encoding的文件时
会提示选择以何种encoding打开该文件,甚爽。新版还增加了代码折叠,很不错。
3.ultraedit,这玩意更新得勤,但是偶用不上它,语法高亮差劲得紧(所有语言的
语法高亮定义在一个文件里),也没找到地方切换encoding.


Thanks jowoody的补充


发信人: jowoody (伍迪), 信区: NewSoftware
标 题: Re: [小结]用过的对多encoding支持、切换最好的文本编辑器
发信站: 水木社区 (Tue Oct 31 10:23:57 2006), 站内

SciTE :
配置文件中修改:
code.page=936 # 简休中文
code.page=65001 # Unicode
code.page=0 # 自动选择
character.set=134 # 中文 gb2132 编码

没用过其它的代码页,但是都差不多
不能动态切换,这一点似乎不够好,不过一般不会遇到非常多的编码
修改的时候只要增加或者去掉注释符号就行了(行首 # 是注释)

【 在 zhouzhenwu (大胡子胖脑袋之暴走周扒皮) 的大作中提到: 】
: freeware:
: 1.首推vim,切换直接输入命令
: :set encoding=cp932
: ...................

我的_vimrc

:colorscheme torte
:set foldcolumn=4
:set columns=101
:set nu!
:set nowrap
:set cursorline
:map <F5> :call ToggleSketch()<CR>
:map <F6> <esc> :set wrap! <CR>
:map <F7> <C-B>
:map <F8> <C-F>
"tabpage mappings
map <M-1> <esc> 1gt
map <M-2> <esc> 2gt
map <M-3> <esc> 3gt
map <M-4> <esc> 4gt
map <M-5> <esc> 5gt
map <M-6> <esc> 6gt
map <M-7> <esc> 7gt
map <M-8> <esc> 8gt
map <M-9> <esc> 9gt
map <C-t> <esc>:tabnew<CR>
map <C-w> <esc>:tabclose<CR>
:set guitablabel=%N/\ %t\ %

Tip #978: Cobol Editing with VIM

,

Tip #978: Cobol Editing with VIM
created: August 26, 2005 20:51 complexity: basic
author: musingattheruins as of Vim: 5.7

http://www.vim.org/tips/tip.php?tip_id=978

"If you have used vim with a Cobol file recently you probably noticed something.
All the text is red. Yes. All of it. "

他提到了这个问题我也碰到了,但是按他说注释掉那块区域后还是没解决问题,
倒是用后面跟贴的stephen提供的cobol.vim成功解决了问题。

taglist.vim & Calendar.vim

今天试用了一些vim Script,留下了两个:taglist和Calendar.

taglist是用一个Source code browser,想使用这个Script还需要ctags的支持,
:Tlist 启用
:TlistClose 关闭(注意区分大小写)

运行图:


Calendar:This script create calender window.
" Usage:
" :Calendar
" show calendar at this year and this month
" :Calendar 8
" show calendar at this year and given month
" :Calendar 2001 8
" show calendar at given year and given month
" :CalendarH ...
" show horizontal calendar ...
"
" <Leader>ca
" show calendar in normal mode
" <Leader>ch
" show horizontal calendar ...

运行图:

December 2009
S M T W T F S
November 2009January 2010
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31