Showing posts with label jump. Show all posts
Showing posts with label jump. Show all posts

Tuesday, November 24, 2009

Jumping to a Buffer

If you have split windows open with multiple buffers, you can jump directly to a specific buffer number by doing the following:

N<C-w><C-w>

N is the window number you want to move the cursor to.

Thanks to Duff for the coffee!

Thursday, September 11, 2008

Jump to Percent of File

Sometimes you don't know the exact line you want to go to in a file, but you can infer an approximate percentage. I was browsing a 200 meg logfile with Vim yesterday and guestimated the area of interest was about 10% back from where I was at (85%). You can easily jump to a desired percentage in a file by typing in the percentage followed by a percent symbol.

Jump to 50% of the file:

50%

Easy to remember to say the least ;-)

Friday, May 30, 2008

A Different Mark Jump

Most people know how handy marks are and most use them to jump to the exact location marked. You can also jump to the first character on the marked line rather than the exact location. Just use '{a-z} rather than `{a-z}.

Thanks to Nate for this tip as well.

Friday, April 11, 2008

Last Jump Location

This technique was used in the "quick uncomment" tip I posted recently, but I figured I would mention it explicitly. A lot of times when I'm editing a file, I'll set a mark at my current location because I need to do something like jump to the bottom of the file and change something, and I anticipate needing to return to the current line. If you know you're going to quickly return to the current position, there's no need to set a mark. Just hit `` and it will return you to the position you were at before the last jump.

Thursday, February 28, 2008

More Marks

Most people know the basics of using marks in Vim; however, there are some special mark locations you may not know about.

`. - move cursor to the line and column of your last edit
'. - move cursor tot the line of your last edit
`' - move to last jump position
`" - move to location before file file was last closed

:marks - show entire mark list
:mark x - show mark stored in register x
:jumps - show the entire jump list

ctrl-o - move cursor to older position in jump list
ctrl-i - move cursor to newer position in jump list

In case you don't know basic marks, in normal mode, press m followed by a-z to set a given mark to your current position in the file. To jump back to that position type `a, `b, etc...

A jump is executed whenever you move the cursor to an arbitrary position in the file, i.e., 123G (line 123).