Capitalizing first letter with multiple cursors in sublime

In sublime, if I use cmd + D to select each "old" case, the selection is case insensitive, so old and camel old will match . But when I start typing, the capitalization is not respected, so I get a new one and camel a new one . Are there any shortcuts or plugins to get the sublime value to keep the first letter when typing using multiple cursors?

+4


source to share


2 answers


  1. Choose your word
  2. Select all the cases you want to change ( ctrl+d

    )
  3. Open Find> Replace ( ctrl+h

    )
  4. Check "in selection" and "keep case" ( alt+a

    ), uncheck regex ( alt+r

    ) and other things you don't need
  5. Go to the bottom field, write your replacement
  6. Replace all

There are hotkeys for all steps except "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 works best for you.

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 its default behavior.

It will prepare all these switches and checks for you, so you can simply

  1. Choose
  2. ctrl+d

    all occurrences
  3. use this shortcut
  4. to go to the bottom margin write replace
  5. ctrl+alt+enter

    to replace everything

... be careful with "replace all"

+6


source


There is a Sublime plugin to help you make this a little easier:

https://github.com/philippotto/Sublime-MultiEditUtils



The case save code was just leaked today.

See the heading "Preserve Case While Editing Selection Content"

+2


source







All Articles