> If I am in line 100, now I want to search a key which will lead me to 
> wherever. I want to back to the place before the seach, can vim support 
> anchor for me to back?


There are several possibilities, depending on your forethought
and quantity of travel.

If you jump elsewhere (searching, making "large" movements such
as page-up/down, etc), you can use control+O and control+I
(that's "oh" and "eye", not "zero" and "one") to navigate the
jump-list  (":help jumplist").  Control+o goes back to previous
jumps and then control+i moves forward in your list of jumps.

If you plan ahead, you can use the 26 named marks (":help mark").
 You can do something like

        ma

to drop the "a" mark at your current location.  You can then
freely navigate all over your document, and then use

        `a
or
        'a

to jump back to where you were.  The apostrophe just jumps to the
line, while the back-tick jumps to the line and
character-position.  Since you can mark any letter you want, you
can use "ma", "mb", "mc"..."mz" to mark up to 26 locations (if
you can remember them) and them use "`a", "`b", "`c",..."`z" to
jump back to each of them.  If you're forgetful, you can use the
":marks" command and vim will tell you where you can jump to with
the apostrophe/backtick.  Note that some are read-only so you
can't set them, but they offer conveniences such as the
backtick-backtick:  you can also use backtick-backtick to toggle
between the last two locations, jumping back and forth.

Hope this gives you several new ways to work.  I use a combo of
both marks (when I remember that there's someplace important I
want to jump back to) and the jumplist to see where I've been.

-tim





Reply via email to