Closed tricktux closed 7 years ago
Here's a way to do this, add the following code into your vimrc, you'll also need a snippet engine (ultisnips/snipmate/neosnippet).
The alias name may not match the prefix of the alias pattern (e.g. foo
and My Foo <foo@bar.com>
), items will be filtered out by NCM. This is why I convert it into snippet.
" ncm's filtering is based on word, so it's better to convert results of
" muttaliases#CompleteMuttAliases into snippet expension
func! g:MuttOmniWrap(findstart, base)
let ret = muttaliases#CompleteMuttAliases(a:findstart, a:base)
if type(ret) == type([])
let i=0
while i<len(ret)
let ret[i]['snippet'] = ret[i]['word']
let ret[i]['word'] = ret[i]['abbr']
let i+=1
endwhile
endif
return ret
endfunc
au User CmSetup call cm#register_source({'name' : 'mutt',
\ 'priority': 9,
\ 'cm_refresh_length': -1,
\ 'cm_refresh_patterns': ['^\w+:\s+'],
\ 'cm_refresh': {'omnifunc': 'g:MuttOmniWrap'},
\ })
Awesome!! Thanks!! :100: :+1:
I'll do a screen cast and put it in the screen shots issues once I figure out how to blur screen :stuck_out_tongue:
This would be a great sample to try to implement #64 ....Just saying :stuck_out_tongue_closed_eyes:
I would like to humbly request for integration with vim-mutt-aliases-plugin.
Thanks for an excellent plugin.