When using vim as my default editor, I (occasionally) accidentally pull up search (e.g. via /wq instead of :wq). Once I do, I escape out of search, and then exit correctly via :wq. However, when that happens, I see the following error message:

 hint: Waiting for your editor to close the file... error: There was a problem with the editor 'vi'.
 Please supply the message using either -m or -F option.

I'm trying to understand why vi is not exiting correctly, or how I can fix it to exit correctly even after a failed search.

I am using macOS High Sierra.

 VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Nov 29 2017 18:37:46)
 Included patches: 1-503, 505-680, 682-1283

Steps to reproduce:

 > git commit
 vim> i
 vim> My Commit Message
 vim> <Esc>
 vim> /wq
 vim> <Esc>
 vim> :wq

Thanks for the help.

  • You shouldn't need the second ESC there. You say "I escape out of search" in the question text too - what state do you find Vi in after the /wq, what happens if you press :wq without the second ESC? – sundar Jun 6 '18 at 20:38
  • Good point, though the error still persists without the extra escape. – ghayes Jun 15 '18 at 18:48
  • You may want to change the config to vi instead of vim – ckwagaba May 23 at 20:26

It is possible that you have EDITOR left unset or to its default value of vi. Try making vim your editor. Although both vi and vim are the same executable in mac, I guess, vim behaves in a minimalist way when invoked as vi than vim.

git config --global core.editor /usr/bin/vim

  • Great-- you're right that I did not have a default editor set. When I set the editor to usr/bin/vim it works as expected, and if I change it back to /usr/bin/vi it fails like above. Thanks for the help! – ghayes Jun 15 '18 at 18:50

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.