Commit Graph

62 Commits

Author SHA1 Message Date
Tom McDonald
b1cae9237e Omit a count of 1 for mappings
This fixes motions like % whose meanings change when a count is supplied
2016-06-24 07:01:35 -07:00
Tom McDonald
d069729b1a Fix another case for cursor adjustment 2016-06-18 09:44:35 -07:00
Tom McDonald
7d14f43244 Support [count] before operator
Fixes #41
2016-06-11 10:35:46 -04:00
Jacob Niehus
d91ebdd797 Fix calling setline on wrong line in reindent 2015-09-07 17:55:02 -07:00
Jacob Niehus
1ff6e3c65b Fix indentation of return line 2015-08-02 10:13:13 -07:00
Jacob Niehus
d54c7e27fe Prevent calling setline() incorrectly
Automatic re-indenting shouldn't call setline() on a line outside of the
exchange region. It currently does so if the exchange region only
contains blank lines.
2015-08-01 20:19:31 -07:00
Jacob Niehus
a1e28c4411 Change indent comparison to !~ with explanation
Truth table:
 x   x != 0  x !~ 0
 0      0      0
 1      1      1
'=='    0      1
2015-08-01 20:15:15 -07:00
Tom McDonald
93ef4c9e42 Enable automatic reindenting by default 2015-08-01 15:45:53 -04:00
Tom McDonald
a131309466 Refactor user setting lookups 2015-08-01 15:44:57 -04:00
Tom McDonald
bae89cbde9 Adjust cursor position to offset text length
Fixes #16
2015-08-01 15:21:17 -04:00
Tom McDonald
e12149d5d6 Avoid screen jumps when scrolled to second region 2015-08-01 15:19:51 -04:00
Tom McDonald
f8f96d83ce Stop using abbreviated command and option names 2015-06-25 13:22:47 +00:00
Tom McDonald
cece558033 Refactor exchange regions as Dict
Improves code legibility a lot
2015-06-21 22:25:01 +00:00
Tom McDonald
4589b307dc Remove :ExchangeClear deprecation notice 2015-06-18 17:16:35 +00:00
Tom McDonald
d769e46011 Fail gracefully when saving register contents
Fixes #37
2015-06-18 17:04:36 +00:00
Jacob Niehus
1394aa3a9b Only reindent when both selections are linewise 2015-06-16 18:43:26 -07:00
Jacob Niehus
8bd96c3e0d Use b:exchange_indent if present 2015-06-12 13:12:24 -07:00
Jacob Niehus
3b4b4b38ab Indent overlapping regions correctly 2015-05-31 10:23:09 -07:00
Jacob Niehus
aff4ade39b Add option to update indent after exchange 2015-05-28 18:12:58 -07:00
Tom McDonald
e459b57740 Enable exchange highlighting by default 2015-02-14 11:00:42 -05:00
Tom McDonald
36673b255b Allow toggling of exchange region highlighting
Closes #33
2015-02-14 10:58:20 -05:00
Tom McDonald
e6bf71a53a Add :XchangeClear, deprecate :ExchangeClear
References #28, #29
2015-02-14 10:38:48 -05:00
Jacob Niehus
3ff60a7b6e Add tpope/vim-repeat compatibility 2015-01-11 11:49:13 -07:00
Tom McDonald
4da8b67383 Suppress errors when restoring invalid registers
Particularly for * and + registers when clipboard support is not
present.

Fixes #31
2014-12-22 14:13:52 +00:00
Tom McDonald
fc78e3aa68 Refactor register save/restore 2014-12-22 14:12:55 +00:00
Jacob Niehus
483a294cce Restore star and plus registers in addition to unnamed register 2014-12-06 12:48:30 -07:00
cohama
3eea6c08fd Add :ExchangeClear command 2014-11-24 16:03:57 +00:00
Tom McDonald
9c025e5914 Merge pull request #27 from inkarkat/fix-selection-exclusive
Support :set selection=exclusive
2014-06-24 11:26:05 -04:00
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
Ingo Karkat
d578e14e89 Do not create a select mode default mapping.
In select mode (the variant of visual mode), any printable characters should override the selection (see below :help v_CTRL-G), so no such mappings should exist. Limit the default visual mode mapping to visual mode (:xmap). (The <Plug>(Exchange) can and should be defined for both.)
2014-06-24 16:28:41 +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