Invalid html <meta and <link tag indentation in vim

When I do gg=G, almost everyone gets indented correctly, except for the tag <metaand the tag <linkwhen >there is no before /, like this one />.

Here is a sample code:

<!DOCTYPE html>
<html lang="en">
    <head>
        <!-- Meta, title, CSS, favicons, etc. -->
        <meta charset="utf-8">
            <meta http-equiv="X-UA-Compatible" content="IE=edge">
                <meta name="viewport" content="width=device-width, initial-scale=1">
                    <meta name="description" content="">
                        <br>

                        <meta name="keywords" content="">
                            <meta name="author" content="">

                                <title>
                                    Site Title
                                </title>
                                <!-- CSS -->

                                <link href="css/main.min.css" rel="stylesheet">
                                    <link href="css/cos.min.css" rel="stylesheet">
                                        <!--[if lt IE 9]><script src="js/ie8.js"></script><![endif]-->
                                        <script src="../assets/js/ie-emulation-modes-warning.js"></script>
                                        <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
                                                                                <!--[if lt IE 9]>
                                                                                <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
                                                                                    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
                                                                                        <![endif]-->

                                                                                        <!-- Favicons -->
                                                                                        <link rel="apple-touch-icon" href="/apple-touch-icon.png">
                                                                                            <link rel="icon" href="/favicon.ico">

                                                                                                <script>

                                                                                                </script>

                                                                                            </head>
                                                                                            <body>


                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   </body>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                               </html>

Here is what was expected:

<!DOCTYPE html>
<html lang="en">
    <head>
        <!-- Meta, title, CSS, favicons, etc. -->
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="description" content="">
        <br>

        <meta name="keywords" content="">
        <meta name="author" content="">

        <title>
        Site Title
        </title>
        <!-- CSS -->

        <link href="css/main.min.css" rel="stylesheet">
        <link href="css/cos.min.css" rel="stylesheet">
        <!--[if lt IE 9]><script src="js/ie8.js"></script><![endif]-->
            <script src="js/ie.js"></script>
        <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
        <!--[if lt IE 9]>
            <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
            <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
        <![endif]-->

        <!-- Favicons -->
        <link rel="apple-touch-icon" href="/apple-touch-icon.png">
        <link rel="icon" href="/favicon.ico">

        <script>

        </script>

    </head>
    <body>


    </body>
</html>

I tried everything I could find on the net, but still the same.
I am using VIM version 7.4.873. MacVim 7.4 (77), compiled by Homebrew.
here is my .vimrc file:

filetype plugin indent on

syntax on
set bg=dark                             "background=dark

set ic                                  "ignorecase
set hls                                 "hlsearch
set is                                  "incsearch
set scs                                 "smartcase
set gd                                  "gdefault

set ai                                  "autoindent
set si                                  "smartindent
set ci                                  "copyindent
set pi                                  "preserveindentd
set bs=2                                "backspace=indent,eol,start

set fenc=utf-8                          "fileencoding=utf-8
set enc=utf-8                           "encoding=utf-8

set ts=4                                "tabstop=4
set sts=0                               "softtabstop=0
set sw=4                                "shiftwidth=4
set noet                                "noexpandtab

"set sm                                 "showmatch
set ru                                  "ruler
set nu                                  "number
set rnu                                 "relativenumber
set wrap                                "wrap
set ch=1                                "cmdheight=1
set title                               "title
set ls=2                                "laststatus=always
set stl=%.50F%m\                        "statusline=F 
set stl+=\|\ 
set stl+=%p%%\ 
set stl+=\:\ %l/%L\ 
set stl+=\:\ %c\ 
set stl+=\:\ %v\ 
set stl+=%=
set stl+=%y
set stl+=[%{&fenc?&enc:&fenc}]
set stl+=[\#%n] 
set cul                                 "cursorline
set clipboard=unnamed

" Other settings
let g:PHP_vintage_case_default_indent = 1

No plugins or padding.

Any ideas?

+4
source share

Source: https://habr.com/ru/post/1608765/


All Articles