English 中文(简体)
因此 甚至在档案类型被揭发时,使用巴什冷却规则?
原标题:why does Vim use Bash indenting rules even when filetype is unset?
  • 时间:2011-06-20 22:34:34
  •  标签:
  • vim

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.

两个问题:

  1. Why might this happen?
  2. How can I debug the startup process (reading ~/.vimrc and files in ~/.vim/)?

更多信息:

  • 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 on autoindent after using a null vimrc doesn t indent the line after "do" is typed in.
最佳回答
 smartindent   si       boolean (default off)
                        local to buffer
                        {not in Vi}
                        {not available when compiled without the
                        |+smartindent| feature}
        Do smart autoindenting when starting a new line.  Works for C-like
        programs, but can also be used for other languages.   cindent  does
        something like this, works better in most cases, but is more strict,
        see |C-indenting|.  When  cindent  is on, setting  si  has no effect.
         indentexpr  is a more advanced alternative.
        Normally  autoindent  should also be on when using  smartindent .
        An indent is automatically inserted:
        - After a line ending in  { .
        - After a line starting with a keyword from  cinwords .
        - Before a line starting with  }  (only with the "O" command).

word语指:

问题回答

暂无回答




相关问题
Autoupdate VIM Plugins?

Is it possible to update vim plugins automatically?

how to unindent in vim without leaving edit mode?

I m writing a lot of python code recently, and i used the tab-to-space mode in vim. I was just wondering how would i unindent in vim without leaving edit mode for example after i finished if...: block....

Scrolling inside Vim in Mac s Terminal

I ve been googling around trying to figure out if it s possible to use my mouse wheel to scroll while inside Vim in Mac s Terminal, with no luck. It seems as if only X11 or iTerm support this. Before ...

Vim - Deleting XML Comments

How do I delete comments in XML? If the opening and the closing comment tags are on the same line, I use :g/^<!--.*-->$/d to delete the comment. How to delete the comments that are spread ...

Limiting a match in vim to certain filetypes?

I have the following in my .vimrc to highlight lines longer than 80 chars: highlight OverLength ctermbg=red ctermfg=white guibg=#592929 match OverLength /\%81v.*/ This works quite well. However, the ...

Profiling Vim startup time

I’ve got a lot of plugins enabled when using Vim – I have collected plugins over the years. I’m a bit fed up with how long Vim takes to start now, so I’d like to profile its startup and see which of ...

热门标签