# Command strategy for \`if\`

**URL:** <https://discuss.kakoune.com/t/command-strategy-for-if/202>\
**Category:** Recipes & Guides\
**Created:** [November 28, 2018, 9:56pm UTC](https://discuss.kakoune.com/t/command-strategy-for-if/202 "2018-11-28T21:56:21Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![andreyorst](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/andreyorst/32/29_2.png) [@andreyorst](https://discuss.kakoune.com/u/andreyorst)\
**Post date:** [November 29, 2018, 12:10pm UTC](https://discuss.kakoune.com/t/command-strategy-for-if/202/3 "2018-11-29T12:10:13Z")

</div>

Yep, that’s how I do it for _sublime style_ multi-cursor mapping. I take length of selection and if it is 1 char, I select word, if it is more then 1 char I jump to the next same word:

> [@Sublime Text style multiple cursor select/add mapping](https://discuss.kakoune.com/t/sublime-text-style-multiple-cursor-select-add-mapping/150):
>
> sometimes it feels more natural to select word and jump to next occurence(s), so instead of doing \<a-i\>w\*\<s-n\>\<s-n\>\<s-n\>... multiple times I use this command: define-command -override -docstring "select a word under cursor, or add cursor on next occurrence of current selection" \ select-or-add-cursor %{ execute-keys -save-regs '' %sh{ if [$(expr $(echo $kak\_selection | wc -m) - 1) -eq 1]; then echo "\<a-i\>w\*" else echo "\*\<s-n\>" fi }} map global normal '\<c-d\>' ': se…

---

_[View the full topic](https://discuss.kakoune.com/t/command-strategy-for-if/202)._
