How to turn off auto-indenting in Vim for HTML?

14 views
Skip to first unread message

Steve Litt

unread,
Jun 14, 2022, 11:48:15 PM6/14/22
to vim_use
Hi all,

How do I turn off auto-indent in Vim for my HTML files? I prefer to
flush left everything and create blank lines at transitions.

Thanks,

SteveT

Steve Litt
March 2022 featured book: Making Mental Models: Advanced Edition
http://www.troubleshooters.com/mmm

BPJ

unread,
Jun 15, 2022, 3:04:13 AM6/15/22
to vim_use
Den ons 15 juni 2022 05:48Steve Litt <sl...@troubleshooters.com> skrev:
Hi all,

How do I turn off auto-indent in Vim for my HTML files? I prefer to
flush left everything and create blank lines at transitions.

Maybe setl noautoindent / setl noai will do?



Thanks,

SteveT

Steve Litt
March 2022 featured book: Making Mental Models: Advanced Edition
http://www.troubleshooters.com/mmm

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20220614234803.1286f3ae%40mydesk.domain.cxm.

Bram Moolenaar

unread,
Jun 15, 2022, 5:35:35 AM6/15/22
to vim...@googlegroups.com, Steve Litt

Steve Litt wrote:

> How do I turn off auto-indent in Vim for my HTML files? I prefer to
> flush left everything and create blank lines at transitions.

Add a file: ~/.vim/indent/html.vim containing:

let b:did_indent = 1
set noautoindent

--
A law to reduce crime states: "It is mandatory for a motorist with criminal
intentions to stop at the city limits and telephone the chief of police as he
is entering the town.
[real standing law in Washington, United States of America]

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Gary Johnson

unread,
Jun 15, 2022, 12:13:37 PM6/15/22
to vim...@googlegroups.com
On 2022-06-15, Bram Moolenaar wrote:
> Steve Litt wrote:
>
> > How do I turn off auto-indent in Vim for my HTML files? I prefer to
> > flush left everything and create blank lines at transitions.
>
> Add a file: ~/.vim/indent/html.vim containing:
>
> let b:did_indent = 1
> set noautoindent

I think that should be

let b:did_indent = 1
setlocal noautoindent
let b:undo_indent = "setlocal autoindent<"

In that way, any non-html buffers created during that Vim session
will have the global 'autoindent' setting.

Regards,
Gary

Reply all
Reply to author
Forward
0 new messages