Questions tagged [filetype-html]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
51
votes
3answers
13k 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?
1
vote
2answers
48 views

Add matching html tag

In Textmate I can do something like when I have the following: <div> <p>new If I press optshift. it will add in the matching tag. So when I press it once, it will look like: <div&...
0
votes
0answers
21 views

Vim formatting in css

I am having a very difficult time formatting css in an html file. For example, here is how vim 'thinks' it should be formatted: That is, after the above css section, it gives it 8 indentations (??), ...
3
votes
6answers
657 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&...
4
votes
2answers
223 views

Easiest way to go to start/end of html element

I seem to be using a hack approach to getting to the start of an html tag. For example: To get to my cursor to be on the t after the tag, I end up doing yit -- this yanks the component (which I don't ...
2
votes
2answers
85 views

Is there an instant way of editing matching inner tags?

In Vim, using the text object i>, you can edit an inner tag, and using the built-in matchit plugin, you can even use % to jump between matching opening and closing tags. Let's say you want to ...
0
votes
0answers
17 views

Emmet expand only HTML tags

Hi I'm trying to make emmet expand only Html tags. For example div<c-y>, should be expanded to <div></div> But abc<c-y>, should not be expanded. By default emmet expands ...
1
vote
0answers
338 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="...
3
votes
1answer
405 views

HTML - Wrap current tag inside another tag

I'm editing an HTML file, and my cursor is inside a tag, like this: <textarea class="code-area"></textarea> And I'm trying to wrap all of this tag inside a div tag, so that it'd be like ...
0
votes
0answers
41 views

vim disable behavior special tags (eg script)

When editing html, vim applies different rules when inside certain tags (like script/pre/style). I want to have the normal html rules when inside a script tag (using handlebars, and I don't write any ...
1
vote
0answers
46 views

How to indent HTML5 with omitted closing tags properly?

I try writing some HTML5 with omitted closing tags in NVIM v0.3.4, and get this: <ol> <li>3 <li>4 <li>8 <li>9 </ol> This ...
2
votes
1answer
99 views

vim html version of text document black on white

I'm trying to figure out a good workflow for printing source code and studying it. So far, the TOhtml function seems really useful for this purpose. I can create an html file with ease, open it in a ...
0
votes
1answer
53 views

How can I reindent/prettyify blocks of HTML code?

I've got a lot of HTML files, some of them with garbage indentation. How can I select a block, and then prettify/reindent the HTML within, adding in newlines where appropriate? I can install any ...
1
vote
1answer
276 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 ...
9
votes
1answer
388 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 ...
1
vote
0answers
123 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
213 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!
1
vote
1answer
348 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?
0
votes
1answer
28 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
0answers
46 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
759 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 ...
4
votes
1answer
670 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
0answers
859 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/...
7
votes
2answers
2k 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
3answers
145 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.
6
votes
2answers
355 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
2k 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 ...
3
votes
2answers
632 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 ...
4
votes
2answers
96 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 <...
0
votes
1answer
311 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
5answers
4k 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, ...
0
votes
2answers
179 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. ...
6
votes
0answers
637 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).
6
votes
1answer
1k 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&...
1
vote
0answers
287 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" > <...
4
votes
2answers
273 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-...
8
votes
2answers
848 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 ...
9
votes
1answer
4k 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 ...
3
votes
1answer
493 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 ...
3
votes
1answer
414 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> ...
3
votes
1answer
152 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
216 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'...
6
votes
1answer
816 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
557 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
840 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
817 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> ...
5
votes
1answer
682 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
997 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 ...
14
votes
2answers
7k 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, ...
9
votes
2answers
290 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 ...