Closed kiryph closed 9 years ago
This is a neat idea, but it's impossible to support all motions and text objects (think user-defined text objects). I think it falls outside the scope of exchange.vim to try to support the concept of "the next text object", when projects like targets.vim are doing a fine job of it. It makes more sense to combine the two and possibly create custom mappings for things you do frequently.
I like the bubbling concept of a single line or serval lines see vimcast #26. Plugins offering such feature are
unimpaired.vim
(line/lines),matze/vim-move
(line/lines),frace/vim-bubbles
andsideways.vim
(function arguments & other). I could imagine thatexchange.vim
could also have a bubbling feature. I think of following workflow:Step 1: Invoke
exchange.vim
normallyStep 2: Invoke bubbling feature, e.g. with
to bubble/exchange the marked object with the equivalent previous or next object. The equivalent object must be defined for the used motion. This does not have to exist for all motions/objects. For instance, for the visual mode mapping
X
it can't be known what an equivalent next/prevous object would be.In a first step I would like to see it working for
cxiw, cxiW, cxis, cxip
(i.e. words/WORDS, sentences, and paragraphs).Step 3: After that it would also be useful to proceed with the dot command.
Mappings are stolen from unimpaired.vim:
[e - bubble over previous line ]e - bubble over next line
The mappings have a good mnemonic: e for exchange.
This clash of mappings could be resolved: If cx is not active, invoke previous mapped commands.
An implementation could look like this:
dict['ip'] = {'{', '}'}
. This can be extended if needed and is possible/makes sense.bubble_exchange
could look somehow like this: