How to open default project in Sublime Text when starting app (mac) - macos

When I click the sublime text icon (to start/open it) I would like it to default to either a specific folder, or the last folder that was open. This SO question was helpful:
Set Sublime Text's default directory when opened
However I have set hot_exit, remember_open_files, and close_windows_when_empty and none of this seems to work for me.
If I actually 'quit' sublime text down in the dock, then it will open the last project I had open (in addition to another blank window).
Any way to make it remember my project without having to quit the app?

I set hot_fix, remember_open_files, and close_windows_when_empty as described in Set Sublime Text's default directory when opened, and this works on macOS IF you 'quit' sublime rather than closing the app using the 'x' in the upper right hand corner of the app. So for me, when I want to close sublime I go down in the doc and right click on sublime and choose 'quit', and when I open it again, the last project I had open will be displayed.
Another quick option is to use command-q to quit the app.

Related

Where is the windows terminal settings location?

I edited the settings file and there must have been a typo and now the app crashes on startup.
Online the documentation says the settings lives in $env:LocalAppData\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json
I can't figure out what that path means since it doesn't exist on the computer.
I re-installed the app to fix the problem then made sure to see what the actual path is.
It's located in : C:\Users\{USERNAME}\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState
In the current version (1.7.1033.0), the application can open the JSON settings file for you via a button. Open the Settings tab, and the bottom left corner will have a button named "Open JSON file". Clicking that button will open a prompt asking with what application to open the file. That text editor can then tell you where the file is located.
If you open the terminal settings, it will open a text editor with the settings.json file. If your default editor is VS Code it will show you the path below the tabs on the top of the screen.
I'm unsure what other editors show you the path, but if it is crucial you can change your default text editor to Code.
There is still the option to open the JSON file through settings. In version 1.15.2875.0 you can still find the "Open JSON file" at the bottom left corner
Screenshot with highlights
This hint was given by a comment by user1340531:
Mine is at C:\Users\{username}\AppData\Local\Microsoft\Windows Terminal\settings.json
(or more generically: %userprofile%\AppData\Local\Microsoft\Windows Terminal\settings.json)
If it's not there, you should consider OP's answer or vyps comment which lets you find out one of these generic paths (they are equivalent):
%userprofile%\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState
%LocalAppData%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState
$env:LocalAppData\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState
If you don't know what these paths mean, I'd recommend playing around with "Windows Run" (Win+R) and the explorer address bar.

Sublime only opens in Sublimerge view

I have the plugin Sublimerge installed in Sublime Text 3. In order to compare two files Sublimerge opens a new window (but without any menu). That is fine since the original Sublime window is still there.
Unfortunately the diff-window was the last one I closed and when I restart Sublime it opens the diff-view without menu.
Question is: How can I restore the default Sublime view?
To make my problem visible, this is what it looks like now:
Edit: Sublime is running on Linux Mint and is set to a German keyboard.
I had the same issue and in my case pressing ctrl+alt+p and selecting last project solved it.
If you are referring to the sidebar, you press super+k,super+b to toggle it on/off.
To close the sublimerge diff window, just press super+w.
edit after reading your comment/image:
To go back to a single pane view, press super+ctrl+1.
Ultimately, you can access the FileDiffs menu via the command palette (ctrl+shift+p) and type in menu.

How do i open a file via terminal with a specific editor?

How do i set a default application to open a file with my preferred text editor? I am currently trying open file.rb. It opens text wrangler, but I want to open with another. How do i do this?
Go to finder, right click on your file.rb file and select Get Info.
In the Info Window you'll see a section that says Open with, expand that section. There you can change the default application to open that particular file. There's also a button labeled Change All... This button allows you to use the specified application for all similar filetypes (*.rb).
You want to use the name of the editor you want to open with, i.e. gedit file.rb, or vim file.rb. You can probably also change your default editor associated with that file type, depending on your OS, etc.

How to Open files and folders in same window in Sublime Text on macOS?

If I open ~/foo.txt then open ~/baz/bar.txt from Terminal, Sublime Text always opens 2 different windows. It's aggravating to have all these different windows open..
I've tried changing a bunch of ST's settings, but nothing seems to fix this.
Is there a way to have ALL files and folders just open up in the same window as if I were manually adding all these folders to the project?
In Sublime Text Menu:
Preferences -> Settings - User
Look for 'open_files_in_new_window'
And change 'true' with 'false'
Rather than editing the SublimeText default settings (as Jahnux73 suggested), you should go to Preferences -> Settings - User, and add the following:
"open_files_in_new_window": false,
The SublimeText default settings file should not be modified, as it may be overwritten by Sublime updates, and so that you'll always be able to restore the default settings. The way Sublime works is that at runtime, it reads and applies the default settings, and then reads and applies the Settings - User file. In the event of a conflict, the User settings take precedence. That way, you can add your own settings without modifying the default configs.
Folder can be directly dragged to sidebar, or from menu bar select
Project --> Add Folder to Project.
And better, since this has the same functionality as File -> Open folder which isn't mapped to a shortcut by default. You can make this a key mapping by going to
File -> Preferences -> Key bindings and append
{ "keys": ["ctrl+shift+o"], "command": "prompt_add_folder" },
then you can use CTRL+SHIFT+O to add a folder.
Drag files or directories to sublime window will add them to current window instead of opening new one.
All the answers above indicate the parameter files only, but this does not work for folders.
I found this solution:
You need to go to the registry path HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3\command
Change command add the parameter -a, get: C:\Program Files\Sublime Text\sublime_text.exe "%1" -a
Also, if You have a custom alias for the console, you can use it like this: subl . -a
For mac OS two changes are needed
1-
Preferences -> Settings - User
Look for 'open_files_in_new_window'
And change 'true' with 'false'
2-
In system Preferences find the Dock and then change its setting for the option “Prefer tabs when opening documents” and choose Always.
Then do :
subl folder_1
subl folder_2
subl folder_3
I explained in details here
All those replies above didn't work. Here I found the real solution to this problem: -
Click Preferences
> Settings - Distraction Free
Then add these lines in user panel:
"open_files_in_new_window": false,
And click Save.
Here you go!!
None of the answers above worked for me.
I had a Sublime app icon pinned to the Dock and every time I opened a new file through the Finder context menu (Open With > Sublime Text.app) it went to a newly opened instance of Sublime that's displayed in "recent apps" zone of the Dock. So I always had 2 icons in the Dock, each with different set of tabs.
I simply removed the first icon from the Dock, and pinned the one from "recent apps" area, and dragged it to the place where the first icon used to be.
This seems to work fine provided that you set "open_files_in_new_window" to "false" (Preferences > Settings), as suggested in other answers.

Multiple editor windows in Xcode

When coding in Xcode, I double-click a file in the "Groups and files" list, and it opens a new editor window. I have several of these open at once.
Until today.
Today, when I double-click a file in the list, it opens the file in the last editor window I was using, meaning I can only have one editor window up at any one time.
I guess I've switched some option somewhere by mistake. How do I get it back to the way I like it?
I'm using Xcode 3.2.5
In the top right of the editing window is an icon that says "grouped", perhaps you clicked on it by accident.
Click on it so it says "ungrouped", and you'll be back to opening multiple windows.
perhaps preferences>General>Open Counterpart in same Editor

Resources