Hi Volker! On Fr, 21 Okt 2011, Volker Bouffier wrote:
> | " mutt: insert attachment with ranger > | fun! RangerMuttAttach() > | if filereadable('/tmp/chosendir') > | silent !ranger --choosefiles=/tmp/chosenfiles > --choosedir=/tmp/chosendir "$(cat /tmp/chosendir)" > | else > | silent !ranger --choosefiles=/tmp/chosenfiles > --choosedir=/tmp/chosendir > | endif > | if filereadable('/tmp/chosenfiles') > | call system('sed "s/\(.*\)/Attach: \1/" /tmp/chosenfiles > > /tmp/muttattach') > | exec 'read /tmp/muttattach' > | call system('rm /tmp/chosenfiles /tmp/muttattach') > | endif > | redraw! > | endfun > | map <C-a> magg/Reply-To<CR><ESC>:call RangerMuttAttach()<CR>`a > > If you replace the line with the sed command with following line, it can even > handle file names with > whitespaces: > call system('sed "s/[[:space:]]/\\\ /g" /tmp/chosenfiles | sed > "s/\(.*\)/Attach: \1/" > /tmp/muttattach') Even better, avoid sed altogether: call append('.', map(readfile('/tmp/chosenfiles'), '"Attach: ".v:val')) regards, Christian