How to open Sublime Text files in window based on extension? - sublimetext3

Is there any way to get Sublime to open all files of a certain extension in the same window? For example, when using a 2x2 grid, I'd like to keep all SCSS files in the upper left, all HAML in upper right, JS lower left and search in lower right. I'd like to use the search function, and have files go to the other three tabs instead of the search window each time.
I've tried the 'open in relevant window' plugin and it doesn't appear to make any difference.
When opening lots of files it gets very tedious opening them and having to manually move them to a window that wasn't active when opening.
Edit: I'm working on a Mac, so I'd need something that works there, or preferably cross platform.

Edit: Op is working on a Mac, I'll leave this in case any windows users are interested in this solution.
---
Perhaps an extra shell extension would help.
If you're familiar with the Registry, you can create a new key that opens all selected files in a new window. Simply create a modified version of what Sublime Text already has.
The existing key for Sublime Text exists here:
HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text\command
With the default value of (depending on version):
C:\Program Files\Sublime Text 3\sublime_text.exe "%1"
You could create a new key like so:
HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text (new window)\command
Then add the -n arguement to the default value:
C:\Program Files\Sublime Text 3\sublime_text.exe -n "%1"
This will create a new window every time you use the shell extension to open files and will keep multiple files organized in the same window.
To take this a step further, if you have any programming experience you could create your own shell extension which takes a list of files and groups them for you, which then in turn can create the new windows programmatically.

Related

How to open a file into the right editor (of split view)? [duplicate]

When I switch between files (Using ctrl-n for examples) in different editors, intellij always opens the file in the original editor the tab for the file is located. Coming from a vim background this seems counter intuitive for me. Is there a way to force intellij to always open the file in the same editor window?
Please vote for the following related issues:
IDEA-67559 Opening a file when there are multiple file groups may re-open in a different group rather than opening in the current group
IDEA-81628 Navigation within same file mistakenly leaves split editor
When using Ctrl-Shift-N to open the desired file, Shift-Enter to confirm will maintain the focused tab group.

Sublime Text 3: how do you configure the display and/or sorting of the Window menu?

If you open a couple folders in Sublime Text 3, you'll see entries for each folder added to the Window menu. It appears that the default format of each entry on the menu is:
(active-filename) - (foldername)
The list on the Window menu is sorted alphabetically starting with (active-filename). Whenever you select a file to work on, the (active-filename) part of the entry changes, and the list reorders itself. If you have a dozen Windows open, the position of a given window in the list will change all the time as you work with files. This makes it hard to find a window when repeatedly switching between Windows.
Is there a way to configure Sublime Text 3 to display only the folder name in the list on the Windows menu? Alternatively, is there a way to configure it to sort on folder name and not on the ever-changing "active" filename?
Unfortunately there open issues around this but no attention form the SublimeText Team yet
https://forum.sublimetext.com/t/alphabetize-window-menu-by-folder-not-file-name/13017/4
https://github.com/SublimeTextIssues/Core/issues/1972
https://github.com/SublimeTextIssues/Core/issues/1445
https://github.com/SublimeTextIssues/Core/issues/1179

old file name stuck at the top of sublimetext

Very strange issue here, it's not causing problems but is aesthetically annoying. I had the kindle plugged into my windows machine as to edit the kindle's files. One of the kindle file names is now listed after the name of the python program I'm working on in sublime text. To paint a picture, above the menu drop downs in sublime text, there is the path to the document (IE python program) I'm working on, followed by the random file from the kindle.
The kindle file is no longer on my computer and never had anything to do with sublime text. I've tried restarting the computer and reinstalling sublime text, neither worked. Any ideas what might be going on??? Thanks!
The sublime text window caption shows you the name of the currently open file, followed by the name of the current project in parentheses (if you have a project open at all), followed by the name of the program.
Based on the screenshot in your image:
You currently have the file softmax.py open and it is stored in a folder on your desktop named machine learning\python programs\test\newyorktest\
The name of the Sublime project file is Casting the Circle_A Woman's Book of Ritual_B009FKTQD8_sample.sdr.sublime-project (the caption doesn't show the sublime-project part because that's redundant).
I would imagine that when you set up the project you accidentally chose that name as the name of the project file.
In order to fix your problem, select Project > Save Project As... from the menu and enter a different name for it. The location that you save the file in doesn't matter (it can be inside the folder of your project or in some other location), all that is important is that it has the extension .sublime-project.
Once you pick the new name, Sublime will immediately swap to using the new project file instead of the old one, which will keep your current set of open files, etc, and the caption will change.
You can then seek out and delete the other project file if you want.

