.vimrc 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  1. " coding:utf-8
  2. " ζ*'ヮ')ζ ζ(*'ヮ'リ+
  3. "
  4. set ignorecase
  5. set smartcase
  6. set tabstop=2
  7. set expandtab
  8. set autoindent
  9. set backspace=2
  10. set wrapscan
  11. set showmatch
  12. set wildmenu
  13. set formatoptions+=mM
  14. set softtabstop=2
  15. set shiftwidth=4
  16. set fileencodings=utf-8,sjis,cp932,euc-jp,default,latin
  17. set number
  18. set ruler
  19. set nolist
  20. set wrap
  21. set laststatus=2
  22. set cmdheight=2
  23. set showcmd
  24. set title
  25. set hlsearch
  26. colorscheme evening
  27. syntax on
  28. set enc=utf8
  29. " ファイル名に大文字小文字の区別がないシステム用の設定:
  30. " (例: DOS/Windows/MacOS)
  31. "
  32. if filereadable($VIM . '/vimrc') && filereadable($VIM . '/ViMrC')
  33. " tagsファイルの重複防止
  34. set tags=./tags,tags
  35. endif
  36. " コンソールでのカラー表示のための設定(暫定的にUNIX専用)
  37. if has('unix') && !has('gui_running')
  38. let uname = system('uname')
  39. if uname =~? "linux"
  40. set term=builtin_linux
  41. elseif uname =~? "freebsd"
  42. set term=builtin_cons25
  43. elseif uname =~? "Darwin"
  44. set term=beos-ansi
  45. else
  46. set term=builtin_xterm
  47. endif
  48. unlet uname
  49. endif
  50. " コンソール版で環境変数$DISPLAYが設定されていると起動が遅くなる件へ対応
  51. if !has('gui_running') && has('xterm_clipboard')
  52. set clipboard=exclude:cons\\\|linux\\\|cygwin\\\|rxvt\\\|screen
  53. endif
  54. " タブページの切り替えをWindowsのように
  55. " CTRL+Tab SHIFT+Tabで行うように.
  56. if v:version >= 700
  57. nnoremap <C-Tab> gt
  58. nnoremap <C-S-Tab> gT
  59. endif
  60. if has('+regexpengine')
  61. set re=0
  62. endif
  63. set nocompatible
  64. filetype off
  65. if has('vim_starting')
  66. set runtimepath+=~/.vim/neobundle.vim.git
  67. endif
  68. call neobundle#rc(expand('~/.bundle'))
  69. let g:neobundle_default_git_protocol='ssh'
  70. NeoBundle 'itchyny/calendar.vim'
  71. NeoBundle 'fuenor/qfixhowm', '', 'default'
  72. call neobundle#config('qfixhowm', {
  73. \ 'rev': '5bad8770a6d2ffd2e93182d937710ad6e3fe769f'
  74. \ })
  75. NeoBundle 'osyo-manga/unite-qfixhowm'
  76. NeoBundle 'thinca/vim-prettyprint'
  77. NeoBundle 'thinca/vim-openbuf'
  78. NeoBundle 'jnwhiteh/vim-golang'
  79. NeoBundle 'osyo-manga/vim-snowdrop'
  80. NeoBundle 'Shougo/echodoc', '', 'default'
  81. call neobundle#config('echodoc', {
  82. \ 'lazy' : 1,
  83. \ 'autoload' : {
  84. \ 'insert' : 1,
  85. \ }})
  86. if has('lua')
  87. NeoBundle 'Shougo/neocomplete.vim', '', 'default'
  88. call neobundle#config('neocomplete.vim', {
  89. \ 'lazy' : 1,
  90. \ 'autoload' : {
  91. \ 'commands' : 'NeoComplateEnable'
  92. \ }})
  93. else
  94. NeoBundle 'Shougo/neocomplcache', '', 'default'
  95. call neobundle#config('neocomplcache', {
  96. \ 'lazy' : 1,
  97. \ 'autoload' : {
  98. \ 'commands' : 'NeoComplCacheEnable',
  99. \ }})
  100. endif
  101. "NeoBundle 'Shougo/neocomplcache-rsense', '', 'default'
  102. "call neobundle#config('neocomplcache-rsense', {
  103. " \ 'lazy' : 1,
  104. " \ 'depends' : 'Shougo/neocomplcache',
  105. " \ 'autoload' : { 'filetypes' : 'ruby' }
  106. " \ })
  107. NeoBundle 'Shougo/neobundle.vim'
  108. NeoBundle 'Shougo/unite.vim', '', 'default'
  109. call neobundle#config('unite.vim',{
  110. \ 'lazy' : 1,
  111. \ 'autoload' : {
  112. \ 'commands' : [{ 'name' : 'Unite',
  113. \ 'complete' : 'customlist,unite#complete_source'},
  114. \ 'UniteWithCursorWord', 'UniteWithInput']
  115. \ }})
  116. NeoBundle 'Shougo/vimfiler', '', 'default'
  117. call neobundle#config('vimfiler', {
  118. \ 'lazy' : 1,
  119. \ 'depends' : 'Shougo/unite.vim',
  120. \ 'autoload' : {
  121. \ 'commands' : [
  122. \ { 'name' : 'VimFiler',
  123. \ 'complete' : 'customlist,vimfiler#complete' },
  124. \ { 'name' : 'VimFilerExplorer',
  125. \ 'complete' : 'customlist,vimfiler#complete' },
  126. \ { 'name' : 'Edit',
  127. \ 'complete' : 'customlist,vimfiler#complete' },
  128. \ { 'name' : 'Write',
  129. \ 'complete' : 'customlist,vimfiler#complete' },
  130. \ 'Read', 'Source'],
  131. \ 'mappings' : ['<Plug>(vimfiler_switch)'],
  132. \ 'explorer' : 1,
  133. \ }
  134. \ })
  135. NeoBundle 'Shougo/vimshell', '', 'default'
  136. call neobundle#config('vimshell', {
  137. \ 'lazy' : 1,
  138. \ 'autoload' : {
  139. \ 'commands' : [{ 'name' : 'VimShell',
  140. \ 'complete' : 'customlist,vimshell#complete'},
  141. \ 'VimShellExecute', 'VimShellInteractive',
  142. \ 'VimShellTerminal', 'VimShellPop'],
  143. \ 'mappings' : ['<Plug>(vimshell_switch)']
  144. \ }})
  145. if has('win32')
  146. NeoBundleLocal 'C:\vim\plugin'
  147. else
  148. NeoBundle 'Shougo/vimproc', '', 'default'
  149. call neobundle#config('vimproc', {
  150. \ 'build' : {
  151. \ 'windows' : 'make -f make_mingw32.mak',
  152. \ 'cygwin' : 'make -f make_cygwin.mak',
  153. \ 'mac' : 'make -f make_mac.mak',
  154. \ 'unix' : 'make -f make_unix.mak',
  155. \ },
  156. \ })
  157. endif
  158. NeoBundle 'thinca/vim-quickrun'
  159. call neobundle#config('vim-quickrun', {
  160. \ 'lazy' : 1,
  161. \ 'autoload' : {
  162. \ 'mappings' : [
  163. \ ['nxo', '<Plug>(quickrun)']],
  164. \ 'commands' : 'QuickRun',
  165. \ },
  166. \ })
  167. NeoBundle 'tsukkee/lingr-vim'
  168. call neobundle#config('lingr-vim', {
  169. \ 'lazy' : 1,
  170. \ 'autoload' : {
  171. \ 'commands' : 'LingrLaunch',
  172. \ },
  173. \ })
  174. NeoBundle 'Shougo/neosnippet', '', 'default'
  175. call neobundle#config('neosnippet', {
  176. \ 'lazy' : 1,
  177. \ 'autoload' : {
  178. \ 'insert' : 1,
  179. \ 'filetypes' : 'snippet',
  180. \ 'unite_sources' : ['snippet', 'neosnippet/user', 'neosnippet/runtime'],
  181. \ }})
  182. NeoBundle 'browser.vim'
  183. NeoBundle 'synmark.vim'
  184. NeoBundleLazy 'tyru/open-browser.vim', { 'autoload' : {
  185. \ 'mappings' : '<Plug>(open-browser-wwwsearch)',
  186. \ }}
  187. NeoBundle 'mattn/gist-vim'
  188. NeoBundle 'mattn/webapi-vim'
  189. NeoBundle 'mru.vim'
  190. NeoBundle 'thinca/vim-ft-clojure'
  191. NeoBundleLazy 'ujihisa/neco-ghc', { 'autoload' : {
  192. \ 'filetypes' : 'haskell',
  193. \ }}
  194. NeoBundle 'sudo.vim'
  195. NeoBundleLazy 'ujihisa/vimshell-ssh', { 'autoload' : {
  196. \ 'filetypes' : 'vimshell',
  197. \ }}
  198. NeoBundle 'Shougo/unite-ssh'
  199. NeoBundle 'ujihisa/neco-look'
  200. NeoBundle 'vim-jp/vital.vim', '', 'default'
  201. "call neobundle#config('vital.vim', {
  202. " \ 'lazy' : 1,
  203. " \ 'autoload' : {
  204. " \ 'commands' : ['Vitalize'],
  205. " \ }})
  206. NeoBundleLazy 'dag/vim2hs', { 'autoload' : {
  207. \ 'filetypes' : 'haskell',
  208. \ }}
  209. NeoBundleLazy 'eagletmt/ghcmod-vim', { 'autoload' : {
  210. \ 'filetypes' : 'haskell',
  211. \ }}
  212. NeoBundle 'thinca/vim-ref'
  213. NeoBundle 'thinca/vim-singleton'
  214. NeoBundle 'mattn/benchvimrc-vim'
  215. NeoBundle 'ryutorion/vim-itunes'
  216. NeoBundle 'raa0121/vim-ulilith'
  217. NeoBundle 'mattn/libcallex-vim'
  218. NeoBundle 'thinca/vim-splash'
  219. NeoBundle 'mattn/sonictemplate-vim'
  220. NeoBundle 'raa0121/vim-eclim'
  221. NeoBundle 'thinca/vim-github'
  222. NeoBundle 'nosami/Omnisharp'
  223. NeoBundle 'jceb/vim-orgmode'
  224. "NeoBundle 'Lokaltog/powerline', { 'rtp' : 'powerline/bindings/vim'}
  225. "NeoBundle 'taichouchou2/alpaca_powertabline'
  226. "NeoBundle 'zhaocai/linepower.vim'
  227. NeoBundle 'osyo-manga/quickrun-hook-u-nya-'
  228. NeoBundle 'osyo-manga/unite-quickfix'
  229. NeoBundle 'basyura/J6uil.vim', '', 'default'
  230. call neobundle#config('J6uil.vim', {
  231. \ 'lazy' : 1,
  232. \ 'autoload' : {
  233. \ 'commands' : 'J6uil',
  234. \ },
  235. \ 'depends' : 'mattn/webapi-vim',
  236. \ })
  237. NeoBundle 'mattn/unite-rhythmbox'
  238. NeoBundleLazy 'rbtnn/vimconsole.vim', {
  239. \ 'depends' : 'thinca/vim-prettyprint',
  240. \ 'autoload' : {
  241. \ 'commands' : 'VimConsoleOpen'
  242. \ }}
  243. filetype plugin indent on
  244. if has('clientserver')
  245. call singleton#enable()
  246. end
  247. set ww+=h,l,>,<,[,]
  248. set mouse=a
  249. set ttymouse=xterm2
  250. set clipboard=unnamedplus
  251. " ,is: シェルを起動
  252. nnoremap <silent> ,is :VimShell<CR>
  253. " ,ipy: pythonを非同期で起動
  254. nnoremap <silent> ,ipy :VimShellInteractive python<CR>
  255. " ,irb: irbを非同期で起動
  256. nnoremap <silent> ,irb :VimShellInteractive irb<CR>
  257. " ,ss: 非同期で開いたインタプリタに現在の行を評価させる
  258. vmap <silent> ,ss :VimShellSendString<CR>
  259. " 選択中に,ss: 非同期で開いたインタプリタに選択行を評価させる
  260. nnoremap <silent> ,ss <S-v>:VimShellSendString<CR>
  261. " ,vs: vimshell
  262. nnoremap <silent> ,vs :tabnew +VimShell<CR>
  263. " ,vr: .vimrc
  264. nnoremap <silent> ,vr :tabnew ~/.vimrc<CR>:lcd<CR>
  265. nnoremap <silent> ,so :so ~/.vimrc<CR>
  266. nnoremap <silent> ,nu :tabnew +Unite\ neobundle/update<CR>
  267. nnoremap <silent> ,ll :tabnew +LingrLaunch<CR>
  268. nnoremap <Esc><Esc> :nohlsearch<CR><ESC>
  269. if neobundle#is_installed('neocomplcache')
  270. let g:neocomplcache_enable_at_startup = 1
  271. let g:neocomplcache_enable_smart_case = 1
  272. let g:neocomplcache_enable_camel_case_completion = 1
  273. let g:neocomplcache_enable_underbar_completion = 1
  274. let g:neocomplcache_min_syntax_length = 3
  275. let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*'
  276. if !exists('g:neocomplcache_keyword_patterns')
  277. let g:neocomplcache_keyword_patterns = {}
  278. endif
  279. let g:neocomplcache_keyword_patterns['default'] = '\h\w*'
  280. endif
  281. if neobundle#is_installed('neocomplete.vim')
  282. let g:neocomplete#enable_at_startup = 1
  283. let g:neocomplete#enable_smart_case = 1
  284. let g:neocomplete#enable_camel_case_completion = 1
  285. let g:neocomplete#enable_underbar_completion = 1
  286. let g:neocomplete#min_syntax_length = 3
  287. let g:neocomplete#lock_buffer_name_pattern = '\*ku\*'
  288. if !exists('g:neocomplete#keyword_patterns')
  289. let g:neocomplete#keyword_patterns = {}
  290. endif
  291. let g:neocomplete#keyword_patterns['default'] = '\h\w*'
  292. endif
  293. let g:vimfiler_as_default_explorer = 1
  294. "let g:neocomplcache#sources#rsense#home_directory = '/opt/rsense-0.3/'
  295. let g:neocomplcache_text_mode_filetypes = {
  296. \ 'tex': 1,
  297. \ 'plaintex': 1,
  298. \}
  299. "tabで補完候補の選択を行う
  300. inoremap <expr><TAB> pumvisible() ? "\<Down>" : "\<TAB>"
  301. inoremap <expr><S-TAB> pumvisible() ? "\<Up>" : "\<S-TAB>"
  302. let g:OmniSharp_host = 'http://localhost:2020'
  303. let g:OmniSharp_typeLookupInPreview = 1
  304. set noshowmatch
  305. autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
  306. autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
  307. autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
  308. autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
  309. autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
  310. autocmd FileType cs setlocal omnifunc=OmniSharp#Complete
  311. let g:netrw_nogx = 1
  312. nmap gx <Plug>(openbrowser-smart-search)
  313. vmap gx <Plug>(openbrowser-smart-search)
  314. let g:quickrun_config = {}
  315. let g:quickrun_config['markdown'] = {
  316. \ 'outputter': 'browser'
  317. \ }
  318. let g:quickrun_config.ruby = {
  319. \ 'command': 'ruby',
  320. \ 'exec': '/usr/bin/env ruby %s',
  321. \ 'tempfile': '{tempname()}.rb'
  322. \ }
  323. let g:quickrun_config = {
  324. \ 'cpp': {
  325. \ 'cmdopt': '-std=c++11 -Wall'
  326. \ }
  327. \ }
  328. let g:quickrun_config = {
  329. \ '_' : {
  330. \ 'hook/close_unite_quickfix/enable_hook_loaded' : 1,
  331. \ 'hook/unite_quickfix/enable_failure' : 1,
  332. \ 'hook/close_quickfix/enable_exit' : 1,
  333. \ 'hook/close_buffer/enable_failure' : 1,
  334. \ 'hook/close_buffer/enable_empty_data' : 1,
  335. \ 'outputter' : 'multi:buffer:quickfix',
  336. \ 'hook/u_nya_/enable' : 1,
  337. \ 'hook/sweep/enable' : 0,
  338. \ 'outputter/buffer/split' : ':botright 15sp',
  339. \ 'outputter/buffer/running_mark' : 'バン(∩`・ω・)バンバンバンバン゙ン',
  340. \ 'runner' : 'vimproc',
  341. \ 'runner/vimproc/updatetime' : 40,
  342. \ 'runner/vimproc/sleep' : 0,
  343. \ }
  344. \ }
  345. let g:lingr_vim_user = 'raa0121'
  346. let g:J6uil_display_offline = 0
  347. let g:J6uil_display_online = 0
  348. let g:J6uil_echo_presence = 1
  349. let g:J6uil_display_icon = 0
  350. let g:J6uil_display_interval = 0
  351. let g:J6uil_updatetime = 1000
  352. let QFixHowm_Key = 'g'
  353. let howm_dir = '~/howm'
  354. let howm_filename = '%Y/%m/%Y-%m-%d-%H%M%S.txt'
  355. let howm_fileencoding = 'utf-8'
  356. let howm_fileformat = 'unix'
  357. let mygrepprg = 'grep'
  358. let MyGrep_cygwin17 = 1
  359. augroup plugin-lingr-vim
  360. autocmd!
  361. autocmd FileType lingr-messages nmap <silent> <buffer> t <Plug>(lingr-messages-show-say-buffer)
  362. autocmd FileType lingr-say let &syntax='clojure'
  363. augroup END
  364. augroup vimrc
  365. autocmd!
  366. augroup END
  367. function! s:SID_PREFIX()
  368. return matchstr(expand('<sfile>'), '<SNR>\d\+_')
  369. endfunction
  370. set titlelen=100
  371. set guioptions-=e
  372. autocmd vimrc BufEnter * let &titlestring = '%{' . s:SID_PREFIX() . 'titlestring()}'
  373. autocmd vimrc User plugin-lingr-unread let &titlestring = '%{' . s:SID_PREFIX() . 'titlestring()}'
  374. if exists('$TMUX') || exists('$WINDOW')
  375. set t_ts=k
  376. set t_fs=\
  377. endif
  378. function! s:titlestring()
  379. if &filetype =~ '^lingr'
  380. let &titlestring = 'lingr: ' . lingr#unread_count()
  381. else
  382. let &titlestring = bufname('')
  383. endif
  384. endfunction
  385. " tabline
  386. set showtabline=2 " always show tabline
  387. let &tabline = '%!' . s:SID_PREFIX() . 'tabline()'
  388. function! s:tabline()
  389. " show each tab
  390. let s = ''
  391. for i in range(1, tabpagenr('$'))
  392. let list = tabpagebuflist(i)
  393. let nr = tabpagewinnr(i)
  394. let current_tabnr = tabpagenr()
  395. "let title = bufname('')
  396. if i == current_tabnr
  397. let title = fnamemodify(getcwd(), ':t') . '/'
  398. "let title = bufname('')
  399. else
  400. let title = fnamemodify(gettabvar(i, 'cwd'), ':t') . '/'
  401. endif
  402. let title = empty(title) ? '[No Name]' : title
  403. let s .= i == current_tabnr ? '%#TabLineSel#' : '%#TabLine#'
  404. let s .= '%' . i . 'T[' . i . '] ' . title
  405. let s .= ' '
  406. endfor
  407. " show lingr unread count
  408. let lingr_unread = ""
  409. if exists('*lingr#unread_count')
  410. let lingr_unread_count = lingr#unread_count()
  411. if lingr_unread_count > 0
  412. let lingr_unread = "%#ErrorMsg#(" . lingr_unread_count . ")"
  413. elseif lingr_unread_count == 0
  414. let lingr_unread = "()"
  415. endif
  416. endif
  417. " build tabline
  418. let s .= '%#TabLineFill#%T%=%<[' . getcwd() . ']' . lingr_unread
  419. return s
  420. endfunction
  421. augroup vimrc-scratch-buffer
  422. autocmd!
  423. " Make a scratch buffer when unnamed buffer.
  424. autocmd BufEnter * call s:scratch_buffer()
  425. autocmd FileType qfreplace autocmd! vimrc-scratch * <buffer>
  426. function! s:scratch_buffer()
  427. if exists('b:scratch_buffer') || bufname('%') !=# '' || &l:buftype !=# ''
  428. return
  429. endif
  430. let b:scratch_buffer = 1
  431. call openbuf#add('scratch', bufnr('%'))
  432. setlocal buftype=nofile nobuflisted noswapfile bufhidden=hide
  433. augroup vimrc-scratch
  434. autocmd! * <buffer>
  435. autocmd BufWriteCmd <buffer> call s:scratch_on_BufWriteCmd()
  436. augroup END
  437. endfunction
  438. function! s:scratch_on_BufWriteCmd()
  439. silent! setl buftype< buflisted< swapfile< bufhidden< nomodified
  440. autocmd! vimrc-scratch * <buffer>
  441. if bufname('%') ==# '' && exists('b:scratch_buffer')
  442. execute 'saveas' . (v:cmdbang ? '!' : '') ' <afile>'
  443. filetype detect
  444. endif
  445. call openbuf#remove('scratch', bufnr('%'))
  446. unlet! b:scratch_buffer
  447. endfunction
  448. augroup END
  449. command! -nargs=? ExtractMatches let s:pat = empty(<q-args>) ? @/ : <q-args> | let s:result = filter(getline(1, '$'), 'v:val =~# s:pat') | new | put =s:result
  450. command! -nargs=? UniGrep let s:pat = empty(<q-args>) ? @/ : <q-args> | execute 'Unite grep:%::' . escape(s:pat, '\')
  451. let g:github_user = 'raa0121'
  452. let g:github_token = 'e3ded9cf6669cc31dbca'
  453. let g:github#user = 'raa0121'