mkdir -p ~/.vim/bundlejavascript
Git clone git@github.com:VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vimphp
能夠直接克隆個人vim配置文件到你的本地css
git clone git@github.com:Tangugo/vim.githtml
把 .vimrc
配置文件拷貝到 ~/
目錄下java
cp vim/.vimrc ~/python
注:前面帶點.
的文件是隱藏文件,需 ls -la
才能查看到linux
vim配置文件通常分爲如下四部分:ios
加載vim的相關插件(vim插件大全)c++
vim的常規設置git
vim插件的設置
鍵盤中一些鍵的功能從新映射其餘鍵或組合鍵上(例如Esc
退出插入模式映射到jj
組合鍵)
.vimrc
配置文件生效按如下步驟操做
cd ~/.vim/bundle
vim
:BundleInstall
安裝插件須要必定的時間,跟網速有關,喝杯茶等待
能夠參考 http://howiefh.github.io/2015/05/22/vim-install-youcompleteme-plugin/
確保Vim版本至少是7.3.584,而且支持python2腳本
cd ~/.vim/bundle/YouCompleteMe
./install.py
須要支持C語言的話
./install.py –clang-completer
cp third_party/ycmd/cpp/ycm/.ycm_extra_conf.py ~/
‘-isystem’,
‘/usr/include’,
在.vimrc
中設定 YouCompleteMe配置(第二部克隆vimrc文件,該vimrc已指定了)
let g:ycm_global_ycm_extra_conf = ‘~/.ycm_extra_conf.py’
在寫代碼時,每當輸入 .
就提示 ConnectionError
錯誤提示(如輸入: os.
),到 /tmp/ycm_temp
目錄下查看日誌文件,提示以下錯誤:
Traceback (most recent call last):
File "/home/zhu/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/jedihttp.py", line 23, in <module>
from waitress import serve
ImportError: No module named waitress
1
2
3
4
5
1
2
3
4
5
發現報錯源,順藤摸瓜,因而到PyPi(幾乎全部Python的第三方庫在此處都能找到)查找waitress模塊,下載安裝後,完美解決了代碼補全出現的問題
waitress安裝:
tar -zxvf waitress-1.0a2.tar.gz
cd waitress-1.0a2
python setup.py install # 注:非root用戶需在命令前加上sudo
安裝完後vim就變得無比強大絢麗了,看截圖
如下是個人vimrc配置文件
" ************* Vundle 配置 ****************
filetype off " 偵測文件類型
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" Vundle.vim : vim的一個很是好用的插件管理器
Bundle 'gmarik/Vundle.vim'
" 更酷的啓動界面
"Bundle 'mhinz/vim-startify'
" 協做編程
"Bundle 'FredKSchott/CoVim'
" 代碼補全
Bundle 'Valloric/YouCompleteMe'
Bundle 'SirVer/ultisnips'
Bundle 'honza/vim-snippets'
Bundle 'YanhaoMo/snippets'
" Python代碼補全
"Bundle 'Pydiction'
" 符號自動補全
Bundle 'Raimondi/delimitMate'
" 文件搜索
Bundle 'kien/ctrlp.vim'
Bundle 'Shougo/unite.vim'
Bundle 'scrooloose/nerdtree'
Bundle 'vim-scripts/mru.vim'
" 靜態語法檢查
Bundle 'scrooloose/syntastic'
" 代碼瀏覽
Bundle 'majutsushi/tagbar'
" git支持
Bundle 'tpope/vim-fugitive'
Bundle 'airblade/vim-gitgutter'
" 美化主題
Bundle 'tomasr/molokai'
Bundle 'morhetz/gruvbox'
Bundle 'kien/rainbow_parentheses.vim'
Bundle 'bling/vim-airline'
"Bundle 'vim-airline-themes'
Bundle 'nathanaelkane/vim-indent-guides'
Bundle 'solarized'
Bundle 'jpo/vim-railscasts-theme'
"Bundle 'altercation/vim-colors-solarized.git'
"Bundle 'fholgado/minibufexpl.vim'
" 代碼bug追蹤
Bundle 'ZenCoding.vim'
" 編輯加強
" 多光標操做
Bundle 'terryma/vim-multiple-cursors'
" 成對符號編輯
Bundle 'tpope/vim-surround'
Bundle 'tpope/vim-unimpaired'
" 快速註釋
Bundle 'scrooloose/nerdcommenter'
" 自動對齊
Bundle 'godlygeek/tabular'
" 快速移動
Bundle 'Lokaltog/vim-easymotion'
" 代碼塊對齊用
Bundle 'Yggdroot/indentLine'
" 加強狀態欄
Bundle 'rstatusline'
" tmux支持
Bundle 'benmills/vimux'
" c/c++
Bundle 'vim-scripts/a.vim'
Bundle 'vim-scripts/c.vim'
" org-mode
Bundle 'jceb/vim-orgmode'
Bundle 'tpope/vim-speeddating'
" markdown
Bundle 'plasticboy/vim-markdown'
" 能夠經過瀏覽器實時預覽,可是要安裝額外依賴,詳見官網
"Bundle 'suan/vim-instant-markdown'
" 網頁開發
Bundle 'mattn/emmet-vim'
" pyhon
Bundle 'klen/python-mode'
"Bundle 'python-imports.vim'
" js
Bundle 'coolwanglu/vim.js'
" golang
"Bundle 'fatih/vim-go'
" 用ack代替grep搜索
Bundle 'mileszs/ack.vim'
"bundle 'vimwiki/vimwiki'
"Bundle 'vim-scripts/bufexplorer.zip'
"Bundle 'terryma/vim-smooth-scroll'
call vundle#end()
filetype plugin on " 載入文件類型插件
filetype indent on " 爲特定文件類型載入相關縮進文件
" *************** gvim配置 ***************
if has("gui_running")
let $LANG='en' "設置gvim菜單欄始終顯示爲英文
set langmenu=en
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
"set guifont=DejaVu\ Sans\ Mono\ for\ Powerline\ Book\ 10
set guifont=Source\ Code\ Pro\ for\ Powerline\ Regular\ 10
set guioptions-=e
set guioptions-=m
set guioptions-=T
set guioptions-=L
set guioptions-=r
set guioptions-=B
set guioptions-=0
set go=
winpos 1000 0
"set lines=100 columns=150 " 開啓時的窗口默認大小
endif
" *************** vim經常使用的基本設置 ***************
set nocompatible " 不使用vi的鍵盤模式,而是vim本身的
"syntax enable " 開啓語法高亮功能
syntax on " 語法高亮支持
set nu " 顯示行號
set rnu " 顯示相對行號
set wrap " 當一行文字很長時換行
"set nowrap " 當一行文字很長時取消換行
set showmatch " 當光標移動到一個括號時高亮顯示對應的另外一個括號
set showcmd " 回顯輸入的命令
set showmode " 顯示當前的模式
set clipboard+=unnamed " 關聯繫統的剪貼板
set ruler " 在編輯過程當中右下角顯示光標的行列信息
set nocp " 讓Vim工做在不兼容模式下
set shortmess=atI " 啓動時不顯示捐助烏干達兒童的提示
set so=6 " 上下滾行時空餘6行
set autoindent " 自動套用上一行的縮進方式
set smartindent " 智能縮進
set mouse=a " 開啓鼠標支持
set laststatus=2 " 老是顯示狀態行
set backspace=indent,eol,start " 對退格鍵提供更好的支持
set ts=4 " 設置tab長度爲4
set sts=4 " 設置製表符寬度
set shiftwidth=4 " 設置縮進空格數
set expandtab " 用空格代替tab鍵
set smarttab " 更加智能的tab鍵
set hid " 當buffer被丟棄時隱藏它
set encoding=utf-8 " 默認使用utf-8編碼格式
set fileencodings=utf-8,cp936,gb18030,big5,euc-kr,latin1 " 自動判斷編碼時 依次嘗試一下編碼
set ffs=unix,dos,mac " 設置文件類型
set hlsearch " 高亮搜索內容
set ignorecase " 搜索模式裏忽略大小寫
set smartcase " 若是搜索字符串裏包含大寫字母,則禁用 ignorecase
set incsearch " 顯示搜索的動態匹配效果
set lazyredraw " 解決某些類型的文件因爲syntax致使vim反應過慢的問題
set ttyfast " 平滑地變化
set cc=80 " 第80字符處顯示分隔符
set foldmethod=indent " 摺疊方式
set nofoldenable " 不自動摺疊
set foldcolumn=1 " 在行號前空出一列的寬度
set t_Co=256 " 設置256真彩色
set history=1000 " 設置歷史記錄條數
"set autoread " 當文件在外部被修改時自動載入
"set cindent " 使用c語言的縮進格式
"set whichwrap+=<,>,h,l " 容許backspace和光標鍵跨越行邊界
"set cmdheight=2 " 顯示兩行命令行
set list lcs=tab:\♠\ ,trail:• " 顯示tab鍵爲♠,而且顯示每行結尾的空格爲'•'
" 一些備用字符:›┆┇┊┋♠♦•
" 格式化狀態行顯示的內容
set statusline=[%t]\ %y\ %m%=%{&fileencoding}\ [%{&ff}]\ [%l,\ %c]\ [%L]\ [%p%%]
" 打開一個文件自動定位到上一次退出的位置
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
" 保存.vim文件後不用退出便可生效
"autocmd BufWritePost $MYVIMRC source $MYVIMRC
"au! bufwritepost .vimrc source %
" ************** 備份設置 ****************
"set nobackup " 不進行備份
"set nowb " 從新載入文件時不要備份
"set noswapfile " 不使用swf文件,可能致使錯誤沒法恢復
" *************** 關閉錯誤聲音 **************
set noerrorbells
set novisualbell
set t_vb=
" **************** 設置vim主題外觀 ***************
"set background=light " 設置vim背景爲淺色
set background=dark " 設置vim背景爲深色
set cursorline " 突出顯示當前行
set cursorcolumn " 突出顯示當前列
"colorscheme molokai " 設置molokai高亮主題
"colorscheme desert " 設置desert高亮主題
"let g:solarized_termcolors=256
"colorscheme solarized " 設置solarized高亮主題
"let g:gruvbox_termcolors=16
colorscheme gruvbox " 設置gruvbox高亮主題
" ************** vim的配色 **************
"hi CursorLine cterm=NONE ctermbg=237 ctermfg=NONE
"hi CursorColumn cterm=NONE ctermbg=237 ctermfg=NONE
hi vertsplit ctermbg=bg guibg=bg
hi GitGutterAdd ctermbg=bg guibg=bg
hi GitGutterChange ctermbg=bg guibg=bg
hi GitGutterDelete ctermbg=bg guibg=bg
hi GitGutterChangeDelete ctermbg=bg guibg=bg
hi SyntasticErrorSign ctermbg=bg guibg=bg
hi SyntasticWarningSign ctermbg=bg guibg=bg
hi FoldColumn ctermbg=bg guibg=bg
" *********** NERDTree插件配置 ***********
let NERDTreeChDirMode=2 " 設置當前目錄爲nerdtree的起始目錄
let NERDChristmasTree=1 " 使得窗口有更好看的效果
let NERDTreeMouseMode=1 " 雙擊鼠標左鍵打開文件
let NERDTreeWinSize=25 " 設置窗口寬度爲25
let NERDTreeQuitOnOpen=1 " 打開一個文件時nerdtree分欄自動關閉
" *********** ctags插件配置 ***********
set tags+=/usr/include/tags
" ********* cscope插件配置 **********
if has("cscope")
"set csprg=/usr/bin/cscope
set csto=0
set cst
set nocsverb
set cscopequickfix=s-,c-,d-,i-,t-,e- "在quickfix窗口中顯示搜索結果
" add any database in current directory
if filereadable("cscope.out")
cs add cscope.out
" else add database pointed to by environment
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
set csverb
endif
" *********** nerdcommenter快速註釋插件配置 **********
" Add spaces after comment delimiters by default
let g:NERDSpaceDelims = 1
" Use compact syntax for prettified multi-line comments
let g:NERDCompactSexyComs = 1
" Align line-wise comment delimiters flush left instead of following code indentation
let g:NERDDefaultAlign = 'left'
" Set a language to use its alternate delimiters by default
let g:NERDAltDelims_java = 1
" Add your own custom formats or override the defaults
let g:NERDCustomDelimiters = { 'c': { 'left': '/**','right': '*/' } }
" Allow commenting and inverting empty lines (useful when commenting a region)
let g:NERDCommentEmptyLines = 1
" Enable trimming of trailing whitespace when uncommenting
let g:NERDTrimTrailingWhitespace = 1
" *********** syntastic插件配置 ***********
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 1
let g:syntastic_error_symbol = '✗'
let g:syntastic_warning_symbol = '⚡'
"let g:syntastic_cpp_include_dirs = ['/usr/include/qt']
"let g:syntastic_cpp_compiler_options = '-std=gnu++11 -Wall'
let g:syntastic_mode_map = { 'mode': 'passive', 'active_filetypes': [],'passive_filetypes': [] }
" ********** pydiction補全設置 **********
"let g:pydiction_location = '~/.vim/bundle/Pydiction/complete-dict'
""defalut g:pydiction_menu_height == 15
"let g:pydiction_menu_height = 10
" ********** youcompleteme自動補全配置 ***********
let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py'
"let g:ycm_python_binary_path = 'python'
set completeopt=longest,menu "讓Vim的補全菜單行爲與通常IDE一致(參考VimTip1228)
autocmd InsertLeave * if pumvisible() == 0|pclose|endif "離開插入模式後自動關閉預覽窗口
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>" "回車即選中當前項
"上下左右鍵的行爲 會顯示其餘信息
inoremap <expr> <Down> pumvisible() ? "\<C-n>" : "\<Down>"
inoremap <expr> <Up> pumvisible() ? "\<C-p>" : "\<Up>"
inoremap <expr> <PageDown> pumvisible() ? "\<PageDown>\<C-p>\<C-n>" : "\<PageDown>"
inoremap <expr> <PageUp> pumvisible() ? "\<PageUp>\<C-p>\<C-n>" : "\<PageUp>"
" 跳轉到定義處
nnoremap <leader>jd :YcmCompleter GoToDefinitionElseDeclaration<CR>
nnoremap <F6> :YcmForceCompileAndDiagnostics<CR> "force recomile with syntastic
" nnoremap <leader>lo :lopen<CR> "open locationlist
" nnoremap <leader>lc :lclose<CR> "close locationlist
inoremap <leader><leader> <C-x><C-o>
" 不顯示開啓vim時檢查ycm_extra_conf文件的信息
let g:ycm_confirm_extra_conf=0
" 開啓基於tag的補全,能夠在這以後添加須要的標籤路徑
let g:ycm_collect_identifiers_from_tags_files=1
"註釋和字符串中的文字也會被收入補全
let g:ycm_collect_identifiers_from_comments_and_strings = 0
" 輸入第2個字符開始補全
let g:ycm_min_num_of_chars_for_completion=2
" 禁止緩存匹配項,每次都從新生成匹配項
let g:ycm_cache_omnifunc=0
" 開啓語義補全
let g:ycm_seed_identifiers_with_syntax=1
"在註釋輸入中也能補全
let g:ycm_complete_in_comments = 1
"在字符串輸入中也能補全
let g:ycm_complete_in_strings = 1
" 設置在下面幾種格式的文件上屏蔽ycm
let g:ycm_filetype_blacklist = {
\ 'tagbar' : 1,
\ 'nerdtree' : 1,
\}
"youcompleteme 默認tab s-tab 和 ultisnips 衝突
let g:ycm_key_list_select_completion = ['<Down>']
let g:ycm_key_list_previous_completion = ['<Up>']
" 修改對C函數的補全快捷鍵,默認是CTRL + space,修改成ALT + ;
let g:ycm_key_invoke_completion = '<M-;>'
" SirVer/ultisnips 代碼片段
" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
let g:UltiSnipsListSnippets="<c-e>"
"定義存放代碼片斷的文件夾,使用自定義和默認的,將會的到全局,有衝突的會提示
let g:UltiSnipsSnippetDirectories=["~/.vim/bundle/vim-snippets/UltiSnips"]
" 參考https://github.com/Valloric/YouCompleteMe/issues/36#issuecomment-62941322
" 解決ultisnips和ycm tab衝突,若是不使用下面的辦法解決能夠參考
" https://github.com/Valloric/YouCompleteMe/issues/36#issuecomment-63205056的配置
" begin
" let g:ycm_key_list_select_completion=['<C-n>', '<Down>']
" let g:ycm_key_list_previous_completion=['<C-p>', '<Up>']
" let g:UltiSnipsExpandTrigger="<Tab>"
" let g:UltiSnipsJumpForwardTrigger="<Tab>"
" let g:UltiSnipsJumpBackwardTrigger="<S-Tab>"
" end
" UltiSnips completion function that tries to expand a snippet. If there's no
" snippet for expanding, it checks for completion window and if it's
" shown, selects first element. If there's no completion window it tries to
" jump to next placeholder. If there's no placeholder it just returns TAB key
function! g:UltiSnips_Complete()
call UltiSnips#ExpandSnippet()
if g:ulti_expand_res == 0
if pumvisible()
return "\<C-n>"
else
call UltiSnips#JumpForwards()
if g:ulti_jump_forwards_res == 0
return "\<TAB>"
endif
endif
endif
return ""
endfunction
au BufEnter * exec "inoremap <silent> " . g:UltiSnipsExpandTrigger . " <C-R>=g:UltiSnips_Complete()<cr>"
" Expand snippet or return
let g:ulti_expand_res = 1
function! Ulti_ExpandOrEnter()
call UltiSnips#ExpandSnippet()
if g:ulti_expand_res
return ''
else
return "\<return>"
endfunction
" Set <space> as primary trigger
inoremap <return> <C-R>=Ulti_ExpandOrEnter()<CR>
" ********** indentLine插件 **********
let g:indentLine_char = '┊' "代碼塊對齊用┊符號
" *********** UltiSnips插件配置 **********
let g:UltiSnipsExpandTrigger="<tab>"
""let g:UltiSnipsJumpForwardTrigger="<tab>"
""let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
let g:UltiSnipsEditSplit = "vertical"
"let g:UltiSnipsSnippetDirectories = ["UltiSnips", "bundle/snippets"]
let g:UltiSnipsSnippetDirectories = ["bundle/snippets"]
" ********** rainbow_parentheses插件配置 ***********
let g:rbpt_colorpairs = [
\ ['brown', 'RoyalBlue3'],
\ ['Darkblue', 'SeaGreen3'],
\ ['darkgray', 'DarkOrchid3'],
\ ['darkgreen', 'firebrick3'],
\ ['darkcyan', 'RoyalBlue3'],
\ ['darkred', 'SeaGreen3'],
\ ['darkmagenta', 'DarkOrchid3'],
\ ['brown', 'firebrick3'],
\ ['gray', 'RoyalBlue3'],
\ ['black', 'SeaGreen3'],
\ ['darkred', 'DarkOrchid3'],
\ ['darkmagenta', 'DarkOrchid3'],
\ ['Darkblue', 'firebrick3'],
\ ['darkgreen', 'RoyalBlue3'],
\ ['darkcyan', 'SeaGreen3'],
\ ['red', 'firebrick3'],
\ ]
let g:rbpt_max = 16
let g:rbpt_loadcmd_toggle = 0
au VimEnter * RainbowParenthesesToggle
au Syntax * RainbowParenthesesLoadRound
au Syntax * RainbowParenthesesLoadSquare
au Syntax * RainbowParenthesesLoadBraces
" ********** vim-multiple-cursors插件配置 ***********
let g:multi_cursor_use_default_mapping=0
let g:multi_cursor_next_key='<C-m>'
let g:multi_cursor_prev_key='<C-p>'
let g:multi_cursor_skip_key='<C-x>'
let g:multi_cursor_quit_key='<Esc>'
" ********** airline插件配置 ***********
let g:airline_powerline_fonts=1 "配置airline使用powerline字體
"let g:airline#extensions#tabline#enabled = 1
"let g:airline#extensions#tabline#left_sep = ' '
"let g:airline#extensions#tabline#left_alt_sep = '|'
" *********** vimwiki插件配置 ***********
"let g:vimwiki_list = [{'path' : '~/.vimwiki/',
" \'template_path' : '~/.vimwiki/template/',
" \'template_default' : 'default_template',
" \'template_ext' : '.html',
" \'path_html': '~/.vimwiki/html/'}
" \]
" ********** mru插件配置 **********
let MRU_Auto_Close = 1
let MRU_Max_Entries = 40
" ************ pythom-mode *********
let g:pymode_lint_on_write = 0
let g:pymode_lint_signs = 0
let g:pymode_rope_lookup_project = 0
let g:pymode_rope = 0
let g:pymode_floding = 0
" *********** 從新映射一些鍵 **********
" 設置以空格打開和關閉摺疊
nmap <space> @=((foldclosed(line('.'))<0)?'zc':'zo')<CR>
" 當一行很長時把分開的段行看成一行來移動
map j gj
map k gk
" 將Esc鍵映射到jj,zz
im jj <Esc>
im JJ <Esc>
im zz <Esc>
im ZZ <Esc>
map zz <Esc>
map ZZ <Esc>
" quickfix相關的一些快捷鍵
map cop :copen<CR>
map ccl :cclose<CR>
map cn :cn<CR>
map cp :cp<CR>
" emacs式的行內跳轉
map <c-a> ^
map <c-e> $
imap <c-a> <Esc>^i
imap <c-e> <Esc>$a
" ff跳轉到文件末尾
map ff G
" visual模式下快速對齊
vnoremap < <gv
vnoremap > >gv
" <F3>關閉打開目錄樹
map <F3> :NERDTreeToggle<CR>
imap <F3> <ESC> :NERDTreeToggle<CR>
" 打開樹狀文件目錄
map <C-F3> \be
" <F4>生成ctags
map <F4> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
im <F4> <Esc>:!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
nmap go g<C-]>
nmap bk <C-t>
nmap <C-_>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-_>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-_>d :cs find d <C-R>=expand("<cword>")<CR><CR>
" <F5>編譯運行
:autocmd BufRead,BufNewFile *.dot map <F5> :w<CR>:!dot -Tjpg -o %<.jpg % && eog %<.jpg <CR><CR> && exec "redr!"
" C,C++ 按F5編譯運行
map <F5> :call CompileRunGcc()<CR>
func! CompileRunGcc()
exec "w"
if &filetype == 'c'
exec "!g++ % -o %<"
exec "!time ./%<"
elseif &filetype == 'cpp'
exec "!g++ % -o %<"
exec "!time ./%<"
elseif &filetype == 'java'
exec "!javac %"
exec "!time java %<"
elseif &filetype == 'sh'
:!time bash %
elseif &filetype == 'python'
exec "!time python2.7 %"
elseif &filetype == 'html'
exec "!firefox % &"
elseif &filetype == 'go'
" exec "!go build %<"
exec "!time go run %"
elseif &filetype == 'mkd'
exec "!~/.vim/markdown.pl % > %.html &"
exec "!firefox %.html &"
endif
endfunc
" C,C++的調試
map <F8> :call Rungdb()<CR>
func! Rungdb()
exec "w"
exec "!g++ % -g -o %<"
exec "!gdb ./%<"
endfunc
" <F6>語法檢查
map <F6> :SyntasticCheck<CR>
im <F6> <Esc>:SyntasticCheck<CR>
"" 代碼格式優化化
"map <F6> :call FormartSrc()<CR><CR>
"" 定義FormartSrc()
"func FormartSrc()
" exec "w"
" if &filetype == 'c'
" exec "!astyle --style=ansi -a --suffix=none %"
" elseif &filetype == 'cpp' || &filetype == 'hpp'
" exec "r !astyle --style=ansi --one-line=keep-statements -a --suffix=none %> /dev/null 2>&1"
" elseif &filetype == 'perl'
" exec "!astyle --style=gnu --suffix=none %"
" elseif &filetype == 'py'||&filetype == 'python'
" exec "r !autopep8 -i --aggressive %"
" elseif &filetype == 'java'
" exec "!astyle --style=java --suffix=none %"
" elseif &filetype == 'jsp'
" exec "!astyle --style=gnu --suffix=none %"
" elseif &filetype == 'xml'
" exec "!astyle --style=gnu --suffix=none %"
" else
" exec "normal gg=G"
" return
" endif
" exec "e! %"
"endfunc
" <F7>更新cscope文件
map <F7> :!cscope -Rbq<CR>
im <F7> <Esc>:!cscope -Rbq<CR>
" 修改<leader>的鍵盤映射
nmap ' <leader>
" 當按下\+Enter時取消搜索高亮
map <silent> <leader><CR> :noh<CR>
" Unite插件配置
map <Leader>b :Unite -winheight=10 buffer<CR>
map <Leader>r :MRU<CR>
map <leader>f :NERDTreeToggle<CR>
" Tagbar插件配置
let g:tagbar_autoclose=1
map <leader>t :TagbarToggle<CR>
" 設置文件類型輔助
map <leader>s :setfiletype
" 更方便的窗口間跳轉
map <leader>j <c-w>j
map <leader>k <c-w>k
map <leader>l <c-w>l
map <leader>h <c-w>h
map <C-j> <c-w>j
map <C-k> <c-w>k
map <C-l> <c-w>l
map <C-h> <c-w>h
" vimux插件配置
map <Leader>e :VimuxPromptCommand<CR>
map <Leader>x :VimuxCloseRunner<CR>
map <Leader>vl :VimuxRunLastCommand<CR>
map <Leader>vi :VimuxInspectRunner<CR>
" 更方便的頁滾動
map <C-j> <C-f>
map <C-k> <C-b>
map ,,j <Plug>(easymotion-w)
map ,,k <Plug>(easymotion-b)
map ,,s <Plug>(easymotion-s)
"********** 新建.c,.h,.sh,.java文件,自動插入文件頭 **********
autocmd BufNewFile *.cpp,*.[ch],*.sh,*.rb,*.java,*.py exec ":call SetHead()"
"" 定義函數SetHead,自動插入文件頭
func! SetHead()
if &filetype == 'sh'
call setline(1,"\#!/bin/bash")
call append(line("."), "")
elseif &filetype == 'python'
call setline(1,"#!/usr/bin/env python")
call append(line("."),"# -*- coding=utf-8 -*-")
call append(line(".")+1, "")
elseif &filetype == 'ruby'
call setline(1,"#!/usr/bin/env ruby")
call append(line("."),"# encoding: utf-8")
call append(line(".")+1, "")
" elseif &filetype == 'mkd'
" call setline(1,"<head><meta charset=\"UTF-8\"></head>")
else
call setline(1, "/*************************************************************************")
call append(line("."), " > File Name: ".expand("%"))
call append(line(".")+1, " > Author: ")
call append(line(".")+2, " > Mail: ")
call append(line(".")+3, " > Created Time: ".strftime("%c"))
call append(line(".")+4, " ************************************************************************/")
call append(line(".")+5, "")
endif
if expand("%:e") == 'cpp'
call append(line(".")+6, "#include<iostream>")
call append(line(".")+7, "using namespace std;")
call append(line(".")+8, "")
endif
if &filetype == 'c'
call append(line(".")+6, "#include<stdio.h>")
call append(line(".")+7, "")
endif
if expand("%:e") == 'h'
call append(line(".")+6, "#ifndef _".toupper(expand("%:r"))."_H")
call append(line(".")+7, "#define _".toupper(expand("%:r"))."_H")
call append(line(".")+8, "#endif")
endif
if &filetype == 'java'
call append(line(".")+6,"public class ".expand("%:r"))
call append(line(".")+7,"")
endif
" 新建文件後,自動定位到文件末尾
endfunc
autocmd BufNewFile * normal G
" ********* 實用設置 *********
if has("autocmd")
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
endif
" 當打開vim且沒有文件時自動打開NERDTree
autocmd vimenter * if !argc() | NERDTree | endif
" 只剩 NERDTree時自動關閉
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
" quickfix模式
autocmd FileType c,cpp map <buffer> <leader><space> :w<cr>:make<cr>
來源: http://blog.csdn.net/luckytanggu/article/details/52045357
第二種配置方法:
1.配置好的vim主要有如下優勢:
1.1.按F5能夠直接編譯並執行C、C++、java代碼以及執行shell腳本,按「F8」可進行C、C++代碼的調試
1.2.自動插入文件頭 ,新建C、C++源文件時自動插入表頭:包括文件名、做者、聯繫方式、創建時間等,讀者可根據需求自行更改
1.3.映射「Ctrl + A」爲全選並複製快捷鍵,方便複製代碼
1.4.按「F2」能夠直接消除代碼中的空行
1.5.「F3」可列出當前目錄文件,打開樹狀文件目錄
1.6. 支持鼠標選擇、方向鍵移動
1.7. 代碼高亮,自動縮進,顯示行號,顯示狀態行
1.8.按「Ctrl + P」可自動補全
1.9.[]、{}、()、""、' '等都自動補全
centos 裝這個必定要用網上新的vim7.4,自帶的是7.2,但如今最新的是8.0
2.設置環境及安裝相關軟件
A. root權限(通常生產環境都不容許root登錄,採用sudo受權)
su
B. 卸載自帶vim
yum remove vim vim-enhanced vim-common vim-minimal
C. 下載、解壓7.4或者最新的8.0
wget ftp://ftp.vim.org/pub/vim/unix/vim-7.4.tar.bz2
wget ftp://ftp.vim.org/pub/vim/extra/vim-7.2-extra.tar.gz
wget ftp://ftp.vim.org/pub/vim/extra/vim-7.2-lang.tar.gz
tar jxvf vim-7.4.tar.bz2
tar zxvf vim-7.2-extra.tar.gz
tar zxvf vim-7.2-lang.tar.gz
mv vim72 vim74
D. 安裝編譯環境
yum install ncurses-devel
E. 編譯安裝 請確保系統內有至少2.5版本的Python
cd vim74/src
./configure --enable-pythoninterp --enable-rubyinterp --enable-multibyte \--with-features=huge \--disable-selinux
make
make install
F. 安裝sudo
安裝完CentOS後,默認沒有啓用sudo,首先應該是對sudo進行設置。
sudo的做用是在輸入本身當前用戶的密碼就能夠完成root用戶的功能,沒必要每次使用su -來回切換用戶。sudo的配置文件位於/etc/sudoers,須要root權限才能夠讀寫。
找到root ALL=(ALL) ALL這一行,在後面再加上一行就能夠了(不用引號):
「username ALL=(ALL) ALL」
其中username爲指定的使用sudo的用戶,引號內的空格爲tab
若是你想每次使用sudo命令的時候都提示你輸入根密碼,移動到這一行:
#%wheel ALL=(ALL) ALL
解除#號註釋
若是你不想每次使用sudo命令的時候都提示你輸入跟密碼,移動到下面這一行:
#%wheel ALL=(ALL)NOPASSWD:ALL
解除#號註釋
保存後退出
添加用戶名到wheel用戶組:
usermod -G wheel username
G. 先安裝好了vim7.4和系統的vim-minium以及sudo以後,再進行下列操做
加入epel源 CentOS 5.x
rpm -Uvh http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
CentOS 6.x
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
加入rhel源
rpm -Uvh http://rbel.co/rbel5
搞定autopep8的一個須要googlecode的依賴
yum install python-argparse
安裝astyle 這裏只給出6.x的一個rpm包
rpm -Uvh http://www.melvilletheatre.com/articles/el6/astyle-2.03-3.el6.x86_64.rpm
執行下列bash腳本
#!/bin/bash
echo "安裝將花費必定時間,請耐心等待直到安裝完成^_^"
if which apt-get >/dev/null; then
sudo apt-get install -y vim vim-gnome ctags xclip astyle python-setuptools python-dev git
elif which yum >/dev/null; then
sudo yum install -y gcc vim git ctags xclip astyle python-setuptools python-devel
fi
##Add HomeBrew support on Mac OS
if which brew >/dev/null;then
echo "You are using HomeBrew tool"
brew install vim ctags git astyle
fi
sudo easy_install -ZU autopep8
sudo ln -s /usr/bin/ctags /usr/local/bin/ctags
mv -f ~/vim ~/vim_old
cd ~/ && git clone https://github.com/ma6174/vim.git
mv -f ~/.vim ~/.vim_old
mv -f ~/vim ~/.vim
mv -f ~/.vimrc ~/.vimrc_old
mv -f ~/.vim/.vimrc ~/
git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
echo "ma6174正在努力爲您安裝bundle程序" > ma6174
echo "安裝完畢將自動退出" >> ma6174
echo "請耐心等待" >> ma6174
vim ma6174 -c "BundleInstall" -c "q" -c "q"
rm ma6174
echo "安裝完成"
vimrc配置文件
set sw=4
set ts=4
set et
set smarttab
set smartindent
set lbr
set fo+=mB
set sm
set selection=inclusive
set wildmenu
set mousemodel=popup
au FileType php setlocal dict+=~/.vim/dict/php_funclist.dict
au FileType css setlocal dict+=~/.vim/dict/css.dict
au FileType c setlocal dict+=~/.vim/dict/c.dict
au FileType cpp setlocal dict+=~/.vim/dict/cpp.dict
au FileType scale setlocal dict+=~/.vim/dict/scale.dict
au FileType javascript setlocal dict+=~/.vim/dict/javascript.dict
au FileType html setlocal dict+=~/.vim/dict/javascript.dict
au FileType html setlocal dict+=~/.vim/dict/css.dict
"
"syntastic相關
execute pathogen#infect()
let g:syntastic_python_checkers=['pylint']
let g:syntastic_php_checkers=['php', 'phpcs', 'phpmd']
"golang
"Processing... % (ctrl+c to stop)
let g:fencview_autodetect=0
set rtp+=$GOROOT/misc/vim
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 顯示相關
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syntax on
set cul "高亮光標所在行
set cuc
set shortmess=atI " 啓動的時候不顯示那個援助烏干達兒童的提示
set go= " 不要圖形按鈕
"color desert " 設置背景主題
color ron " 設置背景主題
"color torte " 設置背景主題
"set guifont=Courier_New:h10:cANSI " 設置字體
"autocmd InsertLeave * se nocul " 用淺色高亮當前行
autocmd InsertEnter * se cul " 用淺色高亮當前行
set ruler " 顯示標尺
set showcmd " 輸入的命令顯示出來,看的清楚些
"set whichwrap+=<,>,h,l " 容許backspace和光標鍵跨越行邊界(不建議)
set scrolloff=3 " 光標移動到buffer的頂部和底部時保持3行距離
set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [POS=%l,%v][%p%%]\ %{strftime(\"%d/%m/%y\ -\ %H:%M\")} "狀態行顯示的內容
set laststatus=2 " 啓動顯示狀態行(1),老是顯示狀態行(2)
"set foldenable " 容許摺疊
""set foldmethod=manual " 手動摺疊
set nocompatible "去掉討厭的有關vi一致性模式,避免之前版本的一些bug和侷限
" 顯示中文幫助
if version >= 603
set helplang=cn
set encoding=utf-8
endif
" 自動縮進
set autoindent
set cindent
" Tab鍵的寬度
set tabstop=4
" 統一縮進爲4
set softtabstop=4
set shiftwidth=4
" 使用空格代替製表符
set expandtab
" 在行和段開始處使用製表符
set smarttab
" 顯示行號
set number
" 歷史記錄數
set history=1000
"搜索逐字符高亮
set hlsearch
set incsearch
"語言設置
set langmenu=zh_CN.UTF-8
set helplang=cn
" 老是顯示狀態行
set cmdheight=2
" 偵測文件類型
filetype on
" 載入文件類型插件
filetype plugin on
" 爲特定文件類型載入相關縮進文件
filetype indent on
" 保存全局變量
set viminfo+=!
" 帶有以下符號的單詞不要被換行分割
set iskeyword+=_,$,@,%,#,-
" 字符間插入的像素行數目
"markdown配置
au BufRead,BufNewFile *.{md,mdown,mkd,mkdn,markdown,mdwn} set filetype=mkd
au BufRead,BufNewFile *.{go} set filetype=go
au BufRead,BufNewFile *.{js} set filetype=javascript
"rkdown to HTML
nmap md :!~/.vim/markdown.pl % > %.html <CR><CR>
nmap fi :!firefox %.html & <CR><CR>
nmap \ \cc
vmap \ \cc
"將tab替換爲空格
nmap tt :%s/\t/ /g<CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""新文件標題
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"新建.c,.h,.sh,.java文件,自動插入文件頭
autocmd BufNewFile *.cpp,*.[ch],*.sh,*.rb,*.java,*.py exec ":call SetTitle()"
""定義函數SetTitle,自動插入文件頭
func SetTitle()
"若是文件類型爲.sh文件
if &filetype == 'sh'
call setline(1,"\#!/bin/bash")
call append(line("."), "")
elseif &filetype == 'python'
call setline(1,"#!/usr/bin/env python")
call append(line("."),"# coding=utf-8")
call append(line(".")+1, "")
elseif &filetype == 'ruby'
call setline(1,"#!/usr/bin/env ruby")
call append(line("."),"# encoding: utf-8")
call append(line(".")+1, "")
" elseif &filetype == 'mkd'
" call setline(1,"<head><meta charset=\"UTF-8\"></head>")
else
call setline(1, "/*************************************************************************")
call append(line("."), " > File Name: ".expand("%"))
call append(line(".")+1, " > Author: ")
call append(line(".")+2, " > Mail: ")
call append(line(".")+3, " > Created Time: ".strftime("%c"))
call append(line(".")+4, " ************************************************************************/")
call append(line(".")+5, "")
endif
if expand("%:e") == 'cpp'
call append(line(".")+6, "#include<iostream>")
call append(line(".")+7, "using namespace std;")
call append(line(".")+8, "")
endif
if &filetype == 'c'
call append(line(".")+6, "#include<stdio.h>")
call append(line(".")+7, "")
endif
if expand("%:e") == 'h'
call append(line(".")+6, "#ifndef _".toupper(expand("%:r"))."_H")
call append(line(".")+7, "#define _".toupper(expand("%:r"))."_H")
call append(line(".")+8, "#endif")
endif
if &filetype == 'java'
call append(line(".")+6,"public class ".expand("%:r"))
call append(line(".")+7,"")
endif
"新建文件後,自動定位到文件末尾
endfunc
autocmd BufNewFile * normal G
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"鍵盤命令
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
:nmap <silent> <F9> <ESC>:Tlist<RETURN>
" shift tab pages
map <S-Left> :tabp<CR>
map <S-Right> :tabn<CR>
map! <C-Z> <Esc>zzi
map! <C-O> <C-Y>,
map <C-A> ggVG$"+y
map <Esc><Esc> :w<CR>
map <F12> gg=G
map <C-w> <C-w>w
imap <C-k> <C-y>,
imap <C-t> <C-q><TAB>
imap <C-j> <ESC>
" 選中狀態下 Ctrl+c 複製
"map <C-v> "*pa
imap <C-v> <Esc>"*pa
imap <C-a> <Esc>^
imap <C-e> <Esc>$
vmap <C-c> "+y
set mouse=v
"set clipboard=unnamed
"去空行
nnoremap <F2> :g/^\s*$/d<CR>
"比較文件
nnoremap <C-F2> :vert diffsplit
"nnoremap <Leader>fu :CtrlPFunky<Cr>
"nnoremap <C-n> :CtrlPFunky<Cr>
"列出當前目錄文件
map <F3> :NERDTreeToggle<CR>
imap <F3> <ESC> :NERDTreeToggle<CR>
"打開樹狀文件目錄
map <C-F3> \be
:autocmd BufRead,BufNewFile *.dot map <F5> :w<CR>:!dot -Tjpg -o %<.jpg % && eog %<.jpg <CR><CR> && exec "redr!"
"C,C++ 按F5編譯運行
map <F5> :call CompileRunGcc()<CR>
func! CompileRunGcc()
exec "w"
if &filetype == 'c'
exec "!g++ % -o %<"
exec "!time ./%<"
elseif &filetype == 'cpp'
exec "!g++ % -std=c++11 -o %<"
exec "!time ./%<"
elseif &filetype == 'java'
exec "!javac %"
exec "!time java %<"
elseif &filetype == 'sh'
:!time bash %
elseif &filetype == 'python'
exec "!time python2.7 %"
elseif &filetype == 'html'
exec "!firefox % &"
elseif &filetype == 'go'
" exec "!go build %<"
exec "!time go run %"
elseif &filetype == 'mkd'
exec "!~/.vim/markdown.pl % > %.html &"
exec "!firefox %.html &"
endif
endfunc
"C,C++的調試
map <F8> :call Rungdb()<CR>
func! Rungdb()
exec "w"
exec "!g++ % -std=c++11 -g -o %<"
exec "!gdb ./%<"
endfunc
"代碼格式優化化
map <F6> :call FormartSrc()<CR><CR>
"定義FormartSrc()
func FormartSrc()
exec "w"
if &filetype == 'c'
exec "!astyle --style=ansi -a --suffix=none %"
elseif &filetype == 'cpp' || &filetype == 'hpp'
exec "r !astyle --style=ansi --one-line=keep-statements -a --suffix=none %> /dev/null 2>&1"
elseif &filetype == 'perl'
exec "!astyle --style=gnu --suffix=none %"
elseif &filetype == 'py'||&filetype == 'python'
exec "r !autopep8 -i --aggressive %"
elseif &filetype == 'java'
exec "!astyle --style=java --suffix=none %"
elseif &filetype == 'jsp'
exec "!astyle --style=gnu --suffix=none %"
elseif &filetype == 'xml'
exec "!astyle --style=gnu --suffix=none %"
else
exec "normal gg=G"
return
endif
exec "e! %"
endfunc
"結束定義FormartSrc
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""實用設置
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if has("autocmd")
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
endif
"當打開vim且沒有文件時自動打開NERDTree
autocmd vimenter * if !argc() | NERDTree | endif
" 只剩 NERDTree時自動關閉
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
" 設置當文件被改動時自動載入
set autoread
" quickfix模式
autocmd FileType c,cpp map <buffer> <leader><space> :w<cr>:make<cr>
"代碼補全
set completeopt=preview,menu
"容許插件
"filetype plugin on
"共享剪貼板
"set clipboard+=unnamed
"自動保存
set autowrite
"set ruler " 打開狀態欄標尺
"set cursorline " 突出顯示當前行
set magic " 設置魔術
set guioptions-=T " 隱藏工具欄
set guioptions-=m " 隱藏菜單欄
""set foldcolumn=0
""set foldmethod=indent
""set foldlevel=3
" 不要使用vi的鍵盤模式,而是vim本身的
set nocompatible
" 去掉輸入錯誤的提示聲音
set noeb
" 在處理未保存或只讀文件的時候,彈出確認
set confirm
"禁止生成臨時文件
set nobackup
set noswapfile
"搜索忽略大小寫
set ignorecase
set linespace=0
" 加強模式中的命令行自動完成操做
set wildmenu
" 使回格鍵(backspace)正常處理indent, eol, start等
set backspace=2
" 容許backspace和光標鍵跨越行邊界
set whichwrap+=<,>,h,l
" 能夠在buffer的任何地方使用鼠標(相似office中在工做區雙擊鼠標定位)
set mouse=a
set selection=exclusive
set selectmode=mouse,key
" 經過使用: commands命令,告訴咱們文件的哪一行被改變過
set report=0
" 在被分割的窗口間顯示空白,便於閱讀
set fillchars=vert:\ ,stl:\ ,stlnc:\
" 高亮顯示匹配的括號
set showmatch
" 匹配括號高亮的時間(單位是十分之一秒)
set matchtime=1
" 光標移動到buffer的頂部和底部時保持3行距離
set scrolloff=3
" 爲C程序提供自動縮進
"自動補全
"":inoremap ( ()<ESC>i
"":inoremap ) <c-r>=ClosePair(')')<CR>
":inoremap { {<CR>}<ESC>O
":inoremap } <c-r>=ClosePair('}')<CR>
"":inoremap [ []<ESC>i
"":inoremap ] <c-r>=ClosePair(']')<CR>
"":inoremap " ""<ESC>i
"":inoremap ' ''<ESC>i
""function! ClosePair(char)
"" if getline('.')[col('.') - 1] == a:char
"" return "\<Right>"
"" else
"" return a:char
"" endif
""endfunction
filetype plugin indent on
"打開文件類型檢測, 加了這句才能夠用智能補全
set completeopt=longest,menu
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" CTags的設定
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let Tlist_Sort_Type = "name" " 按照名稱排序
let Tlist_Use_Right_Window = 1 " 在右側顯示窗口
let Tlist_Compart_Format = 1 " 壓縮方式
let Tlist_Exist_OnlyWindow = 1 " 若是隻有一個buffer,kill窗口也kill掉buffer
""let Tlist_File_Fold_Auto_Close = 0 " 不要關閉其餘文件的tags
""let Tlist_Enable_Fold_Column = 0 " 不要顯示摺疊樹
"let Tlist_Show_One_File=1 "不一樣時顯示多個文件的tag,只顯示當前文件的
"設置tags
set tags=tags;
set autochdir
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"其餘東東
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"默認打開Taglist
let Tlist_Auto_Open=0
""""""""""""""""""""""""""""""
" Tag list (ctags)
""""""""""""""""""""""""""""""""
let Tlist_Ctags_Cmd = '/usr/local/bin/ctags'
let Tlist_Show_One_File = 1 "不一樣時顯示多個文件的tag,只顯示當前文件的
let Tlist_File_Fold_Auto_Close = 1
let Tlist_Exit_OnlyWindow = 1 "若是taglist窗口是最後一個窗口,則退出vim
let Tlist_Use_Right_Window = 1 "在右側窗口中顯示taglist窗口
" minibufexpl插件的通常設置
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplModSelTarget = 1
nmap tl :Tlist<cr>
"python補全
let g:pydiction_location = '~/.vim/after/complete-dict'
let g:pydiction_menu_height = 20
let Tlist_Ctags_Cmd='/usr/local/bin/ctags'
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplModSelTarget = 1
set iskeyword+=.
set termencoding=utf-8
set encoding=utf8
set fileencodings=utf8,ucs-bom,gbk,cp936,gb2312,gb18030
autocmd FileType python set omnifunc=pythoncomplete#Complete
"set nocompatible " be iMproved
"filetype off " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'
" My Bundles here:
"
" original repos on github
Bundle 'tpope/vim-fugitive'
Bundle 'rstacruz/sparkup', {'rtp': 'vim/'}
Bundle 'Yggdroot/indentLine'
let g:indentLine_char = '┊'
"ndle 'tpope/vim-rails.git'
" vim-scripts repos
Bundle 'L9'
Bundle 'FuzzyFinder'
" non github repos
Bundle 'https://github.com/wincent/command-t.git'
Bundle 'Auto-Pairs'
Bundle 'python-imports.vim'
Bundle 'CaptureClipboard'
Bundle 'ctrlp-modified.vim'
Bundle 'last_edit_marker.vim'
Bundle 'synmark.vim'
"Bundle 'Python-mode-klen'
Bundle 'SQLComplete.vim'
Bundle 'Javascript-OmniCompletion-with-YUI-and-j'
"Bundle 'JavaScript-Indent'
"Bundle 'Better-Javascript-Indentation'
Bundle 'jslint.vim'
Bundle "pangloss/vim-javascript"
Bundle 'Vim-Script-Updater'
Bundle 'ctrlp.vim'
Bundle 'tacahiroy/ctrlp-funky'
Bundle 'jsbeautify'
Bundle 'The-NERD-Commenter'
"django
Bundle 'django_templates.vim'
Bundle 'Django-Projects'
"Bundle 'FredKSchott/CoVim'
"Bundle 'djangojump'
" ...
let g:html_indent_inctags = "html,body,head,tbody"
let g:html_indent_script1 = "inc"
let g:html_indent_style1 = "inc"
filetype plugin indent on " required!
"
"ctrlp設置
"
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.pyc,*.png,*.jpg,*.gif " MacOSX/Linux
set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe,*.pyc,*.png,*.jpg,*.gif " Windows
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
let g:ctrlp_custom_ignore = '\v\.(exe|so|dll)$'
let g:ctrlp_extensions = ['funky']
let NERDTreeIgnore=['\.pyc']