Commit Graph

92 Commits

Author SHA1 Message Date
Tom McDonald
0ae5d5ea99 Merge pull request #39 from wilywampa/blank_bugfix
Fix detection of re-indent setting and fix incorrect setline calls when re-indenting
2015-08-02 21:17:34 -04: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
Tom McDonald
5a8e725a64 Merge pull request #36 from wilywampa/reindent
Add option to re-indent text after exchange
2015-06-18 12:38:34 -04: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
Tom McDonald
5cb2a3733a Merge pull request #32 from wilywampa/master
Add tpope/vim-repeat compatibility
2015-01-11 15:11:38 -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
Tom McDonald
fd0e870abd Merge pull request #30 from wilywampa/master
Restore star and plus registers in addition to unnamed register
2014-12-06 15:11:14 -05: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
f841536eac Correction in doc: Visual mapping is X 2014-06-30 15:57:27 -04:00
Tom McDonald
584ceeb136 Reflect use of xmap over vmap in documentation 2014-06-30 15:53:29 -04: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
Tom McDonald
2fb1feb5c7 Merge pull request #26 from inkarkat/no-select-mode-mapping
Do not create a select mode default mapping.
2014-06-24 10:46:05 -04:00
Tom McDonald
a7f31d4c7a Merge pull request #25 from inkarkat/fix-typos
Fix typos in documentation.
2014-06-24 10:45:12 -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
Ingo Karkat
75a3ff822a Fix typos in documentation. 2014-06-24 16:27:10 +02:00
Tom McDonald
c83bfb20bc Clearly explain Visual mode mapping in README 2014-04-27 10:31:37 -04: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
Tom McDonald
771336e5eb Link to Vimcasts Episode 65 in README 2014-03-10 11:00:10 -04:00
Tom McDonald
e2da5d3c1e Merge pull request #20 from wellle/visual-X
Use X as visual mapping for Exchange
2014-02-24 19:40:49 -05:00
Christian Wellenbrock
0e43efeede Update Readme and docs regarding {visual}X 2014-02-25 01:37:04 +01:00
Christian Wellenbrock
ff52604e80 Use X as visual mapping for Exchange 2014-02-25 00:19:48 +01:00
Tom McDonald
b82a774e6f Merge pull request #19 from bps/workaround-vim-7-3-411
Use a named register for visual mode put.
2014-02-04 11:23:10 -08: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
Tom McDonald
1554f82773 Merge pull request #17 from michamos/master
Link 'IncSearch' for default highlight group
2014-01-07 09:27:53 -08: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