VIM: Automatically closing a (HTML) Tag

This is a discussion on VIM: Automatically closing a (HTML) Tag within the Editors forums in Theory and Concepts category; Hi I keep forgetting I've got this mapping " type table,,, to get <table></table> automatically close a tag :imap ,,, <esc>bdwa<<esc>pa><cr></<esc>pa><esc>kA You can adapt the technique to other scripts -- zzapper Best of VimTips http://vim.wikia.com/wiki/Best_Vim_Tips...

Go Back   Application Development Forum > Theory and Concepts > Editors

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-16-2008, 03:18 PM
zzapper
Guest
 
Default VIM: Automatically closing a (HTML) Tag

Hi
I keep forgetting I've got this mapping

" type table,,, to get <table></table> automatically close a tag
:imap ,,, <esc>bdwa<<esc>pa><cr></<esc>pa><esc>kA


You can adapt the technique to other scripts

--
zzapper
Best of VimTips
http://vim.wikia.com/wiki/Best_Vim_Tips
Reply With Quote
  #2  
Old 08-16-2008, 03:48 PM
Ben C
Guest
 
Default Re: VIM: Automatically closing a (HTML) Tag

On 2008-08-16, zzapper <zzapper@gmail.com> wrote:
> Hi
> I keep forgetting I've got this mapping
>
> " type table,,, to get <table></table> automatically close a tag
>:imap ,,, <esc>bdwa<<esc>pa><cr></<esc>pa><esc>kA
>
>
> You can adapt the technique to other scripts


If you use Vim 7 with omnicomplete you can just type </Ctrl-X Ctrl-O.
Closes the tag you're in (and knows about the tags like <img> and <br>
which don't get closed).
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 06:38 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.