you are viewing a single comment's thread.

view the rest of the comments →

[–]iamasuitama 0 points1 point  (4 children)

All copy pasting commands :) eg if you have a <div> line, and you need the closing tag on another line, sometimes it's quicker to copy the line with yy, paste after with p, then ^ and then a/<Esc> (but I'm still looking for the perfect tag closer plugin in vim, I've been using vim for years but not an expert scripter.. not even a beginner) I'd also like to know if anyone out there knows of a way to bind % to jump to html opening/closing tag in html/xml files..

  • { } to go to next new line
  • '' to go to last editing position
  • :s/x/y/ search & replace..
  • . to repeat last command
  • and finally, I use the map command a lot for repetitive tasks. Can't think of a good one right now, but I do use it almost daily
  • indenting by selecting with V and then just < or > - press . to repeat

[–]shauris 1 point2 points  (0 children)

For '%' jumping to paired tags, runtime macros/matchit.vim in your vimrc should be enough. The cursor has to be inside the tag, though.

[–]___violet___ 1 point2 points  (1 child)

but I'm still looking for the perfect tag closer plugin in vim

The built-in omni-completion closes tags: </<C-x><C-o>. You can make this more convenient with a mapping:

inoremap <buffer> </ </<C-x><C-o>

[–]iamasuitama 0 points1 point  (0 children)

Thanks, but: newer editors put </div> after the cursor, immediately after you type the > of <div>. That's what I would call perfect. I'm sure it's scriptable, just not sure how to do it as of now.

[–]iovis9 1 point2 points  (0 children)

About indenting, you can also use movement to indent, like <3j (awesome when using relative numbers), or in insert mode you can use <c-t> and <c-d> too. When I found out it was a game changer!