[Semibug] vim macro

Mike Wayne semibug15 at wayne47.com
Tue Sep 19 23:15:56 EDT 2017


Brandon mentioned that he wanted to have his reader tell him the
word he was on after, say, a 3w while in vim.

I figured I could help with at least part of it. Putting this map
line into ~/.exrc should cause the sequence [f (if typed within one
second) to put the current word into the "z" register, then run a
shell to echo the contents of the z register and return to command
mode.

Replacing "echo" with a command that does text to speech of its
argument should cause the word to be spoken. As written, this will
NOT work in insert mode.  Clearly, a better command sequence than
[f could be used (even a function key?), I just picked this for
testing. It can be used as part of a sequence to build more complex
macros or standalone to simply read the word you are currently at.

:map [f "zyW:!echo <C-R>z<CR><CR>

Hope it helps.



More information about the Semibug mailing list