home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 March / PCWELT_3_2006.ISO / base / 05_common.mo / usr / share / elvis-2.2_0 / scripts / since.ex < prev    next >
Encoding:
Text File  |  2004-02-22  |  1.2 KB  |  46 lines

  1. "Defines some aliases and autocmds for highlighting lines that have changed.
  2.  
  3. alias since {
  4.   " Highlight the differences between current buffer and its file
  5.   "local a s=since f t=/tmp/diff report=0 u=/tmp/diff.ex
  6.   set s=since t=/tmp/diff report=0 u=/tmp/diff.ex
  7.   let f = "!*" || filename
  8.   if !exists(filename)
  9.   then error usage: since [filename]
  10.   eval unr (s)
  11.   w! (t)
  12.   let a = "diff" f t
  13.   let a = a;"| sed -n 's/^[0-9,]*a\\([0-9,]*\\)$/\\1reg diff added/p;s/^[0-9,]*c\\([0-9,]*\\)$/\\1reg diff changed/p' >";u
  14.   eval !!(a)
  15.   safely source (u)
  16.   eval !!rm (t)
  17. }
  18.  
  19. alias rcssince {
  20.   " Highlight the differences between the current buffer and an RCS version
  21.   local s=rcssince t=/tmp/diff report=0
  22.   eval unr (s)
  23.   if exists("RCS"/filename;",v") || exists(filename;",v")
  24.   then {
  25.     w! (t)
  26.     let a = "co -p !1 2>/dev/null" filename "| diff - " t
  27.     let a = a;"| sed -n 's/^[0-9,]*a\\([0-9,]*\\)$/\\1reg" s "added/p;s/^[0-9,]*c\\([0-9,]*\\)$/\\1reg" s "changed/p'"
  28.     let a = shell(a)
  29.     eval (a)
  30.     eval !!rm (t)
  31.   }
  32. }
  33.  
  34. aug since
  35.   au!
  36.   au Edit * {
  37.     if filename
  38.     then '[,']reg unsaved
  39.   }
  40.   au BufWritePost * %unr unsaved
  41.   au BufReadPost * rcssince
  42. aug END
  43. color since on orange
  44. color rcssince on orange
  45. color unsaved on tan
  46.