glasnt
glasnt

Reputation: 2973

Dynamic Automatic Text Inserting

Does such a thing exist where you can set up automatic text insertion shortcuts, but they can be dynamic?

A lot of work I'm doing involves a lot of changes to code, and I've found that I'm copy-pasting my MOD-string hundreds of times, and it can get lost in the other copy-paste objects.

Basically, I want to know if there's something I can setup where I can click say CTRL-ALT-M and it will automatically enter in

--MODYYMMDDBLT

where YY = year (2 digits), MM = month (2 digits), DD = day (see the trend?) and BLT is a userdefined string (namely, the developers initials)

I know that I've probably spent more time typing this than it does just typing '--MOD090701BLT', but I was wondering if such a thing existed.

It can't be program specific, because I'm flicking between things all the time.

If I can find something like it, then it can be used for different things, like say selecting a text string and wrapping a 'if exists (select blah from stuff where 'TEXT STRING' roar)' etc.

Upvotes: 1

Views: 185

Answers (2)

ninesided
ninesided

Reputation: 23273

I guess there are two approaches to take here, macros at the text editor level (most decent text editors support the notion of macros, but some are better than others) and then macros at the OS-level. Either way, if you can write a chunk of code in your language of choice that outputs the text that you want, you should be able to hook it up to key-stroke. My personal preference would be to use a text editor that supports this kind of thing out-of-the-box, so to speak, like JEdit or E-Text Editor. If you want to go down the OS-level route, you could investigate something like AutoHotkey.

Upvotes: 1

Greg Hewgill
Greg Hewgill

Reputation: 994061

Seriously, you add a comment like that to anything you change? Are you using source control? Is this for work where such a comment is mandated by some coding standard?

To answer your question, I would suppose that the macro facilities available in pretty much any full-featured text editor would provide such a capability. What are you using?

(Oh, and considering your nickname, your initials should totally be BLT. Just saying.)

Upvotes: 1

Related Questions