Chinaunix首页 | 论坛 | 博客
  • 博客访问: 239875
  • 博文数量: 108
  • 博客积分: 3045
  • 博客等级: 中校
  • 技术积分: 1162
  • 用 户 组: 普通用户
  • 注册时间: 2007-04-19 18:26
文章分类

全部博文(108)

分类: LINUX

2007-04-23 15:46:35

1.to download three files from the following web:



java.vim javascript.vim html.vim

2.$mkdir ~/.vim && mkdir ~/.vim/syntax
cp *.vim ~/.vim/syntax/

3.$vi ~/.vimrc
content of the .vimrc

:syntax enable
:syntax on
:so $VIMRUNTIME/syntax/java.vim
:so $VIMRUNTIME/syntax/javascript.vim
:so $VIMRUNTIME/syntax/html.vim




" vim设置文件 ( .vimrc 或 _vimrc )
"-----------------------------------------------------------------------------
" 字符编码相关
"
" 多字节编码设置,必须放在.vimrc顶部
"
if has("multi_byte")
  " When 'fileencodings' starts with 'ucs-bom', don't do this manually
  "set bomb
  set fileencodings=ucs-bom,chinese,taiwan,japan,korea,utf-8,latin1
  " CJK environment detection and corresponding setting
  if v:lang =~ "^zh_CN"
    " Simplified Chinese, on Unix euc-cn, on MS-Windows cp936
    set encoding=chinese
    set termencoding=chinese
    if &fileencoding == ''
      set fileencoding=chinese
    endif
  elseif v:lang =~ "^zh_TW"
    " Traditional Chinese, on Unix euc-tw, on MS-Windows cp950
    set encoding=taiwan
    set termencoding=taiwan
    if &fileencoding == ''
      set fileencoding=taiwan
    endif
  elseif v:lang =~ "^ja_JP"
    " Japanese, on Unix euc-jp, on MS-Windows cp932
    set encoding=japan
    set termencoding=japan
    if &fileencoding == ''
      set fileencoding=japan
    endif
  elseif v:lang =~ "^ko"
    " Korean on Unix euc-kr, on MS-Windows cp949
    set encoding=korea
    set termencoding=korea
    if &fileencoding == ''
      set fileencoding=korea
    endif
  endif
   " Detect UTF-8 locale, and override CJK setting if needed
  if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
    set encoding=utf-8
  endif
else
  echoerr 'Sorry, this version of (g)Vim was not compiled with "multi_byte"'
endif

" 不明宽度字符的宽度设置
if exists("&ambiwidth")
    set ambiwidth=double
endif

" 自动认识换行符
set fileformats=unix,dos,mac

"-----------------------------------------------------------------------------
" 编辑相关
"
" 自动缩进
set autoindent

"-----------------------------------------------------------------------------
" 检索相关
"
"不分大小写
set ignorecase

"大小写敏感
set smartcase

"找到最后一项后返回第一项
set wrapscan

"关闭部分匹配模式
set noincsearch

"-----------------------------------------------------------------------------
" 显示相关
"
"打开语法彩显
syntax on

"设置配色方案
colorscheme evening

"不显示行号
set nonumber

"tab左侧显示提示符
set listchars=tab:\ \
set list

"tab的宽度设置
set tabstop=4
set shiftwidth=4

"状态栏里显示输入的命令
set showcmd

"输入括号时显示匹配括号
set showmatch

"搜索结果高亮显示
set hlsearch

"一直显示状态栏
set laststatus=2

"状态栏里显示文字编码和换行符等信息
set statusline=%<%f\ %m%r%h%w%{'['.(&fenc!=''?&fenc:&enc).']['.&ff.']'}%=%l,%c%V%8P


"-----------------------------------------------------------------------------
" 按键映射
"
"F2: 编辑另一个文件(接着输入文件名)
"F3: 上一文件
"F4: 下一文件
"F5: 显示行号
"F6: 不显示行号
"F7: 高亮显示搜索结果
"F8: 不高亮显示搜索结果
"F9: Shell环境(执行exit返回)

map :edit
map :bp
map :bn
map :set nu
map :set nonu
map :set hlsearch
map :set nohlsearch
map :shell

阅读(594) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~