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

Autocomplete with tab and enter to select inserts new line #604

Open
shwoodard opened this issue Jan 22, 2015 · 4 comments
Open

Autocomplete with tab and enter to select inserts new line #604

shwoodard opened this issue Jan 22, 2015 · 4 comments
Assignees

Comments

@shwoodard
Copy link

STR: type fragment of matched word and press tab and then press enter on selected option

Actual: the autocomplete selects the option and inserts a new line
Expected: the autocomplete selects the option and does not insert a new line

@kalbasit kalbasit self-assigned this Jan 23, 2015
@shwoodard
Copy link
Author

I've discovered that esc works. Should we close this and just call this the new behavior?

@dechimp
Copy link

dechimp commented Jul 7, 2015

I agree. I would say just about anybody would expect this behavior.

I believe this is the default behavior of Vim's built-in autocomplete, however. There are some resources that discuss this issue:
http://vim.wikia.com/wiki/Make_Vim_completion_popup_menu_work_just_like_in_an_IDE
https://unix.stackexchange.com/questions/162528/select-an-item-in-vim-autocomplete-list-without-inserting-line-break

I'm going to try adding this Vimtip to my rc and see how that goes.

inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"

@dechimp
Copy link

dechimp commented Jul 7, 2015

I just learned that the above command seems to interfere with other things, like auto-insertion helpers for Ruby, as pointed out by chrisnicola:
spf13/spf13-vim#280

@tommyjcarpenter
Copy link

I second this issue. This is not how I expect it to work. There should not be an auto-newline added. The tip provided by dechimp seems to work great for me, so far..
I now have in my vimrc:

"ENABLES AUTOCOMPLETE
Plugin 'ervandew/supertab'
inoremap
inoremap pumvisible() ? "" : "u"

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