Reputation: 23500
In sublime if I use cmd+D to select every occurrence of 'old' the selection is case insensitive so will match old and camelOld. But when I start typing the capitalisation is not respected so i will get new and camelnew. Are there any shortcuts or plugins to get sublime to preserve first letter capitalisation when typing using multiple cursors?
Upvotes: 4
Views: 1347
Reputation: 1631
ctrl+d
)ctrl+h
)alt+a
), uncheck regex (alt+r
) and other stuff you don't wantThere are key shortcuts for all the steps except for "toggle_in_selection". You can put this in your keys to fix it:
{ "keys": ["alt+s"], "command": "toggle_in_selection", "context":
[
{ "key": "setting.is_widget", "operator": "equal", "operand": true }
]
},
NOTE: change the shortcut to whatever suits you best.
Alternatively, you can put this in your keys:
{ "keys": ["ctrl+h"], "command": "show_panel", "args": {"panel": "replace", "in_selection": true, "preserve_case": true, "regex": false, "highlight": true} },
with custom shortcut. You can use the original shortcut to overwrite it's default behavior.
It will prepare all those toggling and checking for you, so you can just
ctrl+d
all occurrencesctrl+alt+enter
to replace all...be careful, with "replace all"
Upvotes: 7
Reputation: 3819
There is a Sublime plugin that will help you do this a bit easier:
https://github.com/philippotto/Sublime-MultiEditUtils
The case preservation code was just merged today.
See the heading "Preserve case while editing selection contents"
Upvotes: 3