I have the following in my init.vim
"If PUM (complete menu) is visible, then execute <C-y> (which selects an item), otherwise, do a normal tab inoremap <silent><expr> <TAB> \pumvisible() ? "\<C-n>" : "\<TAB>" inoremap <silent><expr> <S-Tab> \pumvisible() ? "\<C-p>" : "\<S-TAB>"
But for some reason, this doesn't seem to be working in insert mode. In command mode, I'm getting the expected behaviour. I'm tabbing through the suggestions and the currently selected item fills itself into the command line. But in insert mode, when I press tab I'm getting 2 spaces inserted instead. My normal tabbing inserts 4 spaces FYI.
Not sure what to change here. I've looked through conflicting mappings in init.vim and don't see anything.
I got the above code snippet from these two questions: