Wikia

Vim Tips Wiki

Editing a hard link to a file

Talk0
1,610pages on
this wiki

Redirected from New When Hardlinked

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

ReferencesEdit

CommentsEdit

Around Wikia's network

Random Wiki