On 20.10.11,15:36, Volker Bouffier wrote:
> 
> 
> 
> 
> ----- Ursprüngliche Message -----
> Von: du yang <duyang....@gmail.com>
> An: mutt-users@mutt.org
> Cc: 
> Gesendet: 15:22 Donnerstag, 20.Oktober 2011 
> Betreff: Re: external file manager
> 
> On Thursday 10/20/11 20:09:26 CST, Volker Bouffier wrote:
> > There have had solutions for file attaching like so.
> > For emacs, post-mode can do that.
> > As I know, the solution is mainly for the problem poeple often forget 
> > attaching
> > files with mutt.;-)
> I've inserted a small vim macro in my .vimrc, which does what I want:
>   " mutt: insert attachment
>   fun! RangerMuttAttach()
>       silent !ranger --choosefile=/tmp/chosenfile
>       if filereadable('/tmp/chosenfile')
>       exec 'read /tmp/chosenfile'
>           call system('rm /tmp/chosenfile')
>       endif
>       redraw!
>   endfun
>   map <C-a> magg/Reply-To<CR><ESC>:call RangerMuttAttach()<CR>IAttach: <ESC>`a
> 

This function works great! I use ranger all the time so this is very useful. My
version as I use screen:

" mutt: insert attachment                                                       
                                                                                
                          
fun! RangerMuttAttach()                                                         
                                                                                
                          
     silent !screen -X eval 'split -v' 'focus' 'screen' 'exec ranger 
--choosefile=/tmp/chosenfile'       
    if filereadable('/tmp/chosenfile')                                          
                                                                                
                          
    exec 'read /tmp/chosenfile'                                                 
                                                                                
                          
    call system('rm /tmp/chosenfile')                                           
                                                                                
                      
    endif                                                                       
                                                                                
                          
    redraw!                                                                     
                                                                                
                          
endfun                                                                          
                                                                                
                          
map \\a magg/Reply-To<CR><ESC>:call RangerMuttAttach()<CR>IAttach: <ESC>`a     

Do you have a way to empty the registry as well from the last use of
this function so it does not paste the previous file instead of the new
one? Tried different ways for that like ':let @a=""', but it did not work.

Jostein

$$

Reply via email to