Skip to content

Instantly share code, notes, and snippets.

@closer
Created September 11, 2014 12:21
Show Gist options
  • Select an option

  • Save closer/74436410e08640648b29 to your computer and use it in GitHub Desktop.

Select an option

Save closer/74436410e08640648b29 to your computer and use it in GitHub Desktop.
ビムの設定
" ============================================
" NeoBundle
" https://github.com/Shougo/neobundle.vim
" ============================================
if has('vim_starting')
set nocompatible
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
call neobundle#rc(expand('~/.vim/bundle/'))
" ============================================
NeoBundleFetch 'Shougo/neobundle.vim'
" base16
NeoBundle 'chriskempson/base16-vim'
let base16colorspace=256
colorscheme base16-eighties
highlight SignColumn ctermbg=0
" Airline
NeoBundle 'bling/vim-airline'
let g:airline_theme = "laederon"
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_left_sep = '⮀'
let g:airline_left_alt_sep = '⮁'
let g:airline_right_sep = '⮂'
let g:airline_right_alt_sep = '⮃'
let g:airline_symbols.branch = '⭠'
let g:airline_symbols.readonly = '⭤'
let g:airline_symbols.linenr = '⭡'
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#left_sep = '⮀'
let g:airline#extensions#tabline#left_alt_sep = '⮁'
" CtrlP
NeoBundle 'kien/ctrlp.vim'
let g:airline#extensions#ctrlp#color_template = 'normal'
let g:airline#extensions#ctrlp#show_adjacent_modes = 1
let g:ctrlp_open_multi = '10t'
let g:ctrlp_use_migemo = 1
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]vendor\/bundle$'
\ }
" Unite
" NeoBundle 'Shougo/unite.vim'
" let g:unite_enable_start_insert = 1
" nnoremap [unite] <Nop>
" nmap <Leader>u [unite]
" imap <silent> <C-u> <ESC>[unite]
" nnoremap <silent> [unite]c :<C-u>UniteWithCurrentDir -buffer-name=files buffer file_mru bookmark file<CR>
" nnoremap <silent> [unite]b :<C-u>Unite buffer<CR>
" Neocomplete
NeoBundle 'Shougo/neocomplete'
let g:neocomplete#force_overwrite_completefunc=1
let g:neocomplete#enable_at_startup = 1
let g:neocomplete#enable_ignore_case = 1
let g:neocomplete#enable_smart_case = 1
if !exists('g:neocomplete#keyword_patterns')
let g:neocomplete#keyword_patterns = {}
endif
let g:neocomplete#keyword_patterns._ = '\h\w*'
let g:neocomplete#sources#dictionary#dictionaries = {
\ 'default' : '',
\ 'ruby' : $HOME.'/.vim/dict/ruby.dict'
\ }
" Neosnippet
NeoBundle 'Shougo/neosnippet'
NeoBundle 'Shougo/neosnippet-snippets'
" 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
" Indeint lines
NeoBundle "Yggdroot/indentLine"
" let g:indentLine_char = '︙'
" Syntastic (syntax checking)
NeoBundle 'scrooloose/syntastic'
let g:airline#extensions#syntastic#enabled= 1
let g:syntastic_error_symbol = '✗'
let g:syntastic_style_error_symbol = '✗'
let g:syntastic_warning_symbol = '⚠'
let g:syntastic_style_warning_symbol = '⚠'
let g:syntastic_mode_map = { 'mode': 'passive' }
let g:syntastic_ruby_checkers = ['mri', 'rubocop']
noremap <Leader><Leader> :up<CR>:SyntasticCheck<CR>
highlight SyntasticErrorSign ctermfg=0 ctermbg=1
highlight SyntasticWarningSign ctermfg=0 ctermbg=9
" Git
NeoBundle 'tpope/vim-fugitive'
let g:airline#extensions#branch#enabled = 1
" GitHub Issues
NeoBundle 'jaxbot/github-issues.vim'
let g:github_access_token = "781151def71231ba646f52b3984a2512f7ba2136"
let g:github_upstream_issues = 1
" Signify (Show a VCS diff using Vim's sign column.)
NeoBundle 'mhinz/vim-signify'
let g:airline#extensions#hunks#enabled = 1
" Tagbar (displays tags in a window)
NeoBundle 'majutsushi/tagbar'
let g:airline#extensions#tagbar#enabled = 1
let g:tagbar_ctags_bin = "/opt/boxen/homebrew/bin/ctags"
let g:tagbar_compact = 1
let g:tagbar_show_visibility = 1
let g:tagbar_iconchars = ['+', '-']
nmap <F8> :TagbarToggle<CR>
" Gundo (visualize Vim undo tree)
NeoBundle 'sjl/gundo.vim'
let g:gundo_width = 40
let g:gundo_close_on_revert = 1
nnoremap <F7> :GundoToggle<CR>
" HTML5
NeoBundleLazy 'othree/html5.vim', {"autoload" : {"filetype" :[ "html" ]} }
" PHP
" NeoBundle 'StanAngeloff/php.vim'
" NeoBundle 'smarty-syntax'
" Objective-C
NeoBundleLazy 'cocoa.vim', { "autoload" : {"filetypes" :[ "objc" ]} }
" Ruby
NeoBundleLazy 'vim-ruby/vim-ruby', {"autoload" : {"filetypes" :[ "ruby" ]} }
NeoBundleLazy 'tpope/vim-rails', {"autoload" : {"filetypes" :[ "ruby" ]} }
NeoBundleLazy 'tpope/vim-rake', {"autoload" : {"filetypes" :[ "ruby" ]} }
NeoBundleLazy 'noprompt/vim-yardoc', {"autoload" : {"filetypes" :[ "ruby" ]} }
NeoBundleLazy 'ngmy/vim-rubocop', {"autoload" : {"filetypes" :[ "ruby" ]} }
let g:vimrubocop_config = './.rubocop.yml'
" Haml
NeoBundleLazy 'tpope/vim-haml', {"autoload" : {"filetypes" :[ "haml" ]} }
" Slim
NeoBundleLazy 'slim-template/vim-slim', {"autoload" : {"filetypes" :[ "slim" ]} }
" Less
NeoBundleLazy 'groenewege/vim-less', {"autoload" : {"filetypes" :[ "less" ]} }
" Markdown
NeoBundleLazy 'tpope/vim-markdown', {"autoload" : {"filetypes" :[ "markdown", "md" ]} }
" Mustache, Handlebars
" NeoBundle 'mustache/vim-mustache-handlebars'
" JavaScript
NeoBundleLazy 'nono/jquery.vim', {"autoload" : {"filetypes" :[ "js" ]} }
" CoffeeScript
NeoBundleLazy 'kchmck/vim-coffee-script', {"autoload" : {"filetypes" :[ "coffee" ]} }
" EJS
" NeoBundle 'briancollins/vim-jst'
" Go lang
" NeoBundle 'jnwhiteh/vim-golang'
" Puppet
" NeoBundle 'puppetlabs/puppet-syntax-vim'
" vim-altr {{{
NeoBundle 'kana/vim-altr'
nmap <F3> <Plug>(altr-forward)
" For ruby tdd
call altr#define('%.rb', '/%_spec.rb')
" For rails tdd
call altr#define('app/models/%.rb', 'test/models/%_test.rb', 'spec/models/%_spec.rb')
call altr#define('app/controllers/%.rb', 'test/controllers/%_test.rb', 'spec/controllers/%_spec.rb')
call altr#define('app/helpers/%.rb', 'test/helpers/%_test.rb', 'spec/helpers/%_spec.rb')
call altr#define('coffee/%.coffee', 'js/%.js')
" }}}
" ============================================
filetype plugin indent on
" ============================================
NeoBundleCheck
" Vim設定
set ambiwidth=double
" bgcolor
set background=dark
" <Leader>
let mapleader = " "
" カーソルキー無効
inoremap <Right> <Nop>
inoremap <Left> <Nop>
inoremap <Up> <Nop>
inoremap <Down> <Nop>
nnoremap <Right> <Nop>
nnoremap <Left> <Nop>
nnoremap <Up> <Nop>
nnoremap <Down> <Nop>
imap <C-j> <Down>
imap <C-k> <Up>
imap <C-h> <Left>
imap <C-l> <Right>
" gj, gkとj, kを交換
nnoremap j gj
nnoremap k gk
nnoremap gj j
nnoremap gk k
" ZZ, ZQを無効化
nnoremap ZZ <Nop>
nnoremap ZQ <Nop>
" Qを無効化
nnoremap Q <Nop>
" vi非互換
set nocompatible
" タブをスペース
set expandtab
" 自動インデント
set autoindent
" シフト移動幅
set shiftwidth=2
" 行頭の余白内で Tab を打ち込むと、'shiftwidth' の数だけインデントする。
set smarttab
" ファイル内の <Tab> が対応する空白の数
set tabstop=2
" モードラインを有効化
set modeline
set nomodeline
set noshowmode
" スワップファイル
set directory-=.
" バックアップファイル
set backupdir=$HOME/.vimbackup
" 行番号表示
set number
" 閉じ括弧が入力されたとき、対応する括弧を表示する
set showmatch
" 検索時に大文字を含んでいたら大/小を区別
set smartcase
" 新しい行を作ったときに高度な自動インデントを行う
set smartindent
" マウスでスクロール
set mouse=a
set ttymouse=xterm2
" タブの設定
" タブを開く
nnoremap <C-t> :tabedit<CR>
" 保存時に行末の空白を除去する
autocmd BufWritePre * :%s/\s\+$//ge
" 保存時にスペース2をtabに変換する
" autocmd BufWritePre * :%s/^\([\t]\*\) /\1\t/ge
" bufffer切り替えリマップ
nnoremap <silent>bp :bprevious<CR>
nnoremap <silent>bn :bnext<CR>
nnoremap <silent>bb :b#<CR>
" クリップボードからペースト
nnoremap <S-P> :r !pbpaste<CR>
" カーソル行をハイライト
set cursorline
" ウィンドウの大きさの自動調整を無効化
set noequalalways
" Leader * 2で保存
noremap <silent> <Leader><Leader> :up<CR>
" カレントウィンドウにのみ罫線を引く
augroup cch
autocmd! cch
autocmd WinLeave * set nocursorline
autocmd WinEnter,BufRead * set cursorline
augroup END
:hi clear CursorLine
:hi CursorLine gui=underline
highlight CursorLine ctermbg=black guibg=black
:set nohls
" Escの2回押しでハイライト消去
nmap <Esc><Esc> :nohlsearch<CR><Esc>
lang mes en_US
" メニューの言語
set langmenu="de.latin1"
set list listchars=tab:->
" FileType
au BufRead,BufNewFile *.cap set ft=ruby
au BufRead,BufNewFile jquery.*.js set ft=javascript syntax=jquery
au BufRead,BufNewFile *.coffee set ft=coffee
au BufRead,BufNewFile *.less set ft=less
au BufRead,BufNewFile *.slim set ft=slim
au BufRead,BufNewFile *.scss set ft=scss
" ignore file
set wildignore+=*/tmp/*
set wildignore+=*/*.so,*/*.zip
set wildignore+=*/*.jpg,*/*.gif,*/*.png,*/*.ico
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*
set wildignore+=*/*~,*/*.swp
" Load settings for each location.
augroup vimrc-local
autocmd!
autocmd BufNewFile,BufReadPost * call s:vimrc_local(expand('<afile>:p:h'))
augroup END
function! s:vimrc_local(loc)
let files = findfile('.vimrc.local', escape(a:loc, ' ') . ';', -1)
for i in reverse(filter(files, 'filereadable(v:val)'))
source `=i`
endfor
endfunction
" 文字コード自動認識読み込み
" if filereadable(expand('~/.vimenc'))
" au BufRead,BufNewFile .vimenc set ft=vim
" source ~/.vimenc
" endif
" NeoBundle読み込み
if filereadable(expand('~/.neobundlerc'))
au BufRead,BufNewFile .neobundlerc set ft=vim
source ~/.neobundlerc
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment