Skip to content

Instantly share code, notes, and snippets.

@haubar
Created February 6, 2013 10:46
Show Gist options
  • Save haubar/4721839 to your computer and use it in GitHub Desktop.
Save haubar/4721839 to your computer and use it in GitHub Desktop.
vim config
"----------------------------------------------------------------------------------
"git 更新套件 bundle 設定
"----------------------------------------------------------------------------------
filetype on " required!
set rtp+=$VIM\bundle\vundle\ "set runtimepath+
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'Lokaltog/vim-powerline'
Bundle 'L9'
Bundle 'mru.vim'
Bundle 'honza/snipmate-snippets'
"Bundle 'vim-scripts/snipmate-snippets'
Bundle 'garbas/vim-snipmate'
Bundle 'MarcWeber/vim-addon-mw-utils'
Bundle 'tomtom/tlib_vim'
Bundle 'The-NERD-tree'
Bundle 'kien/ctrlp.vim'
Bundle 'taglist.vim'
Bundle 'motemen/git-vim'
Bundle 'vim-scripts/minibufexpl.vim'
Bundle 'xml.vim'
Bundle 'Townk/vim-autoclose'
Bundle 'vim-scripts/The-NERD-Commenter'
Bundle 'vim-scripts/cscope_macros.vim'
Bundle 'c9s/filefind.vim'
Bundle 'corntrace/bufexplorer'
Bundle 'OOP-javascript-indentation'
Bundle 'Javascript-Indentation'
Bundle 'Shougo/neocomplcache'
Bundle 'vim-scripts/surround.vim'
Bundle 'tsaleh/vim-matchit'
Bundle 'Lokaltog/vim-easymotion'
filetype plugin indent on " require
let Tlist_File_Fold_Auto_Close=1 " 讓當前沒有被編輯的文件自動摺疊起來
let Tlist_Ctags_Cmd =$VIM.'\ctags\ctags.exe'
"----------------------------------------------------------
" TagList - 暫時套用設定
"----------------------------------------------------------
let Tlist_Show_One_File = 1 " Displaying tags for only one file~
let Tlist_Exist_OnlyWindow = 1 " if you are the last, kill yourself
let Tlist_Use_Right_Window = 0 " split to the right side of the screen
let Tlist_Sort_Type = "order" " sort by order or name
let Tlist_Display_Prototype = 0 " do not show prototypes and not tags in the taglist window.
let Tlist_Compart_Format = 1 " Remove extra information and blank lines from the taglist window.
let Tlist_GainFocus_On_ToggleOpen = 0 " Jump to taglist window on open.
let Tlist_Display_Tag_Scope = 1 " Show tag scope next to the tag name.
let Tlist_Close_On_Select = 0 " Close the taglist window when a file or tag is selected.
let Tlist_Enable_Fold_Column = 0 " Don't Show the fold indicator column in the taglist window.
let Tlist_WinWidth = 40
"-------------------------------------------------------
" ctrlp 設定
"-------------------------------------------------------
let g:ctrlp_working_path_mode = 1
"set wildignore+=tmp\*,*.exe,*.zip,*.dll,*.swp
" Windows
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux
"let g:ctrlp_user_command = 'find %s -type f'
" MacOSX/Linux
let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d' " Windows
let g:ctrlp_custom_ignore = {
\ 'dir': '\.git$\|\.hg$\|\.svn$',
\ 'file': '\.exe$\|\.so$\|\.dll$',
\ 'link': 'some_bad_symbolic_links',
\ }
"-------------------------------------------------------
" NERD_commenter設定
"-------------------------------------------------------
let NERDShutUp=1
"-------------------------------------------------------
" minibufmap setting
"-------------------------------------------------------
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplModSelTarget = 1
"-------------------------------------------------------
" EasyMotion設定
"-------------------------------------------------------
let g:EasyMotion_leader_key = '\'
"-------------------------------------------------------
" 快速鍵設定
"-------------------------------------------------------
set foldmarker={,} "
set foldlevel=2
set foldnestmax=1
set foldmethod=expr " 縮排 Folded 設定,預設沒有縮排
noremap <C-f> :set foldmethod=marker<CR> " ctrl+f一下開始折疊模式 (暫時)
noremap <S-f> :set foldmethod=expr<CR> " shift+f再一下結束折疊模式 (暫時)
noremap <S-v> zx<CR> "打開目前遊標折疊 (暫時)
map <F2> :vsp<CR> " 垂直分割視窗
map <F3> :tabnew<CR> " 開新tab
map <F5> :call PHPsynCHK()<CR> "PHP不存檔即時檢查
map <F9> :BundleInstall!<CR> " 更新所有套件
map <F11> <ESC>:NERDTreeToggle<CR> " Toggles NERD Tree view
nnoremap <F12> :TlistToggle<CR> "設定 F12 為開啟/關閉 Tag List 的快捷鍵:
nmap <C-t> :tabnew<CR> " 開啟新的 tab
nmap <C-w> :tabclose<CR> " 關閉 tab
imap <C-t><ESC> :tabclose<CR> " 關閉 tab
map <C-l> :tabnext<CR>
map <C-h> :tabprevious<CR>
"--------------------------------------------
" Bash like keys for the command line
"--------------------------------------------
"cnoremap <C-A> <Home>
"cnoremap <C-E> <End>
"cnoremap <C-K> <C-U>
map <S-F10> :bp <CR> " <S-F10> 上一個 Buffer File.
map <C-F10> :bn <CR> " <C-F10> 下一個 Buffer File.
map <C-A> ggvG <CR> " select ALL
"----------------------------------------------------------
" tab 設定
"----------------------------------------------------------
"顏色
hi TabLine guifg=#90fff0 guibg=#2050d0 ctermfg=black ctermbg=white
"hi TabLineSel guifg=#90fff0 guibg=#2050d0 ctermfg=white ctermbg=LightMagenta
"Basic settings
set encoding=utf-8
set fileencodings=utf-8
set termencoding=utf-8
lang messages zh_TW.utf-8
fun! ViewUTF8()
set encoding=utf-8
set termencoding=big5
endfun
fun! UTF8()
set encoding=utf-8
set termencoding=big5
set fileencodings=ucs-bom,big5,taiwan,utf-8,latin1
endfun
fun! Big5()
set encoding=big5
set fileencoding=big5
endfun
set nocompatible "not use vi modle
set tabstop=4 " tab 的字元數
set softtabstop=4
set ruler " 顯示右下角設定值
set backspace=2 " 在 insert 也可用 backspace
set ic " 設定搜尋忽略大小寫
set ru " 第幾行第幾個字
set hlsearch " 設定高亮度顯示搜尋結果
set incsearch " 在關鍵字還沒完全輸入完畢前就顯示結果
set smartindent " 設定 smartindent
set confirm " 操作過程有衝突時,以明確的文字來詢問
set history=50 " 保留 50 個使用過的指令
set cursorline " 顯示目前的游標位置
set showcmd " display incomplete commands
set paste " 這是防止在做剪貼時位置會不正確
set tabpagemax=30 " 設定tabt頁面的最大值
set cmdheight=2 " 狀態列的行數,預設一行,建議設成兩行。
set showmatch " 自動找對應括號
set showmode " 顯示編輯模式
set laststatus=2
set nu " 設定行號
syntax on " 語法上色顯示
colorscheme torte " 佈景主題
colorscheme haubar " 自訂義的布景主題
set statusline=%{GitBranchInfoString()}%<%f\ %m%=\ %h%r\ %-19([%p%%]\ %3l,%02c%03V%)%y "設定狀態列
highlight StatusLine term=bold,reverse cterm=bold,reverse "設定狀態列
set guifont=Consolas:h12 " 設定字體樣式及大小。
"set go= "無選單、工具列
"回到上次的位置
if has("autocmd")
autocmd BufRead *.txt set tw=78o
autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal g'\"" |
\ endif
endif
"各OS自別設定
if(has("win32") || has("win95") || has("win64") || has("win16")) "判定目前系統類型
let g:vimrc_iswindows=1
source $vim/gvimrc
elseif (has("unix"))
let g:vimrc_isunix=1
source ~/.vim/unix-vimrc
elseif (has("mac"))
let g:vimrc_ismac=1
source ~/.vim/mac-vimrc
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment