Cua-Mode

InfoInfo
Search:    

Home > ComputerStuff > Software > Programming > ProgrammersTools >Editors > Emacs > Cua-Mode | Contact.

Say you have this

cua-1.png

And you want to have this
cua-2.png

Well, easy. Copy the string [[Image(grep_1.png)]] (use C-space, C-e, M-w). Enter cua-mode M-x cua-mode, then hit C-Enter to start a rectangle. Create a rectangle of 6 lines by 1 column, like so :
cua-3.png

Then hit M-s to insert a string. You can paste the string [[Image(grep_1.png)]] here with C-y, you should get this :

cua-4.png

But we need different values right ? we want grep_1, grep_2, grep_3 etc. Easy. Exit the rectangle-selection mode by hitting C-Enter again, and go to the first 1 (on first line), then start a new rectangle again with C-Enter, you then select that column on all lines, like so :

cua-5.png

Now Type M-n to insert a sequence, starting from 1 and incrementing by 1. You get this as a result :

cua-6.png

Tadaaaaaa

http://www.idealaunch.com/blog/wp-content/uploads/2009/10/fatso_keyboard_cat.gif

EDIT : somebody on reddit (prakashk) expressed his opinion about emacs article not giving what key sequences are bound to because M-n didn't do anything in his configuration. As I have replied there, one must be in cua-mode and have started a rectangle with C-Enter in order for M-n to be bound to the cua-sequence-rectangle function

EDIT2 : another guy [WWW]posted a shorter macro-based solution on his blog.

____________________________________________________________________________________________________
To comment or ask questions, you may prefere to Contact me directly, as I get no notification when you post a comment in here.

[WWW]Je suis parrain Linux http://i.imgur.com/ui89F.png.

Si vous êtes dans ma région et que avez besoin d'aide pour installer linux, vous pouvez me contacter
Sinon, [WWW]vous pouvez chercher un parrain dans votre région.

Comments:

Note: You must be logged in to add comments

This is a Wiki Spot wiki. Wiki Spot is a 501(c)3 non-profit organization that helps communities collaborate via wikis.