lifepillar / vim-mucomplete

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

Add regex based scoped completion #175

Closed vigoux closed 4 years ago

vigoux commented 4 years ago

This PR adds support for regex based scoped completion, as requested in #174.

Another improvement might be to slightly change the way the chains dict is used, to search in this order :

  1. Scoped chain for this ft
  2. Scoped chain in default
  3. Default for this ft
  4. Default in default

This would allow this kind of configuration :

let g:mucomplete#chains = {
            \ 'default': {
            \       'default' : ['tags', 'nsnp'],
            \       '.*String.*' : [],
            \       '.*Comment.*' : ['spel']
            \       },
            \ 'rust' :['omni', 'nsnp'],
            \ 'vim' : ['omni', 'nsnp']
            \ }

Which would have the same effect as this :

let g:mucomplete#chains = {
            \ 'default': ['tags', 'nsnp'],
            \ 'rust' : {
            \       "default" : ['omni', 'nsnp'],
            \       "rustString.*" : [],
            \       "rustComment.*" : ['spel'],
            \       },
            \ 'c' : {
            \       "cComment.*" : [],
            \       "cString.*" : []
            \       },
            \ 'vim' : {
            \       'default' : ['omni', 'nsnp'],
            \       'vimComment.*' : [],
            \       'vimString.*' : ['spel']
            \       },
            \ }
lifepillar commented 4 years ago

Sorry the long delay. Thanks for your contribution!