知识屋:更实用的电脑技术知识网站
所在位置:首页 > 操作系统 > linux

Vim配置文件种类,加载顺序,基本配置

发布时间:2014-09-05 14:47:59作者:知识屋

Vim配置文件种类,加载顺序,基本配置
 
通过查看:version可知Vim配置文件分为三类:
 
:version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Oct 29 2011 18:46:03)
 
     系统 vimrc 文件: "$VIM/vimrc"
     用户 vimrc 文件: "$HOME/.vimrc"
      用户 exrc 文件: "$HOME/.exrc"
         $VIM 预设值: "/usr/local/share/vim"
其各自的加载顺序可通过:scriptname来获知:
 
:scripname
  1: /usr/local/share/vim/vimrc
  2: /usr/local/share/vim/vim73/syntax/syntax.vim
  3: /usr/local/share/vim/vim73/syntax/synload.vim
  4: /usr/local/share/vim/vim73/syntax/syncolor.vim
  5: /usr/local/share/vim/vim73/filetype.vim
  6: /usr/local/share/vim/vim73/ftplugin.vim
  7: /home/zhanhailiang/.vimrc
  8: /usr/local/share/vim/vim73/syntax/nosyntax.vim
  9: /home/zhanhailiang/.vim/plugin/ctag.vim
 10: /home/zhanhailiang/.vim/plugin/jsbeautify.vim
 11: /home/zhanhailiang/.vim/plugin/matchit.vim
 12: /home/zhanhailiang/.vim/plugin/plugin/taglist.vim
 13: /home/zhanhailiang/.vim/plugin/reload.vim
 14: /usr/local/share/vim/vim73/plugin/getscriptPlugin.vim
 15: /usr/local/share/vim/vim73/plugin/gzip.vim
 16: /usr/local/share/vim/vim73/plugin/matchparen.vim
 17: /usr/local/share/vim/vim73/plugin/netrwPlugin.vim
 18: /usr/local/share/vim/vim73/plugin/rrhelper.vim
 19: /usr/local/share/vim/vim73/plugin/spellfile.vim
 20: /usr/local/share/vim/vim73/plugin/tarPlugin.vim
 21: /usr/local/share/vim/vim73/plugin/tohtml.vim
 22: /usr/local/share/vim/vim73/plugin/vimballPlugin.vim
 23: /usr/local/share/vim/vim73/plugin/zipPlugin.vim
 24: /usr/local/share/vim/vim73/scripts.vim
 25: /usr/local/share/vim/vim73/ftplugin/vim.vim
 26: /usr/local/share/vim/vim73/syntax/vim.vim
 27: /usr/local/share/vim/vim73/ftplugin/help.vim
 28: /usr/local/share/vim/vim73/syntax/help.vim
我的Vim配置:
 
" set background=dark命令必须在syntax on之前调用,否则无效
set background=dark
syntax on
 
set nocompatible
" let &termencoding=&encoding
set encoding=utf-8
set tabstop=4
set softtabstop=4
set shiftwidth=4
set nu
set ai
set fdm=marker
set foldclose=all
set foldopen=all
set incsearch
set hlsearch
set history=100
set ruler
set showcmd
set showmatch
set whichwrap=b,s,<,>
" 忽略大小写
" 若是小写模式搜索,则忽略大小写;若模式中有大写,则就要大小写模式敏感
set ignorecase smartcase
set expandtab
" set textwidth=78
 
" dispaly tab and space
set list
set listchars=tab:>-,trail:-
 
" number of lines used for the command-line
set cmdheight=2
 
" Set to auto read when a file is changed from the outside
set autoread
 
" Write the contents of the file automaticly 自动保存
set autowrite
 
" 打开状态行
set laststatus=2
 
" :sh
set shell=/bin/bash
 
" ctag
let g:ctags_statusline=1
set tags+=~/public_html/source/phpext/php-5.3.6
 
" hi Comment ctermfg =blue
 
filetype plugin on
 
if !exists('g:AutoComplPop_Behavior')
    let g:AutoComplPop_Behavior = {}
    let g:AutoComplPop_Behavior['php'] = []
    call add(g:AutoComplPop_Behavior['php'], {
            /   'command'   : "/<C-x>/<C-o>", 
            /   'pattern'   : printf('/(->/|::/|/$/)/k/{%d,}$', 0),
            /   'repeat'    : 0,
            /})
endif
 
" 删除所有的inoremap映射
:imapclear
 
" js 格式化
:nnoremap <SID><F6> :call g:Jsbeautify()<CR>
 
" 公用注释
:iabbrev #b /*****************************************************************
:iabbrev #e <Space>*****************************************************************/
 
" 经常性错误自动纠正
" 注:当遇到经常性出错的单词时可以添加进来
:iab teh the
 
" 每次打开日志文件,自动定位到文件末尾
autocmd BufReadPost *.log normal G
 
au BufRead,BufNewFile /usr/local/services/nginx/conf/* set ft=nginx
(免责声明:文章内容如涉及作品内容、版权和其它问题,请及时与我们联系,我们将在第一时间删除内容,文章内容仅供参考)
收藏
  • 人气文章
  • 最新文章
  • 下载排行榜
  • 热门排行榜