Skip to content

Instantly share code, notes, and snippets.

@tekkoc
Created October 7, 2013 23:36
Show Gist options
  • Select an option

  • Save tekkoc/6876899 to your computer and use it in GitHub Desktop.

Select an option

Save tekkoc/6876899 to your computer and use it in GitHub Desktop.
" 効果音ディレクトリと拡張子の指定。効果音名を元にフルパスに変換出来るように。
let s:se_path = "~/Dropbox/Vim/MinecraftSound/"
let s:se_ext = ".wav"
function! s:change_sound_name(base_name)
return expand(s:se_path . a:base_name . s:se_ext)
endfunction
" テスト用。効果音名の上で<Leader><Leader>を押すと再生出来るように
" command! -nargs=1 Play :call PlaySE("<args>")
" nnoremap <Leader><Leader> :<C-u>Play <C-r><C-w><CR>
" sound#play_wavのラッパ
function! PlaySE(name)
call sound#play_wav(s:change_sound_name(a:name))
endfunction
" 補完を閉じるときに、弓矢ヒット
autocmd CompleteDone * call PlaySE("bowhit1")
" バッファ移動時に、ドア音
autocmd BufEnter * call PlaySE("door_open")
" 入力時に、石を掘る音
autocmd InsertCharPre * call PlaySE("stone3")
" 保存時に爆発
autocmd BufWrite * call PlaySE("explode")
" インサートモードに入る時、抜けるときにピストン音
autocmd InsertEnter * call PlaySE("in")
autocmd InsertLeave * call PlaySE("out")
" タブページ移動時にエンダーマンの移動音
autocmd TabEnter * call PlaySE("portal")
" シフトで多めに移動。かつ効果音をエンダーマンの移動音を再生。
nnoremap <silent> J 20j:<C-u>call PlaySE("portal2")<CR>
nnoremap <silent> K 20k:<C-u>call PlaySE("portal2")<CR>
nnoremap <silent> L 10l:<C-u>call PlaySE("portal2")<CR>
nnoremap <silent> H 10h:<C-u>call PlaySE("portal2")<CR>
" ESC2度押しで検索ハイライトを消すと共に、水に飛び込む
nnoremap <silent> <Esc><Esc> :<C-u>AnzuClearSearchStatus<CR>:nohlsearch<CR>:call PlaySE("splash")<CR>
nnoremap <silent> <C-l><C-l> :<C-u>AnzuClearSearchStatus<CR>:nohlsearch<CR>:call PlaySE("splash")<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment