Various MUA related config files
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

astroid.vim 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. " Error message handling
  2. set shortmess=s " less messages
  3. set cmdheight=2
  4. " Jump to To:, Cc:, Subject:
  5. nmap <M-t> 2GA
  6. map! <M-t> <ESC>2GA
  7. nmap <M-c> 3GA
  8. map! <M-c> <ESC>3GA
  9. nmap <M-b> 4GA
  10. map! <M-b> <ESC>4GA
  11. " delete lines until end
  12. nmap <C-d> dG1o
  13. map! <C-d> <ESC>dG1o
  14. " delete current line
  15. nmap <C-s> ddi
  16. map! <C-s> <ESC>ddi
  17. " add empty line
  18. nmap <C-a> 1o
  19. map! <C-a> <ESC>1o
  20. " Go to first empty line and start insert mode
  21. execute "normal /^$/\n"
  22. execute ":startinsert"
  23. " add two empty lines after header (where we jumped to)
  24. execute "call append(line('.')-1, '')"
  25. execute "call append(line('.')-1, '')"
  26. " Email auto completion for headers
  27. let g:qcc_query_command='abook --datafile ~/DAV/CardDAV/mxmehl-fsfe.abook --mutt-query'
  28. setlocal omnifunc=QueryCommandComplete
  29. " Functions
  30. " Set tw to 500 if in the first 4 lines, else 500
  31. au CursorMovedI * call ModifyTextWidth() " execute when cursor has moved, use for all files
  32. function! ModifyTextWidth()
  33. let line=getline('.') " get the current line number of the cursor
  34. if line('.') < 5 " if line number smaller than 5
  35. setlocal textwidth=500 " use high tw setting
  36. else
  37. setlocal textwidth=72 " Otherwise use normal textwidth
  38. endif
  39. endfunction
  40. function! Mail_Erase_Sig()
  41. " search for the signature pattern (takes into account signature delimiters
  42. " from broken mailers that forget the space after the two dashes)
  43. let i = 0
  44. while ((i <= line('$')) && (getline(i) !~ '^> *-- \=$'))
  45. let i = i + 1
  46. endwhile
  47. " if found, then
  48. if (i != line('$') + 1)
  49. " first, look for our own signature, to avoid deleting it
  50. let j = i
  51. while (j < line('$') && (getline(j + 1) !~ '^-- $'))
  52. let j = j + 1
  53. endwhile
  54. " second, search for the last non empty (non sig) line
  55. while ((i > 0) && (getline(i - 1) =~ '^\(>\s*\)*$'))
  56. let i = i - 1
  57. endwhile
  58. " third, delete those lines plus the signature
  59. exe ':'.i.','.j.'d'
  60. endif
  61. endfunction
  62. function! Mail_Erase_Own_Sig()
  63. let i = 0
  64. while ((i <= line('$')) && (getline(i) !~ '^-- \=$'))
  65. let i = i + 1
  66. endwhile
  67. " if found, then
  68. if (i != line('$') + 1)
  69. " first, look for our own signature, to avoid deleting it
  70. let j = i
  71. while (j < line('$') && (getline(j + 1) !~ '^-- $'))
  72. let j = j + 1
  73. endwhile
  74. " second, search for the last non empty (non sig) line
  75. while ((i > 0) && (getline(i - 1) =~ '^\(>\s*\)*$'))
  76. let i = i - 1
  77. endwhile
  78. " third, delete those lines plus the signature
  79. exe ':'.i.','.j.'d'
  80. endif
  81. endfunction
  82. function! Mail_Beginning()
  83. exe "normal gg"
  84. if getline (line ('.')) =~ '^From: '
  85. " if we use edit_headers in Mutt, then go after the headers
  86. exe "normal /^$\<CR>"
  87. endif
  88. endfunction
  89. call Mail_Erase_Own_Sig()
  90. call Mail_Erase_Sig()
  91. call Mail_Beginning()