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
move a range of text to address?
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
  8 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
 
BartlebyScrivener  
View profile  
 More options Nov 13 2012, 12:01 pm
From: BartlebyScrivener <bscrivene...@gmail.com>
Date: Tue, 13 Nov 2012 09:01:30 -0800 (PST)
Local: Tues, Nov 13 2012 12:01 pm
Subject: move a range of text to address?

I see this command when I do :h :move

:[range]m[ove] {address} *:m* *:mo* *:move* *E134*

Move the lines given by [range] to below the line given by {address}.

But when I try it by setting mark a and b and then try moving the text to the end of the file:

:a,bm $

I get a trailing characters error.

rick


 
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 Nov 13 2012, 12:12 pm
From: Tim Chase <v...@tim.thechases.com>
Date: Tue, 13 Nov 2012 11:13:32 -0600
Local: Tues, Nov 13 2012 12:13 pm
Subject: Re: move a range of text to address?
On 11/13/12 11:01, BartlebyScrivener wrote:

> But when I try it by setting mark a and b and then try moving the text to the end of the file:

> :a,bm $

> I get a trailing characters error.

You want to reference the marks as marks:

  :'a,'bm$

as show in

  :help :'

(part of ":help :range")  Otherwise, it thinks you're trying to do
an :append command, which is the origin or the peculiar error.

-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.
BartlebyScrivener  
View profile  
 More options Nov 13 2012, 12:16 pm
From: BartlebyScrivener <bscrivene...@gmail.com>
Date: Tue, 13 Nov 2012 09:16:58 -0800 (PST)
Local: Tues, Nov 13 2012 12:16 pm
Subject: Re: move a range of text to address?

Thank you, Tim.

I've been yanking and putting my whole life and stumbled on "move" this morning by accident.

Could be quite useful.

Thanks again.

rick


 
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 Nov 13 2012, 12:24 pm
From: Tim Chase <v...@tim.thechases.com>
Date: Tue, 13 Nov 2012 11:25:38 -0600
Local: Tues, Nov 13 2012 12:25 pm
Subject: Re: move a range of text to address?
On 11/13/12 11:16, BartlebyScrivener wrote:

> Thank you, Tim.

Glad to help

> I've been yanking and putting my whole life and stumbled on "move" this morning by accident.

> Could be quite useful.

If you've been *yanking*, you'll want the :copy (also known as :t)
command, too. :-)  Behaves pretty much identically, except it copies
rather than moves the line (which you'd get by *deleting*-then-putting).

I've got my fingers hard-wired with

  :m+

to move the current line down one, which I use because
yanking/deleting tromps my scratch register when it's often useful
to preserve it when your intent is just "move this line down one".

The :t and :m commands are also helpful for gathering lines in a :g
command such as

  :g/pattern/t$
  :g/pattern/m$

which will either copy the lines to the bottom of the file for
review, or move the lines to the bottom of the file for
reviewing/ignoring purposes.  I use both regularly, especially when
dealing with CSV files.

-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.
sc  
View profile  
 More options Nov 13 2012, 12:49 pm
From: sc <tooth...@swbell.net>
Date: Tue, 13 Nov 2012 11:49:04 -0600
Local: Tues, Nov 13 2012 12:49 pm
Subject: Re: move a range of text to address?

On Tue, Nov 13, 2012 at 11:25:38AM -0600, Tim Chase wrote:
> On 11/13/12 11:16, BartlebyScrivener wrote:
> > Thank you, Tim.
> Glad to help
> > I've been yanking and putting my whole life and stumbled on "move" this morning by accident.

> > Could be quite useful.
> If you've been *yanking*, you'll want the :copy (also known as :t)
> command, too. :-)  Behaves pretty much identically, except it copies
> rather than moves the line (which you'd get by *deleting*-then-putting).
> I've got my fingers hard-wired with
>  :m+
> to move the current line down one, which I use because
> yanking/deleting tromps my scratch register when it's often useful
> to preserve it when your intent is just "move this line down one".

I use that so much I've devoted F8 and S-F8 to that very function with

    nnoremap <silent> <F8> :m+<CR>
    inoremap <silent> <F8> <ESC>:m+<CR>gi
    vnoremap <silent> <F8> :m'>+<CR>
    nnoremap <silent> <S-F8> :m-2<CR>
    inoremap <silent> <S-F8> <ESC>:m-2<CR>gi
    vnoremap <silent> <S-F8> :m-2<CR>

sc


 
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 Nov 13 2012, 2:12 pm
From: Christian Brabandt <cbli...@256bit.org>
Date: Tue, 13 Nov 2012 20:12:29 +0100
Local: Tues, Nov 13 2012 2:12 pm
Subject: Re: move a range of text to address?
Hi Tim!

On Di, 13 Nov 2012, Tim Chase wrote:

> The :t and :m commands are also helpful for gathering lines in a :g
> command such as

>   :g/pattern/t$
>   :g/pattern/m$

> which will either copy the lines to the bottom of the file for
> review, or move the lines to the bottom of the file for
> reviewing/ignoring purposes.  I use both regularly, especially when
> dealing with CSV files.

Since you mentioning CSV files, I thought I'll add the CSV plugin. It
let's you dynamically filter lines for certain patterns and folds away
all non-matching lines. I especially use this technique to review
records (while e.g. keeping a header line). Plus it adds some nice
syntax highlighting and can arrange your data into a spreadsheet look.

regards,
Christian
--
Komik entsteht, wenn man Trag dien anschaut und dabei ein Auge
zukneift.
                -- Eug ne Ionesco


 
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.
BartlebyScrivener  
View profile  
 More options Nov 13 2012, 4:45 pm
From: BartlebyScrivener <bscrivene...@gmail.com>
Date: Tue, 13 Nov 2012 13:45:44 -0800 (PST)
Local: Tues, Nov 13 2012 4:45 pm
Subject: Re: move a range of text to address?

As long as there are so many :m wizards around.

The instructions for the address suggest that you could move the text to 'T but it doesn't seem to work if 'T is in another buffer.

For example

:'a,'bm 'T

Is there a way to do this using :m ?

rick


 
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 Nov 13 2012, 5:05 pm
From: Tim Chase <v...@tim.thechases.com>
Date: Tue, 13 Nov 2012 16:06:00 -0600
Subject: Re: move a range of text to address?
On 11/13/12 15:45, BartlebyScrivener wrote:

> As long as there are so many :m wizards around.

> The instructions for the address suggest that you could move the text to 'T but it doesn't seem to work if 'T is in another buffer.

> For example

> :'a,'bm 'T

> Is there a way to do this using :m ?

I don't think there's a way to move a line to another buffer/file.
I believe the destination has to be within the same file.  So you can do

  :10ka
  :20kb
  :30kc
  :'a,'b m 'c

to move lines 10-20 to after line 30 all within the same buffer.

Looking at

  :help :m

it gives the syntax as ":[range]m[ove] {address}", so looking at the
help for

  :help {address}

which states "when the mark is in another file it cannot be used in
a range".  It might be better clarified to include "or as a
destination for a :move or :copy".

-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.
End of messages
« Back to Discussions « Newer topic     Older topic »