Hi Eric!

On Do, 13 Aug 2009, Eric Smith wrote:

> I am using this mapping (to attach files with mutt)

I once pasted this script to the mutt-users mailinglinst. It might be 
helpful:

" This function checks your mail for the words specified in
" check, and if it find them, you'll be asked to attach 
" a file.
function! CheckAttach()
    let check='attach,angehÃĪngt,attachment,Anhang'
    let oldPos=getpos('.')
    let ans=1
    let val = join(split(escape(check,' \.+*'), ','),'\|')
    1
    if search('\%('.val.'\)','W')
        let ans=input("Attach file: (leave empty to abbort): ", "", "file")
        while (ans != '')
                normal magg}-
                call append(line('.'), 'Attach: '.ans)
                redraw
            let ans=input("Attach another file?: (leave empty to abbort): ", 
"", "file")
        endwhile
    endif
    exe ":write ". expand("<amatch>")
    call setpos('.', oldPos)
endfu

augroup script
    au!
    au BufWriteCmd,FileWriteCmd mutt* :call CheckAttach()
augroup END

command! -nargs=1 -complete=file AttachFile exe "normal magg}-" | call 
append(line('.'), 'Attach: '.escape("<args>", " ")) | normal `a

regards,
Christian
-- 
If an elephant is left tied to a parking meter, the parking fee has to be paid
just as it would for a vehicle.
                [real standing law in Florida, United States of America]

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to