开发者

Additional tools/scripts/plugins for editing html with vim

开发者 https://www.devze.com 2023-02-09 02:29 出处:网络
I am looking for any pointers with regards to editing html with Vim. The HTML documents I need to edit will u开发者_开发问答se css (probably inline) but no JavaScript or any other \"technique\".

I am looking for any pointers with regards to editing html with Vim.

The HTML documents I need to edit will u开发者_开发问答se css (probably inline) but no JavaScript or any other "technique".

So, I thought there must be people more knowledgebale than me in that area that could give me some hints as to where I could find some tools, or scripts or Vim plugins that assist me while I am editing the documents.

FWIW, I am using Vim 7.3.


I'm happy with SnipMate. It comes with a bunch of default snippets for many languages including HTML and JavaScript but they are easy to modify/augment: here is my customized html.snippets.

SparkUp allows you to use compact CSS syntax to write massive amounts of HTML, it's a bit too rigid for my taste, though.

To be able to use Omni Completion for CSS you will need to change the "file type" setting for the buffer like this: :set ft=css.html.

Also Vim itself is very powerful for HTML even without fancy plugins:

  • cit will remove text from <p>text</p> and leave you in insertion mode between the opening and closing tags

  • dat will delete the whole <p>text</p>

  • :norm I and :norm A let you append text at the beginning and end of multiple visually selected lines

and so on…


RagTag (documentation) is a nice plugin for HTML (and more) editing.

Also, matchit to help navigate between an opening tag and its closing tag with '%'


I've heard that this one is quite good, HTML/XHTML mappings for Vim it provides macros for templates, header insertion, tag insertion, and tag completion. It does supports inline CSS and includes commands to launch the a web browser and display the currently edited file.

Hope that's a start!

Kate.


The surround plugin is quite useful for HTML, it makes it a lot easier to add/delete/edit sets of tags, instead of having to deal with the opening and closing tags individually.

A good article about explaining some of the things you can do with it is here: Vim Plugins You Should Know About, Part I: surround.vim


Zen plugin seems interesting to write HTML with minimal number of keystroke.

There is a nice video demonstrating how it works in the link above.


Check my .vimrc and vim config in my git repo at github

I've spend so many weeks tweaking Vim to suit my needs to do web development in a productive way.

0

精彩评论

暂无评论...
验证码 换一张
取 消