Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Visual mode maps with <expr> and folds in vimscript
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Silas Silva  
View profile  
 More options Oct 2 2012, 11:26 am
From: Silas Silva <sila...@gmail.com>
Date: Tue, 2 Oct 2012 12:25:18 -0300
Local: Tues, Oct 2 2012 11:25 am
Subject: Visual mode maps with <expr> and folds in vimscript
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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christian Brabandt  
View profile  
 More options Oct 2 2012, 3:01 pm
From: Christian Brabandt <cbli...@256bit.org>
Date: Tue, 2 Oct 2012 21:00:49 +0200
Local: Tues, Oct 2 2012 3:00 pm
Subject: Re: Visual mode maps with <expr> and folds in vimscript
Hi Silas!

On Di, 02 Okt 2012, Silas Silva wrote:

I don't have a solution, but you could add gv to reselect the last
selected region.

regards,
Christian
--


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »