Skip to content

Commit

Permalink
Roll back some changes; direct support for vim-visual-multi is gonna …
Browse files Browse the repository at this point in the history
…be a pain in the ass
  • Loading branch information
LunarWatcher committed Jun 20, 2021
1 parent 2155533 commit 62adf0d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 38 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@
`let g:AutoPairsVersion = 30057`

## Fixed
* Better escape handing ([jiangmiao/#325](https://github.com/jiangmiao/auto-pairs/issues/325))
* Better escape handing ([jiangmiao#325](https://github.com/jiangmiao/auto-pairs/issues/325))
* Typos in the help document
* Update variable list in the help document
* Add additional support for vim-visual-multi

## Added
* `g:AutoPairsSearchEscape`

## Removed
* `g:AutoPairsShortcutMultilineClose`

# 3.0.0-beta11
`let g:AutoPairsVersion = 30056`

Expand Down
5 changes: 0 additions & 5 deletions autoload/autopairs/Keybinds.vim
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,6 @@ fun! autopairs#Keybinds#mapKeys()
endfor
endif

" TODO: remove
if exists("g:AutoPairsShortcutMultilineClose") && g:AutoPairsShortcutMultilineClose != ''
execute 'inoremap <buffer> <silent> ' . g:AutoPairsShortcutMultilineClose . " <C-o>:unsilent echoerr 'This function is a no-op. See :h g:AutoPairsShortcutMultilineClose'<CR>"
endif

" Still use <buffer> level mapping for <BS> <SPACE>
if b:AutoPairsMapBS
" Use <C-R> instead of <expr> for issue #14 sometimes press BS output strange words
Expand Down
16 changes: 0 additions & 16 deletions doc/AutoPairs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1520,22 +1520,6 @@ being escaped. The backslash before the [ is considered a part of the pair.
See |autopairs-regex-escaping| for an explanation on the double escaping in
the pair itself.

------------------------------------------------------------------------------
*g:AutoPairsVMCompatibility*

Type: int
Required plugin: |visual-multi.txt| (https://github.com/mg979/vim-visual-multi)
Default: 0
This flag is a no-op if vim-visual-multi isn't detected~

See also |autopairs-visual-multi| for more compatibility information.

Whether or not to reinstate auto-pairs mappings, and by extension, to
disregard the call to disable auto-pairs when VM is enabled.

Also note that Vim must be restarted for changes to this flag to take effect
-- it can't be set on-demand, and must be declared in your vimrc.

*autopairs-end-of-options* (this tag exists purely for doc editing purposes and
has no meaning for the plugin)
==============================================================================
Expand Down
29 changes: 14 additions & 15 deletions doc/PluginCompatibility.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,20 @@ VM overrides keybinds, and doesn't try to map them in a way that's compatible
with other maps. While there are keys like that in auto-pairs wrt. other
plugins (and some times vice versa), VM gives plugins a way out.

Using |g:VM_plugins_compatibilty| (see also |vm-compatibility|), plugins are
granted an enable and a disable function, which are respectively called when
VM is exited and when it's enabled. (I.e. plugins are disabled when VM is
enabled, and vice versa).
This is all good, but it also means auto-pairs' only way to be compatible is
to offer a way to disable itself. This is also a consequence of maps being
overwritten by force.

Auto-pairs may be instructed to use |vm-functions| to reinstate certain
mappings, but this on its own doesn't disable warnings that occur when the
mappings are overwritten in the first place. To silence these,
let |g:VM_show_warnings| = 0. While potentially not optimal, it does silence
the error output.

See |g:AutoPairsVMCompatibility| for more details on the compatibility tool.
There are, admittedly, ways to retain compatibility by re-enabling keybinds in
a compatible way after the fact, but this breaks jumping, at least wrt. the
cursor position. With the specifics of what's required for compatibility being
vague, the implementation details are unclear and therefore not implemented.

That being said, due to the use of keybinds that do conflict with the plugin,
such as |<cr>| and potentially others, depending on various mapping details,
VM may produce warnings. It's adviced that you suppress these, as they're
unavoidable at the time of writing. The warnings may be suppressed with: >
let g:VM_show_warnings = 0
<

Note, however, that VM only outputs warnings (at the time of writing), meaning
it makes no practical difference.

================================================================================
2. Telescope *autopairs-telescope*
Expand Down
2 changes: 1 addition & 1 deletion plugin/autopairs.vim
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ if exists('g:VM_plugins_compatibilty') || exists('*vm#maps#init')
" No need for those checks when it's set like this.
let g:VM_plugins_compatibilty = extend(get(g:, 'VM_plugins_compatibilty', {}), {
\'AutoPairs': {
\ 'test': { -> b:autopairs_enabled },
\ 'test': { -> 1 },
\ 'enable': 'unlet b:autopairs_loaded | call autopairs#AutoPairsTryInit() | let b:autopairs_enabled = 1',
\ 'disable': 'let b:autopairs_enabled = 0',
\}
Expand Down

0 comments on commit 62adf0d

Please sign in to comment.