[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Transposing words over middle words
From: |
Bob Proulx |
Subject: |
Transposing words over middle words |
Date: |
Wed, 15 Nov 2017 16:17:12 -0700 |
User-agent: |
NeoMutt/20170609 (1.8.3) |
TL;DR: How can I transpose words jumping over middle words?
Of course we all know about C-t transpose-chars. And there is the
corresponding M-t transpose-words too. Here is the documentation.
‘M-t’ transposes the word before point with the word after point
(‘transpose-words’). It moves point forward over a word, dragging the
word preceding or containing point forward as well. The punctuation
characters between the words do not move. For example, ‘FOO, BAR’
transposes into ‘BAR, FOO’ rather than ‘BAR FOO,’.
When modifying a list of comma separated s strings this works great.
But often I find myself wanting to transpose words in an "and"
structure.
Jack and Jill went up the hill.
With the point on the space after Jack the easiest way I know to
transpose those words is to M-d to kill-word forward deleting the
"and" leaving.
Jack and Jill went up the hill.
^ point is here: M-d
Jack Jill went up the hill.
Then M-t to transpose those words:
Jack Jill went up the hill.
^ point is here: M-t
Jill Jack went up the hill.
Then restore the "and" which is somewhat inelegant
Jill Jack went up the hill.
^ point is here: C-b C-y
Jill and Jack went up the hill.
Obviously I can use other brute force make the change.
Jack and Jill went up the hill.
^ point is here: M-d
Jack and went up the hill.
^ point is here: M-b M-b
Jack and went up the hill.
^ point is here: C-y M-d M-f
Jill and went up the hill.
^ point is here: C-f C-y
Jill and Jack went up the hill.
That or something similar is usually what I do. This is one of those
nuisance items I have always wished had a better way to accomplish but
just always worked through it by brute force. But transpose-words has
always been taunting me that it almost does what I want with M-t but
doesn't work in this situation.
Is there a way to use M-t to transpose words skipping over middle
words like it does for punctuation? Perhaps there isn't a better way.
Thanks,
Bob
- Transposing words over middle words,
Bob Proulx <=
- Re: Transposing words over middle words, Eric Abrahamsen, 2017/11/15
- Re: Transposing words over middle words, Emanuel Berg, 2017/11/15
- Re: Transposing words over middle words, ken, 2017/11/18
- Re: Transposing words over middle words, Emanuel Berg, 2017/11/18
- Re: Transposing words over middle words, ken, 2017/11/18
- Re: Transposing words over middle words, Emanuel Berg, 2017/11/18
- Re: Transposing words over middle words, John Mastro, 2017/11/18
- Re: Transposing words over middle words, Emanuel Berg, 2017/11/18
- RE: Transposing words over middle words, Drew Adams, 2017/11/18