CompleteParameter.vim icon indicating copy to clipboard operation
CompleteParameter.vim copied to clipboard

Solution about auto-pair has some side-effects

Open dc3671 opened this issue 5 years ago • 17 comments

Issue Prelude

  • Category
    • [x] Question
    • [ ] Bug
    • [ ] Suggestion
  • OS
    • [x] Linux
    • [ ] macOS
    • [ ] Windows
    • [ ] Etc.
  • Vim
    • [x] Vim
    • [ ] Neovim
  • Language
    • [ ] C
    • [ ] C++
    • [ ] go
    • [x] python
    • [ ] rust
    • [ ] javascript
    • [ ] typescript
    • [ ] erlang

Completion Engine and Commit SHA

YouCompleteMe: master

Minimal Configuration

configs in FAQs about auto-pairs

Issue Details

after I input ( without anything in front, and then input ), there would be a redundant ) like below

())

Messages

dc3671 avatar Jun 24 '19 14:06 dc3671

Please show me the result of :imap )

tenfyzhong avatar Jun 25 '19 00:06 tenfyzhong

@tenfyzhong image

dc3671 avatar Jun 25 '19 07:06 dc3671

Can you make a gif? I can't reproduce the bug.

tenfyzhong avatar Jun 25 '19 08:06 tenfyzhong

@tenfyzhong I only pressed ( and then ). Maybe it's related to my other plugins? test

my plugins list:

- vim-polyglot: OK
- indentLine: OK
- vim-hugefile: OK
- conflict-marker.vim: OK
- fzf: OK
- vim-snippets: OK
- webapi-vim: OK
- vim-textobj-uri: OK
- vim-textobj-chunk: OK
- MatchTagAlways: OK
- vim-textobj-quotes: OK
- vim-coffee-script: OK
- vim-textobj-xmlattr: OK
- vim-autoformat: OK
- vim-closetag: OK
- vim-preview: OK
- tagbar: OK
- ctrlsf.vim: OK
- vim-markdown: OK
- vim-textobj-brace: OK
- vim-litecorrect: OK
- YouCompleteMe: OK
- vim-textobj-indent: OK
- python-syntax: OK
- vim-repeat: OK
- vim-commentary: OK
- csscomplete.vim: OK
- wildfire.vim: OK
- restore_view.vim: OK
- tsuquyomi: OK
- vim-airline-themes: OK
- vim-colorschemes: OK
- vim-colors: OK
- vim-nerdtree-tabs: OK
- fonts: OK
- vim-js-indent: OK
- CompleteParameter.vim: OK
- onedark.vim: OK
- vim-airline: OK
- gist-vim: OK
- vim-js-pretty-template: OK
- editorconfig-vim: OK
- vim-signify: OK
- vim-textobj-user: OK
- vim-json: OK
- fcitx.vim: OK
- vim-less: OK
- nerdtree: OK
- rust.vim: OK
- ultisnips: OK
- vim-wordy: OK
- vim-fugitive: OK
- vim-misc: OK
- vim-jsx-typescript: OK
- tabular: OK
- salt-vim: OK
- nerdcommenter: OK
- ale: OK
- html5.vim: OK
- fzf.vim: OK
- tmuxline.vim: OK
- vim-tags: OK
- vim-haml: OK
- vim-cucumber-align-pipes: OK
- vim-css-color: OK
- vim-over: OK
- vim-abolish: OK
- emmet-vim: OK
- vim-surround: OK
- typescript-vim: OK
- vim-multiple-cursors: OK
- auto-pairs: OK
- vim-javascript: OK
- vim-vue: OK
- vim-bbye: OK
- vim-css3-syntax: OK
- vim-es6: OK
- vim-session: OK

dc3671 avatar Jun 25 '19 09:06 dc3671

I think you should disable other plugins and try it again.

tenfyzhong avatar Jun 25 '19 09:06 tenfyzhong

