Skip to content
This repository has been archived by the owner on Jul 27, 2018. It is now read-only.

Request for mutt aliases integration #97

Closed
tricktux opened this issue Jun 26, 2017 · 3 comments
Closed

Request for mutt aliases integration #97

tricktux opened this issue Jun 26, 2017 · 3 comments

Comments

@tricktux
Copy link

I would like to humbly request for integration with vim-mutt-aliases-plugin.

Thanks for an excellent plugin.

@roxma
Copy link
Owner

roxma commented Jun 27, 2017

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'},
            \ })

roxma added a commit that referenced this issue Jun 27, 2017
@tricktux
Copy link
Author

Awesome!! Thanks!! 💯 👍

I'll do a screen cast and put it in the screen shots issues once I figure out how to blur screen 😛

@tricktux
Copy link
Author

This would be a great sample to try to implement #64
....Just saying 😝

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants