首页 > 代码库 > 我的Vimrc
我的Vimrc
本文出自:http://blog.csdn.net/svitter
自己的vimrc。。功能很少,持续更新。
目前支持缩进4个空格,高亮。
用了gvim的example,和bluedust的部分配置文件,用于C++的编辑。
" An example for a vimrc file. " " Maintainer: Bram Moolenaar <Bram@vim.org> " Last change: 2008 Dec 17 " " 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 " Use Vim settings, rather than Vi settings (much better!). " This must be first, because it changes other options as a side effect. set nocompatible " Make Tab 4 space set ts=4 set expandtab set autoindent " " allow backspacing over everything in insert mode set backspace=indent,eol,start set background=dark set guifont=Consolas:h11 hi clear hi Boolean guifg=#dca3a3 gui=bold hi Character guifg=#dca3a3 gui=bold hi Comment guifg=#7f7f7f hi Condtional guifg=#8fffff hi Constant guifg=#dca3a3 gui=bold hi Cursor guifg=#000000 guibg=#aeaeae hi Debug guifg=#dca3a3 gui=bold hi Define guifg=#ffcfaf gui=bold hi Delimiter guifg=#8f8f8f hi DiffAdd guibg=#613c46 hi DiffChange guibg=#333333 hi DiffDelete guifg=#333333 guibg=#464646 gui=none hi DiffText guifg=#ffffff guibg=#1f1f1f gui=bold hi Directory guifg=#ffffff gui=bold hi Error guifg=#000000 guibg=#00ffff hi ErrorMsg guifg=#000000 guibg=#00c0cf hi Exception guifg=#8fffff gui=underline hi Float guifg=#9c93b3 hi FoldColumn guifg=#dca3a3 guibg=#464646 hi Folded guifg=#dca3a3 guibg=#333333 hi Function guifg=#ffff8f hi Identifier guifg=#ffffff hi Include guifg=#ffcfaf gui=bold hi IncSearch guifg=#000000 guibg=#c15c66 hi Keyword guifg=#ffffff gui=bold hi Label guifg=#8fffff gui=underline hi LineNr guifg=#7f7f7f guibg=#464646 hi Macro guifg=#ffcfaf gui=bold hi ModeMsg guifg=#dca3a3 gui=bold hi MoreMsg guifg=#ffffff gui=bold hi NonText guifg=#1f1f1f hi Normal guifg=#cccccc guibg=#3f3f3f hi Number guifg=#aca0a3 hi Operator guifg=#ffffff hi PreCondit guifg=#dfaf8f gui=bold hi PreProc guifg=#ffcfaf gui=bold hi Question guifg=#ffffff gui=bold hi Repeat guifg=#8fffff gui=underline hi Search guifg=#000000 guibg=#c15c66 hi SpecialChar guifg=#dca3a3 gui=bold hi SpecialComment guifg=#dca3a3 gui=bold hi Special guifg=#7f7f7f hi SpecialKey guifg=#7e7e7e hi Statement guifg=#8fffff hi StatusLine guifg=#333333 guibg=#f18c96 hi StatusLineNC guifg=#333333 guibg=#cccccc hi StorageClass guifg=#ffffff gui=bold hi String guifg=#cc9393 hi Structure guifg=#ffffff gui=bold,underline hi Tag guifg=#dca3a3 gui=bold hi Title guifg=#ffffff guibg=#333333 gui=bold hi Todo guifg=#ffffff guibg=#000000 gui=bold hi Typedef guifg=#ffffff gui=bold,underline hi Type guifg=#ffffff gui=bold hi VertSplit guifg=#333333 guibg=#cccccc hi Visual guifg=#333333 guibg=#f18c96 gui=reverse hi VisualNOS guifg=#333333 guibg=#f18c96 gui=bold,underline hi WarningMsg guifg=#ffffff guibg=#333333 gui=bold hi WildMenu guifg=#000000 guibg=#dca3a3 if has("vms") set nobackup " do not keep a backup file, use versions instead else set backup " keep a backup file endif set history=50 " keep 50 lines of command line history set ruler " show the cursor position all the time set showcmd " display incomplete commands set incsearch " do incremental searching " 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 " CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo, " so that you can undo CTRL-U after inserting a line break. inoremap <C-U> <C-G>u<C-U> " In many terminal emulators the mouse works just fine, thus enable it. if has(‘mouse‘) set mouse=a endif " Switch syntax highlighting on, when the terminal has colors " Also switch on highlighting the last used search pattern. 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). " Also don‘t do it when the mark is in the first line, that is the default " position when opening a file. autocmd BufReadPost * \ if line("‘\"") > 1 && line("‘\"") <= line("$") | \ exe "normal! g`\"" | \ endif augroup END else set autoindent " always set autoindenting on endif " has("autocmd") " Convenient command to see the difference between the current buffer and the " file it was loaded from, thus the changes you made. " Only define it when not defined already. if !exists(":DiffOrig") command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis \ | wincmd p | diffthis endif
以上是在windows下的gvim配置文件.
14.05.13更新了字体Courier 10 Pitch,行号(适用于linux):
" An example for a vimrc file. " " Maintainer: Bram Moolenaar <Bram@vim.org> " Last change: 2008 Dec 17 " " 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 " Use Vim settings, rather than Vi settings (much better!). " This must be first, because it changes other options as a side effect. set nocompatible " Make Tab 4 space set ts=4 set expandtab set autoindent set showmatch " allow backspacing over everything in insert mode set backspace=indent,eol,start set background=dark " set font " set guifont=DejaVu\ Sans\ Mono\ 15 set guifont=Courier\ 10\ Pitch\ 15 " set curline set cursorline " " set number set number " hi clear hi Boolean guifg=#dca3a3 gui=bold hi Character guifg=#dca3a3 gui=bold hi Comment guifg=#7f7f7f hi Condtional guifg=#8fffff hi Constant guifg=#dca3a3 gui=bold hi Cursor guifg=#000000 guibg=#aeaeae hi Debug guifg=#dca3a3 gui=bold hi Define guifg=#ffcfaf gui=bold hi Delimiter guifg=#8f8f8f hi DiffAdd guibg=#613c46 hi DiffChange guibg=#333333 hi DiffDelete guifg=#333333 guibg=#464646 gui=none hi DiffText guifg=#ffffff guibg=#1f1f1f gui=bold hi Directory guifg=#ffffff gui=bold hi Error guifg=#000000 guibg=#00ffff hi ErrorMsg guifg=#000000 guibg=#00c0cf hi Exception guifg=#8fffff gui=underline hi Float guifg=#9c93b3 hi FoldColumn guifg=#dca3a3 guibg=#464646 hi Folded guifg=#dca3a3 guibg=#333333 hi Function guifg=#ffff8f hi Identifier guifg=#ffffff hi Include guifg=#ffcfaf gui=bold hi IncSearch guifg=#000000 guibg=#c15c66 hi Keyword guifg=#ffffff gui=bold hi Label guifg=#8fffff gui=underline hi LineNr guifg=#7f7f7f guibg=#464646 hi Macro guifg=#ffcfaf gui=bold hi ModeMsg guifg=#dca3a3 gui=bold hi MoreMsg guifg=#ffffff gui=bold hi NonText guifg=#1f1f1f hi Normal guifg=#cccccc guibg=#3f3f3f hi Number guifg=#aca0a3 hi Operator guifg=#ffffff hi PreCondit guifg=#dfaf8f gui=bold hi PreProc guifg=#ffcfaf gui=bold hi Question guifg=#ffffff gui=bold hi Repeat guifg=#8fffff gui=underline hi Search guifg=#000000 guibg=#c15c66 hi SpecialChar guifg=#dca3a3 gui=bold hi SpecialComment guifg=#dca3a3 gui=bold hi Special guifg=#7f7f7f hi SpecialKey guifg=#7e7e7e hi Statement guifg=#8fffff hi StatusLine guifg=#333333 guibg=#f18c96 hi StatusLineNC guifg=#333333 guibg=#cccccc hi StorageClass guifg=#ffffff gui=bold hi String guifg=#cc9393 hi Structure guifg=#ffffff gui=bold,underline hi Tag guifg=#dca3a3 gui=bold hi Title guifg=#ffffff guibg=#333333 gui=bold hi Todo guifg=#ffffff guibg=#000000 gui=bold hi Typedef guifg=#ffffff gui=bold,underline hi Type guifg=#ffffff gui=bold hi VertSplit guifg=#333333 guibg=#cccccc hi Visual guifg=#333333 guibg=#f18c96 gui=reverse hi VisualNOS guifg=#333333 guibg=#f18c96 gui=bold,underline hi WarningMsg guifg=#ffffff guibg=#333333 gui=bold hi WildMenu guifg=#000000 guibg=#dca3a3 if has("vms") set nobackup " do not keep a backup file, use versions instead else set backup " keep a backup file endif set history=50 " keep 50 lines of command line history set ruler " show the cursor position all the time set showcmd " display incomplete commands set incsearch " do incremental searching " 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 " CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo, " so that you can undo CTRL-U after inserting a line break. inoremap <C-U> <C-G>u<C-U> " In many terminal emulators the mouse works just fine, thus enable it. if has(‘mouse‘) set mouse=a endif " Switch syntax highlighting on, when the terminal has colors " Also switch on highlighting the last used search pattern. 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). " Also don‘t do it when the mark is in the first line, that is the default " position when opening a file. autocmd BufReadPost * \ if line("‘\"") > 1 && line("‘\"") <= line("$") | \ exe "normal! g`\"" | \ endif augroup END else set autoindent " always set autoindenting on endif " has("autocmd") " Convenient command to see the difference between the current buffer and the " file it was loaded from, thus the changes you made. " Only define it when not defined already. if !exists(":DiffOrig") command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis \ | wincmd p | diffthis endif
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。