I thought perhaps vim was in some compatibility mode of some sort. To make sure it was using vim instead of vi, I set the VISUAL environment variable but was still unable to get into visual mode (hitting the v key).

Any suggestions?

  • See the Caveat Section of the Sudoers man page to understand why jofel's answer is correct.
    – eyoung100
    Sep 26 '14 at 15:58
  • Thanks. I am, however, unsure how the caveat section was relevant. Are you emphasizing the security concerns? Sep 26 '14 at 16:02
  • "The sudoers file should always be edited by the visudo command which locks the file and does grammatical checking. It is imperative that sudoers be free of syntax errors since sudo will not run with a syntactically incorrect sudoers file." My Two Cents: visudo uses a base text editor w/ no visual mode in order to keep those permission checks etc as clean as possible, therefore it ignores the environment variables.
    – eyoung100
    Sep 26 '14 at 16:09

Normally, visudo ignores the VISUAL and EDITOR variable for security reasons and calls vi, so the compatibility mode of vim is enabled.

Read How to set visudo to use a different editor than the default on Fedora? to change the default editor.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.