开发者

Vim return to second last edited line

开发者 https://www.devze.com 2023-02-04 06:18 出处:网络
In vim you can go back to the last edited line with \'. , but is there a 开发者_如何学Goway to go back to the second-last edited line? Suppose I did some edits at line 100, then some edits at line 1,

In vim you can go back to the last edited line with '. , but is there a 开发者_如何学Goway to go back to the second-last edited line? Suppose I did some edits at line 100, then some edits at line 1, is there a quick way to return to line 100? I know a mark can be used but that requires forethought...


You can use the jumplist (:help jumplist). Simply use Ctrl-O to go back (and Ctrl-I to go forward) in the list of the last places you either edited or jumped to (via %, /, [[ etc: see :help jumplist for the full list).

To go back to the place you edited before last then assuming you've done no other jumps in the meantime, this would be Ctrl-O Ctrl-O or (I think) 2 Ctrl-O.


In addition to jumplist, vim has also a changelist, which can be iterated over using g; (to older item) and g, (to newer item) motions.

0

精彩评论

暂无评论...
验证码 换一张
取 消