Thursday, December 29, 2011

Re: mutt and vim playing together

On Thursday, December 29, 2011 07:00:59 Kai Weber wrote: > Hi, > I use vim in combination with mutt. To start vim I have > following setting in my muttrc: [snip] > Any other recommendations for a good mail editing workflow? when i used mutt i liked having the flexibility of a mail script for vim, so i put set editor="vim -S ~/.vim/mail.vim" in my ~/.muttrc you can get as fancy or as simple as you want in that script here's mine: <mail.vim> " mail mode settings setlocal ft=mail setlocal tw=64 let @n = '> kki' " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if has("gui_running") winpos 324 228 set columns=70 set lines=35 endif " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ nmap <silent> <F1> :call F1_formatter("64")<CR> imap <silent> <F1> <C-O>:call F1_formatter("64")<CR> nmap <S-F1> :call F1_toggle_width("64")<CR> imap <S-F1> <C-O>:call F1_toggle_width("64")<CR> " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ let mapleader = ',' nnoremap <Leader>ee :source ~/.vim/mail.vim<CR> nnoremap <Leader>ev :edit ~/.vim/mail.vim<CR> " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ " clean up quoting silent %s/^> /> /e silent %s/^> $//e " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ </mail.vim> now for example while in insert mode i can use ctrl-r n to insert my remarks inside quoted text grrrr -- kmail has bolixed what i have in there for @n it should look like let @n = '^M^M^M^M> ^[kki' where each ^M is an actual return (i should go back to using mutt :) for your purposes you might want to add function! FirstBlankAtEnd() let go = NumberBlankLinesAtEnd() - 1 normal G if (go > 0) execute 'normal ' go . 'k' endif endfunction function! NumberBlankLinesAtEnd() let s:bc = 0 let s:lp = line("$") while s:lp > 0 let s:tl = strlen(getline(s:lp)) if (s:tl > 0) let s:lp = 0 else let s:bc = s:bc + 1 let s:lp = s:lp - 1 endif endwhile return s:bc endfunction and add a call to FirstBlankAtEnd to your editor command in .muttrc something to play around with if you want to get fancy

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment