One very long standing habit I have with my IDE of many years is that the CTRL (or command) + Click selects a full word. It is the equivalent of doing a double click on a word currently in ST2. I am hoping to be able to restore this ability in ST2. Would I go about it with a key-binding or a plugin?
Users can customize their key bindings by creating a file named Default. sublime-keymap in their Packages/User/ directory. For example, the following will create a key binding to show unsaved changes, if any exist, via Ctrl+Shift+`.
Sublime Text comes with a default SUBLIME-KEYMAP file, which is located in the /Packages/Default directory, and a user SUBLIME-KEYMAP file, which is located in the /Packages/User directory.
Key maps of the corresponding platform will be loaded in the Sublime Text editor. A user can open the keymap file or default key bindings using the option Preferences → Key Bindings.
In Sublime Text, you can quickly jump to any line in the code. Hit Ctrl–G (Mac and Windows). Type in a line number and hit Return/Enter to go to that line.
If you create a sublime-text-2/Packages/User/Default (Linux).sublime-mousemap
file (assuming you are on Linux) and put this in it (If the file is already there then put it at the end of the file within the square brackets already present):
[
{
"button": "button1", "count": 1, "modifiers": ["ctrl"],
"press_command": "drag_select",
"press_args": {"by": "words"}
}
]
It will override the standard Ctrl+Click behaviour, and do what you want. However the default Ctrl+Click behaviour is very cool - allowing for simultaneous multiple selections and cursors (try Ctrl+Clicking in different places in a file), so you may want to reassign that functionality elsewhere. If you wanted to change the multi-select feature to Ctrl+Alt+click, you can do this by also adding, inside the square brackets:
{
"button": "button1", "count": 1, "modifiers": ["ctrl", "alt"],
"press_command": "drag_select",
"press_args": {"additive": true}
}
It Works for st3, i think works in st2
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
Win - create "Default (Windows).sublime-mousemap" in %appdata%\Sublime Text 3\Packages\User
[
{
"button": "button1",
"count": 1,
"modifiers": ["ctrl"],
"press_command": "drag_select",
"command": "goto_definition"
}
]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With