DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 14th February 2018
beavers beavers is offline
Port Guard
 
Join Date: Nov 2017
Posts: 14
Default Editor for crontab?

I would like to set vim as the editor for `crontab -e`, and per the man page I have tried setting EDITOR and/or VISUAL in ~/.profile. This works fine; however, I do not want either of these parameters to take effect for the ksh command-line editing mode. Is there a way to use vim _only_ for crontab?
Reply With Quote
  #2   (View Single Post)  
Old 14th February 2018
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 6,179
Default

Hello and welcome!

Consider using your shell and its alias facility. For example, something like this:

$ alias crontab='env EDITOR=/usr/local/bin/vim /usr/bin/crontab'

Last edited by jggimi; 14th February 2018 at 02:16 AM. Reason: Silly me. I didn't need a trailing -e
Reply With Quote
  #3   (View Single Post)  
Old 14th February 2018
Head_on_a_Stick's Avatar
Head_on_a_Stick Head_on_a_Stick is offline
Real Name: Matthew
Mostly Harmless
 
Join Date: Dec 2015
Location: London
Posts: 86
Default

Quote:
Originally Posted by beavers View Post
I have tried setting EDITOR and/or VISUAL in ~/.profile. This works fine; however, I do not want either of these parameters to take effect for the ksh command-line editing mode
Add this line to ~/.profile (if it does not already exist):
Code:
export ENV="${HOME}/.kshrc"
Then add this line to ~/.kshrc:
Code:
set -o emacs
This will allow you to set VISUAL to vim but keep ksh's stock editing mode.
__________________
Linux is for people who hate Windows. BSD is for people who love UNIX.
Reply With Quote
  #4   (View Single Post)  
Old 14th February 2018
beavers beavers is offline
Port Guard
 
Join Date: Nov 2017
Posts: 14
Default

Very nice, thank you both!
Reply With Quote
Reply

Tags
crontab, editing, ksh, mode, vim

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
vi editor jjstorm OpenBSD Packages and Ports 20 1st December 2014 04:37 PM
reboot FreeBSD box with crontab mfaridi FreeBSD General 1 15th October 2011 02:37 AM
default crontab fbroce OpenBSD Installation and Upgrading 13 13th September 2010 09:20 PM
Crontab won't run script Petrocelli08 FreeBSD General 4 7th March 2009 04:19 AM
Crontab not working beandip FreeBSD General 6 6th August 2008 08:33 PM


All times are GMT. The time now is 01:49 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick