Vim Tips Wiki

Editing crontab

1,624pages on
this wiki
Add New Page
Talk0 Share
Tip 1621 Printable Monobook Previous Next

created 2009 · complexity basic · version 7.0

When Vim is called from crontab -e it will not work if the 'backup' option is set to no or auto. (I get the error message

crontab: temp file must be edited in place

when exiting Vim.) There is some information at :help crontab but it does not suggest how to fix the problem. So far, adding this to my vimrc file seems to work:

au BufEnter /private/tmp/crontab.* setl backupcopy=yes

The temporary file created by crontab on Mac OS X is named something like /private/tmp/crontab.XXXXXXXXXX (with a random string of characters at the end). On other systems, you may need to use a different pattern.

Another option that can be set in vimrc tip from ( ) is

set backupskip=/tmp/*,/private/tmp/*


You can also create a file ~/.vim/ftplugin/crontab.vim with the following content:

   set backupcopy=yes

And another option is to add this to ~/.vimrc:

autocmd filetype crontab setlocal nobackup nowritebackup

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