Silas Silva
unread,Oct 2, 2012, 11:25:18 AM10/2/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to vim...@googlegroups.com
Hi again!
I'm trying to remap '}' and '{' to a function with other paragraph
definition. The map command is something like:
nnoremap <silent> <buffer> } :call <SID>ParagraphNavigate()<CR>
nnoremap <silent> <buffer> { :call <SID>ParagraphNavigate()<CR>
vnoremap <expr> <buffer> } <SID>ParagraphNavigate()
vnoremap <expr> <buffer> { <SID>ParagraphNavigate()
In maps for Visual mode, I prefer to use <expr> because setpos() or
:normal inside the function would exit Visual mode, so I work by
returning normal commands (e.g. "20j") to build <expr>.
The problem comes up when folds exist. Motion commands ("j", "k") don't
open folds, they JUMP them, and "zO" exits Visual mode. setpos() points
cursor correctly, but it exits Visual mode.
I'd like to point the cursor correctly and open any fold that is opened,
like traditional '}' and '{' do. Any tip on that?
Thank you.
--
Silas Silva