On 06/06/09 17:38, Suresh Govindachar wrote:
>
>
> Hello,
>
> While editing an html file, when I hit return, the lines gets reformatted 
> automatically.
>
>    1) Why is this happening
>
>    2) how do I prevent it?
>
>    3) what are all the things I can tweak so that the
>       automated reformatting happens the way I like it?
>
> Thanks,
>
> --Suresh

The indent/html.vim script defines an 'indentexpr' option, which takes 
up indenting in a way that I too find much too "we know better what is 
good for you". When I came to Vim some years ago (Vim 6.1 was "latest" 
then), it was the thing which irritated me most, until I found out that 
it was due to an 'indentexpr' option and that adding

        filetype indent off

(just after sourcing the vimrc_example.vim script) cures it.

Alternately, if you don't source the example script but have the line

        filetype plugin indent on

in your vimrc, remove "indent", leaving the rest.

This, of course, will disable auto-indenting for _all_ filetypes. If, 
instead, you want to disable it _only_ for HTML pages, add the line

        let b:did_indent = 1

in either a FileType autocommand for the html filetype, or (on Windows) 
a ~/vimfiles/ftplugin/html.vim script (on Unix, replace ~/vimfiles/ by 
~/.vim/, and on any platform, create the directories and/or the file if 
they don't yet exist).

If what disturbs you is more than "just" autoindenting, you will have to 
look at the 'formatoptions' setting. Display it with

        :verbose setlocal fo?

while editing an HTML page, so it will also tell you where it was last 
set. But don't modify ANYTHING in the tree starting at $VIMRUNTIME, 
because any Vim upgrade may (and sooner or later one will) reverse any 
changes there without warning. Instead, if one of the scripts under 
$VIMRUNTIME includes something that you don't like, you can override it 
by writing something elsewhere, usually in a script in a directory in 
one of the other trees mentioned in the 'runtimepath' (or 'rtp' for 
short) option.

"All the things you can tweak" may include even more than what I 
mentioned above. The |options.txt| helpfile and/or the :options command 
may help you find most of them.


Best regards,
Tony.
-- 
History has the relation to truth that theology has to religion --
i.e., none to speak of.
                -- Lazarus Long

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to