JohnBeckett (talk | contribs) m (moved Configuring vim so it can be callled from "crontab -e" to Editing crontab: fix typo and simplify) |
(→Comments: moved info from talk page) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{TipNew |
||
− | {{TipProposed |
||
− | |id= |
+ | |id=1621 |
− | |previous= |
+ | |previous=1620 |
− | |next= |
+ | |next=1622 |
− | |created= |
+ | |created=2009 |
|complexity=basic |
|complexity=basic |
||
|author= |
|author= |
||
Line 11: | Line 11: | ||
|category2= |
|category2= |
||
}} |
}} |
||
− | When Vim is called from < |
+ | When Vim is called from <code>crontab -e</code> it will not work if the '<code>backup</code>' option is set to ''no'' or ''auto''. (I get the error message |
− | :crontab: temp file must be edited in place |
+ | :<code>crontab: temp file must be edited in place</code> |
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: |
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: |
||
<pre> |
<pre> |
||
Line 18: | Line 18: | ||
</pre> |
</pre> |
||
− | The temporary file created by crontab on Mac OS X is named something like < |
+ | The temporary file created by crontab on Mac OS X is named something like <code>/private/tmp/crontab.XXXXXXXXXX</code> (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 ( http://tim.theenchanter.com/2008_07_01_archive.html ) is |
||
+ | set backupskip=/tmp/*,/private/tmp/* |
||
==Comments== |
==Comments== |
||
+ | You can also create a file ~/.vim/ftplugin/crontab.vim with the following content: |
||
+ | |||
+ | set backupcopy=yes |
Revision as of 16:45, 22 August 2014
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 ( http://tim.theenchanter.com/2008_07_01_archive.html ) is
set backupskip=/tmp/*,/private/tmp/*
Comments
You can also create a file ~/.vim/ftplugin/crontab.vim with the following content:
set backupcopy=yes