Roman Cheplyaka
Roman Cheplyaka

Reputation: 38718

Jump to file without modifying jump list

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?

Upvotes: 5

Views: 657

Answers (1)

Ingo Karkat
Ingo Karkat

Reputation: 172580

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.

Upvotes: 6

Related Questions