Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Also <strong>Vim</strong> :) But what I use is much different from what <a href="https://stackoverflow.com/questions/2457975/is-there-a-tool-that-automatically-saves-incremental-changes-to-files-while-codin/2457999#2457999">kzh wrote</a>.</p> <p>I don't use a version control system for my automatic backup files, I rather want to see <strong>all versions of all files in my <code>~/vim_backup</code> directory</strong>. (Note: of course I do use git for version controlling my source files, but now we are talking about automatic backups.) The following lines in my .vimrc will make Vim create a backup file each time the file is saved. The name of the backup file is the name of the normal file plus the current date and time.</p> <p>The following lines are in my .vimrc file:</p> <pre><code>if v:version &gt;= 700 " If I have a ~/vim_backup directory, let that be the backup " " directory; otherwise do not back up. " " (Vim version earlier than 7.0 do not have the finddir function.) " if finddir("~/vim_backup") != "" set bdir=~/vim_backup/ set backup else set nobackup endif endif " We set the 'backupext' option to contain the current date and time, so " " that the name of the backup file will be the concatenation of the name " " of the normal file and the current date and time. " function! HRefreshBackup() execute ":set backupext=" . strftime(".%y%m%d_%H%M") " You may want to have %H%M%S instead of %H%M if you want to have the " " possibility of having multiple backups in a minute. " endfunction " Refresh the backup file name before each "save" " au BufWritePre * call HRefreshBackup() </code></pre> <p>Example of how my <code>~/vim_backup</code> directory looks like:</p> <pre><code>$ ls -ltr ~/vim_backup | head total 105692 -rwx--x--x 1 hcs hcs 252 2009-12-19 06:49 Sync_flash.091222_0902 -rwxr-xr-x 1 hcs hcs 819 2009-12-19 06:49 hk.091229_1637 -rwxr-xr-x 1 hcs hcs 507 2009-12-19 06:49 FOLLOW_LINK.091220_0802 -rwx--x--x 1 hcs hcs 212 2009-12-19 06:49 Cut.091230_2113 -rwxr-xr-x 1 hcs hcs 275320 2009-12-19 06:51 margitka.100116_1949 -rw-r--r-- 1 hcs hcs 80 2009-12-19 06:51 localrc_dorsu.vim.100101_1112 -rwx--x--x 1 hcs hcs 10335 2009-12-19 06:51 Video.091222_1754 -rwxr-xr-x 1 hcs hcs 1255 2009-12-19 06:51 Update.091222_1754 -rwxr-xr-x 1 hcs hcs 716 2009-12-19 06:51 SshMaker.091222_1754 </code></pre> <p>This wastes some disk space, since all versions of all files are stored . So it may be worth to periodically archive and compress them. I tried several tools to compress the set of backup files, and "rar" with the "-s" option was the best. 100 megabytes of backup files were created in the last three month, and "rar -s" compressed it to 3 MB.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload