Hacker News new | past | comments | ask | show | jobs | submit login

Not op but here they are really handy for creating and formatting repetitive code blocks. I find it particular useful when making testing\throwaway code.

For example, I may be testing a function and wanting to test a few scenarios on many IDs. So I will create a csv list of numbers and then use a macro to format it

your csv string will be like this (normally much longer)

134,234,367,4345

Then record the macro:

- type "myFunction("

- type ctrl + right arrow (this moves the cursor to after the comma)

- type backspace

- type ");"

- type enter key

then run stop recording and run the macro. It will produce:

myFunction(134);

myFunction(234);

myFunction(367);

myFunction(4345);

Which doesn't seem like a big time saver over regular copy and pasting. And you could have iterated over the csv string with a for loop. This is probably a really contrived and basic example but you find yourself thinking about using a macro anytime you have to do the same keystrokes over and over.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: