Loading ...
Sorry, an error occurred while loading the content.

113680Vim and pseudorandom mail signatures (Was: Top/End of file not active with Ctrl-Home/Ctrl-End with vim on a gnome terminal)

Expand Messages
  • Tony Mechelynck
    Apr 9, 2010
      On 17/02/10 14:41, Jean Johner wrote:
      [...]
      > I am delighted by Tony's foot citations. Each time different.
      >
      > Regards.
      >

      I use Vim (compiled with +clipboard, +viminfo and +windows) to generate
      them, with the help of:

      - a file of funny signatures from Bram's site, modified (IIRC) so that
      each individual sig starts with a "dash-dash-space" separator
      - the GNU "fortune" program

      Both of these are optional, but if neither is present then of course no
      funny signatures will be generated.

      Here's the relevant snippet from my vimrc; I don't notice the
      open-and-shut auxiliary window except by the disappearance of any
      |more-prompt| that may be present beforehand.

      ---8<---
      if has('clipboard') && has('viminfo') && has('windows')
      " the above tests if Vim has clipboard support _compiled-in_
      " we should actually test if the clipboard is _available_
      " but that is a non-obvious thing on Unix Vim in console mode.
      function Fortune()
      " In order to remember them in the viminfo,
      " the first two variables defined below
      " must have names starting with an uppercase letter
      " and containing no lowercase letters.
      if !exists("g:FORTUNE")
      let g:FORTUNE = 0
      endif
      if !exists("g:FORTUNECYCLE")
      let g:FORTUNECYCLE = 5
      endif
      if !exists("s:sysFortunes")
      let s:sysFortunes =
      \ (system("which fortune") != "") && (!v:shell_error)
      endif
      if !exists("s:bramFortunes")
      let s:bramFortunes =
      \ filereadable(expand("~/fortunes.txt"))
      endif
      if s:sysFortunes && (g:FORTUNE || (!s:bramFortunes))
      let @+ = "-- \n" . system("fortune -a")
      elseif s:bramFortunes
      new ~/fortunes.txt
      silent 1;/^-- $/-1d +
      $put +
      wq
      else
      let @+ = ""
      endif
      let g:FORTUNE = g:FORTUNE + 1
      if g:FORTUNE >= g:FORTUNECYCLE
      let g:FORTUNE = 0
      endif
      return @+
      endfunction
      map <F5> :echo Fortune()<CR>
      if &vi !~ '!'
      set vi^=! " insert in front
      " to avoid clobbering ,n<filename>
      " which must be last
      endif
      endif
      --->8---


      Best regards,
      Tony.
      --
      The Advertising Agency Song:

      When your client's hopping mad,
      Put his picture in the ad.
      If he still should prove refractory,
      Add a picture of his factory.

      --
      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
    • Show all 7 messages in this topic