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

Unexpected new line while press <CR> to accept a suggestion #3031

Closed
lancelock opened this issue Apr 15, 2021 · 6 comments
Closed

Unexpected new line while press <CR> to accept a suggestion #3031

lancelock opened this issue Apr 15, 2021 · 6 comments

Comments

@lancelock
Copy link

Result from CocInfo

vim version: VIM - Vi IMproved 8.2 8022550
node version: v15.11.0
coc.nvim version: 0.0.80-6e5a2aaeb5
coc.nvim directory: /Users/vixmatric/.config/nvim/plugged/coc.nvim
term: iTerm.app
platform: darwin

Describe the bug

Sometimes i press to accept a suggestion, it will insert a new line and move the cursor to the new line,that's not what i expected

Reproduce the bug

Related keybinding,copy from the README file

" Make auto-select the first completion item and notify coc.nvim to
" format on enter, could be remapped by other vim plugin
inoremap pumvisible() ? coc#_select_confirm()
: "<C-g>u<CR><c-r>=coc#on_enter()<CR>"

Screenshots (optional)

unexpected-new-line

@chemzqm
Copy link
Member

chemzqm commented Apr 15, 2021

Can't understand

@chemzqm chemzqm closed this as completed Apr 15, 2021
@lancelock
Copy link
Author

@chemzqm 如图,我按一下回车键补全user这个词,期望是继续留在这一行,继续输入,但是自动换行了并且光标移动到了新的一行

@chemzqm
Copy link
Member

chemzqm commented Apr 15, 2021

我看不明白

@PangPangPangPangPang
Copy link

PangPangPangPangPang commented May 13, 2021

我也有同样问题,使用了下面这个 map
inoremap pumvisible() ? coc#_select_confirm()
: "<C-g>u<CR><c-r>=coc#on_enter()<CR>"
现象是:
当用 enter 触发了选择补全的时候不会在当前的位置进入 insert 模式,而是会在光标上方新插入一行并且进入 insert 模式。

@nima-dvlp
Copy link

I have the same problem, and same file type JavaScript/Typescript, but not in Rust, Flutter/Dart, Vim, etc.

@chemzqm
Copy link
Member

chemzqm commented Jul 5, 2021

The cursor position could be changed by other vim plugin.
Need minimal vimrc and verbose output from language server, please open a new issue.

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