Ⅰ. 插件描述
Some mappings for deleting surrounding html /django tagsⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'mjbrownie/delete-surround-html'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'mjbrownie/delete-surround-html'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'mjbrownie/delete-surround-html'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/mjbrownie/delete-surround-html
Ⅳ. 文档说明
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'
- It will let you delete the surrounding tag of a specified type
- 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 %}
<div id="bar">
<ul>
<li>'dsdc' here will remove the comment</li>
<li>'dsdb' here will remove the block</li>
<li>'dshd' here will remove the div</li>
<li>'dshu' here will remove the ul</li>
<li>'dshl' here will remove the li</li>
</ul>
</div>
{% 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 r..*r &1%}nrn{% endblock %}n"
let g:surround_{char2nr("i")} = "{% if1 r..*r &1%}nrn{% endif %}n"
let g:surround_{char2nr("w")} = "{% with1 r..*r &1%}nrn{% endwith %}n"
let g:surround_{char2nr("c")} = "{% comment1 r..*r &1%}nrn{% endcomment %}n"
let g:surround_{char2nr("f")} = "{% for1 r..*r &1%}nrn{% endfor %}n"
then go v...sb.. etc