About: Create patch for currently editing file   Sponge Permalink

An Entity of Type : owl:Thing, within Data Space : 134.155.108.49:8890 associated with source dataset(s)

It will create temporary files in case the current buffer is not modified or new. At the end it will delete the temporary files (but this works only on Linux). For Windows this script relies on the command diff which must be in your path in order to be executed successfully. The diff command can be modified in the first line of the function.

AttributesValues
rdfs:label
  • Create patch for currently editing file
rdfs:comment
  • It will create temporary files in case the current buffer is not modified or new. At the end it will delete the temporary files (but this works only on Linux). For Windows this script relies on the command diff which must be in your path in order to be executed successfully. The diff command can be modified in the first line of the function.
Version
  • 6(xsd:integer)
dbkwik:vim/property/wikiPageUsesTemplate
Previous
  • 1507(xsd:integer)
Author
  • Christian Brabandt
Subpage
  • /200712
Complexity
  • basic
Created
  • 2007-06-18(xsd:date)
ID
  • 1508(xsd:integer)
NEXT
  • 1509(xsd:integer)
abstract
  • It will create temporary files in case the current buffer is not modified or new. At the end it will delete the temporary files (but this works only on Linux). For Windows this script relies on the command diff which must be in your path in order to be executed successfully. The diff command can be modified in the first line of the function. fu! DiffUnified() let diffexpr="diff -Nuar" let bname=bufname("") let origtemp=0 " Case 1: File has a filename and is not modified if !&modified && !empty(bname) let tempfile=0 let origFile=bname.".orig" else " Case 2: File has a filename and is modified if &modified && !empty(bname) if !filereadable(bname.".orig") sp enew r # 0d let tempfile2=tempname() exe ":sil w! " .tempfile2 wincmd q let origtemp=1 wincmd p endif let origFile=tempfile2 " Case 2: File is new and is modified else if &modified let origFile=bname.".orig" else let origFile="" endif endif let bname=tempname() exe ":sil w! ".bname let tempfile=1 endif try if !filereadable(origFile) let origFile=input("With which file to diff?: ","","file") endif if !filereadable(bname) exe ":sil w! ".bname endif if empty(origFile) throw "nofile" endif exe "sil sp" exe "enew" set bt=nofile exe "sil r!".diffexpr." ".origFile." ".bname exe "0d_" exe "set ft=diff" " Clean up temporary files if tempfile == 1 exe "sil :!rm -f ". bname let tempfile=0 endif if origtemp == 1 exe "sil :!rm -f ". origFile let origtemp=0 endif catch endtry endf
Alternative Linked Data Views: ODE     Raw Data in: CXML | CSV | RDF ( N-Triples N3/Turtle JSON XML ) | OData ( Atom JSON ) | Microdata ( JSON HTML) | JSON-LD    About   
This material is Open Knowledge   W3C Semantic Web Technology [RDF Data] Valid XHTML + RDFa
OpenLink Virtuoso version 07.20.3217, on Linux (x86_64-pc-linux-gnu), Standard Edition
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2012 OpenLink Software