Sublime Forum

Changing behaviour of the show_files overlay (switch focus to file, not 2nd copy of it)

#1

If I use Ctrl+P to open the show_files overlay and then select a file, ST will open that file in the current group even if the file is already open in another group in the same window. Is it possible to get it to switch the focus to that file instead of opening a 2nd view of it?

To be more precise…

Let’s say I’ve got a ST window in which I’ve set a layout of 2 columns, each with several files open in them. This means I’ve got 2 groups of files which I can switch between by using Ctrl+1 and Ctrl+2.

If I want to switch the focus to a different file in the current group I hit Ctrl+P, start typing the file’s name and hit Enter when it’s shown, all well and good. But if that file is already open in the other group then a 2nd copy of the file is opened in the current group rather than the focus being moved to the already open file in the other group which is what I’d prefer.

I thought it might be possible to achieve this by changing the show overlay key bindings, possibly by calling show_overlay in a different manner, or by altering the behaviour of the Enter key when selecting a file displayed in the overlay, e.g. Ctrl+Enter switches focus to that file if it is open.

Is this possible?

If not possible, is there an existing plugin to do this? [I couldn’t find one].

Thanks all.

1 Like