Sublime Forum

Two tiny feature requests

#1

UPDATE: The first of these is already in sublime, please disregard. (Thanks @vmuriart and @deathaxe!)

  1. I frequently find myself in need of switching rulers between 80 (for most open source projects) and 100 (for my projects). I’ve set 100 as the default in my config, but switch it pretty frequently. In the dropdown, if you have 100 selected and select 80, 100 is no longer selected, i.e. you can only have one selected at once. I’d like to have multiple rulers at once to solve my problem. I’m asking to switch the UI so that you can have multiple checked rulers, and it will display multiple rulers on the page. If many people object (this could save me time but slow down others) then I suppose a shortcut to change the ruler back and forth would suffice (maybe this can be done as a sublime package?).

  2. I can close a file on my mac with (command + w). If I do that twice, it closes the window. I like that behavior. However, if I have a window open with a 2-column layout, (command + w) will no longer close the sublime window, even if there are no files open. Request: if there are no files open in any of the columns, (command + w) should reduce the number of columns by 1 until there is 1 column left. Then it should close the window.

If the folks at SublimeHQ don’t think these are good ideas, I defer to your better judgement! I just wanted to lay them out there.

If others see this, what do you think?

Thanks!

0 Likes

#2

Sublime Text does support multiple rulers. Update your JSON to contain both rulers.
See this link if you need more details on this.

1 Like

#3

1. About rulers

You could add "rulers": [80,100], to your Preferences to display both. It’s just not bound to the main menu items. You can write keybindings to manipulate or set it to a specific value as well.

2. Layouts

I am not too familiar with all the Layout packages such as SppLayout and Origami, but I guess they already provide functions, which could be bound to command+w.

There is also a “close_pane” command available by default, which already does what you want. Maybe just need to find the correct selector to bind it to a key.

1 Like

#4

After a short research, I found your 2nd request already being the default behavior of ST3, too.

I just found the ExtraTabs package to overwrite the default “close” command. “close” closes empty views and finally closes the whole window.

So I guess, you’ll just need to check, whether you have a plugin installed, which does the same.

I found it by running sublime.log_commands(True) from the console. ST lists all commands being executed then. If you press ctrl+w, “close” must be printed in the console.

1 Like

#5

Thanks both for your prompt replies! I’m glad to see that multiple rulers is already in sublime.

With regards to the second of these though, the layout question, I’d like to double down:

The current behavior (in ST3) I believe is inconsistent:

  1. Open a sublime window. Open 3 files (arbitrary number). (command + w) closes a file. Two more times closes the remaining files. Once more closes the window.
  2. Open a sublime window. View > Layout > Columns: 2. Open three files in one of the columns. (command + w) three times closes them. One more time and nothing happens: the column doesn’t close, the window doesn’t close, any number more times and nothing happens.

I’ve checked using sublime.log_commands(True) and I can see that command: close is issued every time I do (command + w) but nothing is happening. I think something should happen.

Let me know what you think @deathaxe!

0 Likes

#6

I guess this is desired behavior.

ST distinguishes between automatic layouts and manual layouts. Panels are closed only in automatic mode in case no more open file is contained in it.

Automatic layouts are created using the “new_pane” (command+k, command+up), … commands or something like that.

Calling View > Layout > Columns: 2. sets a manual layout, which is considered fix and therefore not changed by “close”.

This might not be too obvious but makes sense somehow. If I manually set a layout I might not want it to crash because of an accidental key press.

The code which handles that can be found in the Default.sublime-package/pane.py

1 Like

#7

@deathaxe alright, if this is the desired behavior, then please feel free to close this ticket.

Note: I would still argue this behavior should be changed, but that’s just me =). I’ll look into using (command+k, command+up)

Thanks!

0 Likes

#8
1 Like

#9

From what I saw in code I wouldn’t call it a bug.

0 Likes

#10

For what it’s worth, I tried (command+k, command+up) and (command+w) works the way I’d like it to. I don’t understand why there would be multiple ways of creating new columns/panes that would act differently, so I’d still like to see this changed, but I’m mollified by the fact I can get the behavior I want now, by switching to (command+k, command+up) from (command+option+2)

0 Likes

#11

I don’t understand why there would be multiple ways of creating new columns/panes

The manual way is the basic one. It directly calls an API function set_layout while the automatic layout functionality is built on top of this API.

But I found an interesting detail about your 2nd request.

If I set "close_windows_when_empty": true, in my preferences, ctrl+w closes an empty window even with multiple columns set manually! This setting is true by default on MacOS.

The important detail is - it works with no folders being added to the sidebar only! This is designed behavior.

0 Likes