Vim Tips Wiki
(Change <tt> to <code>, perhaps also minor tweak.)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
  +
{{TipNew
{{TipProposed
 
|id=0
+
|id=1590
|previous=0
+
|previous=1589
|next=0
+
|next=1591
|created=February 16, 2008
+
|created=2008
 
|complexity=basic
 
|complexity=basic
 
|author=Metacosm
 
|author=Metacosm
Line 11: Line 11:
 
|category2=
 
|category2=
 
}}
 
}}
On Unix-based systems, the shell command <tt>ln x y</tt> creates <tt>y</tt> as a hard link to file <tt>x</tt>. There is only a single file, so if you edit <tt>y</tt>, you will also change <tt>x</tt>.
+
On Unix-based systems, the shell command <code>ln x y</code> creates <code>y</code> as a hard link to file <code>x</code>. There is only a single file, so if you edit <code>y</code>, you will also change <code>x</code>.
   
If wanted, you can configure Vim so that it will break hard links whenever a file is written, providing a backup is made. In that case, editing <tt>y</tt> would automatically remove the link, and create a separate file, leaving <tt>x</tt> unchanged. The Vim command (in [[vimrc]]) is:
+
If wanted, you can configure Vim so that it will break hard links whenever a file is written, providing a backup is made. In that case, editing <code>y</code> would automatically remove the link, and create a separate file, leaving <code>x</code> unchanged. The Vim command (in [[vimrc]]) is:
 
<pre>
 
<pre>
 
set backupcopy=auto,breakhardlink
 
set backupcopy=auto,breakhardlink
Line 19: Line 19:
   
 
==References==
 
==References==
*{{help|'backup'}}
+
*{{help|'backup'}}
 
*{{help|'backupcopy'}}
 
*{{help|'backupcopy'}}
   

Latest revision as of 06:36, 13 July 2012

Tip 1590 Printable Monobook Previous Next

created 2008 · complexity basic · author Metacosm · version 7.0


On Unix-based systems, the shell command ln x y creates y as a hard link to file x. There is only a single file, so if you edit y, you will also change x.

If wanted, you can configure Vim so that it will break hard links whenever a file is written, providing a backup is made. In that case, editing y would automatically remove the link, and create a separate file, leaving x unchanged. The Vim command (in vimrc) is:

set backupcopy=auto,breakhardlink

References[]

Comments[]