How do I disable or lower the priority of a package's keybinds? - sublimetext3

I'm using a package (in this case, MarkdownEdit) that has keybinds that are conflicting with those of my other packages.
Is there any way that I can either disable a given package's keybinds or prevent it from overriding other keybinds?

The easiest thing to do would be to create a Default (yourplatform).sublime-keymap file in Packages/MarkdownEditing with an empty JSON array to override the original.
Create a new JSON file with the contents
[
]
Select Preferences → Browse Packages… (or, on macOS, Sublime Text → Preferences → Browse Packages…) to open your Packages folder:
Linux: ~/.config/sublime-text-3/Packages or ~/.config/sublime-text/Packages
OS X: ~/Library/Application Support/Sublime Text 3/Packages or ~/Library/Application Support/Sublime Text/Packages
Windows Regular Install: C:\Users\YourUserName\AppData\Roaming\Sublime Text 3\Packages or C:\Users\YourUserName\AppData\Roaming\Sublime Text\Packages
Windows Portable Install: InstallationFolder\Sublime Text 3\Data\Packages InstallationFolder\Sublime Text\Data\Packages
The exact path depends on version and whether or not you upgraded from Sublime Text 3.
In that folder, create a folder called MarkdownEditing. Save your new JSON file in that folder as Default ($YourPlatform).sublime-keymap, where $YourPlatform is one of Windows, OS X, or Linux, depending on your actual platform.
Restart Sublime Text.
Now, all of the keybindings from MarkdownEditing should be nullified, giving you the originals that shipped with Sublime (or overrides you've already made).

Related

sublime location of packages (can only find hex packages), how to modify packages?

I would like to add to a sublime package so that it can work right now (and then make a PR to the repo after).
I've installed Expand Selection To Quotes on Sublime Text 3. I go to Preferences\Browse Packages which takes me to ~/Library/Application Support/Sublime Text 3/Packages
I cannot find this package anywhere, so I look around the App's root and found it here: ~/Library/Application Support/Sublime Text 3/Packages/Installed Packages/Expand Selection to Quotes.sublime-package
This file is filled with hex values and is 2.2KB in size. I cannot modify this file and I'm not sure if it's the right file or if it's just a metadata file.
I ended up with a different solution than to modify the existing folder.
I forked the repo, made my code updates, then cloned it into the Packages folder. Sublime picks it up automatically plus any further code changes that you want to tweak.

Change Sublime Text 3 packages path

is it possible to change the default packages directory path in Sublime Text 3?
For now, the default path is:
C:\Users\my_user_name\AppData\Roaming\Sublime Text 3\Packages
Would it be possible to change it ? For example to this:
C:\my_folder
Thank you.
For the non_portable version:
QUIT Sublime Text 3
Delete the [Sublime Text 3] directory under C: \ Users \ Administrator \ AppData \ Roaming \ Sublime Text 3
Creat new folder [DATA] under installed [Sublime Text 3]
as d:\Program Files\Sublime Text 3\DATA\
Open Sublime Text 3 and then install the [Package Control] process,
reference operate as https://packagecontrol.io/installation
Done. It change to \DATA\ folder
The non-portable version of Sublime Text on Windows uses the USERPROFILE environment variable to decide where to place the roaming folder.
So the only options are to set this environment variable to something else, create a directory junction, or use the portable version of ST.

How to copy file name of currently opened file in sublime text 3?

How do you copy the file name of the currently opened file in sublime text 3 ?
If this is not possible by default, perhaps you know some sublime extension which does that job using keyboard shortcut.
You can do this if you have the SideBarEnhancements plugin installed.
Open up the command palette with Ctrl+Shift+P (on Mac it is ⌘+Shift+P)
Type File: Copy Name and press Enter
The file name has now been copied to your clipboard.
Setting a hotkey for this command:
Go to your Key Bindings -> User file
Add this line to your file: { "keys": ["ctrl+shift+l"], "command": "side_bar_copy_name" }
Change "ctrl+shift+l" to whatever command you want to use.
In Sublime Text 3 and 4, you can simply right-click within the file body itself and select Copy File Path.
Using the SideBarEnhancements plugin is also an option when you're browsing through files contained within folders that you have added to your project (that show on the lower part of the sidebar). There, just right-click on the file and select Copy Path or Copy Dir Path.
You can download CopyFileName to do just that.
To install it, extract the .zip file to your Packages folder, wich you can access via:
Preferences --> Browse packages
To actually use it:
Open or preview the file --> Right click somewhere in it (not on the tab) --> Copy File Name

How to install sublime package without package control?

How can I install a sublimetext3 package manually, without the package control. I am trying to fix a bug in an existing package, therefore I need a way to test my changes.
what are the naming conventions to be followed when naming the zip file?
Where do I place it?
what other configurations I have to do?
Download the ZIP, and then place it in your Packages directory which can be found by doing Sublime Text -> Preferences -> Browse Packages...
what are the naming conventions to be followed when naming the zip file? Where do I place it? what other configurations I have to do?
This really depends on the specific package you are downloading. For some packages, you can name it whatever you want. For others, the name has to be exact. If you are downloading these packages manually from GitHub, I urge you to read the documentation in the README. They usually provide instructions for manual installation. For example, if you wanted to download the Spacegray theme manually, it tells you to download the ZIP, unzip the folder, and rename it to Theme - Spacegray.
Depending on your OS, your package directory might be one of these and for most of the packages, just extract the content to this folder (with it's root folder as the name)
Linux: ~/.config/sublime-text-3/Packages
OS X: ~/Library/Application Support/Subime Text 3/Packages
Windows: %APPDATA%\\Sublime Text 3
I am trying to fix a bug in an existing package, therefore I need a
way to test my changes.
I was in the same situation. The accepted answer didn't work for me because Package Control would automatically remove the folder. I found this to be helpful:
https://packagecontrol.io/docs/customizing_packages
Sublime Text 3 offers the most options for overriding a package. By
default, packages will be installed by placing a .sublime-package file
in the Install Packages/ folder. Then users may override individual
files in the package by creating a folder Packages/{Package Name}/ and
placing edited files in there.
Another approach is PackageResourceViewer, which allows you to extract and override individual files from packages, including the built-in packages.
The best answer I think, so far, is this one by #Andreas Haferburg.
The most-upvoted answer also has some really useful information, such as the link to the spacegray package which states:
Manual
You can also install the theme manually:
Download the .zip
Unzip and rename the folder to Theme - Spacegray
Copy the folder into Packages directory, which you can find using the menu item Sublime Text -> Preferences -> Browse Packages...
That is where I first learned about the existence of the Packages folder and how to find its path.
Using those answers together, plus putting in about 1 weekend worth of work into learning about how Sublime Text packages and syntax highlighting work, I wrote the following "Developer Notes & Package Development Tutorial", on GitHub, as well as these "manual installation" instructions.
In short, to "install a package" withOUT Package Control, all you need to do is put the package into your Sublime Text Packages folder, whose path can be found by going to Preferences --> Browse Packages.... The folder name can be anything. It only needs to match what is inside the Installed Packages dir (which is at the same level as the Packages dir) if you want to override an already-installed package which was previously installed by Package Control in "packed" (zip file) format.
The main link you should study, aside from my tutorial, is this: https://packagecontrol.io/docs/customizing_packages.
1. How to manually install a package
Here are some of the key quotes and instructions from my manual installation instructions and tutorial.
Again, note that I am only requiring that the name in the Packages folder be something specific like gcode in the instructions below because my instructions are intended to override a Package-Control-installed package the reader may already have installed. If you want to install for the first time, or make a new package, the folder name you use inside the Packages folder can be anything.
2. Manual installation
In Sublime Text, find the path to your Packages folder by clicking Preferences --> Browse Packages.... This will open up your GUI file manager to the path where Sublime Text packages are stored. For me on Linux Ubuntu 20.04, that's /home/gabriel/.config/sublime-text-3/Packages (even though I am running Sublime Text 4).
Now, extract this package to that folder.
Option 1: the GUI way: click the green "Code" button above --> "Download ZIP" --> save the zip file, extract it to your Packages path above, and rename it to gcode.
OR Option 2 [what I prefer]: the command-line way:
# --------------
# Option 2.A: clone the repo directly into your "Packages" dir
# --------------
# cd to the Packages dir (change this path according to your Packages path above)
cd "$HOME/.config/sublime-text-3/Packages"
# clone the repo
git clone https://github.com/ElectricRCAircraftGuy/sublime_gcode.git
# rename the repo dir to "gcode"
mv sublime_gcode gcode
# --------------
# OR Option 2.B [what I prefer]: clone the repo into wherever you want, and then
# symlink it into your "Packages" dir
# --------------
# clone repo into ~/dev
mkdir -p ~/dev
cd ~/dev
git clone https://github.com/ElectricRCAircraftGuy/sublime_gcode.git
# now symlink it into your Packages dir
ln -si ~/dev/sublime_gcode ~/.config/sublime-text-3/Packages/gcode
That's it! The gcode entry is now instantly available in your syntax highlighting menu.
Developer Notes & Package Development Tutorial
...
...
...
Sublime Text packages and syntax highlighting--how it all works
And here are some really important notes about Sublime Text packages and how Package Control works:
1. Sublime Text packages
Any folder inside of your Sublime Text Packages folder (found via Preferences --> Browse Packages...) is automatically instantly loaded by Sublime Text as a "package".
Packages installed by the Package Control package, however, come in two types:
Packed: most packages installed by Package Control are "packed" into a zip file named packageName.sublime-package and are located inside the Installed Packages dir which is at the same level as the Packages dir.
If you manually create a dir inside the Packages dir and name it packageName (to match the packed file above), then any files in it with the same name as those in the packed package will override those in the packed package. See the "Overrides" section here: https://packagecontrol.io/docs/customizing_packages.
Unpacked: any package which is installed in the Packages dir is unpacked.
Developers can tell Package Control to unpack a package installed by Package Control by placing a file named .no-sublime-package at the root of their repo. See here: https://packagecontrol.io/docs/submitting_a_package.
Unpacked packages are required if they contain binary executables which need to be run by the system, for instance, as they apparently can't run from inside the packed zip file.
2. Syntax highlighting
Hopefully I got all of this straight.
If you want to learn more about Syntax Highlighting in Sublime Text, and how it maps to scope entries in your Color Scheme, read my tutorial.
2. Test your changes
I am trying to fix a bug in an existing package, therefore I need a way to test my changes.
See also this section in my tutorial:
To modify and test changes to this package locally...
...in case you'd like to change it or contribute to it, follow the "manual installation" instructions above. If you have already installed it via Package Control, then what is in your /home/$USERNAME/.config/sublime-text-3/Packages/gcode folder will override what is in your /home/$USERNAME/.config/sublime-text-3/Installed Packages/gcode.sublime-package zip file which Package Control installed, so long as the folder and file names are the same.
Modify any files in the Packages/gcode dir as desired. Each time you save, the changes will instantly be reflected in all Sublime Text editors you have open. As a quick test:
Open a gcode file.
Click your cursor on some text in the file.
Use the Tools --> Developer --> Show Scope Name trick to see what the scope is for that text.
Open the corresponding *.sublime-syntax file.
Change or delete the regular expression in the match entry for that corresponding scope you just found, so that it no longer matches the text on which you placed your cursor.
Save the *.sublime-syntax file and you will instantly see the formatting of that text in the gcode file change.
Undo your change to the match entry and save again. The formatting will return to how it was.
Go to Preferences --> Customize Color Scheme, and add a custom rules entry for that scope, with new formatting for that scope. Save it and watch the formatting instantly change again. Delete that custom entry when done, if desired.

build file location for sublime version 3

The Sublime2 build files are located at \Sublime Text2\Packages\ folder, but I cannot figure out where Sublime3 put those files. Can anyone give me some help?
Language.sublime-build files (and everything else that used to be under the Packages/Language hierarchy) are now included in the zipped Language.sublime-package files found in Sublime Text Build 3XXX/Packages/. I haven't found an obvious way to edit these files in a cross-platform-consistent manner, so the easiest thing is to unzip the .sublime-package file into a folder named for that language, then move the folder to the Sublime Text Build 3XXX/Data/Packages/ folder. As I understand it, any file in Data/Packages/Language will overrule whatever is contained in the corresponding Packages/Language.sublime-package file.
EDIT
For Windows installations (not unzipped portable installs) use the C:\Users\YourNameHere\AppData\Roaming\Sublime Text 3\Packages folder. The Users subdirectory in this folder is where all your user-specific preferences, keymaps, build systems, etc. go, similar to the Packages\User directory in ST2. So, if you want to unzip and modify the Python.sublime-package file, for example, unzip it into AppData\Roaming\Sublime Text 3\Packages\Python and you'll be all set, as I described above.
CLARIFICATION
The Packages directory is the one opened when selecting Preferences → Browse Packages…:
Linux: ~/.config/sublime-text-3/Packages or ~/.config/sublime-text/Packages
OS X: ~/Library/Application Support/Sublime Text 3/Packages or ~/Library/Application Support/Sublime Text/Packages
Windows Regular Install: C:\Users\YourUserName\AppData\Roaming\Sublime Text 3\Packages or C:\Users\YourUserName\AppData\Roaming\Sublime Text\Packages
Windows Portable Install: InstallationFolder\Sublime Text 3\Data\Packages InstallationFolder\Sublime Text\Data\Packages
The exact path depends on version and whether or not you upgraded from Sublime Text 3.
Also, instead of manually unzipping .sublime-package files, just use the excellent PackageResourceViewer utility. It does exactly what I described above without the hassle.
On OS X, ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/User works for me.
Just in case someone runs into the same prob on a Mac and can't find the file:
I was trying to find this on a new Mac to edit my compass.sublime-build file, but couldn't find the folder. To look in ~/Library/Application Support/Sublime Text 3/Packages/... you have to press and hold the Option key to see the folders in bold, since it's all hidden folders.
Hope that helps someone.
Bit of a crazy workaround, but if you create a new build system, then when you save the file, you have access to the relevant folder. Before saving, you can drag unwanted files to the rubbish bin, and ones you want to read can be dragged to the file system icon in the launcher and placed somewhere where they can then be opened.
I did a search for sublime-build and heres what I got:
So for Windows, the directory for Sublime Text 3 is:
C:\Users\horse\AppData\Roaming\Sublime Text 3\Packages\User
and the Python build for Sublime 2 for example is located here:
C:\Users\horse\AppData\Roaming\Sublime Text 2\Packages\Python
On Linux, this is the folder you which contains .sublime-build files that you created under Tools > New build System.
/home/<username>/.config/sublime-text-3/Packages/User
If you are using Ubuntu then you can find your previously build files in
/home/your_user_name/.config/sublime-text/Packages/User
.config is a hidden directory, make sure you press control + h so that you can view all the hidden files and folders

Resources