Vim JUMPLIST .pdf
File information
Original filename: Vim JUMPLIST.pdf
This PDF 1.4 document has been generated by Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36 / Skia/PDF m59, and has been sent on pdf-archive.com on 31/07/2017 at 15:56, from IP address 50.206.x.x.
The current document download page has been viewed 229 times.
File size: 341 KB (2 pages).
Privacy: public file
Share on social networks
Link to this file download page
Document preview
7/7/2017
Jumping to previously visited locations | Vim Tips Wiki | Fandom powered by Wikia
Games
Movies
TV
Wikis
1,626
Vim Tips Wiki
COMMUNITY PORTAL
START A WIKI
PAGES
TO DO
ADD NEW PAGE
EXPLORE
in: VimTip
Jumping to previously visited locations
EDIT
SHARE
Tip 10 Printable Monobook Previous Next
created 2001 · complexity basic · author Yegappan · version 6.0
Vim remembers the locations you have recently visited (where you jumped from). Each position (file name, column number, line number) is recorded in a jump list, and each window has a
separate jump list that records the last 100 positions where a jump occurred.
The commands that are regarded as "jumps" include searching, substitute and marks. Scrolling through a file is not regarded as jumping.
The jump list is saved between edits (provided the 'viminfo' option has the ' parameter), so you can see where jumps occurred from previous editing sessions. :help 'viminfo'
Contents [show]
Using a jump list
Edit
Like a web browser, you can go back, then forward:
Press Ctrl-O to jump back to the previous (older) location.
Press Ctrl-I (same as Tab) to jump forward to the next (newer) location.
Display the jump list for the current window with:
:jumps
Your current location in the jump list is indicated with '>', and the first number in each row is a count that can be used to jump to that position. For example, after pressing Ctrl-O three times,
the :jumps command may show something like this:
jump line
4
102
3
93
2
23
1
89
> 0
22
1
39
2
995
3
53
col
0
0
0
34
40
0
0
102
file/text
somefile.txt
-invalidthe current line
the current line
Display the jump
the current line
anotherfile.txt
the current line
23 is shown here
89 is shown here
list for the current window with:
39 is shown here
53 is shown here
Given the above, you could press:
Ctrl-I to jump to line 39 in the current buffer.
Ctrl-O to jump to line 89 in the current buffer.
4 then Ctrl-O to jump to line 102 in file somefile.txt.
3 then Ctrl-I to jump to line 53 in the current buffer.
In the example above:
The last line was added to the jump list when the first Ctrl-O was pressed (so you can return to the initial position: line 53, column 102).
Line 93 in the current buffer no longer exists (the jump location is invalid).
Using a script to select a jump in the list
Edit
Using this vimrc function, you can enter the number of a jump to go to the desired jump:
function! GotoJump()
jumps
let j = input("Please select your jump: ")
if j != ''
let pattern = '\v\c^\+'
if j =~ pattern
let j = substitute(j, pattern, '', 'g')
execute "normal " . j . "\<c-i>"
else
execute "normal " . j . "\<c-o>"
endif
endif
endfunction
You can invoke the function in command mode:
Morrowind Guide
http://vim.wikia.com/wiki/Jumping_to_previously_visited_locations
Sci-Fi Guide
Explore the Beautiful World of RiME
1/3
7/7/2017
Jumping to previously visited locations | Vim Tips Wiki | Fandom powered by Wikia
ESO Morrowind
:call GotoJump()
After this, you will see the list of jumps and be asked to select a jump. If you type 4 and press Enter, it will take you back to the 4th jump. If you type +4 and press Enter, it will take you forward
to the 4th jump in the list. If you press Escape, nothing happens.
You can also have a mapping for it, for example:
nmap <Leader>j :call GotoJump()<CR>
See also
Edit
Using marks to manually record marks that you can return to
List changes to the current file the change list records where changes occurred
References
Edit
:help jump-motions
:help jumplist
:help :jumps
Comments
Edit
You can also use g; and g, to move backward and forward in your edit locations.
One thing that may not be imediately evident is that this works only line-wise. You can't have more tham one jump per-line. If you use any of the jump generator commands inside the line, only
one jump is saved.
Categories: VimTip
Add category
Read more
“
“
Ever have a giant file
with many function
definitions you want
to hide while you edit
only a few...
View only what you are editing
Games
In insert mode,
pressing Ctrl-W
deletes the previous
word (:help word). If a
non-Vim method is...
Map Ctrl-Backspace to delete previous word
“
Simple function to
add pylint and
pychecker support to
Vim. A suggestion is
to use the compiler...
Integrate Pylint and Pychecker support
Follow Us
Movies
TV
Explore Wikis
Overview
About
Careers
Press
Terms of Use
Privacy Policy
Global Sitemap
Local Sitemap
Community
Community Central
START A WIKI
Support
Fan Contributor Program
Contact
WAM Score
Wikia.org
Help
Community Apps
Can't find a community you love? Create your own and start something epic.
Advertise
Sci-Fi Guide
Morrowind Guide
http://vim.wikia.com/wiki/Jumping_to_previously_visited_locations
2/3


Link to this page
Permanent link
Use the permanent link to the download page to share your document on Facebook, Twitter, LinkedIn, or directly with a contact by e-Mail, Messenger, Whatsapp, Line..
Short link
Use the short link to share your document on Twitter or by text message (SMS)
HTML Code
Copy the following HTML code to share your document on a Website or Blog