2013/09/10

Vim With Plugins And Config

Vim

Plugins

็›ฎๅ‰ไฝฟ็”จ 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 ๅ‰‡็•™่จ€:

Unknown ๆๅˆฐ...

ไธ่ฆsudo้˜ฟ,้€™ๆจฃๆ˜ฏๅœจๆ•ด่‡ชๅทฑ XDD