I have two problems:

  • I can not correctly register the address for core.editor in the terminal;
  • Using vim results in an incomprehensible error;

It so happened that the first time I use the terminal and the first time I see vim . After the first $ git commit , there was no error, vim opened, but I was confused and trying to close the editor could have done something bad, but I don’t even imagine what.

Yes, $ git commit -m "text" works. But without -m should work too. As far as I know, the result should be sent to the editor $ git diff and I want to find out what I’ve done.

The $EDITOR seemingly empty (the result is an empty string).
Git reinstalled, computer restarted.

By itself, $ vim works.


 $ git config --global core.editor "'C:/Program Files/Git/usr/bin/vim'" $ git commit 

In the .gitconfig file .gitconfig address looks like this: editor = 'C:/Program Files/Git/usr/bin/vim'

E325: ATTENTION
Aborting commit due to empty commit message.

After this message, I can do nothing in the terminal.


 $ git config --global core.editor vim $ git commit 

In the .gitconfig file .gitconfig address looks like this: editor = vim

E325: ATTENTION
Error: There was a problem with the editor 'vim'. Please supply the message using either the -m or -F option.

After this message, I can do nothing in the terminal.


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

In the .gitconfig file .gitconfig address looks like this: editor = C:/Program Files/Git/usr/bin/vim

C: / Program Files / Git / usr / bin / vim: C: / Program: No "C: / Program Files / Git / usr / bin / vim".
Please supply the message using either the -m or -F option.


 $ git config --global core.editor "C:/Program Files/Git/usr/bin/vim.exe" $ git commit 

In the .gitconfig file .gitconfig address looks like this: editor = C:/Program Files/Git/usr/bin/vim.exe

C: / Program Files / Git / usr / bin / vim.exe: C: / Program: No C: / Program Files / Git / usr / bin / vim. exe '. Please supply the message using either the -m or -F option.


