Skip to content

Instantly share code, notes, and snippets.

@cohalz
Created September 16, 2013 12:18
Show Gist options
  • Save cohalz/6579984 to your computer and use it in GitHub Desktop.
Save cohalz/6579984 to your computer and use it in GitHub Desktop.
set nocompatible
filetype off
if has('vim_starting')
set runtimepath+=~/.vim/bundle/neobundle.vim
call neobundle#rc(expand('~/.vim/bundle/'))
endif
NeoBundle 'Shougo/neobundle.vim'
NeoBundle 'Shougo/neocomplcache'
NeoBundle 'Shougo/neosnippet.vim'
NeoBundle 'ujihisa/neco-ghc'
NeoBundle 'teramako/jscomplete-vim'
NeoBundle 'vim-scripts/c.vim'
NeoBundle 'klen/python-mode'
NeoBundle 'vim-scripts/perl-support.vim'
NeoBundle 'pangloss/vim-javascript'
NeoBundle 'kchmck/vim-coffee-script'
NeoBundle 'sukima/xmledit'
NeoBundle 'vim-scripts/css_color.vim'
NeoBundle 'othree/eregex.vim'
NeoBundle 'rosstimson/scala-vim-support'
NeoBundle 'xolox/vim-lua-ftplugin'
NeoBundle 'georgenano/vimrc'
NeoBundle 'mattn/excitetranslate-vim'
NeoBundle 'mattn/webapi-vim'
NeoBundle 'vim-scripts/YankRing.vim'
NeoBundle 'thinca/vim-quickrun'
NeoBundle 'pekepeke/titanium-vim'
NeoBundle 'scrooloose/syntastic'
NeoBundle 'airblade/vim-rooter'
NeoBundle 'Shougo/vimfiler'
NeoBundle 'itchyny/lightline.vim'
NeoBundle 'project.tar.gz'
NeoBundle 'tyru/skk.vim'
NeoBundle 'vimtaku/vim-mlh'
NeoBundle 'basyura/TweetVim'
NeoBundle 'mattn/webapi-vim'
NeoBundle 'basyura/twibill.vim'
NeoBundle 'tyru/open-browser.vim'
NeoBundle 'h1mesuke/unite-outline'
NeoBundle 'basyura/bitly.vim'
NeoBundle 'fuenor/qfixhowm'
NeoBundle 'kana/vim-operator-user'
NeoBundle 'kana/vim-operator-replace'
NeoBundle 'kana/vim-textobj-user'
NeoBundle 'kana/vim-textobj-indent'
NeoBundle 'glts/vim-textobj-comment'
NeoBundle 'thinca/vim-textobj-plugins'
NeoBundle 'tpope/vim-surround'
NeoBundle 'rhysd/clever-f.vim'
NeoBundle 'Lokaltog/vim-easymotion'
NeoBundle 'thinca/vim-visualstar'
NeoBundle 'kana/vim-smartinput'
NeoBundle 'mattn/emmet-vim'
NeoBundle 'tyru/caw.vim'
NeoBundle 'h1mesuke/vim-alignta'
NeoBundle 'osyo-manga/shabadou.vim'
NeoBundle 'osyo-manga/unite-quickfix'
NeoBundle 'osyo-manga/vim-watchdogs'
NeoBundle 'jimsei/winresizer'
NeoBundle 'chriskempson/vim-tomorrow-theme'
NeoBundle 'w0ng/vim-hybrid'
" neobundle"{{{
" コマンドを伴うやつの遅延読み込み
"bundle"{{{
" その他 {{{
NeoBundle 'Shougo/echodoc', '', 'default'
call neobundle#config('echodoc', {
\ 'lazy' : 1,
\ 'autoload' : {
\ 'insert' : 1,
\ }})
NeoBundle 'Shougo/vimproc', {
\ 'build' : {
\ 'windows' : 'make -f make_mingw32.mak',
\ 'cygwin' : 'make -f make_cygwin.mak',
\ 'mac' : 'make -f make_mac.mak',
\ 'unix' : 'make -f make_unix.mak',
\ },
\ }
NeoBundleLazy 'taichouchou2/vim-endwise.git', {
\ 'autoload' : {
\ 'insert' : 1,
\ } }
" }}}
" 補完 {{{
NeoBundleLazy 'Shougo/neocomplcache', {
\ 'autoload' : {
\ 'insert' : 1,
\ }}
NeoBundleLazy 'Shougo/neosnippet', {
\ 'autoload' : {
\ 'insert' : 1,
\ }}
NeoBundle 'Shougo/neocomplcache-rsense', {
\ 'depends': 'Shougo/neocomplcache',
\ 'autoload': { 'filetypes': 'ruby' }}
NeoBundleLazy 'taichouchou2/rsense-0.3', {
\ 'build' : {
\ 'mac': 'ruby etc/config.rb > ~/.rsense',
\ 'unix': 'ruby etc/config.rb > ~/.rsense',
\ } }
" }}}
" 便利 {{{
" 範囲指定のコマンドが使えないので、tcommentのLazy化はNeoBundleのアップデートを待ちましょう...
NeoBundle 'tomtom/tcomment_vim'
NeoBundleLazy 'tpope/vim-surround', {
\ 'autoload' : {
\ 'mappings' : [
\ ['nx', '<Plug>Dsurround'], ['nx', '<Plug>Csurround'],
\ ['nx', '<Plug>Ysurround'], ['nx', '<Plug>YSurround'],
\ ['nx', '<Plug>Yssurround'], ['nx', '<Plug>YSsurround'],
\ ['nx', '<Plug>YSsurround'], ['vx', '<Plug>VgSurround'],
\ ['vx', '<Plug>VSurround']
\ ]}}
" }}}
" ruby / railsサポート {{{
NeoBundle 'tpope/vim-rails'
NeoBundleLazy 'ujihisa/unite-rake', {
\ 'depends' : 'Shougo/unite.vim' }
NeoBundleLazy 'basyura/unite-rails', {
\ 'depends' : 'Shjkougo/unite.vim' }
NeoBundleLazy 'taichouchou2/unite-rails_best_practices', {
\ 'depends' : 'Shougo/unite.vim',
\ 'build' : {
\ 'mac': 'gem install rails_best_practices',
\ 'unix': 'gem install rails_best_practices',
\ }
\ }
NeoBundleLazy 'taichouchou2/unite-reek', {
\ 'build' : {
\ 'mac': 'gem install reek',
\ 'unix': 'gem install reek',
\ },
\ 'autoload': { 'filetypes': ['ruby', 'eruby', 'haml'] },
\ 'depends' : 'Shougo/unite.vim' }
NeoBundleLazy 'taichouchou2/alpaca_complete', {
\ 'depends' : 'tpope/vim-rails',
\ 'build' : {
\ 'mac': 'gem install alpaca_complete',
\ 'unix': 'gem install alpaca_complete',
\ }
\ }
let s:bundle_rails = 'unite-rails unite-rails_best_practices unite-rake alpaca_complete'
function! s:bundleLoadDepends(bundle_names) "{{{
" bundleの読み込み
execute 'NeoBundleSource '.a:bundle_names
au! RailsLazyPlugins
endfunction"}}}
aug RailsLazyPlugins
au User Rails call <SID>bundleLoadDepends(s:bundle_rails)
aug END
" reference環境
NeoBundleLazy 'vim-ruby/vim-ruby', {
\ 'autoload' : { 'filetypes': ['ruby', 'eruby', 'haml'] } }
NeoBundleLazy 'taka84u9/vim-ref-ri', {
\ 'depends': ['Shougo/unite.vim', 'thinca/vim-ref'],
\ 'autoload': { 'filetypes': ['ruby', 'eruby', 'haml'] } }
NeoBundleLazy 'skwp/vim-rspec', {
\ 'autoload': { 'filetypes': ['ruby', 'eruby', 'haml'] } }
NeoBundleLazy 'ruby-matchit', {
\ 'autoload' : { 'filetypes': ['ruby', 'eruby', 'haml'] } }
" }}}
" }}}
"}}}
filetype plugin on
filetype indent on
"NeoBundleここまで
function InsertTabWrapper()
if pumvisible()
return "\<c-n>"
endif
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k\|<\|/'
return "\<tab>"
elseif exists('&omnifunc') && &omnifunc == ''
return "\<c-n>"
else
return "\<c-x>\<c-o>"
endif
endfunction
inoremap <tab> <c-r>=InsertTabWrapper()<cr>
"ポップアップ補完メニュー色設定(通常の項目、選択されている項目、スクロールバー、スクロールバーのつまみ部分)
hi Pmenu guibg=#666666
hi PmenuSel guibg=#8cd0d3 guifg=#666666
hi PmenuSbar guibg=#333333
let g:jscomplete_use = ['dom', 'moz','xpcom','es6th']
nnoremap Q <Nop>
">"
" pair close checker.
" from othree vimrc ( http://github.com/othree/rc/blob/master/osx/.vimrc )
function ClosePair(char)
if getline('.')[col('.') - 1] == a:char
return "\<Right>"
else
return a:char
endif
endf
augroup MyXML
autocmd!
autocmd Filetype xml inoremap <buffer> </ </<C-x><C-o>
autocmd Filetype html inoremap <buffer> </ </<C-x><C-o>
autocmd Filetype eruby inoremap <buffer> </ </<C-x><C-o>
augroup END
" <TAB>: completion.
" inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<S-TAB>"
" Plugin key-mappings.
imap <C-k> <Plug>(neosnippet_expand_or_jump)
smap <C-k> <Plug>(neosnippet_expand_or_jump)
" SuperTab like snippets behavior.
imap <expr><TAB> neosnippet#jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : pumvisible() ? "\<C-n>" : "\<TAB>"
smap <expr><TAB> neosnippet#jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
" For snippet_complete marker.
if has('conceal') set conceallevel=2 concealcursor=i
endif
set iminsert=0
set imsearch=-1
set tabstop=2
set shiftwidth=2
set expandtab
set autoindent
set nocompatible
syntax on
filetype on
filetype indent on
filetype plugin on
set sm
set ai
syntax on
let java_highlight_all=1
let java_highlight_functions="style"
let java_allow_cpp_keywords=1
au BufNewFile,BufRead *.less setf less.css
" 自動プレビュー
au BufWritePost *.coffee :CoffeeCompile watch vert
" 自動コンパイル
au BufWritePost *.coffee silent CoffeeMake! -b | cwindow | redraw!
augroup MyXML
autocmd!
autocmd Filetype xml inoremap <buffer> </ </<C-x><C-o>
autocmd Filetype html inoremap <buffer> </ </<C-x><C-o>
autocmd Filetype eruby inoremap <buffer> </ </<C-x><C-o>
autocmd Filetype erb inoremap <buffer> </ </<C-x><C-o>
augroup END
set nocompatible
syntax on
filetype on
filetype indent on
filetype plugin on
"omni
function InsertTabWrapper()
if pumvisible()
return "\"
endif
let col = col('.') - 1
if !col || getline('.')[col -1] !~ '\k\|< \|/'
return "\"
elseif exists('&omnifunc') && &omnifunc == ''
return "\"
else
return "\\"
endif
endfunction
inoremap =InsertTabWrapper()
" rubycomplete.vim
let g:rubycomplete_buffer_loading = 1
let g:rubycomplete_rails = 1
let g:rubycomplete_classes_in_global = 1
"Note: This option must set it in .vimrc(_vimrc). NOT IN .gvimrc(_gvimrc)!
" 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>"
" 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_omni_patterns')
let g:neocomplcache_omni_patterns = {}
endif
let g:neocomplcache_omni_patterns.php = '[^. \t]->\h\w*\|\h\w*::'
let g:neocomplcache_omni_patterns.c = '[^.[:digit:] *\t]\%(\.\|->\)'
let g:neocomplcache_omni_patterns.cpp = '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::'
" For perlomni.vim setting.
" https://github.com/c9s/perlomni.vim
let g:neocomplcache_omni_patterns.perl = '\h\w*->\h\w*\|\h\w*::'
" , y でヤンク履歴
nmap ,y :YRShow<CR>
" クリップボード共有
set clipboard+=unnamedplus,unnamed
let g:vimfiler_as_default_explorer = 1
let g:syntastic_enable_signs=1
let g:syntastic_auto_loc_list=2
let g:syntastic_scala_lib_path ="Applications/eclipse/Eclipse.app/Contents/MacOS/workspace/slickTest/libraries"
inoremap <silent> <ESC> <ESC>:set iminsert=0<CR>
nnoremap Y y$
"lightlineカラースキームはじまり
let g:lightline = {
\ 'mode_map': {'c': 'NORMAL'},
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ] ]
\ },
\ 'component_function': {
\ 'modified': 'MyModified',
\ 'readonly': 'MyReadonly',
\ 'fugitive': 'MyFugitive',
\ 'filename': 'MyFilename',
\ 'fileformat': 'MyFileformat',
\ 'filetype': 'MyFiletype',
\ 'fileencoding': 'MyFileencoding',
\ 'mode': 'MyMode'
\ }
\ }
function! MyModified()
return &ft =~ 'help\|vimfiler\|gundo' ? '' : &modified ? '+' : &modifiable ? '' : '-'
endfunction
function! MyReadonly()
return &ft !~? 'help\|vimfiler\|gundo' && &readonly ? 'x' : ''
endfunction
function! MyFilename()
return ('' != MyReadonly() ? MyReadonly() . ' ' : '') .
\ (&ft == 'vimfiler' ? vimfiler#get_status_string() :
\ &ft == 'unite' ? unite#get_status_string() :
\ &ft == 'vimshell' ? vimshell#get_status_string() :
\ '' != expand('%:t') ? expand('%:t') : '[No Name]') .
\ ('' != MyModified() ? ' ' . MyModified() : '')
endfunction
function! MyFugitive()
try
if &ft !~? 'vimfiler\|gundo' && exists('*fugitive#head')
return fugitive#head()
endif
catch
endtry
return ''
endfunction
function! MyFileformat()
return winwidth('.') > 70 ? &fileformat : ''
endfunction
function! MyFiletype()
return winwidth('.') > 70 ? (strlen(&filetype) ? &filetype : 'no ft') : ''
endfunction
function! MyFileencoding()
return winwidth('.') > 70 ? (strlen(&fenc) ? &fenc : &enc) : ''
endfunction
function! MyMode()
return winwidth('.') > 60 ? lightline#mode() : ''
endfunction
"lightlineカラースキーム終わり
let g:skk_control_j_key = ""
let g:skk_large_jisyo = "$HOME/local/dict/SKK-JISYO.L"
"--------------------
"howm
"--------------------
if has('gui')
"キーマップリーダー
let QFixHowm_Key = 'g'
"howm_dirはファイルを保存したいディレクトリを設定。
let howm_dir = '~/Dropbox/memo'
let howm_filename = '%Y/%m/%Y-%m-%d-%H%M%S.txt'
let howm_fileencoding = 'utf-8'
let howm_fileformat = 'unix'
"howmファイル読込の際、howm_fileencodingに強制設定する/しない
let QFixHowm_ForceEncoding = 0
"タイムスタンプを更新日時に変更(カーソルがあるエントリの日時を変更)
let QFixHowm_SaveTime = 2
endif
"--------------------
"operator-replace
"Rで置換できるようにする
"defaultのRが使えなくなるので注意
"--------------------
map R <Plug>(operator-replace)
"easymotion の設定
" ホームポジションに近いキーを使う
let g:EasyMotion_keys='hjklasdfgyuiopqwertnmzxcvbHJKLASDFGYUIOPQWERTNMZXCVB'
" 「'」 + 何かにマッピング
let g:EasyMotion_leader_key=";"
" 1 ストローク選択を優先する
let g:EasyMotion_grouping=1
" カラー設定変更
hi EasyMotionTarget ctermbg=none ctermfg=red
hi EasyMotionShade ctermbg=none ctermfg=blue
"caw.vim
nmap <Leader>c <Plug>(caw:I:toggle)
vmap <Leader>c <Plug>(caw:I:toggle)
" runner/vimproc/updatetime で出力バッファの更新間隔をミリ秒で設定できます
" updatetime が一時的に書き換えられてしまうので注意して下さい
let g:quickrun_config = {
\ "_" : {
\ "hook/shabadoubi_touch_henshin/enable" : 1,
\ "hook/shabadoubi_touch_henshin/wait" : 20,
\ "outputter/buffer/split" : ":botright 8sp",
\ "runner" : "vimproc",
\ "runner/vimproc/updatetime" : 40,
\ }
\}
set whichwrap+=h,l,<,>,[,],b,s,~
syn on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment