Vim Tips Wiki
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=0
+
|id=1621
|previous=0
+
|previous=1620
|next=0
+
|next=1622
|created=March 26, 2009
+
|created=2009
 
|complexity=basic
 
|complexity=basic
 
|author=
 
|author=
Line 11: Line 11:
 
|category2=
 
|category2=
 
}}
 
}}
When Vim is called from <tt>crontab -e</tt> it will not work if the '<tt>backup</tt>' option is set to ''no'' or ''auto''. (I get the error message
+
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 <tt>/private/tmp/crontab.XXXXXXXXXX</tt> (with a random string of characters at the end). On other systems, you may need to use a different pattern.
+
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

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 ( 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