sublime-selectuntil icon indicating copy to clipboard operation
sublime-selectuntil copied to clipboard

Feature request: command or search argument to quickly expand to the nth occurence of word

Open certainlyakey opened this issue 10 years ago • 7 comments

I often use selectUntil to quickly select foreach blocks, therefore I need to put endforeach (or more concise endf) as a search query. However, foreach blocks may contain other foreach'es inside, and it requires an Enter, ctrl+shift+s, Enter chain of keystrokes to go past inner terms and select to the second or more occurence of word.

Is it possible to make a separate bindable command for expanding the selection to the next occurence (while the panel is open) or introduce a search argument for expanding to the nth occurence at once?

For example, the query endf*2 would allow to quickly expand the selection to the end of the following block ignoring inner endf occurence:

foreach( $events as $post ) : setup_postdata($post); 
    if ($post->news) {
        echo '...';
        foreach ( $post->news as $newspiece ) : setup_postdata( $newspiece );
            echo '...';
        endforeach;
        echo '...';
    }
endforeach;

Thank you for a great plugin.

certainlyakey avatar Jan 24 '15 11:01 certainlyakey

I'm a little worried about adding more syntax to the query selector. Perhaps a good middle ground would be to introduce a new shortcut that immediately repeats the previous selection?

Something like ctrl + shift + alt/command + s?

Let me know if that's a good compromise.

xavi- avatar Jan 26 '15 19:01 xavi-

Yes, that would be an optimal solution. Is it possible to make it work without closing the panel, so the results could be still previewed like it happens now?

certainlyakey avatar Jan 26 '15 20:01 certainlyakey

Interesting. Yeah, I'll try that.

On Mon, Jan 26, 2015 at 12:39 PM, certainlyakey [email protected] wrote:

Yes, that would be an optimal solution. Is it possible to make it work without closing the panel, so the results could be still previewed like it happens now?

— Reply to this email directly or view it on GitHub https://github.com/xavi-/sublime-selectuntil/issues/12#issuecomment-71533605 .

xavi- avatar Jan 26 '15 20:01 xavi-

@xavi- Any update on this issue? Would love to have this feature in this package.

Have you thought about something simpler like using F3 when you have the text input open? Many other builtin commands use F3 to select/goto next instance of somethiing, for example how incremential search works.

Grokzen avatar Sep 20 '15 22:09 Grokzen

Could you instead rely on the amount of indentation that you expect? Like:

/^    endf/

adzenith avatar Jan 29 '16 22:01 adzenith

pumped for this feature :)

an extra shortcut (I'd use shift+ctrl+e cos g is too far away) and keeping the panel open for preview would be amazing!

many thanks for the awesome tool! I use it daily

ptim avatar Mar 18 '16 13:03 ptim

A context-specific binding to ctrl+enter to skip the current find result (and ctrl+shift+enter to go back) would be perfect for this.

FichteFoll avatar Jul 16 '16 23:07 FichteFoll