Vim Tips Wiki

Editing a hard link to a file

Redirected from New When Hardlinked

1,624pages on
this wiki
Add New Page
Talk0 Share
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



Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random Wiki