If you are on Sublime Text build 4153 or newer:
A new command called current_result
was added for this purpose: https://github.com/sublimehq/sublime_text/issues/6014#issuecomment-1669019483
If you are on Sublime Text build 4143 or older:
It is possible to emulate a double click in Sublime Text by executing the drag_select
command with an argument of "by": "words"
(as seen in the Default sublime-mousemap
file).
However, you need to pretend that the mouse is where the caret is for this work. The following plugin will do this (Tools menu -> Developer -> New Plugin..., and replace the template with the following):
import sublime
import sublime_plugin
class DoubleClickAtCaretCommand(sublime_plugin.TextCommand):
def run(self, edit, **kwargs):
view = self.view
window_offset = view.window_to_layout((0,0))
vectors = []
for sel in view.sel():
vector = view.text_to_layout(sel.begin())
vectors.append((vector[0] - window_offset[0], vector[1] - window_offset[1]))
for idx, vector in enumerate(vectors):
view.run_command('drag_select', { 'event': { 'button': 1, 'count': 2, 'x': vector[0], 'y': vector[1] }, 'by': 'words', 'additive': idx > 0 or kwargs.get('additive', False) })
To be used in combination with a keybinding like:
{ "keys": ["alt+/"], "command": "double_click_at_caret" },