OVH Cloud OVH Cloud

Sélection d'un bloc

3 réponses
Avatar
ADelm
Bonjour,

J'aimerais savoir si la s=E9lection d'un bloc de texte est possible ;
par bloc de texte j'entends une zone rectangulaire au milieu de lignes
de longueur variable
(comme une s=E9lection Alt+[glisser-souris] dans MSWord).

Cette possibilit=E9 existe-t-elle en emacs?

J'utilise emacs sous WindowsXP

Merci

Alain

3 réponses

Avatar
lhabert
"ADelm" :

J'aimerais savoir si la sélection d'un bloc de texte est possible ;
par bloc de texte j'entends une zone rectangulaire au milieu de lignes
de longueur variable



Oui. Pour la sélection elle-même, tu fais comme une sélection normale. Le
rectangle sélectionné sera le rectangle dont le point et la marque sont deux
coins opposés. Ensuite, tu as les commandes suivantes qui interprètent la
région comme un rectangle :

`C-x r k'
Kill the text of the region-rectangle, saving its contents as the
"last killed rectangle" (`kill-rectangle').

`C-x r d'
Delete the text of the region-rectangle (`delete-rectangle').

`C-x r y'
Yank the last killed rectangle with its upper left corner at point
(`yank-rectangle').

`C-x r o'
Insert blank space to fill the space of the region-rectangle
(`open-rectangle'). This pushes the previous contents of the
region-rectangle rightward.

`M-x clear-rectangle'
Clear the region-rectangle by replacing its contents with spaces.

`M-x delete-whitespace-rectangle'
Delete whitespace in each of the lines on the specified rectangle,
starting from the left edge column of the rectangle.

`C-x r t STRING <RET>'
Replace rectangle contents with STRING on each line.
(`string-rectangle').

`M-x string-insert-rectangle <RET> STRING <RET>'
Insert STRING on each line of the rectangle.
Avatar
ADelm
Merci Luc pour ces infos.

J'avais cherché le livre "Introduction à GNU emacs", mais je n'avais
pas pensé au terme "rectangle".

Je vais donc continuer à explorer emacs et peut-être l'adopter.

Encore merci !

Alain
Avatar
drkm
"ADelm" writes:

Je vais donc continuer à explorer emacs et peut-être l'adopter.



L'essayer, *c'est* l'adopter ;-)

--drkm