Hello,
I’m coming from being a big NEdit user. One of the reasons I use that program is for its excellent macro support.
I have tried using Sublime Text Macros for a little bit and am a bit frustrated.
Perhaps I am doing something wrong.
Here is an example I’m trying to do. Can someone help show me the Sublime Text equivalent of doing the following.
Lets say I have the following text.
I want to line up all of the colons and the values.
This is something I do very often in NEdit
data = {
'zero': 0,
'one': 1,
'two': 2,
'three': 3,
'four': 4,
'five': 5,
'six': 6,
'seven': 7,
'eight': 8,
'nine': 9
}
In NEdit to make all of the colons line up I would do the following.
I’d start my cursor at the beginning of the ‘zero’ line (all the way or right by the single quote; doesn’t matter).
- Start recording a macro (alt+k)
- find a colon (ctrl+f, colon, enter)… this leaves the editor with the first colon on that line selected.
- dismiss dialog (esc)
- press left arrow to get cursor to the left of the colon
- select from there to the end of the line (shift+end)
- cut (ctrl+x)
- insert a bunch of spaces for padding (like 20 or so)
- press home to go to beginning of line.
- press right arrow a bunch of times (like 20 or so). This brings the cursor to the same position no matter where the initial colon was because we went home first.
- paste (ctrl+v)
- trim extra space off end (shift+end, then delete)
- go on to beginning of next line (home, down)
- end macro (alt+k)
I can then repeat the macro until the end of the Python dictionary.
I end up with the following, which I can do a rectangular selection and delete the whitespace to bring the values closer to the keys while leaving them lined up.
data = {
'zero' : 0,
'one' : 1,
'two' : 2,
'three' : 3,
'four' : 4,
'five' : 5,
'six' : 6,
'seven' : 7,
'eight' : 8,
'nine' : 9
}
How can I do something similar in Sublime Text2.
I do the equivalent keystrokes but when I play them back weird things happen.