Created
October 28, 2014 19:33
-
-
Save tamakiii/f7b705a91c2c022ded20 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" 変数整備 | |
let s:uname = system("echo -n \"$(uname)\"") | |
let s:hostname = system("echo -n \"$(hostname -s)\"") | |
" 基本設定(表示) | |
syntax on | |
filetype on | |
filetype indent on | |
filetype plugin on | |
" 基本設定(編集) | |
set nowrap | |
" ベル | |
set noerrorbells | |
" 文字セット | |
set encoding=utf-8 | |
set fileencodings=ucs-bom,utf-8,default,sjis,euc-jp,latin1 | |
" 情報表示 | |
" auto BufEnter * let &titlestring = hostname() . '/' . expand("%:p") | |
set laststatus=2 " 情報を表示する | |
set noshowmode | |
" ファイル名、文字エンコード、改行形式をステータスラインに表示(http://d.hatena.ne.jp/ruicc/20080615) | |
set statusline=%<%f\ %m%r%h%w%{'['.(&fenc!=''?&fenc:&enc).']['.&ff.']'}%=%l,%c%V%8P | |
" ディレクトリ設定 | |
set backupdir=~/.vim/backup | |
set directory=~/.vim/swapfile | |
if v:version > 730 | |
set undodir=~/.vim/undo | |
endif | |
" IME | |
set nowrap | |
set iminsert=0 | |
set imsearch=0 | |
" クリップボード | |
set clipboard+=unnamed | |
" Explore | |
set browsedir=current " :Explore時にカレントディレクトリを開く | |
" ショートカット | |
nnoremap ; : | |
nnoremap <ESC><ESC> :noh<CR><ESC> " <ESC>二度押しで検索ハイライト解除 | |
nnoremap ,h ^ | |
nnoremap ,l $ | |
" 検索 | |
set ignorecase " ファイル検索時に大文字小文字の違いを無視する | |
if v:version > 730 | |
set wildignorecase " ignorecaseの補完的な機能(v.7.3.072以降) | |
endif | |
set wildmenu " 補完候補を表示する | |
set wildmode=list:longest,full " 補完候補を全て表示する | |
set hlsearch " 検索文字列をハイライトする | |
set complete+=k " 'dictionary' で指定されたファイルから検索する | |
set complete+=i " カレントファイルとインクルードされるファイルから検索する | |
set complete+=w " 別のウィンドウ内のバッファから検索する | |
set complete+=w " カレントファイルとインクルードされるファイルから、定義された名前またはマクロを検索する | |
set complete+=t " タグ補完する | |
set incsearch " インクリメンタルサーチ | |
" エディタ設定 | |
set tabstop=4 " \tに対応する空白の文字数 | |
set softtabstop=0 " tabstopを変えずに空白を含めて見た目のtabstopを変える | |
set shiftwidth=4 " 自動インデントの各段階に使われる空白の数 | |
set expandtab " \tを挿入するのに適切な数の空白 | |
set autoindent " 次の行を開始したときに次の行のインデント量を現在行と同じにする | |
set smartindent " 次の行を開始したときに高度な自動インデントを行う | |
set backspace=indent,eol,start " <BS>でインデントを,行の先頭で前の行の改行を削除できるように, | |
" また,Ctrl+Wで入力した単語以外を削除できるようにする | |
set number " 行番号を表示する | |
set ruler " ルーラーを表示する | |
set cmdheight=1 " コマンドラインの高さ | |
set showmatch " 括弧の入力時にカーソルを対応する括弧の上に一定時間表示させる | |
set title " タイトルを表示する | |
set matchtime=3 " マッチした括弧を強調表示する時間(1/10秒) | |
" ファイルタイプ毎の設定 | |
autocmd FileType php set ai | |
" neobundle (https://github.com/Shougo/neobundle.vim) | |
" {:NeoBundleList, :NeoBundleInstall, :NeoBundleClean} | |
" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
set nocompatible " be improved | |
if has('vim_starting') | |
set runtimepath+=~/.vim/bundle/neobundle.vim/ | |
call neobundle#begin(expand('~/.vim/bundle/')) | |
NeoBundleFetch 'Shougo/neobundle.vim' | |
call neobundle#end() | |
filetype off " (required) | |
filetype plugin indent off " (required) | |
endif | |
" <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 | |
NeoBundle 'https://github.com/altercation/vim-colors-solarized' | |
NeoBundle 'https://github.com/tyru/caw.vim.git' | |
" 作業環境の都合上,Macでしか動かないようにしている | |
if has("unix") && s:uname == "Darwin\n" | |
NeoBundle 'https://github.com/Lokaltog/powerline' | |
NeoBundle 'https://github.com/Lokaltog/powerline-fonts.git' | |
endif | |
NeoBundle 'https://github.com/StanAngeloff/php.vim.git' | |
NeoBundle 'https://github.com/evidens/vim-twig.git' | |
NeoBundle 'https://github.com/groenewege/vim-less.git' | |
NeoBundle 'https://github.com/tpope/vim-surround.git' | |
NeoBundle 'https://github.com/rosstimson/scala-vim-support.git' | |
NeoBundle 'https://github.com/flazz/vim-colorschemes.git' | |
NeoBundle 'https://github.com/scrooloose/nerdtree.git' | |
NeoBundle 'https://github.com/Lokaltog/vim-easymotion.git' | |
NeoBundle 'https://github.com/ujihisa/unite-colorscheme' | |
NeoBundle 'https://github.com/tsukkee/unite-tag.git' | |
NeoBundle 'https://github.com/vim-php/phpctags', { | |
\ 'build': { | |
\ 'others': 'make', | |
\ }, | |
\ } | |
NeoBundle 'https://github.com/vim-scripts/tagbar-phpctags', { | |
\ 'build' : { | |
\ 'others' : 'chmod +x bin/phpctags', | |
\ }, | |
\ } | |
NeoBundle 'https://github.com/majutsushi/tagbar' | |
NeoBundle 'https://github.com/Shougo/unite.vim.git' | |
NeoBundle 'https://github.com/Shougo/neomru.vim.git' | |
NeoBundle 'https://github.com/Shougo/neocomplcache.vim.git' | |
NeoBundle 'https://github.com/Shougo/neosnippet.vim' | |
NeoBundle 'https://github.com/Shougo/neosnippet-snippets' | |
NeoBundle 'Shougo/vimproc.vim', { | |
\ 'build' : { | |
\ 'windows' : 'tools\\update-dll-mingw', | |
\ 'cygwin' : 'make -f make_cygwin.mak', | |
\ 'mac' : 'make -f make_mac.mak', | |
\ 'linux' : 'make', | |
\ 'unix' : 'gmake', | |
\ }, | |
\ } | |
" Colorscheme | |
" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
set t_Co=256 | |
let g:solarized_visibility = "high" | |
let g:solarized_contrast = "high" | |
let g:solarized_termtrans = 1 | |
" colorscheme herald | |
" colorscheme slate | |
" colorscheme twilight256 | |
" colorscheme twitchy | |
" colorscheme hornet | |
colorscheme colorful | |
set bg=dark | |
" caw.vim | |
" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
" gci 文の頭からコメントアウト | |
" gcI 行頭からコメントアウト | |
" gca 行末にコメントアウト | |
" gco カーソル行の下にコメントアウト | |
" gcO カーソル行の上にコメントアウト | |
" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
nmap ,c<space> <Plug>(caw:i:toggle) | |
nmap ,o<space> gCi | |
nmap ,y<space> yypgcIk | |
" NERDTree | |
" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
let NERDTreeChDirMode=2 | |
let NERDTreeQuitOnOpen=1 | |
let NERDTreeIgnore = ['\.git$', 'vendor'] | |
nmap ,f<space> :NERDTreeToggle .<CR> | |
" EasyMotion | |
" http://haya14busa.com/mastering-vim-easymotion/ | |
" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
if version > 702 | |
nmap ,<space> <Plug>(easymotion-s2) | |
endif | |
" Powerline | |
" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
" $ mkdir ~/.config/powerline | |
" $ cp -R ~/.vim/bundle/powerline/powerline/config_files/* ~/.config/powerline | |
" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
set rtp+=~/.vim/bundle/powerline/powerline/bindings/vim | |
let g:Powerline_symbols = 'fancy' | |
set fillchars+=stl:\ ,stlnc:\ | |
if ! has('gui_running') | |
set ttimeoutlen=10 | |
augroup FastEscape | |
autocmd! | |
au InsertEnter * set timeoutlen=0 | |
au InsertLeave * set timeoutlen=1000 | |
augroup END | |
endif | |
" Unite.vim (https://github.com/Shougo/unite.vim.git) | |
" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
let g:unite_enable_start_insert=1 " https://github.com/Shougo/unite.vim.git | |
let g:unite_source_file_mru_filename_format = '' " 空にすると表示が高速化する | |
nnoremap <silent> '<space> :<C-u>Unite file_rec file/new<CR> | |
nnoremap <silent> @<space> :<C-u>Unite file_rec file/new<CR> | |
" ファイルを開く.新規ファイルが開けるように file/new | |
nnoremap <silent> 'f<space> :<C-u>Unite -buffer-name=files file_rec file/new<CR> | |
" バッファを開く | |
nnoremap <silent> 'b<space> :<C-u>Unite buffer<CR> | |
" てんこ盛り | |
nnoremap <silent> 'a<space> :<C-u>Unite -buffer-name=files buffer file file_mru file/new<CR> | |
" gitでmodifiedなファイルを開く | |
nnoremap <silent> 'g<space> :<C-u>Unite -buffer-name=files git_modified<CR> | |
" unite-outlineを呼び出す | |
nnoremap <silent> 'o<space> :<C-u>Unite outline<CR> | |
" unite-outlineを縦分割でかつ閉じないように表示する | |
nnoremap <silent> 'ov<space> :<C-u>Unite -vertical -winwidth=30 -no-quit outline<CR> | |
" file/asyncする | |
nnoremap <silent> 'r<space> :Unite file_rec/async<cr> | |
" unite.vimのfile_recでプロジェクトのファイルを一望する | |
" (http://d.hatena.ne.jp/h1mesuke/20110918/p1) | |
function! s:unite_project(...) | |
let opts = (a:0 ? join(a:000, ' ') : '') | |
let dir = unite#util#path2project_directory(expand('%')) | |
execute 'Unite' opts 'file_rec:' . dir | |
endfunction | |
" uniteを開いている間のキーマッピング | |
" (http://www.karakaram.com/vim/vimfiler/) | |
augroup vimrc | |
autocmd FileType unite call s:unite_my_settings() | |
augroup END | |
function! s:unite_my_settings() | |
" ESCでuniteを終了する | |
nmap <buffer> <ESC> <Plug>(unite_exit) | |
" 入力モードのときctrl+wでバックスラッシュも削除 | |
imap <buffer> <C-w> <Plug>(unite_delete_backward_path) | |
endfunction | |
" ウィンドウを分割して開く | |
au FileType unite nnoremap <buffer> <expr> 's unite#do_action('split') | |
au FileType unite inoremap <buffer> <expr> 's unite#do_action('split') | |
" ウィンドウを横に分割して開く | |
au FileType unite nnoremap <buffer> <expr> 'v unite#do_action('vsplit') | |
au FileType unite inoremap <buffer> <expr> 'v unite#do_action('vsplit') | |
" 新しいタブで開く | |
au FileType unite nnoremap <buffer> <expr> 't unite#do_action('tabopen') | |
au FileType unite inoremap <buffer> <expr> 't unite#do_action('tabopen') | |
" Neocomplcache | |
" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
" Disable AutoComplPop. | |
let g:acp_enableAtStartup = 0 | |
" Use neocomplcache. | |
let g:neocomplcache_enable_at_startup = 1 | |
" Use smartcase. | |
let g:neocomplcache_enable_smart_case = 1 | |
" Set minimum syntax keyword length. | |
let g:neocomplcache_min_syntax_length = 3 | |
let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*' | |
" Enable heavy features. | |
" Use camel case completion. | |
let g:neocomplcache_enable_camel_case_completion = 1 | |
" Use underbar completion. | |
let g:neocomplcache_enable_underbar_completion = 1 | |
" Define dictionary. | |
let g:neocomplcache_dictionary_filetype_lists = { | |
\ 'default' : '', | |
\ 'vimshell' : $HOME.'/.vimshell_hist', | |
\ 'scheme' : $HOME.'/.gosh_completions' | |
\ } | |
" Define keyword. | |
if !exists('g:neocomplcache_keyword_patterns') | |
let g:neocomplcache_keyword_patterns = {} | |
endif | |
let g:neocomplcache_keyword_patterns['default'] = '\h\w*' | |
" Plugin key-mappings. | |
inoremap <expr><C-g> neocomplcache#undo_completion() | |
inoremap <expr><C-l> neocomplcache#complete_common_string() | |
" Recommended key-mappings. | |
" <CR>: close popup and save indent. | |
" inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR> | |
function! s:my_cr_function() | |
return neocomplcache#smart_close_popup() . "\<CR>" | |
" For no inserting <CR> key. | |
"return pumvisible() ? neocomplcache#close_popup() : "\<CR>" | |
endfunction | |
" <TAB>: completion. | |
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>" | |
" <C-h>, <BS>: close popup and delete backword char. | |
inoremap <expr><C-h> neocomplcache#smart_close_popup()."\<C-h>" | |
inoremap <expr><BS> neocomplcache#smart_close_popup()."\<C-h>" | |
inoremap <expr><C-y> neocomplcache#close_popup() | |
inoremap <expr><C-e> neocomplcache#cancel_popup() | |
" Close popup by <Space>. | |
" inoremap <expr><Space> pumvisible() ? neocomplcache#close_popup() : "\<Space>" | |
" For cursor moving in insert mode(Not recommended) | |
inoremap <expr><Left> neocomplcache#close_popup() . "\<Left>" | |
inoremap <expr><Right> neocomplcache#close_popup() . "\<Right>" | |
inoremap <expr><Up> neocomplcache#close_popup() . "\<Up>" | |
inoremap <expr><Down> neocomplcache#close_popup() . "\<Down>" | |
" Or set this. | |
"let g:neocomplcache_enable_cursor_hold_i = 1 | |
" Or set this. | |
"let g:neocomplcache_enable_insert_char_pre = 1 | |
" AutoComplPop like behavior. | |
"let g:neocomplcache_enable_auto_select = 1 | |
" Shell like behavior(not recommended). | |
"set completeopt+=longest | |
"let g:neocomplcache_enable_auto_select = 1 | |
"let g:neocomplcache_disable_auto_complete = 1 | |
"inoremap <expr><TAB> pumvisible() ? "\<Down>" : "\<C-x>\<C-u>" | |
set completeopt=menuone | |
" Enable omni completion. | |
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS | |
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags | |
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS | |
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete | |
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags | |
" Enable heavy omni completion. | |
if !exists('g:neocomplcache_force_omni_patterns') | |
let g:neocomplcache_force_omni_patterns = {} | |
endif | |
let g:neocomplcache_force_omni_patterns.php = '[^. \t]->\h\w*\|\h\w*::' | |
let g:neocomplcache_force_omni_patterns.c = '[^.[:digit:] *\t]\%(\.\|->\)' | |
let g:neocomplcache_force_omni_patterns.cpp = '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::' | |
" For perlomni.vim setting. | |
" https://github.com/c9s/perlomni.vim | |
let g:neocomplcache_force_omni_patterns.perl = '\h\w*->\h\w*\|\h\w*::' | |
syntax on | |
" Neosnippet | |
" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
" Plugin key-mappings. | |
imap <C-k> <Plug>(neosnippet_expand_or_jump) | |
smap <C-k> <Plug>(neosnippet_expand_or_jump) | |
xmap <C-k> <Plug>(neosnippet_expand_target) | |
" SuperTab like snippets behavior. | |
imap <expr><TAB> neosnippet#expandable_or_jumpable() ? | |
\ "\<Plug>(neosnippet_expand_or_jump)" | |
\: pumvisible() ? "\<C-n>" : "\<TAB>" | |
smap <expr><TAB> neosnippet#expandable_or_jumpable() ? | |
\ "\<Plug>(neosnippet_expand_or_jump)" | |
\: "\<TAB>" | |
" For snippet_complete marker. | |
if has('conceal') | |
set conceallevel=2 concealcursor=i | |
endif | |
" Enable snipMate compatibility feature. | |
let g:neosnippet#enable_snipmate_compatibility = 0 | |
" Tell Neosnippet about the other snippets | |
let g:neosnippet#snippets_directory='~/.vim/snippets' | |
" tagbar | |
" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
nmap <F8> :TagbarToggle<CR> | |
" tagbar-phpctags | |
" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
" let g:tagbar_phpctags_bin='~/.vim/bundle/tagbar-phpctags/bin/phpctags' | |
let g:tagbar_phpctags_bin='~/.vim/bundle/phpctags/phpctags' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment