You can fake it with this:
vnoremap <expr> . expand('<cword>') =~# '[(){}\[\]]' ? 'a'.expand('<cword>') : ''
The character under the cursor is used to expand the selection if it's one of the brace characters. Since an expression map is being used, you never leave visual mode, which avoids breaking the normal mode .
repeat.
Visual repeat of all text objects
This method gives you a much broader coverage of text objects:
function! s:repeat_block(key) abort
if a:key ==# '.'
return get(s:, 'v_repeat_count', '').get(s:, 'v_repeat_key', '')
endif
let s:v_repeat_count = v:count1
let s:v_repeat_key = a:key
return a:key
endfunction
for k in ['w', 'W', 's', 'p', '[', ']', '(', ')', 'b', '<', '>', 't', '{', '}', 'B', '"', "'", '`']
execute printf('vnoremap <expr> a%s <sid>repeat_block(''a%s'')', k, k)
execute printf('vnoremap <expr> i%s <sid>repeat_block(''i%s'')', k, k)
endfor
unlet! k
vnoremap <expr> . <sid>repeat_block('.')
This very lightly uses the same method as vim-repeat
and covers both a
and i
text object prefixes. The side effect of this is that the visual repetition is remembered after you leave and re-enter visual mode. Whether or not that's a good thing is up to you.
.
is indended to repeat changes, not selections, movements and so on. Do you really want to break this concept to save one keystroke? If you know you want the second next brace level you can even type2a{
and have the same keystrokes asa{.
would have.t
with.
.
? Sad, but if you are happy with it ...