標籤:解決方案 vim vimrc xptemplate emmet
為了使用pathogen外掛程式,我把.vim檔案夾和.vimrc添加的配置刪除,重新整理了下!1、pathogen 外掛程式管理https://github.com/tpope/vim-pathogen運行如下命令mkdir -p ~/.vim/autoload ~/.vim/bundlecurl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim在.vimrc中添加" pathogen execute pathogen#infect()2、nerdtree 檔案瀏覽器https://github.com/scrooloose/nerdtree運行如下命令cd ~/.vim/bundlegit clone https://github.com/scrooloose/nerdtree.git在.vimrc中添加" NERDTreemap <silent> <F3> :NERDTreeToggle<CR>" 映射F3開啟關閉NERDTree3、xptemplate 程式碼片段自動補全https://github.com/drmingdrmer/xptemplate運行如下命令cd ~/.vim/bundlegit clone https://github.com/drmingdrmer/xptemplate.git在.vimrc中添加" xptemplatelet g:xptemplate_vars = "SParg=&BRfun="" 代碼緊貼括弧,函數名單行let g:xptemplate_brace_complete = "([{\""" 括弧引號自動補全4、emmet-vim 快速編寫html和css代碼 https://github.com/mattn/emmet-vim/運行如下命令cd ~/.vim/bundlegit clone https://github.com/mattn/emmet-vim.git5、nerdcommenter 為程式碼片段添加註釋https://github.com/scrooloose/nerdcommenter運行如下命令cd ~/.vim/bundlegit clone https://github.com/scrooloose/nerdcommenter.git在.vimrc中添加" NERDcommenterlet NERDSpaceDelims = 1" 注釋左右兩端留空格 let NERDRemoveExtraSpaces = 16、supertab 映射ctrl+x ctrl+o用https://github.com/ervandew/supertab運行如下命令cd ~/.vim/bundlegit clone https://github.com/ervandew/supertab.git在.vimrc中添加" supertablet g:SuperTabDefaultCompletionType = "<C-X><C-O>"inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>" " 斷行符號即選中當前項7、taglist 顯示代碼結構 http://www.vim.org/scripts/script.php?script_id=273到上面網站下載taglist,在.vim/bundle檔案夾下為該外掛程式建立檔案夾,然後將其解壓到建立的新檔案夾中即可。在.vimrc中添加" Taglistmap <silent> <F4> :TlistToggle<CR>" 映射F4開啟關閉Taglist8、更新協助文檔外掛程式安裝完後可開啟vim運行:Helptags命令即可更新各外掛程式的協助文檔9、備份我當前的.vimrc配置" An example for a vimrc file."" Maintainer:Bram Moolenaar <[email protected]>" Last change:2014 Feb 05"" 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"finishendif" Use Vim settings, rather than Vi settings (much better!)." This must be first, because it changes other options as a side effect.set nocompatible" allow backspacing over everything in insert modeset backspace=indent,eol,startif has("vms")set nobackup" do not keep a backup file, use versions insteadelseset backup" keep a backup file (restore to previous version)set undofile" keep an undo file (undo changes after closing)endifset history=50" keep 50 lines of command line historyset ruler" show the cursor position all the timeset showcmd" display incomplete commandsset 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 formattingmap 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=aendif" 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 onset hlsearchendif" 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 vimrcExau!" 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`\"" |\ endifaugroup ENDelseset autoindent" always set autoindenting onendif " 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 ++edit # | 0d_ | diffthis\ | wincmd p | diffthisendif" 一些雜項set numberset tabstop=4set shiftwidth=4set autoindentset cindentset hlsearchset backspace=2set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936set termencoding=utf-8set encoding=utf-8set timeout timeoutlen=3000 ttimeoutlen=100"可提高輸入O插入行的速度" set cursorline" 游標底線" 預設標記摺疊方式set fdm=marker" Ctags setfiletype plugin indent on set completeopt=longest,menu " pathogen execute pathogen#infect()" NERDTreemap <silent> <F3> :NERDTreeToggle<CR>" 映射F3開啟關閉NERDTree" Taglistmap <silent> <F4> :TlistToggle<CR>" 映射F4開啟關閉Taglist" xptemplatelet g:xptemplate_vars = "SParg=&BRfun="" 代碼緊貼括弧,函數名單行let g:xptemplate_brace_complete = "([{\""" 括弧引號自動補全" NERDcommenterlet NERDSpaceDelims = 1" 注釋左右兩端留空格 let NERDRemoveExtraSpaces = 1" Backupset nobackupset undodir=~/.vim/undodir" html indent" let g:html_indent_script1 = "inc" " let g:html_indent_style1 = "inc" let g:html_indent_inctags = "body,head,tbody" " 縮排body head s" supertablet g:SuperTabDefaultCompletionType = "<C-X><C-O>"inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>" " 斷行符號即選中當前項" support html css and javascrip auto completeautocmd FileType html set omnifunc=htmlcomplete#CompleteTagsautocmd FileType css set omnifunc=csscomplete#CompleteCSSautocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
0011 vim外掛程式的安裝