How to navigate between instances of selected text in Sublime Text 3?

孤者浪人 提交于 2019-12-02 22:51:45
Arthur

Yes, all you need to do is edit your key bindings (Sublime Text -> Preferences -> Key Bindings User) for "find_under". Copy & paste this into your bindings and set your keys (defaults are "alt+super+g" and shift+alt+super+g)

{ "keys": ["alt+super+g"], "command": "find_under" },
{ "keys": ["shift+alt+super+g"], "command": "find_under_prev" },

I may be misunderstanding your question but what you are asking seems pretty simple and I wonder if that means you might mean something else. Anyway here's an answer that I hope is what you are looking for.

First, ensure that you have the following set to true in your preferences:

// If true, the selected text will be copied into the find panel when it's
// shown.
// On OS X, this value is overridden in the platform specific settings, so
// you'll need to place this line in your user settings to override it.
"find_selected_text": true,

Select the string you are interested in.

Search in current file [OS X Cmd+F :: Windows Ctrl+F]

Now you can step through the matches:

  • Forward [OS X Cmd+G :: Windows F4]
  • Back [OS X Cmd+Shift+G :: Windows Shift+F4]

Some more here :: http://www.cheatography.com/njovin/cheat-sheets/sublime-text-2-keyboard-shortcuts-windows/

What am I missing in your question?

Florent Daligand

I also needed to navigate through occurrences of a word in a quicker way than:

  • Ctrl + F
  • Type world to find
  • Press F3 to find next occurrence.

And I just found this tip:

  • Select occurrence
  • Ctrl+F3 to find next occurrence, or Ctrl+Shift+F3 for the previous one.
  • At this point the occurrence is already the search text, so you can simply use F3 for next one and Shift+F3 for previous, if you need to navigate between more occurrences.

I hope this also helps you.

I'm on a mac, and this has sort of already been mentioned, but it doesn't require altering the hotkey menu and works well enough for me.

cmd+K keeps your highlight but deselects it

cmd+D expands your selection (now empty thanks to cmd+k) by including the next occurrence

highlight a string (one that recurs)

while holding cmd -> press K, then press D

alternating back and forth as many times as necessary.

Each time D is alternated to, your highlight and selection jump to only the next occurrence.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!