I've got a perplexing Vim problem. If I start editing a new file, say with vim test.txt
, and I type in the word "do" and hit enter (while still in insert mode), the next line is automatically indented. Before giving a quick answer, please read this whole post.
Two questions:
- Why might this happen?
- How can I debug the startup process (reading ~/.vimrc and files in ~/.vim/)?
More information:
- Here's my .vimrc: http://dotfiles.org/~meonkeys/.vimrc.
- "do", "if", and "switch" all cause indenting, but I still haven't figured out what language Vim is using indent rules for.
- I do have a bunch of stuff in ~/.vim/. Here's that: http://adammonsen.com/tmp/dot_vim.tgz
- I can't find anything in my ~/.vimrc or ~/.vim/ that should turn on some kind of indenting even if
filetype
is unset! - If I start Vim using
vim -u /dev/null test.txt
, the problem goes away. - Yes, I know about the
autoindent
setting. I don't think this is the problem because turning onautoindent
after using a null vimrc doesn't indent the line after "do" is typed in.
:scriptnames
. This will show you a list of scripts that have been sourced. Also, are you sure filetype is unset? :echo &ft to find out. – Randy Morris