Re: Vertical selection

2006-05-19 Thread Robert Cussons

Hi guys,

I knew about the Ctrl-V with I command, but have never used it with A. 
So out of interest I just tried it, but it appends at the next point in 
front of the cursor, not at the end of the line, as I expected A to act, 
I guess this is because you are in some way taking the A command from 
visual mode


Gerald Lai wrote:

On Thu, 18 May 2006, John Love-Jensen wrote:


Hi Eddine,


Is it possible to make a vertical selection in a text, to have a
rectangular selection in the text ?
If so, how ?



Yes, you are looking for the Visual mode blockwise.

^V to initiate Visual mode blockwise.

Use movement keys to get to where you want the block to span.

Use y (yank) or x (cut) to put the block into the register (as a block)

Use p (put) to insert the register (as a block) into the buffer

For more info...

:help CTRL-V
:help '
:help '

There are probably a zillion variants and tricks with Visual mode 
blockwise.

I find that these simple ones suffice for all my needs.



One more extremely useful thing to do in Visual Block mode is to hit I
or A (capital) to insert/append the same text for all the lines that
have been selected.

--
Gerald



--

Robert Cussons
Office SB3 3.163, Theory Group
Gesellschaft für Schwerionenforschung mbH (GSI)
Planckstraße 1
64291 Darmstadt
Germany.

Tel: +49 (0)6159 71 2754
E-mail: [EMAIL PROTECTED]



Re: Vertical selection

2006-05-19 Thread Benji Fisher
On Fri, May 19, 2006 at 10:34:27AM +0200, Robert Cussons wrote:
 Hi guys,
 
 I knew about the Ctrl-V with I command, but have never used it with A. 
 So out of interest I just tried it, but it appends at the next point in 
 front of the cursor, not at the end of the line, as I expected A to act, 
 I guess this is because you are in some way taking the A command from 
 visual mode

 First, a slight correction:  it appends after the Visual selection.
If you start at the (upper or lower) left and move the cursor right (and
down or up), then this is the same as appending after the cursor.  It is
different if you start the Visual selection at the right and move left.

 Second, if you want to append at the ends of the lines, use $ (end
of line) while in Blockwise-Visual mode.

HTH --Benji Fisher


Re: Vertical selection

2006-05-19 Thread Robert Cussons
Thanks for the tip Benji, just to make the difference between 'I' and 
'A' in blockwise visual mode clear to anyone else who might be reading 
this and doesn't know, 'I' will always insert in the position 
immediately before the selected block, whilst 'A' will always insert in 
the position immediately after the selected block and as Benji said, 
pressing '$' followed by 'A' whilst in blockwise visual mode will insert 
at the end of each line.

Sorry if no-one else cares:-)

Benji Fisher wrote:

On Fri, May 19, 2006 at 10:34:27AM +0200, Robert Cussons wrote:


Hi guys,

I knew about the Ctrl-V with I command, but have never used it with A. 
So out of interest I just tried it, but it appends at the next point in 
front of the cursor, not at the end of the line, as I expected A to act, 
I guess this is because you are in some way taking the A command from 
visual mode



 First, a slight correction:  it appends after the Visual selection.
If you start at the (upper or lower) left and move the cursor right (and
down or up), then this is the same as appending after the cursor.  It is
different if you start the Visual selection at the right and move left.

 Second, if you want to append at the ends of the lines, use $ (end
of line) while in Blockwise-Visual mode.

HTH --Benji Fisher



--

Robert Cussons
Office SB3 3.163, Theory Group
Gesellschaft für Schwerionenforschung mbH (GSI)
Planckstraße 1
64291 Darmstadt
Germany.

Tel: +49 (0)6159 71 2754
E-mail: [EMAIL PROTECTED]



RE: Vertical selection

2006-05-19 Thread Suresh Govindachar
 
Robert Cussons wrote: 

   ... as Benji said, pressing '$' followed by 'A' whilst in 
   blockwise visual mode will insert at the end of each line.
   Sorry if no-one else cares:-)


  Well, I knew about I and A, but $A was news to me!  Thanks.

  --Suresh



Re: Vertical selection

2006-05-18 Thread Jürgen Krämer

Hi,

Baha-Eddine MOKADEM wrote:
 
 Is it possible to make a vertical selection in a text, to have a
 rectangular selection in the text ?
 If so, how ?

  :help ctrl-v

Regards,
Jürgen

-- 
Jürgen Krämer  Softwareentwicklung
HABEL GmbH  Co. KGmailto:[EMAIL PROTECTED]
Hinteres Öschle 2  Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-WeilheimFax: +49 / 74 61 / 93 53 - 99


Re: Vertical selection

2006-05-18 Thread Gerald Lai

On Thu, 18 May 2006, John Love-Jensen wrote:


Hi Eddine,


Is it possible to make a vertical selection in a text, to have a
rectangular selection in the text ?
If so, how ?


Yes, you are looking for the Visual mode blockwise.

^V to initiate Visual mode blockwise.

Use movement keys to get to where you want the block to span.

Use y (yank) or x (cut) to put the block into the register (as a block)

Use p (put) to insert the register (as a block) into the buffer

For more info...

:help CTRL-V
:help '
:help '

There are probably a zillion variants and tricks with Visual mode blockwise.
I find that these simple ones suffice for all my needs.


One more extremely useful thing to do in Visual Block mode is to hit I
or A (capital) to insert/append the same text for all the lines that
have been selected.

--
Gerald


Re: Vertical selection (fwd)

2006-05-18 Thread Gerald Lai

[I wasn't sure if Eddine sent this out to everybody, so I'm forwarding
this to the list.]

You're welcome, Eddine :)
--
Gerald

-- Forwarded message --
Date: Thu, 18 May 2006 22:20:24 +0200
From: Baha-Eddine MOKADEM [EMAIL PROTECTED]
To: Gerald Lai [EMAIL PROTECTED]
Subject: Re: Vertical selection

Once again, Victor, Gerald, Eljay and J?rgen thank for all of you !!!
It's a real pleasure to get quick and precise responses.
Thank you again.

Eddine

Re: Vertical selection

2006-05-18 Thread Charles E Campbell Jr

Baha-Eddine MOKADEM wrote:


Is it possible to make a vertical selection in a text, to have a
rectangular selection in the text ?
If so, how ?



In addition to the ctrl-v answer: vis.vim, available at 
http://vim.sourceforge.net/scripts/script.php?script_id=1195 ,
allows one to apply any Ex command to a visual block selected region.  
Two common uses: sorting the contents of
just the visual block and restricting a substitute to take place over 
just the visual block.


Regards,
Chip Campbell