Closed
Description
I'm just starting to use Vundle and I'm running into an error when editing a Git message using the .vimrc setup from the README. When I try to save any git message in vim, I get the following error.
$ git commit
error: There was a problem with the editor 'vi'.
Please supply the message using either -m or -F option.
I've tracked this down to the initial filetype off
directive (marked as required in the README). I don't understand why its causing this issue, but after commenting out the line, but this re-enabled Git commit editing in vim.
Can you shed some light on why its "required" to disable filetype detection before using vundler? And then to re-enable it (using filetype plugin indent on
) later on?
FWIW, my vim version:
$ vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jun 24 2011 20:00:09)
Compiled by root@apple.com
Normal version without GUI. Features included (+) or not (-):
-arabic +autocmd -balloon_eval -browse +builtin_terms +byte_offset +cindent
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
-conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con +diff +digraphs
-dnd -ebcdic -emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path
+find_in_path +float +folding -footer +fork() -gettext -hangul_input +iconv
+insert_expand +jumplist -keymap -langmap +libcall +linebreak +lispindent
+listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape
-mouse_dec -mouse_gpm -mouse_jsbterm -mouse_netterm -mouse_sysmouse
+mouse_xterm +multi_byte +multi_lang -mzscheme +netbeans_intg -osfiletype
+path_extra -perl +persistent_undo +postscript +printer -profile -python
-python3 +quickfix +reltime -rightleft -ruby +scrollbind +signs +smartindent
-sniff +startuptime +statusline -sun_workshop +syntax +tag_binary
+tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title
-toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo
+vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp
-xterm_clipboard -xterm_save
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -D_FORTIFY_SOURCE=0 -Iproto -DHAVE_CONFIG_H -arch i386 -arch x86_64 -g -Os -pipe
Linking: gcc -arch i386 -arch x86_64 -o vim -lncurses
Activity
phildobbin commentedon Apr 22, 2012
I think it's to enable Vundle to bypass $VIMRUNTIME when installing & then you re-set to enable the use of filetypes.
See:
h: filetype
I'm sure our author can elucidate further :-)
gmarik commentedon Apr 30, 2012
@codyaray as @phildobbin it's required to set
filetype
detection properly.It's usually hard to say what causing issues for you without looking
.vimrc
.Also i'd like to know what
$EDITOR
is set to.Closing issue, as suspect it's just a configuration issue.
Feel free to comment if you still having issues.
sent-hil commentedon Dec 30, 2012
git config --global core.editor /usr/bin/vim
solved it for me.ruebenramirez commentedon Dec 12, 2013
git config --global core.editor $(which vim)
liyicky commentedon Feb 3, 2014
git config --global core.editor $(which vim) works. Very strange however because I was always using /usr/bin/vim. Whatever I guess.
coryfklein commentedon Jun 30, 2014
This worked for me too:
git config --global core.editor $(which vim)
hughgr commentedon Jul 4, 2014
git config --global core.editor $(which vim)
that works
cbeams commentedon Jul 16, 2014
I just went through this process as well:
git commit
$EDITOR
, which is set tovi
git config --global core.editor $(which vim)
), notice that it works$EDITOR
fromvi
to/usr/bin/vim
I'm using Vim 7.3. Thanks for Vundle. Looking forward to using it.
Work around Vim issues caused by Vundle plugin
jdevera commentedon Jul 16, 2014
@cbeams what does
which vim
andwhich vi
give you?Also, can you provide the output of:
vim --version
and
vi --version
cbeams commentedon Jul 16, 2014
jdevera commentedon Jul 16, 2014
After reading the blog post in step 5, it gets even darker. To be honest I haven't got the slightest clue of what's going on 😒
maljub01 commentedon Aug 9, 2014
If the vim executable's name is
vi
, vim will run in vi mode. This is mentioned in the manpage under the option-v
and seems to be causing this.This gist proposes turning filetype on and then off to solve this issue. I have been using that solution for more than 8 months now without any issues (Ubuntu and OS X).
It might be a good idea to change the first two lines of the README's example
.vimrc
to:cameronr commentedon Sep 16, 2014
i spent some time looking into this and here's what's what i found out:
first, i started with just this in my
vimrc
:and the error shows up as expected:
that config causes vim to load
ftoff.vim
(you can see what files are loaded at startup by runningvim --startuptime <logfile>
):if you remove silent!, you can see the error that vim is generating:
setting
filetype on
works around the problem because it causes thefiletypedetect
group to exist and no error to be generated.so why does running as vi return a non-zero exit code when vim doesn't? i didn't spend the time to trace it down exactly, but that bug was fixed somewhere in the post 7.3 patches. if you
brew install vim
, which currently installs 7.4.430 the problem goes away:so, you can resolve this issue by setting your editor to vim (instead of vi), setting
filetype on
before setting it off, or upgrading your version of vim.37 remaining items