1

Here's how global bookmarks work.

Let's say I have two tabs in my vim session. One showing foo.txt, one showing bar.txt. I go to line 10 in foo.txt and hit mA

Then I go to the other tab, showing bar.txt. I hit `A, and the workspace on that tab opens foo.txt, putting my cursor on line 10.

So now I have two tabs, both showing foo.txt. This is less than ideal.

How I want it to work is, if one of my active workspaces on any tab is showing the file I the bookmark system is trying to navigate too, move my focus to that tab. If the file isn't open, sure - open it in my active workspace.

Is there any way to make this possible?

Thanks!

chrispitzer
  • 991
  • 1
  • 8
  • 26
  • NB: this is not off-topic, please do read the FAQ. However, this is an exact duplicate of: http://stackoverflow.com/questions/4603745/how-do-i-jump-to-markers-within-different-tabs-in-vim – Luc Hermitte Mar 01 '11 at 12:30

2 Answers2

3

This is not a problem with Vim's global bookmarks. It's a problem with Vim's tabs.

In most text editors, tabs serve as a list of currently open files, but in Vim, the buffer list serves this purpose. If you think of a tab in Vim as being like a saved layout for split windows, then you'll meet less friction. This answer sums it up nicely, and I made a screencast to try and explain how tabs can be used.

Community
  • 1
  • 1
nelstrom
  • 18,802
  • 13
  • 54
  • 70
0

Here is a script that answers your initial question. But as far as I'm concerned, nelstrom is right: tabs are not meant to contains the others files, but other layouts.

How do I jump to markers within different tabs in vim?

Community
  • 1
  • 1
Luc Hermitte
  • 31,979
  • 7
  • 69
  • 83