Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [filetype-html]

The tag has no usage guidance.

2
votes
6answers
63 views

Indent on New Line between HTML/XML Tags

I'm currently using imap <silent> <C-c> </<C-X><C-O><C-X><Esc>F<i as per this post and this page to close <></> tags of any kind with <C-c&...
1
vote
0answers
33 views

How to get html tag auto completion?

I can't seem to figure out how to implement auto tag completion for html. Is there a plug-in or something else you guys use that works? Is there just one thing I can download that will handle ...
2
votes
1answer
92 views

NeoVim indents each property:value in CSS

I have a style element in an HTML file. When I type, NeoVim continuously indents each successive line: In my Vim, it works correctly: My vimrc. I would be grateful for any suggestion. Thanks!
0
votes
1answer
18 views

Automatic format: how to insert needed amount of spaces for vertical aligning? [duplicate]

Given code: <option id='Nicole' data-language='en-AU'>Australian English - female - Nicole</option> <option id='Russell' data-language='en-AU'>Australian English - female - Russell&...
1
vote
1answer
58 views

Question about autocompletion in Vim editor and html document

Why does one of Vim's autocomplete functions (ctrl+n) not work in html documents, while the other (ctrl+p) still does?
1
vote
0answers
37 views

Automatically create files based on expanding snippets?

when developing for web (in Vim) I'm always using the BEM methodology. I have identified that I always go through the same steps when adding a new block element, and I'm looking for ways to automate ...
-1
votes
1answer
191 views

Check a simple html file with ale

Install ale with pathogen. cd ~/.vim/bundle git clone https://github.com/w0rp/ale.git My setting for ale in .vimrc. let g:ale_sign_column_always = 1 let g:ale_set_highlights = 0 The target html ...
3
votes
1answer
286 views

How to change indenting for html files?

I code mainly in 2 languages python and HTML. I currently have the indenting configured for python in my neovim configuration file but I would to know how to make neovim auto-detect the type of file ...
1
vote
1answer
65 views

enabling syntax in vim creates lag

