I am trying to remap the autocomplete key from the "Enter" key to "TAB" because I keep autocompleting when I intend to go to the next line. The code below is the default option for coc, and I think this is where I should be able to remap the key.
" make <CR> auto-select the first completion item and notify coc.nvim to
" format on enter, <cr> could be remapped by other vim plugin
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
\: "\<c-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
I thought that changing the <cr> in the beginning to <TAB> would work. However, although it does allow me to autocomplete using TAB, it creates weird auto indentations in some cases. For example:
//normal behavior
someFunction(){
//cursor here appropriately indented
}
//behavior after I made the changes mentioned above
someFunction(){
//cursor here}
I assume I just fundamentally don't understand something about coc or remapping keys in VIM.
Why can't I simply change that <cr> to <TAB>? How can I go about remapping the autocomplete key from "Enter" to "TAB"?