If bash can, why not Speakup?

pj at pjb.com.au pj at pjb.com.au
Thu Nov 18 21:52:38 EST 2010


Janina Sajka wrote:
> to track whether I'm in insert or command mode, i.e. it would
> sure help if Speakup could give me a differently pitched voice

Misunderstanding this to be about vim itself :-( , I wrote:
> Presumably by writing something to somewhere in
> /sys/accessibility/speakup/ (or /proc/speakup ?)
> ... It might be possible to do it with a vim script

And it is possible :-) if you copy spokenmode.vim (after the .sig)
into your ~/.vim/plugin/ dir (you might have to mkdir it first)
then you should see the contents of /tmp/t change according to
the editing mode.

It just remains to find something in /sys/accessibility/speakup/
which switches between two suitable voices...

Regards,  Peter Billam

http://www.pjb.com.au       pj at pjb.com.au      (03) 6278 9410
"Was der Meister nicht kann,   vermöcht es der Knabe, hätt er
 ihm immer gehorcht?"   Siegfried to Mime, from Act 1 Scene 2

--------------------------------------

" spokenmode.vim: cause Speakup to use a different tone of voice
" according to whether Vim is in insert mode or command mode
" 1.0, 2010.10.18
" inherits much from obviousmode.vim, by Brian Lewis and Sergey Vlasov
" 1. Put spokenmode.vim in ~/.vim/plugins/

if &cp || exists('g:loaded_spokenmode')
    finish
endif

let s:isInsertMode = 0

function! s:InsertEnter()
    let s:isInsertMode = 1
    call writefile(['low'], "/tmp/t")
endfunction

function! s:InsertLeave()
    let s:isInsertMode = 0
    call writefile(['high'], "/tmp/t")
endfunction

au InsertEnter * call s:InsertEnter()
au InsertLeave * call s:InsertLeave()

let g:loaded_spokenmode = 1




More information about the Speakup mailing list