Bug#506190: ftplugin/html.vim: indenting broken

James Vega jamessan at debian.org
Mon Nov 24 04:39:47 UTC 2008


On Wed, Nov 19, 2008 at 08:56:41AM +0100, martin f krafft wrote:
> File: /usr/share/vim/vim72/ftplugin/html.vim

Actually indent/html.vim

> Look at the attached file. There are three problems/inconsistencies
> with indenting:
> 
> 1. gq causes lines 4-7 to assume the indent of line 3.

That's not a full command, so I'll assume you meant you were
reformatting all the text inside the tags (a la gqit).  Reformatting
simply re-wraps the lines according to the textwidth, causing the new
line to be indented according to the current indenting rules.  Just like
manually re-indenting lines 4-7 would use the indent of line 3, so does
reformatting the text inside the tags.

> 2. Appending a line after line 3 (o) preserves the indent, as does
>    autowrapping when adding more text to line 3.

HTML's indenting is based on the line previous to the line being
indented.  'indentkeys' is set so that adding a new line (via o or O)
causes the line to be automatically indented, thus picking up the indent
of line 3.

> 3. Inserting a newline into line 3 removes the indent.

The html indent script sets 'indentkeys' such that re-indenting is
performed before the newline is inserted (the *<Return> value in
'indentkeys').  Since the line previous to line 3 has zero indent, that
is how line 3 gets indented.

-- 
James
GPG Key: 1024D/61326D40 2003-09-02 James Vega <jamessan at debian.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/pkg-vim-maintainers/attachments/20081123/846aaf2c/attachment.pgp 


More information about the pkg-vim-maintainers mailing list