vimrc

来源:互联网 发布:快手录歌都用什么软件 编辑:程序博客网 时间:2024/05/16 01:02
</pre><pre name="code" class="html">" .vimrc - Vim configuration file."" Copyright (c) 2010 Jeffy Du. All Rights Reserved."" Maintainer: Jeffy Du <jeffy.du@gmail.com>" Maintainer: KunMing Xie <ckelsel@hotmail.com>" Created: 2010-01-01" LastChange: 2015-09-07" GENERAL SETTINGS: {{{1" To use VIM settings, out of VI compatible mode.set nocompatible" Enable file type detection.filetype plugin indent on" Syntax highlighting.syntax on" Setting colorschemecolor evening" Other settings.set autoindentset autoreadset autowriteset background=darkset backspace=indent,eol,startset nobackupset cindentset cinoptions=:0set cursorlineset completeopt=longest,menuoneset noexpandtabset fileencodings=cp936,utf-8,gb2312,gbk,gb18030set fileformat=unixset foldenableset foldmethod=markerset guioptions-=Tset guioptions-=mset guioptions-=rset guioptions-=lset helpheight=10set helplang=cnset hiddenset history=100set hlsearchset ignorecaseset incsearchset laststatus=2"set mouse=a"set numberset pumheight=10set rulerset scrolloff=5set shiftwidth=4set showcmdset smartindentset smartcaseset tabstop=4set termencoding=utf-8set textwidth=80set whichwrap=h,lset wildignore=*.bak,*.o,*.e,*~set wildmenuset wildmode=list:longest,fullset wrap" AUTO COMMANDS: {{{1" auto expand tab to blanks"autocmd FileType c,cpp set expandtab" Restore the last quit position when open file.autocmd BufReadPost *    \ if line("'\'") > 0 && line("'\"") <= line("$") |    \ exe "normal g'\"" |    \ endif" SHORTCUT SETTINGS: {{{1" Set mapleaderlet mapleader=","" Space to command mode.nnoremap <space> :vnoremap <space> :" Switching between buffers.nnoremap <C-h> <C-W>hnnoremap <C-j> <C-W>jnnoremap <C-k> <C-W>knnoremap <C-l> <C-W>linoremap <C-h> <Esc><C-W>hinoremap <C-j> <Esc><C-W>jinoremap <C-k> <Esc><C-W>kinoremap <C-l> <Esc><C-W>l" "cd" to change to open directory.let OpenDir=system("pwd")nmap <silent> <leader>cd :exe 'cd ' . OpenDir<cr>:pwd<cr>function AddGPL3()    call setline(1,"/**")    call append (1, "*  Copyright (C) 2015 ckelsel@hotmail.com")    call append (2, "*")    call append (3, "*  This program is free software: you can redistribute it and/or modify")    call append (4, "*  it under the terms of the GNU General Public License as published by")    call append (5, "*  the Free Software Foundation, either version 3 of the License, or")    call append (6, "*  (at your option) any later version.")    call append (7, "*")    call append (8, "*  This program is distributed in the hope that it will be useful,")    call append (9, "*  but WITHOUT ANY WARRANTY; without even the implied warranty of")    call append (10, "*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the")    call append (11, "*  GNU General Public License for more details.")    call append (12, "*  ")    call append (13, "*  You should have received a copy of the GNU General Public License")    call append (14, "*  along with this program.  If not, see <http://www.gnu.org/licenses/>.")    call append (15, "*/")endfmap gpl :call AddGPL3()function AddTitle()    call setline(1,"/**-----------------------------------------------------------------------------")    call append (1," * @file " . expand("%"))    call append (2," *" )    call append (3," * @author xiekunming@cldmind.com" )    call append (4," *" )    call append (5," * @date " . strftime("%Y-%m-%d"))    call append (6," *" )    call append (7," * @brief " )    call append (8," *" )    call append (9," * @version " )    call append (10," *" )    call append (11," *----------------------------------------------------------------------------*/")endfmap title :call AddTitle()function AddTitlePrivate()    call setline(1,"/**-----------------------------------------------------------------------------")    call append (1," * @file " . expand("%"))    call append (2," *" )    call append (3," * @author ckelsel@hotmail.com" )    call append (4," *" )    call append (5," * @date " . strftime("%Y-%m-%d"))    call append (6," *" )    call append (7," * @brief " )    call append (8," *" )    call append (9," * @version " )    call append (10," *" )    call append (11," *----------------------------------------------------------------------------*/")endfmap mytitle :call AddTitlePrivate()function AddCdemo()    call setline(1,"#include <stdio.h>")    call append (1,"#include <stdlib.h>")    call append (2,"#include <string.h>")    call append (3,"")    call append (4,"int main(int argc, char **argv)")    call append (5,"{")    call append (6," return 0;")    call append (7,"}")endfmap cdemo :call AddCdemo()function AddCxxdemo()    call setline(2,"#include <iostream>")    call append (2,"using namespace std;")    call append (3,"")    call append (4,"int main(int argc, char **argv)")    call append (5,"{")    call append (6," return 0;")    call append (7,"}")endfmap cxxdemo :call AddCxxdemo()function AddSvnLog()    call setline(1,"Author: xiekunming")    call append (1,"Description: ")    call append (2,"1. ")endfmap svnlog :call AddSvnLog()" PLUGIN SETTINGS: {{{1" taglist.vimlet g:Tlist_Auto_Update=1let g:Tlist_Process_File_Always=1let g:Tlist_Exit_OnlyWindow=0let g:Tlist_Show_One_File=1let g:Tlist_WinWidth=25let g:Tlist_Enable_Fold_Column=0let g:Tlist_Auto_Highlight_Tag=1" NERDTree.vimlet g:NERDTreeWinPos="right"let g:NERDTreeWinSize=25let g:NERDTreeShowLineNumbers=1let g:NERDTreeQuitOnOpen=1" cscope.vimif has("cscope")    set csto=1    set cst    set nocsverb    if filereadable("cscope.out")        cs add cscope.out    endif    set csverbendif" OmniCppComplete.vimlet g:OmniCpp_DefaultNamespaces=["std"]let g:OmniCpp_MayCompleteScope=1let g:OmniCpp_SelectFirstItem=2" VimGDB.vimif has("gdb")    set asm=0    let g:vimgdb_debug_file=""    run macros/gdb_mappings.vimendif" LookupFile settinglet g:LookupFile_TagExpr='"./tags.filename"'let g:LookupFile_MinPatLength=2let g:LookupFile_PreserveLastPattern=0let g:LookupFile_PreservePatternHistory=1let g:LookupFile_AlwaysAcceptFirst=1let g:LookupFile_AllowNewFiles=0" Man.vimsource $VIMRUNTIME/ftplugin/man.vim" snipMatelet g:snips_author="Du Jianfeng"let g:snips_email="cmdxiaoha@163.com"let g:snips_copyright="SicMicro, Inc"" plugin shortcutsfunction! RunShell(Msg, Shell)    echo a:Msg . '...'    call system(a:Shell)    echon 'done'endfunctionnmap <F2> :TlistToggle<cr>nmap <F3> :NERDTreeToggle<cr>nmap <F4> :MRU<cr>nmap <F5> <Plug>LookupFile<cr>nmap <F6> :vimgrep /<C-R>=expand("<cword>")<cr>/ **/*.c **/*.h<cr><C-o>:cw<cr>"nmap <F9> :call RunShell("Generate tags", "ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .")<cr>"nmap <F10> :call HLUDSync()<cr>nmap <F11> :call RunShell("Generate filename tags", "~/.vim/shell/genfiletags.sh")<cr>nmap <F12> :call RunShell("Generate cscope", "cscope -Rb")<cr>:cs add cscope.out<cr>nmap <leader>sa :cs add cscope.out<cr>nmap <leader>ss :cs find s <C-R>=expand("<cword>")<cr><cr>nmap <leader>sg :cs find g <C-R>=expand("<cword>")<cr><cr>nmap <leader>sc :cs find c <C-R>=expand("<cword>")<cr><cr>nmap <leader>st :cs find t <C-R>=expand("<cword>")<cr><cr>nmap <leader>se :cs find e <C-R>=expand("<cword>")<cr><cr>nmap <leader>sf :cs find f <C-R>=expand("<cfile>")<cr><cr>nmap <leader>si :cs find i <C-R>=expand("<cfile>")<cr><cr>nmap <leader>sd :cs find d <C-R>=expand("<cword>")<cr><cr>nmap <leader>zz <C-w>onmap <leader>gs :GetScripts<cr>nmap <C-N> :tabnext<CR>nmap <C-P> :tabp<CR>nmap <F9> :cn<CR>nmap <F10> :cp<CR>nmap <Space> :set ts=4set sw=4set expandtabset tags=~/tagsif has('win32')    au GUIEnter * simalt ~xendif


0 0
原创粉丝点击