0

Vim has an annoying behavior that I can't seem to condense enough to ask a search engine for a solution:

Say I have 2 windows open in tab 1, displaying file_a and file_b, and 1 open window in tab page 2, containing file_c. While in tab page 1, in the window containing file_b, I run the command

:e /path/to/file_c

What I want to happen is to open file_c in the current tab page 1 window, the one with file_b. What actually happens is that it switches me to tab page 2, which already contains file_c.

Apparently some people consider this a feature, but it's a pain to have to switch to tab page 2, close the file_c window, go back to tab page 1, and reopen it again. In other words it isn't my intention to just open file_c, I want to open file_c next to file_a.

How can I disable this "help" and get Vim to open a file where I tell it to?

EDIT: Changed "window" & "pane" to "tab" & "window", which seems to be the Vim terminology.

6
  • What do you mean by window and pane? Is window a Vim window, or a Vim tab page, or a window manager window? By pane I presume that you mean a Vim window, is this true? Commented Feb 12, 2017 at 2:58
  • @AlexP, By window I mean a Vim tab page. By pane, I mean the divisions of a tab. Commented Feb 12, 2017 at 3:39
  • Vim has garbage terminology. "tab" and "split" are easier to understand, and "buffers" if you're describing multiple files open in the same tab or split, where only one is visible. Commented Feb 12, 2017 at 3:49
  • 1
    Please edit your question to be coherent. Include a minimum number of steps to get Vim into the state you're in. If I have one tab with file_a and file_b in splits, and another tab with file_c, and I do :e file_c while in the first tab, file_c appears on the first tab and i am not sent to the second tab. You may have a plugin that's causing this behavior, or you may not be asking a coherent question. Commented Feb 12, 2017 at 3:55
  • @AndyRay: Vim has coherent terminology. A buffer is a chunk of text, which may be or not be associated with a file. A window is a view into a buffer; not all buffers have associated windows, and a buffer can be shown in more than one window. But yes, I agree, the original question describes unusual behavior. Normally, :edit will load the file into the current window even if it is already shown in another window. Commented Feb 12, 2017 at 4:03

1 Answer 1

2
+50

This is not the default behavior of Vim. You have a plugin or a configuration setting in your .vimrc causing this. You can quickly test things like this by running vim at the command line with no plugins:

$ vim -u NONE
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.