Jump to file without modifying jump list

送分小仙女□ 提交于 2019-12-23 22:27:27

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!