~/.vimrc
“配色一 黑底绿光标
“ 使用 murphy 调色板
colo murphy
“ 设置用于GUI图形用户界面的字体列表。
set guifont=Fixedsys\ Excelsior\ 2.00\ 13
“
set nocompatible
“ 设定文件浏览器目录为当前目录
set bsdir=buffer
set autochdir
“ 设置编码
set enc=chinese
“ 设置文件编码
set fenc=chinese
“ 设置文件编码检测类型及支持格式
set fencs=gbk,utf-8,ucs-bom,gb18030,gb2312,cp936
“ 指定菜单语言
set langmenu=zh_CN.GBK
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
“显示行号
set nu!
“ 查找结果高亮度显示
set hlsearch
“ tab宽度
set tabstop=4
set cindent shiftwidth=4
set autoindent shiftwidth=4
“ C/C++注释
set comments=://
“ 修正自动C式样注释功能 <2005 16="" 07="">
set comments=s1:/,mb:,ex0:/
“ 增强检索功能
set tags=./tags,./../tags,./**/tags
“ 保存文件格式
set fileformats=unix,dos
“ 键盘操作
map gk
map gj2005>
set nocompatible
set bs=2
set tw=72
set cindent
set mouse=a
set nowrapscan
set fileencodings=ucs-bom,utf-8,cp936,big5,euc-jp,euc-kr,latin1
set showmatch
set showmode
set uc=0
set t_kD=^?
map ^H X
map \e[3~ x
set mousehide
set hlsearch
“let c_comment_strings=1
syntax on
“set columns=120
“set lines=380
“配色二 白底蓝光标
set nu
set sm
set tabstop=4
set shiftwidth=4
set cindent
syntax on
set ruler
set smartindent
set showmatch
set encoding=utf-8 fencs=utf-8,gb18030,gb2312,gbk,big5
“ REQUIRED. This makes vim invoke latex-suite when you open a tex file.
filetype plugin on
“
“ “ IMPORTANT: grep will sometimes skip displaying the file name if you
“ “ search in a singe file. This will confuse latex-suite. Set your grep
“ “ program to alway generate a file-name.
set grepprg=grep\ -nH\ $*
“
“ “ OPTIONAL: This enables automatic indentation as you type.
filetype indent on
“配色三 黑底绿标加亮字
“ To use it, copy it to
“ for Unix and OS/2: ~/.vimrc
“ for Amiga: s:.vimrc
“ for MS-DOS and Win32: $VIM_vimrc
“ for OpenVMS: sys$login:.vimrc
“ When started as “evim”, evim.vim will already have done these settings.
if v:progname =~? “evim”
finish
endif
“ VMS 系统会自动产生备份文件,所以这里把备份去掉,备份文件名为原来文件名后加~
if has(“vms”)
set nobackup
else
set backup
endif
“ For Win32 GUI: remove ‘t’ flag from ‘guioptions’: no tearoff menu entries
“ let &guioptions = substitute(&guioptions, “t”, “”, “g”)
“ 未知
“ Don’t use Ex mode, use Q for formatting
map Q gq
“ 未知
“ This is an alternative that also works in block mode, but the deleted
“ text is lost and it only works for putting the current register.
“vnoremap p “_dp
“ 当终端支持颜色或者运行着gui版本时打开高亮及搜索关键词高亮
if &t_Co > 2 || has(“gui_running”)
syntax on
set hlsearch
endif
“ Only do this part when compiled with support for autocommands.
if has(“autocmd”)
“ Enable file type detection.
“ Use the default filetype settings, so that mail gets ‘tw’ set to 72,
“ ‘cindent’ is on in C files, etc.
“ Also load indent files, to automatically do language-dependent indenting.
filetype plugin indent on
“ Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
“ For all text files set ‘textwidth’ to 78 characters.
autocmd FileType text setlocal textwidth=78
“ When editing a file, always jump to the last known cursor position.
“ Don’t do it when the position is invalid or when inside an event handler
“ (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if line(“‘\””) > 0 && line(“‘\””) <= line(“$”) | \ exe “normal g`\”” | \ endif augroup END else set autoindent “ always set autoindenting on endif “ has(“autocmd”) “ Win32 简体中文 “set encoding=cp936 “ Win32 简体中文 “set encoding=cp936 “ UNIX 简体中文 set encoding=euc-cn set fileencoding=gbk “ 颜色主题 colors darkblue “ Use Vim settings, rather then Vi settings (much better!). “ This must be first, because it changes other options as a side effect. set nocompatible “ allow backspacing over everything in insert mode “set backspace=indent,eol,start “ 设置 Backspace 和 Delete 的灵活程度,backspace=2 则没有任何限制 set backspace=2 “ 设置命令历史行数为50行 set history=50 “ 设置当前光标位置 set ruler “ 在命令末尾输完之前显示命令 set showcmd “ Make command line two lines high set ch=1 “ 设置搜索方向为向前搜索 set incsearch “ 显示TAB健 set list set listchars=tab:>-,trail:-
“ 设置路径,在 f 等命令中涉及此参数
“ 对于 windows 编程,path 可设为如下
“ set path=.,”C:\Program Files\Microsoft Visual Studio\vc98\Include”,,
“ 对于 UNIX 编程,path 可设为如下
set path=.,/usr/include,/usr/include/qt,,
“ 告诉 Vim 先尝试用 UNIX 格式在尝试 MS-DOS 格式
set fileformats=unix,dos
“ 搜索忽略大小写
set ignorecase
“ 先是行号
set nu!
“ 打开不同类型文件特有的缩近
“filetype indent on
“ 制表符TAB宽度,保持兼容
set tabstop=8
“ 将TAB设定为空格
set softtabstop=4
“ 指定下一级的缩近空格数
set cindent shiftwidth=4
“ 在C注释中高亮字符串
let c_comment_strings=1
“ 关闭备份
“set nobackup
“ 设置备份目录
set backupdir=/home/wgd/vimtmp
“ 如果当前目录找不到tags文件,则向上一级目录查找
set tags=./tags,./../tags,./*/tags,~/tags
“map :runtime syntax/2html.vim
“ 定义剪切命令
“unmap
“map “+x
“imap “+xi
“ 定义复制命令
“unmap
“map “+y
“imap “+yi
“ 定义粘贴命令
“unmap
“map “+gp
“imap “+gpi
“ 定义撤销命令
“unmap
“map u
“imap ui
“ 编辑模式下 Ctrl+o 插入新行
“unmap
imap o
“ Ctrl+a 全选
map ggVG
imap ggVGi
“ Ctrl+s 保存文件
“unmap
map :w
imap :wi
cmap :w
“ Ctrl+q 退出
map :q
imap :qi
“map w
“ 语音朗读
nmap :w !festival –tts &
nmap :!killall festival&
“ 用于浏览tags的脚本
map ,t :Tlist
“map ,te :TagExplorer
“ 用于浏览project的脚本
map ,P :Project ./.vimprojects
“ 设定 TagExplorer 环境
“let TE_Include_File_Pattern = ‘[Mm]akefile(..)\?|..c(pp)\?$|.*.h$|.
“ 进入当前编辑的文件的目录
“ autocmd BufEnter * exec “cd %:p:h”
alias vi=vim //用vi代替vim