我之前有把 vim 的安裝過程寫成 script,放在 dropbox 上,但前天遇到 dropbox 連不上而必須建立環境的窘境,所以還是 blog 放一篇比較穩當。
vim_centos_dispatch.sh
sudo localedef -i zh_TW -c -f UTF-8 zh_TW.UTF-8 sudo yum -y install vim sudo yum -y install git sudo mkdir -p ~/.vim/autoload sudo mkdir -p ~/.vim/bundle sudo curl -o ~/.vimrc https://dl.dropboxusercontent.com/u/15447570/vim/config.txt sudo curl -o ~/.vim/bundle/install.sh https://dl.dropboxusercontent.com/u/15447570/vim/install.sh sudo curl -o ~/.vim/bundle/update.sh https://dl.dropboxusercontent.com/u/15447570/vim/update.sh sudo curl -o ~/.vim/autoload/pathogen.vim https://raw.githubusercontent.com/tpope/vim-pathogen/master/autoload/pathogen.vim cd ~/.vim/bundle sudo sh install.sh cd -
vim_ubuntu_dispatch.sh
sudo locale-gen --lang zh_TW.UTF-8 sudo aptitude -y install vim sudo aptitude -y install git sudo mkdir -p ~/.vim/autoload sudo mkdir -p ~/.vim/bundle sudo curl -o ~/.vimrc https://dl.dropboxusercontent.com/u/15447570/vim/config.txt sudo curl -o ~/.vim/bundle/install.sh https://dl.dropboxusercontent.com/u/15447570/vim/install.sh sudo curl -o ~/.vim/bundle/update.sh https://dl.dropboxusercontent.com/u/15447570/vim/update.sh sudo curl -o ~/.vim/autoload/pathogen.vim https://raw.githubusercontent.com/tpope/vim-pathogen/master/autoload/pathogen.vim cd ~/.vim/bundle sudo sh install.sh cd -
.vimrc
execute pathogen#infect() syntax on filetype plugin indent on :filetype plugin on language messages zh_TW.utf-8 autocmd FileType php set omnifunc=phpcomplete#CompletePHP colorscheme jellybeans set autoindent set backspace=indent,eol,start set clipboard=unnamed set cursorline set encoding=utf-8 set expandtab set fileencoding=utf-8 set fileencodings=utf-8,big5,euc-jp,gbk,euc-kr,utf-bom,iso8859-1 set foldcolumn=1 set guifont=Consolas:h12 set laststatus=2 set nobackup set noundofile set nowritebackup set number set shellslash set shiftwidth=4 set t_Co=256 set tabstop=4 set tenc=utf-8 set winheight=5 set winminheight=5 set winheight=999 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 let g:vim_php_refactoring_auto_validate_sg = 1 let g:vim_php_refactoring_auto_validate_rename = 1 let g:vim_php_refactoring_auto_validate_visibility = 1 let g:phpunit_bin = '/root/.composer/vendor/bin/phpunit' :map <C-t> :tabnew<CR> :map <C-l> :tabnext<CR> :map <C-h> :tabprevious<CR> :map <F2> :NERDTreeToggle<CR> :map <F3> :Flisttoggle<CR>
_vimrc
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
execute pathogen#infect()
syntax on
filetype plugin indent on
:filetype plugin on
source $VIMRUNTIME/delmenu.vim
language messages zh_TW.utf-8
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
colorscheme jellybeans
set autoindent
set cursorline
set encoding=utf-8
set expandtab
set fileencoding=utf-8
set fileencodings=utf-8,big5,euc-jp,gbk,euc-kr,utf-bom,iso8859-1
set foldcolumn=1
set guifont=Consolas:h12
set laststatus=2
set noundofile
set nowritebackup
set nobackup
set number
set shellslash
set shiftwidth=4
set tabstop=4
set tenc=utf-8
set winheight=5
set winminheight=5
set winheight=999
let g:EasyMotion_leader_key = '<Leader>'
let g:airline_powerline_fonts = 1
let g:ctrlp_working_path_mode = 0
let g:syntastic_auto_jump = 1
let g:syntastic_php_checkers = ['php']
let g:syntastic_javascript_checkers = ['jshint']
let g:vim_php_refactoring_auto_validate_sg = 1
let g:vim_php_refactoring_auto_validate_rename = 1
let g:vim_php_refactoring_auto_validate_visibility = 1
let g:phpunit_bin = 'C:/Users/chan/AppData/Roaming/Composer/vendor/bin/phpunit'
:map <C-t> :tabnew<CR>
:map <C-l> :tabnext<CR>
:map <C-h> :tabprevious<CR>
:map <F2> :NERDTreeToggle <CR>
:map <F3> :Flisttoggle<CR>
:nunmap <C-a>
set diffexpr=MyDiff()
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
let arg1 = v:fname_in
if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
let arg2 = v:fname_new
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
let arg3 = v:fname_out
if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
if $VIMRUNTIME =~ ' '
if &sh =~ '\<cmd'
if empty(&shellxquote)
let l:shxq_sav = ''
set shellxquote&
endif
let cmd = '"' . $VIMRUNTIME . '\diff"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
endif
else
let cmd = $VIMRUNTIME . '\diff'
endif
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3
if exists('l:shxq_sav')
let &shellxquote=l:shxq_sav
endif
endfunction
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/adoy/vim-php-refactoring-toolbox.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/c9s/lftp-sync.vim.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/jiangmiao/auto-pairs 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/rhysd/conflict-marker.vim.git git clone https://github.com/scrooloose/nerdtree.git git clone https://github.com/scrooloose/syntastic.git git clone https://github.com/stephpy/vim-php-cs-fixer.git git clone https://github.com/tmhedberg/matchit.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/functionlist.vim.git git clone https://github.com/vim-scripts/restore_view.vim.git git clone https://github.com/vim-scripts/smarty-syntax.git git clone https://github.com/c9s/phpunit.vim.git git clone https://github.com/captbaritone/better-indent-support-for-php-with-html.git
update.sh
for item in *
do
if [ -d "$item" ]; then
echo processing $item
cd $item
git pull
echo finish $item
printf "\n------------------------------------\n\n"
cd ..
fi
done
沒有留言:
張貼留言