lifepillar / vim-mucomplete

Chained completion that works the way you want!
MIT License
913 stars 18 forks source link

Feature Request - Ability to set completeopt on MU Auto Toggle #31

Closed tjharman closed 7 years ago

tjharman commented 7 years ago

It would be nice (I think, there are probably good reasons it's not) to have completeopt's settings be toggled for you when MUcompleteAutoOff/On/Toggle is used.

For example (this is bad pseudo code)

let g:mucomplete#CompAutoOn = {add : 'noinsert, noselect'}
let g:mucomplete#CompAutoOff = {remove: 'noinsert,noselect'}

Does this make sense? Is it a good idea, or a stupid one?

lifepillar commented 7 years ago

By design, µcomplete does not set or change any Vim options, much less global options. So, the short answer is: the user has to do it (through a custom command or mapping). For example:

fun! s:toggle_completeopt()
  if exists('#MUcompleteAuto')
    set completeopt+=noinsert,noselect
  else
   set completeopt-=noinsert,noselect
  endif
endf
nnoremap <silent> coa :<c-u>MUcompleteAutoToggle<cr>:call <sid>toggle_completeopt()<cr>

Note that noinsert is ignored in manual completion (again, by design), except for spelling suggestions.

tjharman commented 7 years ago

This makes perfect sense, thank you. And thank you for the .vimrc suggestion, that'll do perfectly.