Is there a way to use Sublime to show file previews in Windows Explorer for certain files?

I'd like to be able to preview all plain-text files in the Windows File Explorer Preview Pane. To illustrate, here's what sublime files currently look like:
As you can see, Context.sublime-menu is highlighted, but a preview doesn't appear. They're just plain-text files though - you can open them in Notepad. Is there a way to tell windows "Use notepad (or sublime) to view this type of file the preview pane"?
Thanks to #KeithHall's link - while it didn't work for me - got me started on a pretty long path to finally figuring this out. And finding a better solution than I thought existed.
In short, simply install the Delphi Preview Handler. Which pretty much gives you an IDE in the preview pane. It's pretty simple to use and just awesome.
After installation, if you click on a .js file in Windows File Explorer you can immediately see a different preview pane.
Registering Other Extensions
The Preview Handler doesn't compensate for all plain-text files unfortunately, so you're gonna have to manually add the sublime extensions and any other extensions in the Registry Editor.
Here's the bird's-eye view of this process:
Find the key/value that instructs Windows to use Delphi as the preview handler for .js files.
Copy the key/value
Apply that to each extension you want to preview.
Here's more in-depth instructions:
First, you need to find the ID of the Preview Handler, and its Default Value
win + rregedit > expand HKEY_CLASSES_ROOT
Find .js and expand it.
.js should have a subkey named shellex, expand that
You need to recreate this shellex key for each extension you want to add, so copy its contents:
shellex should have a sub-key named with a bunch of numbers, letters, and dashes, this is the ID of the preview pane (I think)
Right-Click that > Rename > Copy > Cancel
Open Sublime > Create a new file > Paste
Go back to the Registry Editor, Click that ID subkey, and a String value called (Default) should appear in the right side of the window.
Double-Click that
Copy > Cancel > Paste in sublime. This is the ID of the Preview Handler (I think).
At this point there should be 2 IDs in the sublime file.
Now You're ready to add these same values to other extensions.
Find the extension(s) you want to change. For me it was all the sublime file-types.
Right-click > New > Key > call it shellex
Go to sublime, copy the first value
Right-click shellex > New > Key > Paste
Go to sublime, copy the second value
Click the new key and make it's default value that 2nd id.
So it should look similar to this:
v .sublime-commands
| v shellex
| |- {823BD1D4-...
And in the right side of the window:
Name Type Data
(Default) REG_SZ {AD9955...
Sources:
This Answer by #rxantos pointed me in the direction of the Delphi Preview Handler.
I spent about an hour looking for this app but never found it.
This Answer by #tvj247 is perhaps a more simple solution, but my HKey structure didn't match his (I'm using Windows 10).
And as for fiddling with the Registry, that was trial, error, and comparing sublime extension keys to js, html and css.

Preference - How to prevent duplicate tabs from being opened?

I like to work in multiple columns when working on a project.
I will often switch back and forth between the columns and open other files using cmd+p.
If one column has the file open already then it will just refocus on that tab (good!). However, if I am in a column where the file isn't opened, instead of switching focus to that column, it will open a new tab and clutter my workspace(bad!).
Is there a setting I can change so I can achieve the desired behavior I described above? Chrome has an extension that can do this
There's a plugin for Sublime text 3 for this as well, it's called Open in relevant window and it works just like you just described.
Installation is simple and just like any other ST3 plugin, through package control.
Hope this helps!

Resources