Guest User

Untitled

a guest
May 25th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.50 KB | None | 0 0
  1. syntax on
  2.  
  3. set autoindent
  4. "バックアップファイルを作るディレクトリ
  5. set backupdir=$HOME/.vimbackup
  6. "ファイル保存ダイアログの初期ディレクトリをバッファファイル位置に設定
  7. set browsedir=buffer
  8. "クリップボードをWindowsと連携
  9. "set clipboard=unnamed
  10. "Vi互換をオフ
  11. set nocompatible
  12. "スワップファイル用のディレクトリ
  13. set directory=$HOME/.vimbackup
  14. "変更中のファイルでも、保存しないで他のファイルを表示
  15. set hidden
  16. "インクリメンタルサーチを行う
  17. set incsearch
  18. "タブ文字、行末など不可視文字を表示する
  19. set list
  20. "listで表示される文字のフォーマットを指定する
  21. set listchars=tab:>\ ,extends:<
  22. "行番号を表示する
  23. set number
  24. set expandtab
  25. "シフト移動幅
  26. set shiftwidth=4
  27. "閉じ括弧が入力されたとき、対応する括弧を表示する
  28. set showmatch
  29. "新しい行を作ったときに高度な自動インデントを行う
  30. set smartindent
  31. "行頭の余白内で Tab を打ち込むと、'shiftwidth' の数だけインデントする。
  32. set smarttab
  33. "ファイル内の <Tab> が対応する空白の数
  34. set tabstop=4
  35. set whichwrap=b,s,h,l,<,>,[,]
  36. "検索をファイルの先頭へループしない
  37. set nowrapscan
  38. set fileencoding=utf-8
  39. set encoding=utf-8
  40.  
  41. "畳み込みの設定
  42. set foldmethod=marker
  43.  
  44. " python実行
  45. function! s:Exec()
  46. exe "!" . &ft . " %"
  47. :endfunction command! Exec call <SID>Exec()
  48. map <silent> <C-P> :call <SID>Exec()<CR>
  49. nmap bb :<C-u>Unite buffer<CR>
  50. nmap BB :ls<CR>:vs<CR>:buf
  51. map gb :bn<CR>
  52. map gB :bp<CR>
  53. map gw <C-W><C-W>
  54. map bo :only<CR>
  55. map cc \x
  56. map <C-u> u
  57. imap <C-@> <C-[>
  58. imap <C-X> <C-[>
  59. imap <C-F> <C-[>
  60. imap <C-E> <C-Y>,
  61.  
  62. "imap <C-k> <Plug>(neocomplcache_snippets_expand)
  63. "smap <C-k> <Plug>(neocomplcache_snippets_expand)
  64.  
  65. " cpp
  66. autocmd FileType cpp setl autoindent
  67. autocmd FileType cpp setl expandtab smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class
  68. autocmd FileType cpp setl tabstop=2 shiftwidth=2 softtabstop=2
  69. " python
  70. filetype plugin on
  71. autocmd FileType python setl autoindent
  72. autocmd FileType python setl expandtab smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class
  73. autocmd FileType python setl tabstop=4 shiftwidth=4 softtabstop=4
  74.  
  75. " python
  76. filetype plugin on
  77. autocmd FileType ruby setl autoindent
  78. autocmd FileType ruby setl tabstop=2 shiftwidth=2 softtabstop=2
  79.  
  80.  
  81. " coffee
  82. autocmd FileType coffee setl autoindent
  83. autocmd FileType coffee setl expandtab smartindent
  84. autocmd FileType coffee setl tabstop=2 shiftwidth=2 softtabstop=2
  85.  
  86. " coffee
  87. autocmd FileType html setl autoindent
  88. autocmd FileType html setl expandtab smartindent
  89. autocmd FileType html setl tabstop=2 shiftwidth=2 softtabstop=2
  90.  
  91.  
  92. " vue
  93. autocmd FileType vue setl tabstop=2 shiftwidth=2 softtabstop=2
  94. " coffee
  95. autocmd FileType javascript setl autoindent
  96. autocmd FileType javascript setl expandtab smartindent
  97. autocmd FileType javascript setl tabstop=2 shiftwidth=2 softtabstop=2
  98.  
  99.  
  100.  
  101. set t_Co=256
  102. let g:molokai_original = 1
  103.  
  104.  
  105. set nocompatible
  106. filetype off
  107.  
  108. if has('vim_starting')
  109. set runtimepath+=~/.vim/bundle/neobundle.vim/
  110. endif
  111.  
  112. call neobundle#begin(expand('~/.vim/bundle/'))
  113.  
  114. NeoBundleFetch 'Shougo/neobundle.vim'
  115. NeoBundle 'Shougo/vimproc.vim', {
  116. \ 'build' : {
  117. \ 'windows' : 'tools\\update-dll-mingw',
  118. \ 'cygwin' : 'make -f make_cygwin.mak',
  119. \ 'mac' : 'make',
  120. \ 'linux' : 'make',
  121. \ 'unix' : 'gmake',
  122. \ },
  123. \ }
  124. "NeoBundle 'jalcine/cmake.vim'
  125. NeoBundle 'rust-lang/rust.vim'
  126. NeoBundle 'osyo-manga/shabadou.vim'
  127. NeoBundle 'ekalinin/Dockerfile.vim'
  128. NeoBundle "posva/vim-vue"
  129. NeoBundle "danro/rename.vim"
  130. NeoBundle 'pangloss/vim-javascript'
  131. NeoBundle 'darthmall/vim-vue'
  132. NeoBundle 'mopp/autodirmake.vim'
  133. NeoBundle 'Shougo/neocomplete'
  134. "NeoBundle 'Shougo/neocomplcache'
  135. NeoBundle 'kylef/apiblueprint.vim'
  136. NeoBundle 'thinca/vim-ref'
  137. NeoBundle 'mitechie/pyflakes-pathogen'
  138. NeoBundle 'mattn/webapi-vim'
  139. NeoBundle 'mattn/gist-vim'
  140. NeoBundle 'tpope/vim-fugitive'
  141. NeoBundle 'Shougo/vimshell'
  142. NeoBundle 'Shougo/vimproc', {
  143. \ 'build' : {
  144. \ 'windows' : 'make -f make_mingw32.mak',
  145. \ 'cygwin' : 'make -f make_cygwin.mak',
  146. \ 'mac' : 'make -f make_mac.mak',
  147. \ 'unix' : 'make -f make_unix.mak',
  148. \ },
  149. \ }
  150. NeoBundle "Shougo/unite.vim"
  151. NeoBundle "Shougo/neomru.vim"
  152. NeoBundle 'Shougo/neosnippet'
  153. NeoBundle 'Shougo/neosnippet-snippets'
  154. NeoBundle 'Shougo/unite-build'
  155. NeoBundleLazy 'othree/yajs.vim', {'autoload':{'filetypes':['javascript']}}
  156. autocmd BufRead,BufNewFile *.es6 setfiletype javascript
  157. NeoBundle "Shougo/VimFiler"
  158. NeoBundle 'h1mesuke/unite-outline'
  159. NeoBundle 'Lokaltog/vim-easymotion'
  160. NeoBundle 'surround.vim'
  161. NeoBundle 'python.vim'
  162. NeoBundle 'atourino/jinja.vim'
  163. NeoBundle 'wesleyche/SrcExpl'
  164. NeoBundle 'wesleyche/Trinity'
  165. NeoBundle 'taglist.vim'
  166. NeoBundle 'vim-scripts/DrawIt'
  167. NeoBundle 'mattn/emmet-vim'
  168. NeoBundle 'tpope/vim-fugitive'
  169. NeoBundle 'ervandew/supertab'
  170. NeoBundle 'scrooloose/syntastic'
  171.  
  172.  
  173. NeoBundle 'justmao945/vim-clang'
  174. NeoBundle "thinca/vim-quickrun"
  175. NeoBundle "osyo-manga/shabadou.vim"
  176.  
  177.  
  178. NeoBundle 'scrooloose/nerdcommenter.git'
  179. NeoBundle "szw/vim-tags"
  180.  
  181. NeoBundleLazy "majutsushi/tagbar", { "autoload": { "commands": ["TagbarToggle"] }}
  182.  
  183. NeoBundle 'rust-lang/rust.vim'
  184. NeoBundle 'nathanaelkane/vim-indent-guides'
  185.  
  186.  
  187. call neobundle#end()
  188. "call pathogen#infect()
  189.  
  190. filetype plugin on
  191. filetype indent on
  192.  
  193. let g:neosnippet#snippets_directory='~/.vim/snippets'
  194.  
  195. " Plugin key-mappings.
  196. imap <C-k> <Plug>(neosnippet_expand_or_jump)
  197. smap <C-k> <Plug>(neosnippet_expand_or_jump)
  198. xmap <C-k> <Plug>(neosnippet_expand_target)
  199.  
  200. " SuperTab like snippets behavior.
  201. imap <expr><TAB> neosnippet#expandable_or_jumpable() ?
  202. \ "\<Plug>(neosnippet_expand_or_jump)"
  203. \: pumvisible() ? "\<C-n>" : "\<TAB>"
  204. smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
  205. \ "\<Plug>(neosnippet_expand_or_jump)"
  206. \: "\<TAB>"
  207.  
  208. " For snippet_complete marker.
  209. if has('conceal')
  210. set conceallevel=2 concealcursor=i
  211. endif
  212.  
  213. "easy motion
  214. " ホームポジションに近いキーを使う
  215. let g:EasyMotion_keys='hjklasdfgyuiopqwertnmzxcvbHJKLASDFGYUIOPQWERTNMZXCVB'
  216. " 「'」 + 何かにマッピング
  217. let g:EasyMotion_leader_key="-"
  218. " 1 ストローク選択を優先する
  219. let g:EasyMotion_grouping=1
  220. " カラー設定変更
  221. hi EasyMotionTarget ctermbg=none ctermfg=red
  222. hi EasyMotionShade ctermbg=none ctermfg=blue
  223.  
  224. "tからはじまるpythonファイルをテストコードとする
  225. autocmd BufWinEnter,BufNewFile test*.py set filetype=python.test
  226.  
  227. " 自分の場合は Space q でquickrunを実行するようにしている
  228. silent! map <unique> <Space>q <Plug>(quickrun)
  229.  
  230. " quickrun.vim 用設定
  231. " ↑の2行あたりが既存なら↓の追加だけ
  232. "let g:quickrun_config['python.test'] = {'command': 'nosetests', 'exec': ['%c-v %s']}
  233.  
  234. if executable("clang++")
  235. let g:syntastic_cpp_compiler = 'clang++'
  236. let g:syntastic_cpp_compiler_options = '--std=c++1y --stdlib=libc++'
  237. let g:quickrun_config = {}
  238. let g:quickrun_config['cpp/clang++'] = {
  239. \ 'cmdopt': '--std=c++1y --stdlib=libc++',
  240. \ 'type': 'cpp/clang++'
  241. \ }
  242. let g:quickrun_config['cpp'] = {'type': 'cpp/clang++'}
  243. endif
  244.  
  245.  
  246. autocmd FileType * setlocal formatoptions-=ro
  247.  
  248. " CTRL-hjklでウィンドウ移動
  249. nnoremap <C-t>j <C-w>j
  250. nnoremap <C-t>k <C-w>k
  251. nnoremap <C-t>l <C-w>l
  252. nnoremap <C-t>h <C-w>h
  253. nnoremap <C-j> <C-w>j
  254. nnoremap <C-k> <C-w>k
  255. nnoremap <C-l> <C-w>l
  256. nnoremap <C-h> <C-w>h
  257.  
  258.  
  259. """ unite.vim
  260. " 入力モードで開始する
  261. " let g:unite_enable_start_insert=1
  262. " バッファ一覧
  263. let g:unite_enable_start_insert=1
  264. let g:unite_source_history_yank_enable =1
  265. let g:unite_source_file_mru_limit = 200
  266. nnoremap <silent> ,uy :<C-u>Unite history/yank<CR>
  267. nnoremap <silent> <C-y> :<C-u>Unite history/yank<CR>
  268. nnoremap <silent> ,ub :<C-u>Unite buffer<CR>
  269.  
  270. " grep検索
  271. nnoremap <silent> <C-g> :<C-u>Unite grep:. -buffer-name=search-buffer<CR>
  272. nnoremap <silent> ,cg :<C-u>Unite grep:. -buffer-name=search-buffer<CR><C-R><C-W>
  273. if executable('ag')
  274. let g:unite_source_grep_command = 'ag'
  275. let g:unite_source_grep_default_opts = '--nogroup --nocolor --column'
  276. let g:unite_source_grep_recursive_opt = ''
  277. endif
  278.  
  279. " ファイル一覧
  280. nnoremap <silent> <C-k>f :<C-u>UniteWithBufferDir -buffer-name=files file<CR>
  281. " レジスタ一覧
  282. nnoremap <silent> <C-k>r :<C-u>Unite -buffer-name=register register<CR>
  283. " 最近使用したファイル一覧
  284. nnoremap <silent> <C-k>m :<C-u>Unite file_mru<CR>
  285. " 常用セット
  286. nnoremap <silent> <C-k>u :<C-u>Unite buffer file_mru<CR>
  287. " 全部乗せ
  288. nnoremap <silent> <C-k>a :<C-u>UniteWithBufferDir -buffer-name=files buffer file_mru bookmark file<CR>
  289.  
  290. let g:unite_split_rule = 'botright'
  291. noremap ,uo <ESC>:Unite -vertical -winwidth=40 outline<Return>
  292. noremap <C-e> :VimFilerExplorer<CR>
  293.  
  294. " ビルド
  295. nnoremap <silent> ,mk :Unite build:make:-Cbuild<CR>
  296.  
  297. " ESCキーを2回押すと終了する
  298. au FileType unite nnoremap <silent> <buffer> <ESC><ESC> q
  299. au FileType unite inoremap <silent> <buffer> <ESC><ESC> <ESC>q
  300.  
  301.  
  302. " 'Shougo/neocomplete.vim' {{{
  303. let g:neocomplete#enable_at_startup = 1
  304.  
  305. if !exists('g:neocomplete#force_omni_input_patterns')
  306. let g:neocomplete#force_omni_input_patterns = {}
  307. endif
  308. let g:neocomplete#force_overwrite_completefunc = 1
  309. let g:neocomplete#force_omni_input_patterns.c =
  310. \ '[^.[:digit:] *\t]\%(\.\|->\)\w*'
  311. let g:neocomplete#force_omni_input_patterns.cpp =
  312. \ '[^.[:digit:] *\t]\%(\.\|->\)\w+\|\h\w+::\w+'
  313.  
  314. " }}}
  315. "
  316. " 'justmao945/vim-clang' {{{
  317.  
  318. " disable auto completion for vim-clang
  319. let g:clang_auto = 0
  320.  
  321. " default 'longest' can not work with neocomplete
  322. let g:clang_c_completeopt = 'menuone'
  323. let g:clang_cpp_completeopt = 'menuone'
  324.  
  325. if executable('clang-3.6')
  326. let g:clang_exec = 'clang-3.6'
  327. elseif executable('clang-3.5')
  328. let g:clang_exec = 'clang-3.5'
  329. elseif executable('clang-3.4')
  330. let g:clang_exec = 'clang-3.4'
  331. else
  332. let g:clang_exec = 'clang'
  333. endif
  334.  
  335. if executable('clang-format-3.6')
  336. let g:clang_format_exec = 'clang-format-3.6'
  337. elseif executable('clang-format-3.5')
  338. let g:clang_format_exec = 'clang-format-3.5'
  339. elseif executable('clang-format-3.4')
  340. let g:clang_format_exec = 'clang-format-3.4'
  341. else
  342. let g:clang_format_exec = 'clang-format'
  343. endif
  344.  
  345. let g:clang_cpp_options = '-std=c++1y -stdlib=libc++'
  346. let g:clang_compilation_database = './build'
  347. " }}}
  348.  
  349. set backspace=indent,eol,start
  350.  
  351. let g:rustfmt_autosave = 1
  352. let g:rustfmt_command = '$HOME/.cargo/bin/rustfmt'
  353.  
  354. set hidden
  355. let g:racer_cmd = '$HOME/.cargo/bin/racer'
  356.  
  357. au FileType rust nmap gd <Plug>(rust-def)
  358. au FileType rust nmap gs <Plug>(rust-def-split)
  359. au FileType rust nmap gx <Plug>(rust-def-vertical)
  360. au FileType rust nmap <leader>gd <Plug>(rust-doc)
Add Comment
Please, Sign In to add comment