Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
fuf
Sep 12, 2004

haha
Any tips or good plugins for writing HTML with vim?

Two things that I'd find really helpful:

A command to jump from a tag to the corresponding close tag (like jump from <div> to </div>)

A command to replace the contents of the open and close tag at the same time (like if I replace <h1> with <h2> it will simultaneously replace </h1> with </h2>)

Adbot
ADBOT LOVES YOU

fuf
Sep 12, 2004

haha
Thanks Lumpy!

I feel like pretty much every thread I ask a question in you are usually the one who provides a useful answer! ;)

fuf
Sep 12, 2004

haha

Lumpy posted:

Sparkup: https://github.com/tristen/vim-sparkup
Write HTML super fast!

Update: I can't live without this now. :)

I still haven't quite found a solution for this one though:

fuf posted:

A command to jump from a tag to the corresponding close tag (like jump from <div> to </div>)

This doesn't work unfortunately:

The Laplace Demon posted:

Place cursor over div, and press %.

(it jumps from between the opening and closing brackets of <div>, but not from <div> to </div>)

The closest thing I've found is this plugin which highlights the closing tag (pretty useful in itself):
https://github.com/gregsexton/MatchTag
http://www.vim.org/scripts/script.php?script_id=3818

If I knew how I'd edit the plugin code to add a way to jump between matched tags.

fuf
Sep 12, 2004

haha

The Laplace Demon posted:

:downs: Oops, I use sensible.vim, which automatically runs runtime! macros/matchit.vim. That macro has been included in vim since 6.0, and it's what adds the jump between tag behavior.

Oh hey it works! Thanks.

fuf
Sep 12, 2004

haha
I used to have a shortcut that would open a fullscreen list of all open buffers that you could scroll through and switch to with <enter>.

It wasn't :ls, and I'm sure it wasn't a plugin. Any ideas?

Adbot
ADBOT LOVES YOU

fuf
Sep 12, 2004

haha
gg=G works great on html files, except for inline javascript. It just pushes anything inside the <script> tag all the way to the left:

code:
<html>
   <body>
      <div>
         <script type="text/javascript">
var hello;
console.log("I am not indented");
         </script>
      </div>
   </body>
</html>
Any way to fix this?

  • Locked thread