Skip to content

Instantly share code, notes, and snippets.

@shoya140
Created November 19, 2012 07:57
Show Gist options
  • Save shoya140/4109503 to your computer and use it in GitHub Desktop.
Save shoya140/4109503 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/vimfiler'
NeoBundle 'petdance/vim-perl'
NeoBundle 'hotchpotch/perldoc-vim'
NeoBundle 'Shougo/neocomplcache'
NeoBundle 'Shougo/neocomplcache-snippets-complete'
NeoBundle 'hrp/EnhancedCommentify'
NeoBundle 'h1mesuke/vim-alignta'
NeoBundle 'vim-scripts/sudo.vim'
NeoBundle 'JavaScript-syntax'
"Super Ishii pack
NeoBundle 'basyura/unite-rails'
NeoBundle 'romanvbabenko/rails.vim'
NeoBundle 'ruby-matchit'
NeoBundle 'taichouchou2/neco-rubymf'
NeoBundle 'taichouchou2/vim-rails'
NeoBundle 'taichouchou2/vim-ref-ri'
NeoBundle 'taichouchou2/vim-rsense'
NeoBundle 'taq/vim-rspec'
NeoBundle 'thinca/vim-ref'
NeoBundle 'tpope/vim-endwise.git'
NeoBundle 'ujihisa/unite-rake'
NeoBundle 'tomtom/tcomment_vim'
"Python
NeoBundle 'lambdalisue/vim-python-virtualenv'
NeoBundle 'mitechie/pyflakes-pathogen'
NeoBundle 'reinh/vim-makegreen'
NeoBundle 'lambdalisue/nose.vim'
NeoBundle 'sontek/rope-vim'
NeoBundle 'lambdalisue/vim-django-support'
"Gist
NeoBundle 'mattn/gist-vim'
NeoBundle 'mattn/webapi-vim'
let g:gist_show_privates = 1
let g:gist_post_private = 1
NeoBundle 'thinca/vim-quickrun'
let g:quickrun_config = {}
" default のキーマップを使用しない
let g:quickrun_no_default_key_mappings = 1
let g:quickrun_config['coffee'] = {'command' : 'coffee', 'exec' : ['%c -cbp %s']}
"let g:quickrun_config['markdown'] = {
" \ 'outputter': 'browser',
" \ 'cmdopt': '-s'
" \ }
"javascriptの実行をnode.jsで
let $JS_CMD='node'
NeoBundle 'scrooloose/syntastic'
NeoBundle 'grep.vim'
" カーソル下のキーワードを再帰grep
nnoremap <silent> <C-g><C-g> :<C-u>Rgrep<Space><C-r><C-w> *<Enter><CR>
" カーソル下のキーワードをバッファ内grep
nnoremap <C-g><C-b> :<C-u>GrepBuffer<Space><C-r><C-w><ENTER>
" 検索外のディレクトリ、ファイルパターン
let Grep_Skip_Dirs = '.svn .git .hg .swp'
let Grep_Skip_Files = '*.bak *~'
" qf内でファイルを開いた後画面を閉じる
function! OpenInQF()
.cc
ccl
" filetype on
endfunction
" rgrepなどで開いたqfを編修可にする
" また、Enterで飛べるようにする
function! OpenGrepQF()
"QuickFixをqだけで閉じる
nnoremap <buffer> q :q!<CR>
" cw
set nowrap "折り返ししない
set modifiable "編修可
"gfで開くときに、新しいTabで開く
nmap gf <C-W>gf
"C-Mで開ける
nmap <C-M> :call OpenInQF()<CR>
"Enterで開ける
nmap <CR> :call OpenInQF()<CR>
endfunction
autocmd Filetype qf call OpenGrepQF()
NeoBundle 'Shougo/unite.vim'
" unite.vim
" 入力モードで開始する
let g:unite_enable_start_insert=0
" 全部乗せ
"nnoremap <C-J> :<C-u>UniteWithCurrentDir -no-split -buffer-name=files buffer file_mru bookmark file<CR>
" 現在のバッファのカレントディレクトリからファイル一覧
nnoremap <C-P><C-P> :<C-u>UniteWithBufferDir file<CR>
" バッファ一覧
noremap <C-P> :Unite buffer<CR>
" ファイル一覧
noremap <C-H> :Unite -buffer-name=file file<CR>
" 最近使ったファイルの一覧
noremap <C-U> :Unite file_mru<CR>
" ウィンドウを分割して開く
au FileType unite nnoremap <silent> <buffer> <expr> <C-L>
au FileType unite inoremap <silent> <buffer> <expr> <C-L>
" ウィンドウを縦に分割して開く
au FileType unite nnoremap <silent> <buffer> <expr> <C-K>
au FileType unite inoremap <silent> <buffer> <expr> <C-K>
" 初期設定関数を起動する
"au FileType unite call s:unite_my_settings()
let g:unite_source_file_mru_limit = 60 "最大数
"Neocomplete関連
" Disable AutoComplPop.
let g:acp_enableAtStartup = 0
" Use neocomplcache.
let g:neocomplcache_enable_at_startup = 1
" Use underbar completion.
let g:neocomplcache_enable_underbar_completion = 1
" Set minimum syntax keyword length.
let g:neocomplcache_min_syntax_length = 3
let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*'
" Use smartcase.
let g:neocomplcache_enable_smart_case = 1
" Use camel case completion.
let g:neocomplcache_enable_camel_case_completion = 1
" Select with <TAB>
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
let g:neocomplcache_ctags_arguments_list = {
\ 'perl' : '-R -h ".pm"'
\ }
let g:neocomplcache_snippets_dir = "~/.vim/snippets"
" Define dictionary.
let g:neocomplcache_dictionary_filetype_lists = {
\ 'default' : '',
\ 'perl' : $HOME . '/.vim/dict/perl.dict'
\ }
" Define keyword.
if !exists('g:neocomplcache_keyword_patterns')
let g:neocomplcache_keyword_patterns = {}
endif
let g:neocomplcache_keyword_patterns['default'] = '\h\w*'
" for snippets
imap <expr><C-k> neocomplcache#sources#snippets_complete#expandable() ? "\<Plug>(neocomplcache_snippets_expand)" : "\<C-n>"
smap <C-k> <Plug>(neocomplcache_snippets_expand)
filetype plugin on
filetype indent on
" netrwは常にtree view
let g:netrw_liststyle = 3
" CVSと.で始まるファイルは表示しない
let g:netrw_list_hide = 'CVS,\(^\|\s\s\)\zs\.\S\+'
" 'v'でファイルを開くときは右側に開く。(デフォルトが左側なので入れ替え)
let g:netrw_altv = 1
" 'o'でファイルを開くときは下側に開く。(デフォルトが上側なので入れ替え)
let g:netrw_alto = 1
set cursorline
highlight CursorLine cterm = underline ctermfg = NONE ctermbg = NONE
highlight CursorLine gui = underline guifg = NONE guibg=NONE
"vimfiler 現在開いているバッファをIDE風に開く
nnoremap <silent> <Leader>fi :<C-u>VimFilerBufferDir -split -simple -winwidth=30 -no-quit<CR>
" Ctrl + n でNERDTreeを開く/閉じる
" nnoremap <f12> :NERDTreeToggle<CR>
nnoremap <silent> <C-n> :NERDTreeToggle<CR>
"ウィンドウ間移動
nmap fj <C-W>j<C-w>_
nmap fk <C-W>k<C-w>_
nmap fh <C-w>h<C-w>_
nmap fl <C-w>l<C-w>_
" create directory automatically
augroup vimrc-auto-mkdir
autocmd!
autocmd BufWritePre * call s:auto_mkdir(expand('<afile>:p:h'), v:cmdbang)
function! s:auto_mkdir(dir, force)
if !isdirectory(a:dir) && (a:force ||
\ input(printf('"%s" does not exist. Create? [y/N]', a:dir)) =~? '^y\%[es]$')
call mkdir(iconv(a:dir, &encoding, &termencoding), 'p')
endif
endfunction
augroup END
set clipboard=unnamed,autoselect
" コンマの後に自動的にスペースを挿入
inoremap , ,<Space>
"インデント
set autoindent
set smartindent
set expandtab
" set tabstop=4
" set softtabstop=4
" set shiftwidth=4
if has("autocmd")
filetype indent on
" 無効にしたい場合
" autocmd FileType html filetype indent off
autocmd FileType apache setlocal sw=4 sts=4 ts=4 et
autocmd FileType aspvbs setlocal sw=4 sts=4 ts=4 et
autocmd FileType c setlocal sw=4 sts=4 ts=4 et
autocmd FileType coffee setlocal sw=2 sts=2 ts=2 et
autocmd FileType conf setlocal sw=4 sts=4 ts=4 et
autocmd FileType cpp setlocal sw=4 sts=4 ts=4 et
autocmd FileType cs setlocal sw=4 sts=4 ts=4 et
autocmd FileType css setlocal sw=4 sts=4 ts=4 et
autocmd FileType diff setlocal sw=4 sts=4 ts=4 et
autocmd FileType eruby setlocal sw=2 sts=2 ts=2 et
autocmd FileType haml setlocal sw=2 sts=2 ts=2 et
autocmd FileType html setlocal sw=4 sts=4 ts=4 et
autocmd FileType java setlocal sw=4 sts=4 ts=4 et
autocmd FileType javascript setlocal sw=2 sts=2 ts=2 et
autocmd FileType less,sass setlocal sw=2 sts=2 ts=2 et
autocmd FileType lisp setlocal sw=2 sts=2 ts=2 et
autocmd FileType markdown setlocal sw=4 sts=4 ts=4 et
autocmd FileType perl setlocal sw=4 sts=4 ts=4 et
autocmd FileType php setlocal sw=4 sts=4 ts=4 et
autocmd FileType python setlocal sw=4 sts=4 ts=4 et
autocmd FileType ruby setlocal sw=2 sts=2 ts=2 et
autocmd FileType gitcommit setlocal sw=2 sts=2 ts=2 et
autocmd FileType scala setlocal sw=2 sts=2 ts=2 et
autocmd FileType scss setlocal sw=2 sts=2 ts=2 et
autocmd FileType sh setlocal sw=4 sts=4 ts=4 et
autocmd FileType sql setlocal sw=4 sts=4 ts=4 et
autocmd FileType vb setlocal sw=4 sts=4 ts=4 et
autocmd FileType vim setlocal sw=2 sts=2 ts=2 et
autocmd FileType wsh setlocal sw=4 sts=4 ts=4 et
autocmd FileType xhtml setlocal sw=4 sts=4 ts=4 et
autocmd FileType xml setlocal sw=4 sts=4 ts=4 et
autocmd FileType yaml setlocal sw=2 sts=2 ts=2 et
autocmd FileType zsh setlocal sw=4 sts=4 ts=4 et
endif
autocmd InsertLeave * set nopaste
"括弧を自動補完
"inoremap { {}<LEFT>
"inoremap [ []<LEFT>
"inoremap ( ()<LEFT>
"inoremap " ""<LEFT>
"inoremap ' ''<LEFT>
"au FileType ruby,eruby inoremap <buffer>\| \|\|<LEFT>
"保存時に無駄な文字を消す
function! s:remove_dust()
let cursor = getpos(".")
%s/\s\+$//ge
%s/\t/ /ge
call setpos(".", cursor)
unlet cursor
endfunction
au BufWritePre * call <SID>remove_dust()
"tex
let g:Tex_DefaultTargetFormat = 'pdf' "標準で.pdfにコンパイル
let g:Tex_ViewRule_pdf = 'open -a Preview.app' "PDFはPreview.appで開く
let g:Tex_CompileRule_pdf = 'pdflatex $*.tex' "pdflatexを使って.texから.pdfに変換
"-------------------------
"Lock
" Color Scheme
NeoBundle 'altercation/vim-colors-solarized'
syntax enable
set background=dark
"let g:solarized_termcolors=256
colorscheme solarized
"set showtabline=2 " タブを常に表示
set imdisable " IME OFF
set antialias " アンチエイリアス
set number " 行番号表示
set nobackup " バックアップなし
set visualbell t_vb= " ビープ音なし
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment