Unmap ctrl+space in Sublime Text 3 - macos

On OS X, I have ctrl+space mapped systemwide to "Help...Search". However, in Sublime Text 3, the default for ctrl+space is auto-complete. In Sublime Text 2, I was able to edit the default keymap and just delete it, but it seems like you can no longer edit the default keymap anymore.
Is there any way in Sublime Text 3 to "undefine" a keymap so that Sublime will allow the operating system wide shortcut to take effect instead?

Select menu. Sublime Text > Preferences > Key Bindings - Default
Default (OSX).sublime-keymap (read-only) will open.
Save as new file has same name to ~/Library/Application Support/Sublime Text 3/Packages/Default (not exist. create new folder).
Close (2)
Do (1) again.
You can edit default keymap :)

Go to /Applications, left-click on Sublime Text.app, and select "Show Package Contents". Open Contents/MacOS/Packages/Default.sublime-package in TextWrangler (it's a free d/l if you don't have it) - it supports editing ZIP files. You should now be able to edit Default (OSX).sublime-keymap and save the whole package. Restart ST3 and you should be good!

Related

Add a right click option in windows

Is it possible to add an option to the list when you right-click on a file or folder in the windows file explorer? More specifically I use the Sublime text editor, and I'd like an option "Open in Sublime" when I right-click a folder or file.
I use Windows 10 Pro and Sublime Text 3, both up to date.
Quick google search gives already quite precise results: Sublime as default editor
You can't do right click and open a folder in Sublime but if you open Sublime you can open a folder from there. Here is the feature request on GitHub: https://github.com/SublimeTextIssues/Core/issues/113

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

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.

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.

How do I edit the Solarized (Light) theme in Sublime Text 3

I am trying to edit some of the syntax colours in Sublime Text 3. I'm using the Solarized (Light) built in colour scheme but I only want to change a few of the colours. Where is the settings file (on a Mac)?
I have managed to find a solution:
Go to http://tmtheme-editor.herokuapp.com (someone has built a web-based theme editor). Once you have tweaked the colour syntax you can download the themename.tmTheme file. Move that file to /Users/username/Library/Application Support/Sublime Text 3/Packages/ User/ (if you are on a Mac).
Load in the syntax theme from the top menu: Sublime Text > Preferences > Color Scheme > themename.
If you want to tweak you syntax further up can upload the custom theme back in the web-based theme editor and save it out again.
Hope this helps someone else.
I'd recommend using PackageResourceViewer to open the file. You could make your modifications there, and it would save in the proper location to override the built in files. However, I would recommend copying the contents of the file and creating a custom version in your User folder. That way, you can easily move it around and modify it without worrying about the built in color schemes.
The default color scheme files are located in Color Schemes - Default.sublime-package. In ST2, this was extracted to Packages/Color Scheme - Default. PackageResourceViewer will display these folders (as they would normally appear in the Packages folder in ST2. You could navigate to your color scheme from that.
This should be much easier than it is
I used parts of all the other answers to make this work.
Important notes before you begin:
1. I had used this menu item to select a colour scheme: Sublime Text > Preferences > Color Scheme
2. I chose "Monokai.tmTheme"
3. Therefore the file you need containing the colours is: Monokai.tmTheme
4. You will NOT have easy access to that file yet!!
Overall Steps:
The overall steps I found to work are:
1. Get a copy of the Monokai.tmTheme text file
2. Place it in your "/Users/XXX/Library/Application Support/Sublime Text 3/Packages/User" directory
(replace XXX with your username)
3. Again use this menu: Sublime Text > Preferences > Color Scheme
4. Choose the new entry "Monokai - User"
5. Any changes to your Monokai.tmTheme file will immediately be seen by Sublime Text
Getting the Monokai.tmTheme text file :
This is the tricky part.
You have two options
Option A. Use PackageResourceViewer to open the resource:
A1. Tools -> Command Palette
A2. Type "PackageResourceViewer"
A3. Choose "PackageResourceViewer: Open Resource"
A4. Navigate to "Color Scheme - Default"
A5. Navigate to "Monokai.tmTheme"
A6. This will open the contents of the file but it is NOT a real file on your disk! You must copy the contents into a new text document and save it into "/Users/XXX/Library/Application Support/Sublime Text 3/Packages/User/Monokai.tmTheme" as above
Option B. Use the web app to create your .tmTheme file:
B1. Goto http://tmtheme-editor.herokuapp.com
B2. Edit the colours
B3. Download the .tmTheme file
B4. Put it into "/Users/XXX/Library/Application Support/Sublime Text 3/Packages/User/Monokai.tmTheme" as above
Editing is way simpler than advices above.
Go to Sublime installation folder, find there Packages subfolder.
Open Color Scheme - Default.sublime-package as a zip archive (I use Total Commander and Ctrl+PgDn keys).
Find there any scheme you like *.tmTheme, copy to HDD and edit with any XML editor.
Pack modified file back (with Total Commander just copy file to opened archive).
Sublime version, OS & OS version independent way:
In Sublime, at the top menu bar goto "Sublime Text 2/3" -> Preferences -> "Browse Packages...".
This will open the "Packages" folder correctlin Finder/FileExplorer/Nautilus/... depending on OS/version-of-OS.
Find your theme and edit away..
Source
As of May 2018 using Sublime Text 3:
I followed the Overall Steps and Option A. from #davidfrancis with great success to customize the Mariana color scheme.
However, I had to change the file extension from <name>.tmTheme to <name>.sublime-color-scheme. Also, the filename can be anything you want (don't need to keep the default), and it will appear under Preferences > Color Scheme.

Vim as the default editor

I'm on Windows XP and I just installed GVim 7.3. How do I make the default editor? How can I make it run using the command prompt
e.g.
c:\Windows>gvim boot.ini
open this file in gvim.
Thanks a lot
Add Gvim to your PATH variable
To be able to call Gvim from the command line, you have to add the installation directory of Vim to your PATH variable. To do that, right click on My Computer on the desktop (or in Explorer) → Properties → Advanced Tab → Click on Button Environment Variables.
In the Dialog, go to the User Variables field and search if there is already a PATH variable. If there is a PATH Variable, select it, click Edit and change it as follows:
%PATH%;C:/Program Files/Vim/Vim73
(or whatever the installation directory of Gvim is).
If there is no PATH variable set, create a new one with the content written above.
Confirm everything with OK, then open a new command window (important!), navigate to the desired directory and type
gvim somefile.txt
This should bring up your favourite editor.
Set Gvim as default editor for a certain file type
Adding Gvim to your PATH doesn't make Gvim the default editor for a certain file type. This can be achieved the following way:
In Explorer, right click on any file and select Open With → Choose Program
in the upcoming window, select Vi improved - A Text Editor or browse for gvim.exe if the entry is not already there
select the Always use the selected program ... checkbox and click OK
from now on, every time you double-click the file, it will be opened with Gvim
The easiest way
If you install Gvim, be sure to check the Add to context menu option. If you did that, you can right click on any file in the Windows Explorer and select Edit with Vim.
Right click the any file you want to open -> select Open or Open With ->check always open with the following editor.
After installing vim the "Edit with vim..." menu item appears in the context menu (RMB click on any file to check). Thus you can edit any file (not only text file) with just selecting this menu item
Add gvim to the PATH variable and you can run it right as you want:
c:\Windows>gvim boot.ini

Resources