ser*_*ken 7 windows git vim commit
Windows 7 x64
无法理解我的错误.
$ git config --global core.editor vim
$ git commit
Run Code Online (Sandbox Code Playgroud)
.gitconfig
路径: editor = vim
E325:注意
错误:编辑器'vim'出现问题.请使用-m或-F选项提供消息.
$ git config --global core.editor "'vim' -w"
$ git commit
Run Code Online (Sandbox Code Playgroud)
.gitconfig
路径: editor = 'vim' -w
当Vim打开时,它是空的,但应该包含类似的内容$ git diff
$ git config --global --unset core.editor
$ git commit
Run Code Online (Sandbox Code Playgroud)
E325注意
由于空提交消息而中止提交.
我以为Vim默认使用.
$ EDITOR=vim
$ git commit
Run Code Online (Sandbox Code Playgroud)
E325注意
由于空提交消息而中止提交.
$ 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
Run Code Online (Sandbox Code Playgroud)
我今天遇到了这个错误.我在这里发布我的解决方案,因为它可以帮助其他人.首先,关于我如何让自己陷入获得此错误的困境(TL; DR?跳转到"解决方案"部分)的一个小故事.
我将VIM设置为我的默认编辑器并编写了提交消息.像往常一样,我忘了使用Shift + Insert粘贴一行文本,而是使用Ctrl + V. 我的脑子仍处于Windows模式,我试图通过按Ctrl + Z来"撤消"我的错误(这太自然了).一阵冲动压力机和:q!
后来的尝试,我失去了工作.VIM不会回应任何事情.我不得不使用Windows任务管理器终止进程.从那时起,每次Git启动VIM时我都会收到OP的错误(对于commit
消息rebase -i
,等等).
但是,我注意到问题仅发生在我搞砸了VIM时我所在的存储库中.Git推出的VIM在其他回购中运行良好.谷歌搜索,我被提醒VIM的交换文件.
果然,我在受影响的repo的.git目录中找到了一个流氓交换文件,而且有意义的是,它是针对COMMIT_EDITMSG文件的.删除此交换文件(*.swp)修复了问题.