Ialberquilla
Ialberquilla

Reputation: 133

Macro on sublime text 3

I want to create a macro in sublime text 3, to do:

Replace all beginnig of the line with ' Replace all beginnig of the end with ',

I recorded the macro doing this with cntl H and making the replaces, then save the macro but when I want to execute it don't do it.

Is there any other way to record macros for replaces?

Example:

Before:

12313
12313
12313
12313
12313
12313
12313
12313
12313
12313
12313
12313
12313
12313
12313
12313
12313
12313
12313

After:

'12313', '12313', '12313', '12313', '12313', '12313', '12313', '12313', '12313', '12313', '12313', '12313', '12313', '12313', '12313', '12313', '12313', '12313', '12313'

Thanks Regards

Upvotes: 1

Views: 1349

Answers (1)

sergioFC
sergioFC

Reputation: 6016

You can do it using this actions (which you can record and save in a macro):

  1. Press ctrl+a: select all.
  2. Press ctrl+shift+l: split selection into lines.
  3. Press home: move every cursor to the beginning of each line.
  4. Press ': add ' char at the bbeginning of each line.
  5. Press end: move cursor at the end of each line.
  6. Press ' and then space and then , and then supr.
  7. Press ctrl+end to move at the end of the line.
  8. Press backspace two times to delete the extra space and comma at the end of the line.

You can also probablly do it using regex and snippets but macros are also a good way.

Upvotes: 1

Related Questions