> 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.
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
> 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
> 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".