RE: mark an anchor

2007-03-02 Thread Gene Kwiecinski
>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?

If you just went to one other line, eg, line 150,

''

will get you back to line 100.  If you searched and got to line 150,
then hit 'n' and got to line 163, then another 'n' brought you to line
213, "''" would then take you back to line 163.

If you want to literally mark line 100 as your "anchor", which is what I
think you actually want, then

mm

will mark that as mark 'm'.  I just use 'm' because it's the same key,
and 'n' as a secondary mark, but others might use marks 'a' and 'b'
("ma" and "mb" commands). In that case

'm

will bring you back to the beginning of line 100 no matter where you
are.  Haven't used this in a while (farther to reach the key :D ), but

`m

should bring you back to the exact character on line 100 should you
desire.


Re: mark an anchor

2007-03-02 Thread Tim Chase
> Thank you!

glad to help

> But what is back-tick?

It, on US keyboards, usually shares the same key as the tilde
("~").  A "reverse-apostrophe" if you will:

`

instead of

'

(no those aren't specs of dust on your screen...the top one is a
backtick/back-apostrophe that you're interested in, and the
bottom one is a regular apostrophe)

The backtick is ascii character 0x60 while the apostrophe is 0x27

HTH,

-tim





Re: mark an anchor

2007-03-02 Thread Bin Chen

Thank you!
But what is back-tick?

Tim Chase 写道:
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.





  




Re: mark an anchor

2007-03-02 Thread Tim Chase
> 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







Re: mark an anchor

2007-03-02 Thread Jean-Rene David
* Bin Chen [2007.03.02 09:45]:
> 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?

If I understand your question, CTRL-O will do what
you want.

:h CTRL-O

-- 
JR