Monday, May 13, 2013

Re: Need a vim "hard mode" tutorial.

On 05/13/2013 04:05 AM, Asis Hallab wrote:
> Dear Vimers,
>
> 2013/5/13 DwigtArmyOfChampions <dwightarmyofchampions@hotmail.com>:
>> If you're not going to search, then are you pretty much always supposed to use Ctrl-u and Ctrl-d to navigate through your code, and then when you spot a line that needs changed, type :(line number)?
>
> I have been facing the very same problem. For me Vim is about doing
> the job of text editing efficiently. So getting to the place you want
> to edit should be fast and easy. In spite of all the different
> available movement commands I frequently find myself thinking, that in
> a particular situation I might had gotten to the place I want to edit
> faster using the mouse. After all searching or jumping to a a line
> number easily require four to five key strokes.
>
>> Because that's pretty much the only way I've been able to move around. What if you're in visual mode and you therefore can't use the : to run a command to get to the line number you want the visual block to end on?
>
> You can use G<line_number> to get to the line you spotted. This works
> in visual mode, too.
> :h G
>
> I would very much like to read about expert Vim users most used
> movement commands and get more efficient in getting to the point I
> want to edit.
>
> Cheers!
>


I made a small modification to Vim source that shows line number from
top of screen instead of from top of file and I've set up two shortucts
for navigation:

<N>space - goes to Nth line from top of screen
space - toggles between 3 positions on current line: 25%, 50% and 75%

The last shortcut uses a small function I wrote.

These two commands that use the same key work much better (for me) than
anything Vim has available built-in.

I thought relative-number mode would be great but in practice it doesn't
seem to work that well. First of all, I don't always remember if I'm
above the line I need to go to or below. This is annoying, because the
action of 'go to this line' is so common it really NEEDS to be a
single-action process, i.e. look up the line, use a single command to go
there.

With relative-number, first you need to make sure if you're above or
below and then use j or k. And it's easy to make a mistake. This is
simply too much overhead for such a simple action.

In addition, a common case is that you might want to go back and forth
between a couple of places in current screen, then it's very helpful if
you just need to remember 2 absolute line locations, e.g. 5 and 25 and
go there directly without having to look them up, irrespective of
current line location.

-ak

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: