Skip to content

Instantly share code, notes, and snippets.

@higumachan
Created May 20, 2018 13:38
Show Gist options
  • Save higumachan/a22446823f8647818582cc1c6ec18d2e to your computer and use it in GitHub Desktop.
Save higumachan/a22446823f8647818582cc1c6ec18d2e to your computer and use it in GitHub Desktop.
syntax on
set autoindent
"バックアップファイルを作るディレクトリ
set backupdir=$HOME/.vimbackup
"ファイル保存ダイアログの初期ディレクトリをバッファファイル位置に設定
set browsedir=buffer
"クリップボードをWindowsと連携
"set clipboard=unnamed
"Vi互換をオフ
set nocompatible
"スワップファイル用のディレクトリ
set directory=$HOME/.vimbackup
"変更中のファイルでも、保存しないで他のファイルを表示
set hidden
"インクリメンタルサーチを行う
set incsearch
"タブ文字、行末など不可視文字を表示する
set list
"listで表示される文字のフォーマットを指定する
set listchars=tab:>\ ,extends:<
"行番号を表示する
set number
set expandtab
"シフト移動幅
set shiftwidth=4
"閉じ括弧が入力されたとき、対応する括弧を表示する
set showmatch
"新しい行を作ったときに高度な自動インデントを行う
set smartindent
"行頭の余白内で Tab を打ち込むと、'shiftwidth' の数だけインデントする。
set smarttab
"ファイル内の <Tab> が対応する空白の数
set tabstop=4
set whichwrap=b,s,h,l,<,>,[,]
"検索をファイルの先頭へループしない
set nowrapscan
set fileencoding=utf-8
set encoding=utf-8
"畳み込みの設定
set foldmethod=marker
" python実行
function! s:Exec()
exe "!" . &ft . " %"
:endfunction command! Exec call <SID>Exec()
map <silent> <C-P> :call <SID>Exec()<CR>
nmap bb :<C-u>Unite buffer<CR>
nmap BB :ls<CR>:vs<CR>:buf
map gb :bn<CR>
map gB :bp<CR>
map gw <C-W><C-W>
map bo :only<CR>
map cc \x
map <C-u> u
imap <C-@> <C-[>
imap <C-X> <C-[>
imap <C-F> <C-[>
imap <C-E> <C-Y>,
"imap <C-k> <Plug>(neocomplcache_snippets_expand)
"smap <C-k> <Plug>(neocomplcache_snippets_expand)
" cpp
autocmd FileType cpp setl autoindent
autocmd FileType cpp setl expandtab smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class
autocmd FileType cpp setl tabstop=2 shiftwidth=2 softtabstop=2
" python
filetype plugin on
autocmd FileType python setl autoindent
autocmd FileType python setl expandtab smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class
autocmd FileType python setl tabstop=4 shiftwidth=4 softtabstop=4
" python
filetype plugin on
autocmd FileType ruby setl autoindent
autocmd FileType ruby setl tabstop=2 shiftwidth=2 softtabstop=2
" coffee
autocmd FileType coffee setl autoindent
autocmd FileType coffee setl expandtab smartindent
autocmd FileType coffee setl tabstop=2 shiftwidth=2 softtabstop=2
" coffee
autocmd FileType html setl autoindent
autocmd FileType html setl expandtab smartindent
autocmd FileType html setl tabstop=2 shiftwidth=2 softtabstop=2
" vue
autocmd FileType vue setl tabstop=2 shiftwidth=2 softtabstop=2
" coffee
autocmd FileType javascript setl autoindent
autocmd FileType javascript setl expandtab smartindent
autocmd FileType javascript setl tabstop=2 shiftwidth=2 softtabstop=2
set t_Co=256
let g:molokai_original = 1
set nocompatible
filetype off
if has('vim_starting')
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
call neobundle#begin(expand('~/.vim/bundle/'))
NeoBundleFetch 'Shougo/neobundle.vim'
NeoBundle 'Shougo/vimproc.vim', {
\ 'build' : {
\ 'windows' : 'tools\\update-dll-mingw',
\ 'cygwin' : 'make -f make_cygwin.mak',
\ 'mac' : 'make',
\ 'linux' : 'make',
\ 'unix' : 'gmake',
\ },
\ }
"NeoBundle 'jalcine/cmake.vim'
NeoBundle 'rust-lang/rust.vim'
NeoBundle 'osyo-manga/shabadou.vim'
NeoBundle 'ekalinin/Dockerfile.vim'
NeoBundle "posva/vim-vue"
NeoBundle "danro/rename.vim"
NeoBundle 'pangloss/vim-javascript'
NeoBundle 'darthmall/vim-vue'
NeoBundle 'mopp/autodirmake.vim'
NeoBundle 'Shougo/neocomplete'
"NeoBundle 'Shougo/neocomplcache'
NeoBundle 'kylef/apiblueprint.vim'
NeoBundle 'thinca/vim-ref'
NeoBundle 'mitechie/pyflakes-pathogen'
NeoBundle 'mattn/webapi-vim'
NeoBundle 'mattn/gist-vim'
NeoBundle 'tpope/vim-fugitive'
NeoBundle 'Shougo/vimshell'
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',
\ },
\ }
NeoBundle "Shougo/unite.vim"
NeoBundle "Shougo/neomru.vim"
NeoBundle 'Shougo/neosnippet'
NeoBundle 'Shougo/neosnippet-snippets'
NeoBundle 'Shougo/unite-build'
NeoBundleLazy 'othree/yajs.vim', {'autoload':{'filetypes':['javascript']}}
autocmd BufRead,BufNewFile *.es6 setfiletype javascript
NeoBundle "Shougo/VimFiler"
NeoBundle 'h1mesuke/unite-outline'
NeoBundle 'Lokaltog/vim-easymotion'
NeoBundle 'surround.vim'
NeoBundle 'python.vim'
NeoBundle 'atourino/jinja.vim'
NeoBundle 'wesleyche/SrcExpl'
NeoBundle 'wesleyche/Trinity'
NeoBundle 'taglist.vim'
NeoBundle 'vim-scripts/DrawIt'
NeoBundle 'mattn/emmet-vim'
NeoBundle 'tpope/vim-fugitive'
NeoBundle 'ervandew/supertab'
NeoBundle 'scrooloose/syntastic'
NeoBundle 'justmao945/vim-clang'
NeoBundle "thinca/vim-quickrun"
NeoBundle "osyo-manga/shabadou.vim"
NeoBundle 'scrooloose/nerdcommenter.git'
NeoBundle "szw/vim-tags"
NeoBundleLazy "majutsushi/tagbar", { "autoload": { "commands": ["TagbarToggle"] }}
NeoBundle 'rust-lang/rust.vim'
NeoBundle 'nathanaelkane/vim-indent-guides'
call neobundle#end()
"call pathogen#infect()
filetype plugin on
filetype indent on
let g:neosnippet#snippets_directory='~/.vim/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
"easy motion
" ホームポジションに近いキーを使う
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
"tからはじまるpythonファイルをテストコードとする
autocmd BufWinEnter,BufNewFile test*.py set filetype=python.test
" 自分の場合は Space q でquickrunを実行するようにしている
silent! map <unique> <Space>q <Plug>(quickrun)
" quickrun.vim 用設定
" ↑の2行あたりが既存なら↓の追加だけ
"let g:quickrun_config['python.test'] = {'command': 'nosetests', 'exec': ['%c-v %s']}
if executable("clang++")
let g:syntastic_cpp_compiler = 'clang++'
let g:syntastic_cpp_compiler_options = '--std=c++1y --stdlib=libc++'
let g:quickrun_config = {}
let g:quickrun_config['cpp/clang++'] = {
\ 'cmdopt': '--std=c++1y --stdlib=libc++',
\ 'type': 'cpp/clang++'
\ }
let g:quickrun_config['cpp'] = {'type': 'cpp/clang++'}
endif
autocmd FileType * setlocal formatoptions-=ro
" CTRL-hjklでウィンドウ移動
nnoremap <C-t>j <C-w>j
nnoremap <C-t>k <C-w>k
nnoremap <C-t>l <C-w>l
nnoremap <C-t>h <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
nnoremap <C-h> <C-w>h
""" unite.vim
" 入力モードで開始する
" let g:unite_enable_start_insert=1
" バッファ一覧
let g:unite_enable_start_insert=1
let g:unite_source_history_yank_enable =1
let g:unite_source_file_mru_limit = 200
nnoremap <silent> ,uy :<C-u>Unite history/yank<CR>
nnoremap <silent> <C-y> :<C-u>Unite history/yank<CR>
nnoremap <silent> ,ub :<C-u>Unite buffer<CR>
" grep検索
nnoremap <silent> <C-g> :<C-u>Unite grep:. -buffer-name=search-buffer<CR>
nnoremap <silent> ,cg :<C-u>Unite grep:. -buffer-name=search-buffer<CR><C-R><C-W>
if executable('ag')
let g:unite_source_grep_command = 'ag'
let g:unite_source_grep_default_opts = '--nogroup --nocolor --column'
let g:unite_source_grep_recursive_opt = ''
endif
" ファイル一覧
nnoremap <silent> <C-k>f :<C-u>UniteWithBufferDir -buffer-name=files file<CR>
" レジスタ一覧
nnoremap <silent> <C-k>r :<C-u>Unite -buffer-name=register register<CR>
" 最近使用したファイル一覧
nnoremap <silent> <C-k>m :<C-u>Unite file_mru<CR>
" 常用セット
nnoremap <silent> <C-k>u :<C-u>Unite buffer file_mru<CR>
" 全部乗せ
nnoremap <silent> <C-k>a :<C-u>UniteWithBufferDir -buffer-name=files buffer file_mru bookmark file<CR>
let g:unite_split_rule = 'botright'
noremap ,uo <ESC>:Unite -vertical -winwidth=40 outline<Return>
noremap <C-e> :VimFilerExplorer<CR>
" ビルド
nnoremap <silent> ,mk :Unite build:make:-Cbuild<CR>
" ESCキーを2回押すと終了する
au FileType unite nnoremap <silent> <buffer> <ESC><ESC> q
au FileType unite inoremap <silent> <buffer> <ESC><ESC> <ESC>q
" 'Shougo/neocomplete.vim' {{{
let g:neocomplete#enable_at_startup = 1
if !exists('g:neocomplete#force_omni_input_patterns')
let g:neocomplete#force_omni_input_patterns = {}
endif
let g:neocomplete#force_overwrite_completefunc = 1
let g:neocomplete#force_omni_input_patterns.c =
\ '[^.[:digit:] *\t]\%(\.\|->\)\w*'
let g:neocomplete#force_omni_input_patterns.cpp =
\ '[^.[:digit:] *\t]\%(\.\|->\)\w+\|\h\w+::\w+'
" }}}
"
" 'justmao945/vim-clang' {{{
" disable auto completion for vim-clang
let g:clang_auto = 0
" default 'longest' can not work with neocomplete
let g:clang_c_completeopt = 'menuone'
let g:clang_cpp_completeopt = 'menuone'
if executable('clang-3.6')
let g:clang_exec = 'clang-3.6'
elseif executable('clang-3.5')
let g:clang_exec = 'clang-3.5'
elseif executable('clang-3.4')
let g:clang_exec = 'clang-3.4'
else
let g:clang_exec = 'clang'
endif
if executable('clang-format-3.6')
let g:clang_format_exec = 'clang-format-3.6'
elseif executable('clang-format-3.5')
let g:clang_format_exec = 'clang-format-3.5'
elseif executable('clang-format-3.4')
let g:clang_format_exec = 'clang-format-3.4'
else
let g:clang_format_exec = 'clang-format'
endif
let g:clang_cpp_options = '-std=c++1y -stdlib=libc++'
let g:clang_compilation_database = './build'
" }}}
set backspace=indent,eol,start
let g:rustfmt_autosave = 1
let g:rustfmt_command = '$HOME/.cargo/bin/rustfmt'
set hidden
let g:racer_cmd = '$HOME/.cargo/bin/racer'
au FileType rust nmap gd <Plug>(rust-def)
au FileType rust nmap gs <Plug>(rust-def-split)
au FileType rust nmap gx <Plug>(rust-def-vertical)
au FileType rust nmap <leader>gd <Plug>(rust-doc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment