On Wednesday 13 February 2008 11:33, Nick Gravgaard wrote:
> On Wed, 13 Feb 2008 10:26:00 -0700, "Erik Falor"
> <[EMAIL PROTECTED]>
>
> said:
> > :.,+23d
>
> How does that help you count the number of lines you want
> to delete?
>
> > On 2/13/08, Nick Gravgaard <[EMAIL PROTECTED]> wrote:
> > > On Wed, 13 Feb 2008 17:48:52 +0100, "Tony Mechelynck"
> > >
> > > <[EMAIL PROTECTED]> said:
> > > > Nick Gravgaard wrote:
> > > > > Hi everyone,
> > > > >
> > > > > I have an idea which I think will make Vim much
> > > > > faster and easier to use. I find that over 4 lines
> > > > > or so, it becomes difficult to quickly count the
> > > > > number of lines I want to delete/yank/shift or
> > > > > whatever, and so I usually revert to using linewise
> > > > > Visual mode to select the lines
> > >
> > > I
> > >
> > > > > want to perform the operation on. Obviously it's
> > > > > much faster to (for example) press 23d than to
> > > > > press V followed by down 23 times and
> > >
> > > finally
> > >
> > > > > d to delete, but the problem is knowing how many
> > > > > lines I want to
> > >
> > > perform
> > >
> > > > > the operation on. I believe this could be easily
> > > > > rectified if Vim
> > >
> > > could
> > >
> > > > > display relative line numbers in the left hand
> > > > > margin (with the
> > >
> > > current
> > >
> > > > > line being 1, the next being 2, and so on). Then
> > > > > the user could just look down to the last line they
> > > > > want to operate on, see how many lines it is from
> > > > > the cursor, and type the command.
> > > > >
> > > > > Cheers,
> > > > > Nick
> > > > >
> > > > > PS. Similar visual hints could help users count
> > > > > words, but I can't see how it could be done without
> > > > > making the editor look cluttered.
> > > >
> > > > I guess relative line numbers would have the current
> > > > line be 0, the next one
> > > > 1, etc.,
> > >
> > > At first I thought it should start at 0 too, but then I
> > > realised that it's a count, not an index. 2dd deletes 2
> > > lines, the current line and the line below it, so it
> > > makes sense that the current line should have "1" next
> > > to it and the next line "2".
> > >
> > > > the line before the current line -1, the one before
> > > > that -2, etc. --
> > >
> > > Can Vim use negative counts?
> > >
> > > > Vim cannot easily do that, but what it can do is
> > > > almost as good: Vim can show
> > > > absolute line numbers, the first line in the file
> > > > being 1, the next one 2,
> > > > etc. Then instead of visually selecting the lines
> > > > upon which you want to operate, you can use an
> > > > ex-command with a range, such as
> > > >
> > > >       :2435,2457d
> > >
> > > Sure, but it's not as easy or as fast as 23dd though :(
> >
> > --
> > Erik Falor
> > Registered Linux User #445632 http://counter.li.org

nick--

it occurs to me, if it were possible to display
relative line numbers as you suggest, right away you
wouldn't like them -- every time you scroll they'd move
as the current line moved -- you'd never see more than
one screen of relative numbers -- so for example if you
wanted to act on several hundred lines, as you scrolled
to see how many there are the numbers would keep
changing

here's a thought:  open a 2nd window, put sequence
numbers in it, line it up so line 1 is across from
current in your main window, then turn on scrollbind
for both windows -- it would take some doing but you
could automate it with a script

you do know about marks, right?

sc



--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui