Plugins
- IndexedSearch
- MatchTag
- SearchComplete
- ctrlp.vim
- delimitMate
- emmet-vim
- jellybeans.vim
- nerdtree
- smarty-syntax
- syntastic
- tabular
- tcomment_vim
- tlib_vim
- vim-addon-mw-utils
- vim-airline
- vim-easymotion
- vim-javascript
- vim-matchit
- vim-scripts/AutoComplPop
- vim-snipmate
- vim-snippets
- vim-surround
- vim-trailing-whitespace
目前使用 vim-pathogen 來配置我的 vim plugin,他的好處是只要將檔案放置於 bundle 這個資料夾,插件就會自動去處理所有 plugin 該作的事情。
之前是從 GitHub 下載檔案以後放到 bundle 資料夾,然後不定期去查詢作者有沒有更新的版本,有的話再 download 下來覆蓋,可是每個作者標註版本的習慣不一,甚至有的人根本沒有寫明版本,所以對於更新這件事情十分困擾,於是我採用了新的作法,我將每個 plugin 使用 git clone 的方式 clone 到資料夾,在寫一支 script 去 loop 所有的資料執行 git pull,這樣等於最簡單的 update 方式了。
install.sh
git clone https://github.com/Lokaltog/vim-easymotion.git git clone https://github.com/MarcWeber/vim-addon-mw-utils.git git clone https://github.com/Raimondi/delimitMate.git git clone https://github.com/bling/vim-airline.git git clone https://github.com/bronson/vim-trailing-whitespace.git git clone https://github.com/edsono/vim-matchit.git git clone https://github.com/garbas/vim-snipmate.git git clone https://github.com/godlygeek/tabular.git git clone https://github.com/gregsexton/MatchTag.git git clone https://github.com/honza/vim-snippets.git git clone https://github.com/kien/ctrlp.vim.git git clone https://github.com/mattn/emmet-vim.git git clone https://github.com/nanotech/jellybeans.vim.git git clone https://github.com/pangloss/vim-javascript.git git clone https://github.com/scrooloose/nerdtree.git git clone https://github.com/scrooloose/syntastic.git git clone https://github.com/tomtom/tcomment_vim.git git clone https://github.com/tomtom/tlib_vim.git git clone https://github.com/tpope/vim-surround.git git clone https://github.com/vim-scripts/AutoComplPop.git git clone https://github.com/vim-scripts/IndexedSearch.git git clone https://github.com/vim-scripts/SearchComplete.git git clone https://github.com/vim-scripts/smarty-syntax.git
update.sh
for item in * do if [ -d "$item" ]; then echo processing $item cd $item git pull echo $item finished printf "\n------------------------------------\n\n" cd .. fi done
只要執行 sudo sh update.sh
程式便會去一一進入每個目錄執行 git pull 了,在實作時遇到一個小插曲,這隻 bash 一開始是在 Windows 的環境下寫的,複製到 Linux 會出現 error,問題出在檔案格式,Windows 斷行使用 CRLF,而 Linux 是 LF,解決方法很簡單,將檔案使用 Vim 打開,執行 :set fileformat=unix
,問題就解決了。
Vimrc On Windows
execute pathogen#infect() syntax on filetype plugin indent on :filetype plugin on au BufRead,BufNewFile *.tpl set filetype=smarty.html source $VIMRUNTIME/delmenu.vim language messages zh_TW.utf-8 autocmd FileType php set omnifunc=phpcomplete#CompletePHP colorscheme jellybeans :autocmd ColorScheme * hi CursorLineNr guifg=yellow set cursorline set number set nobackup set fileencoding=utf-8 set tabstop=4 set shiftwidth=4 set expandtab set guifont=Consolas:h12 set foldcolumn=1 set fileencodings=utf-8,big5,euc-jp,gbk,euc-kr,utf-bom,iso8859-1 set encoding=utf-8 set tenc=utf-8 set winheight=5 set winminheight=5 set winheight=999 set shellslash set laststatus=2 let g:EasyMotion_leader_key = '<Leader>' let g:ctrlp_working_path_mode = 0 let g:syntastic_auto_jump = 1 let g:syntastic_php_checkers = ['php'] let g:airline_powerline_fonts = 1 :map <C-t> :tabnew<CR> :map <C-l> :tabnext<CR> :map <C-h> :tabprevious<CR> set nocompatible source $VIMRUNTIME/vimrc_example.vim source $VIMRUNTIME/mswin.vim behave mswin :nunmap <C-a>
Vimrc On Linux
execute pathogen#infect() syntax on filetype plugin indent on :filetype plugin on au BufRead,BufNewFile *.tpl set filetype=smarty.html language messages zh_TW.utf-8 autocmd FileType php set omnifunc=phpcomplete#CompletePHP colorscheme jellybeans :autocmd ColorScheme * hi CursorLineNr ctermfg=yellow set t_Co=256 set cursorline set number set nobackup set fileencoding=utf-8 set tabstop=4 set shiftwidth=4 set expandtab set foldcolumn=1 set fileencodings=utf-8,big5,euc-jp,gbk,euc-kr,utf-bom,iso8859-1 set encoding=utf-8 set tenc=utf-8 set winheight=5 set winminheight=5 set winheight=999 set autoindent set backspace=indent,eol,start set laststatus=2 let g:EasyMotion_leader_key = '<Leader>' let g:ctrlp_working_path_mode = 0 let g:syntastic_auto_jump = 1 let g:syntastic_php_checkers = ['php'] let g:airline_powerline_fonts = 1 :map <C-t> :tabnew<CR> :map <C-l> :tabnext<CR> :map <C-h> :tabprevious<CR>
1 則留言:
不要sudo阿,這樣是在整自己 XDD
張貼留言