@tenfyzhong sorry for delay, it's a little busy some time ago. I've tried to disable all other plugins except auto-pair and CompleteParameter, and all other vim configs. But the problem still exists. image

dc3671 avatar Jun 27 '19 14:06 dc3671

Can you give my you vimrc?

tenfyzhong avatar Jun 28 '19 00:06 tenfyzhong

@tenfyzhong I tried disable all other plugins except CompleteParameter and these configs:

call plug#begin('~/.vim/plugged')

Plug 'tenfyzhong/CompleteParameter.vim'

call plug#end()

inoremap <silent><expr> ( complete_parameter#pre_complete("()")
smap <c-j> <Plug>(complete_parameter#goto_next_parameter)
imap <c-j> <Plug>(complete_parameter#goto_next_parameter)
smap <c-k> <Plug>(complete_parameter#goto_previous_parameter)
imap <c-k> <Plug>(complete_parameter#goto_previous_parameter)

And the problem still exists! So I think maybe it's related to my terminal or input method? Because when I input ( there outputs a ) automatically! And then I input ) there exist two ) for sure. Although with autopair my input ) will be combined with the automatic output ) and only one ) exists.

dc3671 avatar Jul 11 '19 07:07 dc3671

Can you give me you vimrc?

tenfyzhong avatar Jul 11 '19 07:07 tenfyzhong

@tenfyzhong I deleted all other configs except the above ones, so that's my .vimrc

dc3671 avatar Jul 11 '19 07:07 dc3671

Update: It's not my input method or terminal issue. The automatically output ) is related to line:

inoremap <silent><expr> ( complete_parameter#pre_complete("()")

when I input (, it will output ()

dc3671 avatar Jul 11 '19 07:07 dc3671

CompleteParameter can't complete brackets. You should install auto-pairs and add this configuration.

let g:AutoPairs = {'[':']', '{':'}',"'":"'",'"':'"', '`':'`'}
inoremap <buffer><silent> ) <C-R>=AutoPairsInsert(')')<CR>

tenfyzhong avatar Jul 11 '19 07:07 tenfyzhong

@tenfyzhong Sorry, I deleted too much. When I added these (At the very beginning I already added), the problem still exists. My .vimrc:

call plug#begin('~/.vim/plugged')

Plug 'tenfyzhong/CompleteParameter.vim'
Plug 'jiangmiao/auto-pairs'

call plug#end()

let g:AutoPairs = {'[':']', '{':'}',"'":"'",'"':'"', '`':'`'}
inoremap <buffer><silent> ) <C-R>=AutoPairsInsert(')')<CR>
inoremap <silent><expr> ( complete_parameter#pre_complete("()")
smap <c-j> <Plug>(complete_parameter#goto_next_parameter)
imap <c-j> <Plug>(complete_parameter#goto_next_parameter)
smap <c-k> <Plug>(complete_parameter#goto_previous_parameter)
imap <c-k> <Plug>(complete_parameter#goto_previous_parameter)

I think it's related to AutoPairsInsert(')') problem because you removed () from AutoPairs so it can't combine your ) and existed ). Could in some ways I disabled () before AutoPairsInsert and enabled it during AutoPairsInsert?

dc3671 avatar Jul 11 '19 08:07 dc3671

Try to remove <buffer> in the inoremap <buffer><silent> ) <C-R>=AutoPairsInsert(')')<CR> like this

inoremap <silent> ) <C-R>=AutoPairsInsert(')')<CR>

tenfyzhong avatar Jul 11 '19 08:07 tenfyzhong

@tenfyzhong no change

dc3671 avatar Jul 11 '19 08:07 dc3671

@dc3671 Please give me the version of you ycm and auto-pairs

tenfyzhong avatar Jul 15 '19 00:07 tenfyzhong

@tenfyzhong YCM: 9dee2b4e3f5de5f8b9fdc4790eac35eb2c40257a auto-pairs: 39f06b873a8449af8ff6a3eee716d3da14d63a76

dc3671 avatar Jul 15 '19 08:07 dc3671