Reputation: 21088
Is there a shortcut or a command to select word under cursor in Sublime Text or Atom? I want a replacement for double-click. So I could press shortcut instead and get selection on a current word and start typing to replace it or get in quotes etc...
Upvotes: 92
Views: 40206
Reputation: 13373
command+d on OSX
control+d on Windows/Linux
You can find all the default keybindings by going to Preferences > Keybindings - Default
and perusing the list.
Upvotes: 158
Reputation: 1732
*
- to find next
#
- to find last
For both, all matches are highlighted
For current file: CMD+E, CMD+F, Enter
Explanation:
CMD+E
- copies the word under cursor
CMD+F
- bring up find in local file dialogue
Enter
- er you know what this means
Substitute CMD+F
for CMD+SHIFT+F
to find in all files in project (or whatever search range you specify)
Upvotes: 2
Reputation: 1497
install ExpandRegion if you want to expand the selection:
Upvotes: 10
Reputation: 61
I looked around for this and eventually came up with this, which I assigned to ctrl-F
you need to paste it into a new user plugin python file
import sublime, sublime_plugin
class find_under_cursor(sublime_plugin.WindowCommand):
def run(self):
view = self.window.active_view()
view.run_command("expand_selection", {"to": "word"})
view.run_command("slurp_find_string")
self.window.run_command("show_panel", {"panel": "find", "reverse": False} )
Upvotes: 5
Reputation: 43698
You can add a key binding to select the word:
{ "keys": ["ctrl+shift+w"], "command": "expand_selection", "args": {"to": "word"} }
Unlike the find_under_expand
command (control+d
by default) repeated presses won't add cursors at matching words.
Upvotes: 19