Sublime Forum

Simpler split view

#1

Hello,

My first post here…
I recently switched to MAC from PC (using PCs for 20+ years, developing since 7). I’ve been evaluating text editors for about a week. I’ve stumbled on ST and purchased it in less than 3 hours. It had everything I need. All other text editors missed something.
I love everything about it besides one thing - splitting a single file in two.
Now I know this can be achieved here with layouts but it’s a quite cumbersome to do and also not working quite as expected.

Here’s my use case - I work mainly with huge files (10-20k+ lines), containing both client and server code (usually javascript, php). When I code some new functionality I usually work on both client and server simultaneously. Being in a single file I need to work on very different positions. The split view here is a real life saver. But most of the time I don’t need it, because it takes precious vertical space. I also usually keep a lot of open files and only some of them are like this.
The current implementation in BBEdit is exactly what I need. It’s done via simple divider above the scrollbar which you just drag to whatever position you need and then when you finish you just discard it by dragging the divider all the way to the top. It is also aware of the current file, so file A is split, but file B isn’t. On Windows I have used EditPlus for years and it had the same implementation. The selection highlighting is also very important to work in spilt view - when I select text in the top pane it should be highlighted in the bottom one and vice versa. This is again a life saver when you code client/server functions and you are reusing variable names.

Is there something similar planned for the future? Can this be achieved via plugin?
I really love ST and this is the only thing that’s making me a lot less productive than before.

0 Likes

#2

This is really a good idea, not sure if some package already do this. But seems doable.

0 Likes

#3

I’m not exactly sure what you are proposing, so let me phrase it like this: You want to be able to have certain files in a (vertically) split clone view and have that disappear when switching tabs?

0 Likes

#4

Something like this. It’s basically a lot easier approach of splitting the current file in two, working like that for the current task and then easily remove split. Like I said, it’s exactly what how BBEdit is doing it (and EditPlus on Windows). I just found a similar topic in the forum, but I’m not sure if it will resolve this case… sublimetext.com/forum/viewt … f=2&t=7347

0 Likes

#5

The more I need to do this in ST, the more I’m going crazy, sorry :frowning:
There are also some bugs with search, but they are minor.

What’s happening right now - I’m working in a single huge file on a single layout. Suddenly I need to jump to another place in the file to add some functions, but I also need to work on the same position as I am now, simultaneously. What I do now:

  1. Open View -> Layout -> Rows: 2 (shortcut is almost impossible to press with one hand).
  2. Click again inside the file from Group 1, because the focus automatically shifts to the new empty group (why?)
  3. Go to File -> New View Into File (no shortcut for that and is not available if you skip 2.)
  4. Drag the new tab into the second row.
  5. In the new view into the same file, I am positioned at the top of the file instead of the last used position, so I have to search where I am.

Also the tabs are taking way too much vertical space, so I’m forced to use the side bar and turn off tabs

What I was doing with BBEdit and EditPlus before that.

  1. Drag and drop the divider above the scroll bar to the middle of the screen - That’s it!
    The view is automatically split, the file is the same and the position of the file is if was a continuous file, just you can now scroll independently the two parts.

When you need to do this countless times a day it becomes a huge issue. Is there some other workflow that I’m not aware of in ST which can help in this case? I can’t be the only one with this issue.

0 Likes

#6

Create your own plugin to do exactly what you want, something like:

[code]import sublime, sublime_plugin

class SplitViewCommand(sublime_plugin.WindowCommand):
def run(self):

    if self.window.num_groups() == 1:
        self.window.run_command('clone_file')
        self.window.run_command('set_layout',
                        {
                        "cols": [0.0, 1.0],
                        "rows": [0.0, 0.5, 1.0],
                        "cells": [0, 0, 1, 1], [0, 1, 1, 2]]
                        })
        self.window.run_command('focus_group', {"group": 0})
        self.window.run_command('move_to_group', {"group": 1})[/code]
0 Likes

#7

You should take a look at sublime.wbond.net/packages/Origami, maybe it can help you simplify the process. (And I find alt+shift+2 not hard to press at all with one hand.)

0 Likes

#8

Origami is close, didn’t know about that. Although it’s a bit of an overkill and still not working as expected (selection highlight doesn’t work across panes, but I guess I will have to suck it up and deal with this way. Thank you for the link.

0 Likes

#9

There is an on_selection_modified event listener for plugins. You could probably use that to manage highlighting for multiple views into the same file.

0 Likes