On Nov 15, 11:43 pm, Peng Yu <[email protected]> wrote: > Hi, > > If I open a file X from command line, the file can be indented > correctly. But if I first open a file of different type, which include > a string to X, then open X with ctrl_W, then the indentation is not > correct. Does anybody know what I should check to fix this bug? >
I assume you mean CTRL-W_f or similar, since CTRL-W by itself does nothing by default, unless you or a plugin has defined a mapping. Does file X have a detected file type? What is it? What file type is the "file of different type"? Or does any filetype do the same thing? Do you use filetype-specific indent rules, i.e. is "filetype indent on" in your .vimrc? Possibly: 1. file X's filetype does not set any indent rules 2. The filetype of the "file of different type" does not properly reset the indent options used, and file X's filetype sets indent using an option which is superceded by the options used by the first file's filetype, and file X does not make sure such indent options are properly set. 3. You have an autocmd interfering 4. Other? A good place to start your investigation, is: :verbose set filetype? autoindent? smartindent? cindent? indentexpr? both when launching the file from the command-line, and using <C-W>f or similar. Also, what's your Vim version? -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
