Commit Graph

33 Commits

Author SHA1 Message Date
Ingo Karkat
55421a1852 Support :set selection=exclusive
With this, the '> mark points to after the end of the selection.
- Do not change the 'selection' value when the plugin is triggered from visual mode, so that we can grab the original selection.
- Simplification: gv can be used instead of "`<" . a:type . "`>" to restore the original selection. This also deals with blockwise-to-end in all cases.
- For the highlighting, the end position must be corrected. Since these are byte indices, we cannot just decrement by 1, but have to subtract the length of the last selected character!
2014-06-24 16:33:37 +02:00
Tom McDonald
72d9f0a3cf Add "expand" functionality
When one exchange region is completely contained within another,
replace the larger one with the smaller one.

The term "expand" may seem counter-intuitive, as the result is less
text, but think of it this way: the smaller region is "expanding"
to occupy the space previously defined by the larger region.
2014-04-27 10:28:16 -04:00
Tom McDonald
a55ebe1c8d Use srings to describe exchange region comparison
... in preparation for things to come.
2014-04-27 10:14:13 -04:00
Tom McDonald
06f62c9f51 Ensure 'selection' is set to inclusive
References #23.
2014-04-26 08:25:46 -04:00
Tom McDonald
105cf06d43 Use '[ and '] marks instead of a-z marks
Closes #22.
2014-04-08 17:09:22 -04:00
Tom McDonald
c307765978 Use less popular marks during exchange
At least until I can figure out why they're being overwritten.

References #22.
2014-04-08 15:21:36 -04:00
Tom McDonald
694d00abe9 Use clearer variable names for mark backups 2014-04-08 15:20:29 -04:00
Christian Wellenbrock
ff52604e80 Use X as visual mapping for Exchange 2014-02-25 00:19:48 +01:00
Brian Smyth
57fe37a89c Use a named register for visual mode put.
Save and restore both the unnamed and z registers. Using the z register
works around the bug addressed by Vim patch 7.3.411.
2014-02-04 12:39:30 -05:00
Micha Moskovic
ac8ae24d73 Link 'IncSearch' for default highlight group
The previous green one is completely arbitrary and looks ugly with some colorschemes.
2014-01-07 18:12:25 +01:00
Tom McDonald
d67bace226 Improve highlighting coverage
* Support gui
* Use colors available for terminals with 8 colors
2014-01-05 11:06:07 -05:00
Tom McDonald
53b2b497b0 Maintain cursor position when exchanging
Closes #16.
2014-01-01 11:32:54 -05:00
Tom McDonald
39895312ec Highlight the first defined exchange region
Closes #13.
2014-01-01 11:03:33 -05:00
Tom McDonald
80f24f2398 Change <Plug> mappings to avoid prefix strings
Any custom mappings to <Plug>Exchange, <Plug>ExchangeLine, or
<Plug>ExchangeClear will have to be changed to map to <Plug>(Exchange),
<Plug>(ExchangeLine), and <Plug>(ExchangeClear).

References #12
2013-12-22 10:05:38 -05:00
Tom McDonald
88bb271e2d Fix incorrect visual mapping to cxx
Fixes #12.
2013-12-22 09:28:36 -05:00
Tom McDonald
855b57077e Allow default mappings to be overridden
Partial solution to #11
2013-12-21 22:51:50 -05:00
Tom McDonald
fba5bcea8c Detect overlap for two blockwise regions 2013-12-12 15:12:14 -05:00
Tom McDonald
ec7f183583 Fix quoting for escaped <C-V> sequence
This bug would probably have never affected anyone, since it only
comes up when a normal-mode motion results in a blockwise selection.
2013-12-12 15:06:40 -05:00
Tom McDonald
2d7ef58550 Use getreg() instead of macro syntax 2013-12-11 10:19:25 -05:00
Tom McDonald
62ae17d31a Use " register instead of @ 2013-12-11 10:17:26 -05:00
Tom McDonald
a0e2169959 Use setreg() to preserve yanked text's -wise mode 2013-12-11 10:03:15 -05:00
Israel Chauca Fuentes
07d9946872 Use getregtype() to restore register's mode. 2013-12-11 09:23:52 -05:00
Micha Moskovic
00b3dd0274 Make the default mappings optional 2013-12-10 17:43:08 +01:00
Tom McDonald
ae6495dafc Protect against mapped underscore
Refs pull request #3
2013-12-10 09:16:01 -05:00
James Baumgarten
a1745846e6 make sure to paste from unnamed register 2013-12-10 01:18:03 -08:00
Tom McDonald
9aa477fa96 Match case when comparing visual mode
Closes #4.
2013-12-09 20:40:00 -05:00
Christian Wellenbrock
275bc1e2b7 Add mapping to make 'cxx' work linewise 2013-12-09 23:03:55 +01:00
Tom McDonald
e31a5f57d2 Detect overlapping and swap-needing exchange text
Closes #1.
2013-12-09 13:19:19 -05:00
Tom McDonald
6ff338e953 Code organization 2013-12-06 13:45:08 -05:00
Tom McDonald
366ead65a2 Rewrite to support swapping exchange operands 2013-12-06 00:26:36 -05:00
Tom McDonald
9833bfaf9f Preserve cursor position after exchange 2013-12-05 23:19:37 -05:00
Tom McDonald
ea205fd0fc Fix typo
(Actually, it was the result of me testing the plugin)
2013-12-05 13:00:38 -05:00
Tom McDonald
a17828563e Initial prototype 2013-12-05 12:50:07 -05:00