Environment
Sublime Text: 3.1.1, Build 3176
Windows 10
Undesired Behaviour
I must have unintentionally pressed a keyboard combination as I have not had this issue before.
I cannot identify what circumstances create the undesired behavior, but sometimes this happens:
ie, I will be editing some text and realise that the cursor is in 2 (possibly more?) places and everything i am typing is also appearing in multiple places.
Edit: It seems to sometimes occurs after I have Ctrl + V / Ctrl + Shift + V pasted content.
What I've Tried
I've looked at this link, as the title sounded like it might be related:
https://www.sublimetext.com/docs/3/multiple_selection_with_the_keyboard.html
But on closer reading it doesn't seem to be.
I think the following answer might explain the behaviour, but not how to disable it:
https://stackoverflow.com/a/46800245
Desired Behaviour
I'd like to know how to disable the undesired behaviour.
Multiple Cursors on Sublime3, is activated by default either with
ctrl+left mouse button
or by
ctrl+shift+l
disabling ctrl+shift+l:
setting is called split_selection_into_lines. to disable it (Windows):
click Preferences, Key Binding, and on the file Default (Windows).sublime-keymap that will open add the line. (
{ "keys": ["ctrl+shift+l"], "command": "" },
be sure to put this inside the default brackets [ ].
Same is for Linux or Mac, only thing changes is the operating system name on the filename.
disabling ctrl+left mouse button:
Windows - create Default (Windows).sublime-mousemap in %appdata%\Sublime Text 3\Packages\User
Linux - create Default (Linux).sublime-mousemap in ~/.config/sublime-text-3/Packages/User
Mac - create Default (OSX).sublime-mousemap in ~/Library/Application Support/Sublime Text 3/Packages/User
open it with a text editor and paste the following lines in it:
[
{
"button": "button1",
"count": 1,
"modifiers": ["ctrl"],
"press_command": "",
"command": ""
}
]
Save and you are done. In my test, (win10, sublime text 3) method worked instantly, without even restarting Sublime Text 3.
Related
In the past, ctrl+w used to close a single tab in Sublime Text (3), and if there were no tabs left open, it would close the text editor. How can I achieve the same behaviour in the updated Sublime Text? ST 4
EDIT: The setting I was looking for is "close_windows_when_empty": true
Sublime Text 4 behaves for me as described - it closes all open files and when no files are open, it closes the editor.
However, you may have had your key bindings changed by a plugin/misconfiguration etc.
Preferences > Key Bindings will open up a file.
Ensure that for ctrl+w, the command is set to close not close_file.
Once changed, restart Sublime.
It should look like below:
...
{ "keys": ["ctrl+w"], "command": "close" },
...
Really strange, for me this settings wasn't working:
"close_windows_when_empty": true
tried and tested everything else, finally I've completely uninstalled Sublime 4 and reinstalled it (using AppCleaner, deleted all configs etc).
Now:
"close_windows_when_empty": false
is really set to false, BUT the last window is always closing "everything". exacty what I wanted. It works even the settings tells something else.
So: Reinstall possibly helps
I want to have a shortcut for showing/hiding the side menu, because I mainly use sublime on a flipped monitor.
I tried this but it doesn't work...
[
{"keys": ["ctrl+alt+q"], "command": "show_side_bar"}
]
t
The command is actually toggle_side_bar.
This can be discovered for any command or action by opening the console (Ctrl`) and running
sublime.log_commands(True)
Run whichever commands you wish, and the command names along with any runtime parameters will show up in the console. When you're done, it's usually a good idea to run
sublime.log_commands(False)
to avoid your console filling up with nonsense, such as every single key you press.
By the way, there already is a keyboard shortcut for showing and hiding the side bar: CtrlK,CtrlB. That means hit CtrlK, release them, then hit CtrlB.
I love working with Sublime Text, but one of its features annoys me sometimes which is "the accidental zoom in". Whenever that happens it breaks the momentum and I have to change it back to where it was and is kind of annoying. I searched for a shortcut which can reset the size back to normal but each one of them involved creating a python file and it does not work for me for some reason.
What would made my life much easier that if I could just change something in Preference.sublime-settings file and reset the font back to where I wanted it to be with just a shortcut key say "Control+0".
For background, Sublime Text 3 has commands named increase_font_size and decrease_font_size. These commands modify the font size up or down by some value (depending on what it is currently set to) and then directly modify the setting in the Preferences.sublime-settings file, which makes the change permanent everywhere.
These commands are bound by default to Ctrl+WheelUp/Down as well as Ctrl++ and Ctrl+-.
There exists a command reset_font_size (not bound to a key by default), but this command works by erasing the font size setting entirely; thus if you weren't using the default font size, this is unlikely to be useful. Additionally, this would also not reset any e.g. syntax specific font size.
There is a set_setting command which could be used to set the font size to one that you desire in a key binding, but this only modifies the font size of the current view (while the commands above make the change permanent globally), so this is a non-solution.
A solution that doesn't require a plugin to modify the behaviour would be to remove the binding from the mouse wheel entirely, or alter it so that it requires a different modifier key. That way it won't trigger by accident at all.
In order to do that, you need to create or modify the file Packages\User\Default.sublime-mousemap. In order to determine where your User package is stored, you can use Preferences > Browse Packages from the menu.
Something like the following stored as the contents of that file will remove the binding completely, so that font changes with the mouse wheel are not possible. If the file already exists, just add the second and third lines to the file, making sure that all entries end in a comma.
[
{ "button": "scroll_down", "modifiers": ["ctrl"], "command": "noop" },
{ "button": "scroll_up", "modifiers": ["ctrl"], "command": "noop" }
]
If you still want this functionality from the mouse, then you need a couple of extra lines to add the commands back. It's important that the two lines that map to the noop command remain; if you don't override them explicitly the defaults will remain.
Here's an example of requiring Shift and Control to both be held during a mouse scroll to modify the font size.
[
{ "button": "scroll_down", "modifiers": ["ctrl"], "command": "noop" },
{ "button": "scroll_up", "modifiers": ["ctrl"], "command": "noop" },
{ "button": "scroll_down", "modifiers": ["shift", "ctrl"], "command": "decrease_font_size" },
{ "button": "scroll_up", "modifiers": ["shift", "ctrl"], "command": "increase_font_size" }
]
Go to Preference->Settings and change the font size as you want....
Go to Preferences>keybinding
{ "keys": ["ctrl+shift+0",], "command": "reset_font_size" },
add this line at the last line before "]" in the right panel and save it.
Now every time you want to reset use this keyboard shortcut.
However, there isn't a keyboard shortcut for resetting the zoom/font size. Normally this would be super + 0(aka cmd + 0) in most apps, but Sublime Text doesn't give you this by default.
To get this feature you need to add the following to your keyboard bindings (found under Preferences -> Key Bindings)
{ "keys": ["super+0"], "command": "reset_font_size" }
Courtesy: coderwall.com
For Apple or MacOS, Press the Command Key -> ⌘) with either + or - key to increase or decrease text size in sublime accordingly
Press ctrl + to increase font and ctrl shift + to decrease font size.
I used and it works.
I am trying to use the package "Alternate VIM Navigation" in ST3 on Linux Ubuntu, but the alt+i and alt+h keybindings bring up the find and help menus rather than their movement keybindings:
{ "keys": ["alt+i"], "command": "move", "args": {"by": "lines", "forward": false}},
{ "keys": ["alt+h"], "command": "move_to", "args": {"to": "bol", "forward": true}},
I have been able to disable the alt key from displaying the application menubar using CompizConfig Settings Manager, but the alt+i still brings up the find menu (and likewise for alt+h).
I have looked in many places for an answer to this, but have found nothing that works for ST3 in Linux. Here are some related answers for OSX and Windows, and an answer in Ubuntu that suggests the CompizConfig Settings Manager:
https://askubuntu.com/questions/553687/change-or-disable-modifier-key-alt-which-activates-the-application-menubar
Change behavior of Alt key in Sublime Text 2
Stop Alt key bringing up the menu in Sublime Text 2
Any solution to this in ST3 for Linux would be much appreciated!
This worked for me:
Open Sublime's packages directory by going to Preferences > Browse Packages.
Open the User directory and create a file called Main.sublime-menu
Paste the following in:
[
{
"caption": "Help",
"mnemonic": "",
"id": "help"
}
]
Save the file and enjoy!
I found a bit of a strange workaround...
I have a sublime text package called "SubRed" which has a file "Main.sublime-menu" (it's in .config/sublime-text-3/Packages/SubRed - I manually installed the package).
To disable the menubar all I have to do is:
ctrl+shift+p view: toggle menu (which does not disable the menu by
itself for some reason),
open the Main.sublime-menu file in sublime,
save it.
Then voila, the menu bar is gone and I can finally use my Alternate Vim package key bindings without conflicting with the alt+[menubar mnemonic].
To get the menu bar back if needed, just simply do ctrl+shift+p view: toggle menu.
If anyone could suggest a better solution based on this (which doesn't involve a random 3rd party package) that would be much appreciated!
The ideal solution would be to not have to disable the menubar, but get it to work like windows where user or package defined st3 keybindings take precedence over default or system bindings. So if "alt+i" is defined by the package as "move up a line", then it no longer opens the "Find" menu, but actually (eureka!) moves up a line! But opening the "Find" menu is still possible with "alt, i" in sequence.
I'm using the newest build (3033) of Sublime Text 3 on OS X 10.8
(This also was happening in build 3021)
I've setup some shortcuts to open an overlay of custom commands using the following in my sublime-keymap file:
{ "keys": ["command+f1"], "command": "show_overlay", "args": {"overlay": "command_palette", "text": "PHP"} }
I've noticed recently the using the down arrow works to navigate the menu but for some reason the up arrow does not in the way it used to. The up arrow works if I down arrow a few items then use up to go back up but it does not work to wrap from the first item to the last item on the overlay. Sublime Text 2 did (and still does) this on my computer.
Am I missing something? (it's mildly frustrating)
UPDATE
If I do a command + shift + P to open the Command Pallet or command + R to open the Goto Symbol overlay the up arrow does not work when trying to wrap around the list. It does in ST2.
ADDTIONAL UPDATE
Now on OS X 10.11 and Sublime Text 3 build 3103 and still the up arrow does not work.
I also posted this here: http://www.sublimetext.com/forum/viewtopic.php?f=3&t=12333
This behavior is still true (Sublime Text 3 Build 3103). Seems to be a software limitation (feature?) since they encourage the use of the fuzzy search bar that comes with the overlay window.
Also, there is no preference/setting that enables the wrapping.
It would be nice to have it.