vim折叠II

转:http://blog.csdn.net/vincent_czz/article/details/7900670

vim折叠高亮显示

http://arch.pconline.com.cn//pcedu/soft/gj/photo/0610/acc/test2.txt

* 中文内容

	以 热爱祖国 为 荣
	   以 危害祖国 为 耻
	以 服务人民 为 荣
	   以 背离人民 为 耻
	以 崇尚科学 为 荣
	   以 愚昧无知 为 耻
	以 辛勤劳动 为 荣
	   以 好逸恶劳 为 耻
	以 团结互助 为 荣
	   以 损人利己 为 耻
	以 诚实守信 为 荣
	   以 见利忘义 为 耻
	以 遵纪守法 为 荣
	   以 违法乱纪 为 耻
	以 艰苦奋斗 为 荣
	   以 骄奢淫逸 为 耻

* 英文内容
2.1 以下是中青网的翻译 
	Eight Dos and Eight Don'ts
	Love, do not harm the motherland.
	Serve, don't disserve the people.
	Uphold science; don't be ignorant and unenlightened.
	Work hard; don't be lazy and hate work.
	Be united and help each other; don't gain benefits at the expense of others.
	Be honest and trustworthy, not profit-mongering at the expense of your values.
	Be disciplined and law-abiding instead of chaotic and lawless.
	Know plain living and hard struggle; do not wallow in luxuries and pleasures. 	

2.2 以下是新华网的翻译 
	Eight Honors,Eight Disgraces 
	-- Love the country; do it no harm.
	-- Serve the people; do no disservice.
	-- Follow science; discard ignorance.
	-- Be diligent; not indolent.
	-- Be united, help each other; make no gains at other's expense.
	-- Be honest and trustworthy; do not spend ethics for profits.
	-- Be disciplined and law-abiding; not chaotic and lawless.
	-- Live plainly, struggle hard; do not wallow in luxuries and pleasures.
	

2.3 以下是欧美同学会网站的翻译 
	Take the eight glorious merits against eight shameful behaviors 
	1  'Love our motherland' as glory;   'jeopardise her' as shame.
	2  'Serve for the people' as glory;   'err from them' as shame.
	3  'Advocate science' as glory;   'The ignorant ' as shame.
	4  'The laborious' as glory;   'love ease and hate work' as shame.
	5  'Unite and help each other' as glory;   'harm others to benefit oneself'as shame.
	6  'Be honest to keep faith'as glory;   'forget justice to seek for benefit' as shame.
	7  'Abide by the law and discipline'as glory;   'disobey the law and discipline' as shame.
	8  'Fight against everything hard and bitter' as glory;   'the extravagant and dissipated' as shame.

tx1.vim	
保存到E:\Vim\vim70\syntax中

set fdc=2
set lsp=5
syn keyword k1 以 为
syn keyword k2 荣 glory
syn keyword k3 耻 shame
syn match k4 " \W\{4} "
syn match k5 "'.\{-}'"

syn match zhead "^*.\+"
syn match zhead2 "^\d\(\.\d\)\=\s\+.*"
syn match ztxt1 "`1"
hi zhead guifg=green gui=bold
hi ztxt1 guifg=red guibg=red
hi link zhead2 zhead

hi k1 guifg=lightblue
hi k2 guibg=red gui=bold
hi k3 guifg=yellow
hi k4 guifg=lightgreen
hi link k5 k4

hi zhead guifg=green gui=bold
hi ztxt1 guifg=red guibg=red
hi link zhead2 zhead

set fdm=expr
set foldexpr=Myindent(v:lnum)
func! Myindent(lnum)
    let s:a=strlen(matchstr(getline(v:lnum), '^\*\+\s\+\|^\d\(\.\d\)\=\s\+'))
    if s:a == 4
        return '>2'
    elseif s:a == 2
        return '>1'
    else
        return '='
    endif

endf

vim test2.txt

键入一个命令:setf tx1

如果想打开文件自动就高亮显示

vim /etc/vimrc

ype plugin indent on
syntax on
"syntax enable
"source syntax/tx1.vim
source $VIMRUNTIME/syntax/tx1.vim
"source $VIMRUNTIME/syntax/html.vim
"source $VIMRUNTIME/syntax/html.vim
"au syntax txt runtime! syntax/tx1.vim
"au syntax txt runtime! $VIMRUNTIME/syntax/tx1.vim

    A+
发布日期:2014年11月11日  所属分类:未分类

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: