|
一、环境配置:
1、配置vim alias,使vim成为默认的vi编辑器:
echo alias vi=\'vim\' >> ~/.bashrc
source ~/.bashrc
2、配置vimrc文件
cp /etc/vim/vimrc /etc/vim/vimrc.default
vi ~/.vimrc
" File: _vimrc" Date: 2009-09-22" Author: gashero" NOTE: 配置一份简单的vim配置文件 set nocompatible "非兼容模式syntax on "开启语法高亮set background=dark "背景色color desertset ruler "在左下角显示当前文件所在行set showcmd "在状态栏显示命令set showmatch "显示匹配的括号set ignorecase "大小写无关匹配set smartcase "只能匹配,即小写全匹配,大小写混合则严格匹配set hlsearch "搜索时高亮显示set incsearch "增量搜索"set nohls "搜索时随着输入立即定位,不知什么原因会关闭结果高亮set report=0 "显示修改次数set mouse=a "控制台启用鼠标set number "行号set nobackup "无备份set cursorline "高亮当前行背景set fileencodings=ucs-bom,UTF-8,GBK,BIG5,latin1set fileencoding=UTF-8set fileformat=unix "换行使用unix方式set ambiwidth=doubleset noerrorbells "不显示响铃set visualbell "可视化铃声set foldmarker={,} "缩进符号set foldmethod=indent "缩进作为折叠标识set foldlevel=100 "不自动折叠set foldopen-=search "搜索时不打开折叠set foldopen-=undo "撤销时不打开折叠set updatecount=0 "不使用交换文件set magic "使用正则时,除了$ . * ^以外的元字符都要加反斜线 "缩进定义set shiftwidth=4set tabstop=4set softtabstop=4set expandtabset smarttabset backspace=2 "退格键可以删除任何东西"显示TAB字符为<+++set listset list listchars=tab:<+ "映射常用操作map [r :! python % <CR>map [o :! python -i % <CR>map [t :! rst2html.py % %<.html <CR> if has("gui_running") set lines=25 set columns=80 set lazyredraw "延迟重绘 set guioptions-=m "不显示菜单 set guioptions-=T "不显示工具栏 set guifont=consolas\ 10endif if has("autocmd") "回到上次文件打开所在行 au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") \| exe "normal g'\"" | endif "自动检测文件类型,并载入相关的规则文件 filetype plugin on filetype indent on "智能缩进,使用4空格,使用全局的了 "autocmd FileType python setlocal et | setlocal sta | setlocal sw=4 "autocmd FileType c setlocal et | setlocal sta | setlocal sw=4 "autocmd FileType h setlocal et | setlocal sta | setlocal sw=4endif 二、vim python 环境配置
1、加强python语法高亮脚本:python.vim
python.vim : Enhanced version of the python syntax highlighting script
http://www.vim.org/scripts/script.php?script_id=790
cd /usr/share/vim/vim72/syntax/
cp python.vim python.vim.default cp /opt/python.vim .2、在 vim 中显示 ctag 序列列表下载 taglist 插件:taglist_45.ziphttp://www.vim.org/scripts/script.php?script_id=273 unzip taglist_45.zip cp plugin/taglist.vim /usr/share/vim/vim72/plugin/ cp doc/taglist.txt /usr/share/vim/vim72/doc/ |
|
|