Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility issue with andymass/vim-matchup #328

Open
moetayuko opened this issue Apr 17, 2023 · 4 comments
Open

Compatibility issue with andymass/vim-matchup #328

moetayuko opened this issue Apr 17, 2023 · 4 comments

Comments

@moetayuko
Copy link

https://github.com/andymass/vim-matchup is a popular vim plugin. However, the cursor doesn't behave as expected after expanding some snippets.

MWE

call plug#begin()
 Plug 'neoclide/coc.nvim', {'branch': 'master', 'do': 'yarn install --frozen-lockfile'}
 Plug 'honza/vim-snippets'
 Plug 'andymass/vim-matchup'
call plug#end()
set nocp
let g:tex_flavor = "latex"
let g:coc_global_extensions = [
      \ 'coc-snippets',
      \ ]
imap <C-l> <Plug>(coc-snippets-expand)

To reproduce

  1. vim t.tex
  2. type beg<ctrl_l>

The snippet expands correctly, but the cursor doesn't locate at the expected position.

Expected (w/o vim-matchup)

| denotes cursor position

\begin{|}
	
\end{}

Current (w/ vim-matchup)

\be|gin{}
	
\end{}

It's worth noting that https://github.com/SirVer/ultisnips works correctly with vim-matchup

@kevin61416
Copy link

I encountered the same issue 🥲
Any update about this?

@JS-Zheng
Copy link

Dear maintainers @chemzqm @fannheyward,
I discovered that vim-matchup has these two commands:

:NoMatchParen       Disable matching after the plugin was loaded.
:DoMatchParen       Enable matching again.

The issue can be fixed by using :NoMatchParen before auto-completion, and using :DoMatchParen after auto-completion.

However, I was unable to find a suitable autocmd to call these commands automatically.

Could you consider adding autocmds like CocPumCanceled, CocCompletionDone? This way, users could manually call :NoMatchParen to temporarily disable vim-matchup or other conflicting plugins when invoking coc#refresh(), and let these autocmds actively call :DoMatchParen to restore the operation of vim-matchup.

@fannheyward
Copy link
Member

@JS-Zheng there's CompleteStop autocmd, does it work for your case?

@JS-Zheng
Copy link

JS-Zheng commented Sep 2, 2023

@JS-Zheng there's CompleteStop autocmd, does it work for your case?

I only discovered the following coc autocmds in Vim:

CocLocationsChange, CocNvimInit, CocStatusChange, CocDiagnosticChange, 
CocJumpPlaceholder, CocOpenFloat, CocOpenFloatPrompt & CocTerminalOpen

I believe CompleteStop is a RPC event, not an autocmd, correct?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants