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

Solution about auto-pair has some side-effects #47

Open
4 of 17 tasks
dc3671 opened this issue Jun 24, 2019 · 17 comments
Open
4 of 17 tasks

Solution about auto-pair has some side-effects #47

dc3671 opened this issue Jun 24, 2019 · 17 comments

Comments

@dc3671
Copy link

dc3671 commented Jun 24, 2019

Issue Prelude

  • Category
    • Question
    • Bug
    • Suggestion
  • OS
    • Linux
    • macOS
    • Windows
    • Etc.
  • Vim
    • Vim
    • Neovim
  • Language
    • C
    • C++
    • go
    • 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

@tenfyzhong
Copy link
Owner

Please show me the result of :imap )

@dc3671
Copy link
Author

dc3671 commented Jun 25, 2019

@tenfyzhong
image

@tenfyzhong
Copy link
Owner

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

@dc3671
Copy link
Author

dc3671 commented Jun 25, 2019

@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

@tenfyzhong
Copy link
Owner

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

@dc3671
Copy link
Author

dc3671 commented Jun 27, 2019

@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

@tenfyzhong
Copy link
Owner

Can you give my you vimrc?

@dc3671
Copy link
Author

dc3671 commented Jul 11, 2019

@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.

@tenfyzhong
Copy link
Owner

Can you give me you vimrc?

@dc3671
Copy link
Author

dc3671 commented Jul 11, 2019

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

@dc3671
Copy link
Author

dc3671 commented Jul 11, 2019

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 ()

@tenfyzhong
Copy link
Owner

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

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

@dc3671
Copy link
Author

dc3671 commented Jul 11, 2019

@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?

@tenfyzhong
Copy link
Owner

tenfyzhong commented Jul 11, 2019

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

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

@dc3671
Copy link
Author

dc3671 commented Jul 11, 2019

@tenfyzhong no change

@tenfyzhong
Copy link
Owner

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

@dc3671
Copy link
Author

dc3671 commented Jul 15, 2019

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

Repository owner deleted a comment from truth4you Feb 15, 2024
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

2 participants