LoginSignup
27
27

More than 5 years have passed since last update.

Vim の操作を幼女に音声支援させる方法

Posted at

ほら、Editor 使っているとさ幼女の声ききたいじゃん。そのほうが作業も捗るからね。
動画: http://www.youtube.com/watch?v=DFuEJpNTcA8

以下設定方法

.vimrc
" function
function! PlaySE(name)
    silent! exec '!afplay ~/Dropbox/vim/sound/' . a:name . '.wav &'
endfunction

" 補完を閉じる
autocmd CompleteDone * call PlaySE("shift")

" バッファ移動
autocmd BufEnter * call PlaySE("switch")

" 入力
autocmd InsertCharPre * call PlaySE("input")

" 保存
autocmd BufWrite * call PlaySE("save")

" インサートモード IN / OUT
autocmd InsertEnter * call PlaySE("in")
autocmd InsertLeave * call PlaySE("out")

ランダムでの設定

.vimrc
function! s:Rand(max)
redir @n
ruby << EOF
    rmax = VIM::evaluate("a:max")
    rmax = nil if rmax == ""
    printf rand(rmax).to_s
EOF
redir END

let @n = strpart(@n, 1, strlen(@n) - 1)
return @b
endfunction


" Random Play
function! RandPlaySE(name)
    silent! exec '!afplay ~/Dropbox/vim/sound/d/' . a:name . '-' . s:Rand(2) . '.wav &'
endfunction
27
27
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
27
27