$ vim --version

 VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jun 1 2017 21:25:47) Π—Π°ΠΏΠ»Π°Ρ‚ΠΊΠΈ: 1-606 Π‘ΠΊΠΎΠΌΠΏΠΈΠ»ΠΈΡ€ΠΎΠ²Π°Π½ <alexpux@gmail.com> ΠžΠ³Ρ€ΠΎΠΌΠ½Π°Ρ вСрсия Π±Π΅Π· графичСского интСрфСйса. Π’ΠΊΠ»ΡŽΡ‡Ρ‘Π½Π½Ρ‹Π΅ (+) ΠΈ ΠΎΡ‚ΠΊΠ»ΡŽΡ‡Ρ‘Π½Π½Ρ‹Π΅ (-) особСнности: +acl +file_in_path +mouse_sgr +tag_old_static +arabic +find_in_path -mouse_sysmouse -tag_any_white +autocmd +float +mouse_urxvt -tcl -balloon_eval +folding +mouse_xterm +termguicolors -browse -footer +multi_byte +terminfo ++builtin_terms +fork() +multi_lang +termresponse +byte_offset +gettext -mzscheme +textobjects +channel -hangul_input +netbeans_intg +timers +cindent +iconv +num64 +title -clientserver +insert_expand +packages -toolbar +clipboard +job +path_extra +user_commands +cmdline_compl +jumplist +perl/dyn +vertsplit +cmdline_hist +keymap +persistent_undo +virtualedit +cmdline_info +lambda +postscript +visual +comments +langmap +printer +visualextra +conceal +libcall +profile +viminfo +cryptv +linebreak +python/dyn +vreplace +cscope +lispindent +python3/dyn +wildignore +cursorbind +listcmds +quickfix +wildmenu +cursorshape +localmap +reltime +windows +dialog_con -lua +rightleft +writebackup +diff +menu +ruby/dyn -X11 +digraphs +mksession +scrollbind -xfontset -dnd +modify_fname +signs -xim -ebcdic +mouse +smartindent -xpm +emacs_tags -mouseshape +startuptime -xsmp +eval +mouse_dec +statusline -xterm_clipboard +ex_extra -mouse_gpm -sun_workshop -xterm_save +extra_search -mouse_jsbterm +syntax +farsi +mouse_netterm +tag_binary общСсистСмный Ρ„Π°ΠΉΠ» vimrc: "/etc/vimrc" ΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚Π΅Π»ΡŒΡΠΊΠΈΠΉ Ρ„Π°ΠΉΠ» vimrc: "$HOME/.vimrc" Π²Ρ‚ΠΎΡ€ΠΎΠΉ ΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚Π΅Π»ΡŒΡΠΊΠΈΠΉ Ρ„Π°ΠΉΠ» vimrc: "~/.vim/vimrc" ΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚Π΅Π»ΡŒΡΠΊΠΈΠΉ Ρ„Π°ΠΉΠ» exrc: "$HOME/.exrc" defaults file: "$VIMRUNTIME/defaults.vim" Π·Π½Π°Ρ‡Π΅Π½ΠΈΠ΅ $VIM ΠΏΠΎ ΡƒΠΌΠΎΠ»Ρ‡Π°Π½ΠΈΡŽ: "/etc" Π·Π½Π°Ρ‡Π΅Π½ΠΈΠ΅ $VIMRUNTIME ΠΏΠΎ ΡƒΠΌΠΎΠ»Ρ‡Π°Π½ΠΈΡŽ: "/usr/share/vim/vim80 " ΠŸΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€Ρ‹ компиляции: gcc -c -I. -Iproto -DHAVE_CONFIG_H -D_FORTIFY_SOURCE=2 -I/usr/include/ncursesw -march=x86-64 -mtune=generic -O2 -pipe -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 Π‘Π±ΠΎΡ€ΠΊΠ°: gcc -L. -pipe -fstack-protector -pipe -Wl, --as-needed -o vim.exe -lm -lncursesw -liconv -lacl -lintl -Wl, --enable-auto-import -Wl,--export-all-symbols -Wl, --enable-auto-image-base -fstack-protector-strong -L/usr/lib/perl5/core_perl/CORE -lperl -lpthread -ldl -lcrypt 
  • I realized that the address must be entered in double quotes. "''" But why Vim does not work I do not understand - serken
  • I was able to put Sublime Text with the -w flag, but after saving and exiting, I get an error, an empty commit message . I do not know how to fix it yet. - serken
  • I could get rid of the empty commit message when I realized that there must be at least 1 uncommented symbol. As a result, Sublime Text works, but Vim does not. What is wrong with Vim don't understand. - serken
  • Try in the .gitconfig file put a .gitconfig before the space in the Program Files folder name. - mymedia
  • one
    And one more thing: check that you do not have other vim instances running (if you are not sure about this, restart the computer for reliability), and try doing the same on a clean repository. - mymedia

1 answer 1

Among the many mistakes that you cited, I noticed error number 325, which Vim complained about. Logically, this is not exactly a mistake, but only a message about unsaved file changes when the previous session with the editor crashes. (Apparently, for the first time you just killed the vim process, but it did not delete the temporary file needed for recovery).

Technically, when you invoke the git commit command without specifying a git commit message, git creates a .git/COMMIT_EDITMSG with a comment template and opens the editor for this file. The first time Vim opened, it created a temporary .git/COMMIT_EDITMSG.swp and did not delete it due to abnormal termination. In subsequent times, he offered you to restore the original file, but for some unknown reason, the corresponding invitation was not displayed (under Windows, there are often any glitches). However, if you delete the .swp file, I believe the editor will work.

You can disable the functionality of such temporary files by disabling the swapfile setting. Add the following line to your Vim configuration file.

 set noswapfile 

You can read more about the initial error in the help by calling it with the command :help E325 from Vim. web version

Note that Git checks the exit status of the called editor, so if an error occurs during editing, the commit is canceled. In addition, without specifying the --allow-empty-message parameter, Git will refuse to record anything unless there is a single line in the COMMIT_EDITMSG file COMMIT_EDITMSG does not begin with # .

  • one
    Thank you, I have been looking for this information all day. Obviously, having deleted the repository from the computer, I deleted the .swp file. Having downloaded the repository again, this file was not there, of course, and the error disappeared. Thanks again. - serken