我试图让 vim 允许我用 tab 键在自动完成弹出列表中循环。它适用于 tab 但不适用于 s-tab (shift-tab)。似乎 shift-tab 在应用 CP 之前以某种方式取消了自动完成菜单
有人有什么想法吗?
function InsertTabWrapper(direction)
if pumvisible()
if "forward" == a:direction
return "\<C-N>"
else
return "\<C-P>"
endif
endif
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k'
return "\<tab>"
else
return "\<c-x>\<c-o>"
endif
endfunction
inoremap <tab> <c-r>=InsertTabWrapper("forward")<cr>
inoremap <s-tab> <c-r>InsertTabWrapper("backward")<cr>