Re: vim & mutt
Alexey Vyskubov <alexey@pepper.spb.ru> writes:
> > У меня тут есть небольшой скриптик для vim, который делает чтобы titlebar у
> > xterm содержал получателя письма (когда пишутся письма, естественно).
> >
> > Если кому-то интересно, могу поделится.
>
> Интересно, поделись!
Вот это надо вставить в .vimrc:
if has("autocmd")
autocmd BufRead mutt* execute M_settings()
endif
" set up xterm title to indicate a recipient of the letter
function M_settings()
" general settings
execute 'set tw=78 noshowmatch'
let i = 1
let line = getline(i)
" find a line with To: field
while (match(line, "To:") == -1 && line != "")
let i = i + 1
let line = getline(i)
endwhile
" if it's there, modify title
if (line != "")
let i = match(line, " ") + 1
let j = match(line, "<") - 1
if j == -2
let j = match(line, ",")
endif
if j == -1
let j = strlen(line)
endif
let len = j - i
let address = strpart(line, i, len)
let title = "Mail to " . address
let title = substitute(title, " ", "\\\\ ", "g")
let title = substitute(title, "\"", "", "g")
execute 'set titlestring=' . title
execute 'set iconstring=' . title
else
" leave default mutt title otherwise
execute 'set titlestring=Mutt'
execute 'set iconstring=Mutt'
endif
execute 'set titleold=Mutt'
endfunc
Peter.
--
Software is like sex; it's better when it's free.
Reply to: