Home > delete-surround-html

delete-surround-html

Delete-surround-html is a project mainly written in Vim Script, it's free.

for deleting surrounding html/django tags

This is a mirror of http://www.vim.org/scripts/script.php?script_id=3010

Repo: http://github.com/mjbrownie/delete-surround-html Example vid (includes other plugins): http://www.youtube.com/watch?v=NbV-OrFMalU

after/ftplugin/html/delete_surround_html.vim

For Deleting Surrounding html and django tags

This plugin is inspired by Tim Popes surround.vim delete-surround-tag 'dst' mapping. It will let you delete the surrounding tag of a specified type rather than just the immediate tag.

on html filetypes this will add two normal mappings in your vimrc

'dsh' (delete-surround-html) delete - surround - html - (u)l / (l)i / (d)iv / (s)pan / (f)orm / (t)able / t(r) / (c)td / (p):

'dsd' (delete-surround-django) will give you the options delete - surround - django - (b)lock / (c)omment / (i)f* / (w)ith / (f)or :

simple example here

{% comment%} {% block foo %}

  • 'dsdc' here will remove the comment
  • 'dsdb' here will remove the block
  • 'dshd' here will remove the div
  • 'dshu' here will remove the ul
  • 'dshl' here will remove the li

{% endblock %} {% endcomment %}

This scripts mnemonics are intended to compliment these two scripts

django-textobjects http://www.vim.org/scripts/script.php?script_id=2999 html-advanced-textobjects http://www.vim.org/scripts/script.php?script_id=3000

Also if you want the reverse, ie. to surround a visual selection with django tags

you can also use http://www.vim.org/scripts/script.php?script_id=1697 with the following mappings

let g:surround{char2nr("b")} = "{% block1 ..* &1%} {% endblock %} " let g:surround{char2nr("i")} = "{% if1 .. &1%} {% endif %} " let g:surround_{char2nr("w")} = "{% with1 .. &1%} {% endwith %} " let g:surround{char2nr("c")} = "{% comment1 ..* &1%} {% endcomment %} " let g:surround{char2nr("f")} = "{% for1 ..* &1%} {% endfor %} "

then go v...sb.. etc

Previous:tumblr.vim