Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Questions tagged [filetype-html]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
33 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
34 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
62 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
36 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 ...
2
votes
6answers
366 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
66 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
154 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
25 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
250 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
45 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
524 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
508 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
188 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
615 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
314 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
407 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
230 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 ...
4
votes
2answers
94 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 <...
1
vote
0answers
287 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
155 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. ...
5
votes
0answers
603 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
3k 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
261 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
967 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&...
4
votes
3answers
131 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.
8
votes
2answers
778 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
393 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 ...
5
votes
2answers
1k 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
235 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
367 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
335 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
148 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
210 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
696 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
503 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
601 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
560 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 ...
5
votes
1answer
584 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
738 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 ...
13
votes
2answers
6k 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, ...
44
votes
3answers
10k 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
228 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 ...