Sophisticated navigation system

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Sophisticated navigation system

Ven Tadipatri
Wow, I am amazed at how nice the built-in navigation system is in vi and vim.
Who came up with the original concept of using ctrl+f and ctrl+bto
navigate, and the */# key
to jump forward/back?

All I wanted to do was take the svn diff output, pipe it to vi -.
The problem is that to find out what was changed, I had to jump to all
the "Index" elements,
so I can use # and * to navigate.

But when I got to the end of the screen, I got stuck. H, M, & L didn't
seem to do much.
So I tried the ctrl+f. To my surprise, it moved forward a screen,
it neatly positioned the cursor *above* the line I was just on.
  So I can move forward one screen *AND* see the context of the code,
in other words
what was on the line before.  Ctrl+b appears to behave in a similar fashion.

Kudos to whoever invented Vi, vim or wherever the basic navigation system in vi
was invented. It's one of the most advanced and user-friendly ones
I've ever encountered.

-Ven

--
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
Reply | Threaded
Open this post in threaded view
|

Re: Sophisticated navigation system

Tim Chase
On 01/12/12 13:02, Ven Tadipatri wrote:
> So I tried the ctrl+f. To my surprise, it moved forward a
> screen, it neatly positioned the cursor *above* the line I was
> just on. So I can move forward one screen *AND* see the
> context of the code, in other words what was on the line
> before.  Ctrl+b appears to behave in a similar fashion.

While this doesn't sound like default behavior, it sounds like
you have 'scrolloff' set to 1.

   :help 'scrolloff'

which allows you to specify the number of context lines to show.
  To have it always try to center the line on the screen, you can
set it to an absurdly high value:

   :set scrolloff=999

-tim



--
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
Reply | Threaded
Open this post in threaded view
|

Re: Sophisticated navigation system

Ven Tadipatri
On Thu, Jan 12, 2012 at 2:08 PM, Tim Chase <[hidden email]> wrote:

> While this doesn't sound like default behavior, it sounds like you have
> 'scrolloff' set to 1.
>
>  :help 'scrolloff'

Does scrolloff work with only jumping forward (ctrl + f) or does it also work
with jumping back? (ctrl+b)
   And actually I think it's ok having the scrolloff set to 1. I believe it
is the default value that vim ships with, because I've never changed it
and indeed didn't even know there was a scrolloff feature.
  I mean, it does make sense that when you move forward a screen, you
want to see some context of where you are right? Or maybe it's just me.

Thanks,
Ven


>
> -tim
>
>
>

--
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
Reply | Threaded
Open this post in threaded view
|

Re: Sophisticated navigation system

Tim Chase
On 01/13/12 14:27, Ven Tadipatri wrote:
> On Thu, Jan 12, 2012 at 2:08 PM, Tim Chase<[hidden email]>  wrote:
>>   :help 'scrolloff'
>
> Does scrolloff work with only jumping forward (ctrl + f) or does it also work
> with jumping back? (ctrl+b)

It works with all jumps (searching forwards/backwards, ^F, ^B,
^D, ^U, *, #, etc), aiming merely to keep 'scrolloff' lines of
context above and below the cursor.

>     And actually I think it's ok having the scrolloff set to 1. I believe it
> is the default value that vim ships with, because I've never changed it
> and indeed didn't even know there was a scrolloff feature.

Unless your distribution or a plugin has messed with the setting,
stock vim defaults to 0.

>    I mean, it does make sense that when you move forward a screen, you
> want to see some context of where you are right? Or maybe it's just me.

I tend to leave the default most of the time, only setting it
temporarily as-needed.  Mostly because I use the
zt/z<cr>/zb/z-/z./zz family of commands to push a particular line
to the top/bottom of the window, and 'scrolloff' interferes with
my intentions here.

For horizontal scrolling, there's also the companion
'sidescrolloff' option.

-tim


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