I was trying to learn javascript the other day and was using emacs as I have been trying to learn emacs as well. But after sometimes my left wrist started to hurt(as one's does) so I switched to ...
1
vote
0answers
362 views

vim autoindent not working correctly

This is what I have in my vimrc: if empty(glob('~/.vim/autoload/plug.vim')) silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/...
6
votes
2answers
243 views

How can I shift only inner contents of HTML element?

How can I quickly shift only inner contents of HTML tag X, when they are on separate lines to the opening and closing X tag? Example below: I want to shift only 2 lines with <p> tags when the ...
4
votes
1answer
718 views

Expand <TAB> into 2 spaces when and only when editing HTML

My current configuration makes vim automatically expand TAB to 4 spaces for me: " Define tab as 4 spaces " Taken from http://stackoverflow.com/questions/1878974/redefine-tab-as-4-spaces set tabstop=4 ...
2
votes
2answers
229 views

How can I override a syntax keyword match?

I would like the html tag attribute id to be highlighted differently from the rest of the tag attributes. Like the Atom editor: Given this line from the html5.vim plugin syn keyword htmlArg ...
0
votes
1answer
144 views

Skip over closing html tag?

Plugins such as snipMate, emmet and many others allow me to quickly insert opening and closing html tags. For example by typing span and hitting the correct key (TAB for snipMate, <C-y>, for ...
5
votes
2answers
87 views

Linewise inner tag without the tag lines?

An example HTML, with the cursor where the brackets are: <foo> <bar> baz quux [] </bar> </foo> I would like to outdent the text inside <...
2
votes
0answers
235 views

How to select unclosed tag and close it automatically?

Here is my html file already edited,there are two errors in it. <!DOCTYPE html> <html lang="zh-Hans"> <head> <meta charset="utf-8"> <link rel="stylesheet" type="...
0
votes
2answers
125 views

How to insert tabs in key remapping?

I wrote the following in my .vimrc file in order to automate getting an HTML file set up. :imap html<tab> \<html><enter> \<tab><head><enter> .... and so on. ...
3
votes
0answers
462 views

Mixed PHP and HTML indenting

Is there a way to have mixed indenting more like Sublime Text (left) than Vim does it? I would like the nested UL to follow the (line 10) to follow along the (main indentation).
5
votes
5answers
2k views

How to generate closing tags for HTML?

I want to do the following: When I insert an HTML tag (which is a sequence of text that starts with <tagname tag_attributes and ends with >), as soon as I press > to insert the > character, ...
1
vote
0answers
220 views

Fix indentation after a multiline HTML tag

I have the following in .vimrc: set tabstop=2 softtabstop=-1 shiftwidth=0 expandtab filetype plugin indent on When I type the following in an HTML file: <html id="somethingverylong" > <...
6
votes
1answer
832 views

How can I indent JavaScript that's within <script> tags in an HTML file?

If I am viewing a HTML file that someone else wrote, it often has <script> tags containing javascript, e.g. <!DOCTYPE html> <html> <head> </head> <body&...
0
votes
0answers
47 views

View reletant CSS inline like Brackets

There's a really cool feature in Brackets I wish I had in vim: https://www.youtube.com/watch?v=Nhvj1NYC3Uc It allows you to pull up (inline in your text editor) the CSS that relates to a particular ...
4
votes
3answers
115 views

How do I open several FORTRAN files in Vim and save them as HTML files?

I know the separate answers. For example, To open several files: :n \**/*.f90 To save *.f90 file to HTML: :TOhtml and :wq. However, I don't know how to combine both of them.
9
votes
2answers
740 views

How do I paste the same line of code X times but change one word in the line each time?

I'm writing HTML lists, and I want to be able to automagically paste 10 list items where the item text is the only thing that changes. I could accomplish this using PHP and then just copying the ...
3
votes
1answer
253 views

Nested highlighting

In html eruby files, I would like to highlight the <% ... %> text in dark green only when it is inside double quotes. I.e. in in this example: I want it dark green instead of white. I know ...
4
votes
2answers
813 views

How to override a ftplugin

I am trying to use this plugin I have created a copy of xml.vim and named it html.vim. The problem is that the system ftplugin C:\Program Files (x86)\Vim\vim74\ftplugin\html.vim is loaded before the ...
4
votes
2answers
226 views

Why does Vim load unrelated ftplugins?

When I open a file with .md extension, the filetype is set to markdown, as expected. But the ftplugin for HTML is also loaded as I can see since I have some insert mode mappings in there to auto-...
3
votes
1answer
307 views

How to auto fold html tags?

I am new to vim. I have a HTML code with lots of <li></li> with its content that could span multiply lines like below: <ol> <li> text text </li> ...
9
votes
1answer
271 views

Disabling partial HTML indentation in Vim

Caveat: I'm not a web developer. That being said, there are rare occasions where I have to edit HTML. When I do, I've noticed a behavior in Vim that I don't like, and hope that I can change via ...
3
votes
1answer
142 views

How to convert code to html **with** arbitrary html page breaks?

Thanks to @BobHyam's question and to @BenjiFischer's answer on the list vim_use@googlegroups.com, I found out how to print to hardcopy while integrating form feeds: in ~/.vimrc " ^L by analogy, ...
3
votes
0answers
187 views

Is there a way to add handlebars to html.vim?

I'm working with handlebars right now and I'd like to get tags like: {{#component 'whatever'}} {{/component}} and {{#if}} {{else}} {{/if}} to increase the indent count. Unfortunately, it doesn'...
5
votes
1answer
547 views

How do I get vim to auto indent block-level html elements?

I'm having trouble with vim wanting to treat the p element as an inline element rather than a block level one. What vim's auto indent should produce is: <body> <p> Aaaaaaaaaaaaaa ...
2
votes
1answer
408 views

How to remove inner content of html tag conditionally?

I've html file (e.g. curl -o page.html http://example.com/) where I would like to remove inner html block for given html tag. I've the following code which works: $ ex -V1 page.html <<-EOF /&...
4
votes
2answers
401 views

How to search in Ex mode and place the cursor on the matched pattern?

I've the following example: vim -E http://example.com/ where I'd like to search for <head> tag. It seems that search only works when the lines are separated, but when the lines are joined ...
2
votes
4answers
418 views

How can I surround the lines inside the html tag object?

I have the following piece of HTML: <div> <section> </section> </div> I would like to wrap the 2 section tags in a single article like so: <div> <article> ...
8
votes
1answer
3k views

HTML syntax folding in VIM?

I was wondering which is the best way to use syntax folding for HTML files. Specially if it can recognize javascript code within <script> tags. I typed set foldmethod=syntax but it does not ...
4
votes
1answer
414 views

Why I am losing syntax highlighting when folding code within a <script> tag?

I am working with an HTML file and within a <script> tag specifically. I usually fold my code using the marker method. However an annoying behavior sometimes happens with my syntax highlighting ...
1
vote
1answer
555 views

How can I remove the red highlighting of ejs code braces?

I'm pretty new to vim and am working on a node.js project with ejs files. I have syntax highlighting turned on with syntax on in my .vimrc file. I also have an ejs file that contains JavaScript code ...
11
votes
2answers
5k views

How to convert a source code file into HTML?

I've a file of source code written in a programming language (e.g. PHP) and I would like to convert it into a HTML file, so I can publish it on web in order to share my code. By conversion I mean, ...
41
votes
3answers
8k views

How to jump between matching HTML/XML tags?

How to jump between matching tags (such as <div>, <span>, etc.) when editing HTML/XHTML/XML documents similarly as % is used to jump between matching parentheses?
9
votes
2answers
191 views

How can I check spelling in HTML attributes?

Vim spell check feature works great in most cases - it is even smart enough to distinguish code from literals and comments in most languages. However I have problems with HTML spell check: <div ...