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
re-selecting block in different buffer
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
  5 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
 
Chris Lott  
View profile  
 More options Oct 30 2012, 12:12 pm
From: Chris Lott <ch...@chrislott.org>
Date: Tue, 30 Oct 2012 08:11:43 -0800
Local: Tues, Oct 30 2012 12:11 pm
Subject: re-selecting block in different buffer
The gv command is very useful. I'd like to be able to reselect a block
after I have selected, cut, and pasted it into a different buffer.

Is this possible?

c
--
Chris Lott <ch...@chrislott.org>


 
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.
Tim Chase  
View profile  
 More options Oct 30 2012, 12:18 pm
From: Tim Chase <v...@tim.thechases.com>
Date: Tue, 30 Oct 2012 11:18:57 -0500
Local: Tues, Oct 30 2012 12:18 pm
Subject: Re: re-selecting block in different buffer
On 10/30/12 11:11, Chris Lott wrote:

> The gv command is very useful. I'd like to be able to reselect a block
> after I have selected, cut, and pasted it into a different buffer.

> Is this possible?

It's a little tricky.  Vim does track the `[ and `] marks for you
which can be used to find the beginning/end of the block.  However,
since you're now in another window/buffer, I don't know of any way
to get Vim to know whether the paste was from a
linewise/characterwise/blockwise selection.  There is a visualmode()
function, but it only gives you the most recent visual mode for the
*current* buffer.

So you could do something like

  :nnoremap <leader>v `[v`]
  :nnoremap <leader>V `[V`]
  :nnoremap <leader><c-v> `[<c-v>`]

to reselect the pasted contents in the given mode.

-tim


 
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.
Ben Fritz  
View profile  
 More options Oct 30 2012, 1:32 pm
From: Ben Fritz <fritzophre...@gmail.com>
Date: Tue, 30 Oct 2012 10:32:52 -0700 (PDT)
Local: Tues, Oct 30 2012 1:32 pm
Subject: Re: re-selecting block in different buffer

On Tuesday, October 30, 2012 11:18:04 AM UTC-5, Tim Chase wrote:
> On 10/30/12 11:11, Chris Lott wrote:
> > The gv command is very useful. I'd like to be able to reselect a block
> > after I have selected, cut, and pasted it into a different buffer.

> > Is this possible?

> It's a little tricky.  Vim does track the `[ and `] marks for you
> which can be used to find the beginning/end of the block.  However,
> since you're now in another window/buffer, I don't know of any way
> to get Vim to know whether the paste was from a
> linewise/characterwise/blockwise selection.  There is a visualmode()
> function, but it only gives you the most recent visual mode for the
> *current* buffer.

Vim remembers the previous mode though, and while it might not be accessible,
you can select the same area and mode in a different place by using 1v. The help
on this is a little hard to find, it does not have its own topic, it is right
above :help v_<Esc>.

This works for me, to select the pasted text in the correct mode:

`[1v

(Note, it doesn't QUITE work with the 'selection' set to "exclusive", it selects
one character too few. This may be a bug.)


 
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.
Tim Chase  
View profile  
 More options Oct 31 2012, 7:02 am
From: Tim Chase <v...@tim.thechases.com>
Date: Wed, 31 Oct 2012 06:03:27 -0500
Local: Wed, Oct 31 2012 7:03 am
Subject: Re: re-selecting block in different buffer
On 10/30/12 12:32, Ben Fritz wrote:

> Vim remembers the previous mode though, and while it might not be
> accessible, you can select the same area and mode in a different
> place by using 1v. The help on this is a little hard to find, it
> does not have its own topic, it is right above :help v_<Esc>.

This must have been added more recently than the 7.2 that Debian
Stable gives me by default.  But it sounds like an interesting feature.

-tim


 
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.
Marcin Szamotulski  
View profile  
 More options Oct 31 2012, 7:22 am
From: Marcin Szamotulski <msza...@gmail.com>
Date: Wed, 31 Oct 2012 11:22:21 +0000
Local: Wed, Oct 31 2012 7:22 am
Subject: Re: re-selecting block in different buffer
On 06:03 Wed 31 Oct     , Tim Chase wrote:

Indeed it is a nice feature. But it doesn't remember the are when
escaping the visual mode (with <esc> or <c-c>). I've asked about it on
vim_dev, and I got an answer that this rather will not be changed in vim
(since it may break some plugins) but there is a workaround:

vnoremap <Esc> g?gvg?

Best,
Marcin


 
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 »