问题
I'm writing a TAGS-like plugin. It should be able to jump to the given file, line, and column.
I use :edit to jump to the right file, and then G/| to jump to the right location (as explained here).
My problem is that :edit adds the beginning of the target file to the jump list, and thus I end up with two locations in the jump list instead of one.
Can I prevent :edit from modifying the jump list, or maybe make it open the target file at the right location?
回答1:
Use :keepjumps edit to avoid adding to the jump list.
Instead of the G command, use the more low-level :call cursor(...) function; it doesn't affect the jump list. The | command for horizontal positioning is fine.
来源:https://stackoverflow.com/questions/19925591/jump-to-file-without-modifying-jump-list