Permalink
Browse files

Support for HTML tags

  • Loading branch information...
AndrewRadev committed Dec 21, 2012
1 parent 1543150 commit 780073054e83dd9c0fa82c3e33963611e188955b
Showing with 23 additions and 1 deletion.
  1. +1 −1 doc/whitespaste.txt
  2. +11 −0 examples/example.html
  3. +11 −0 plugin/whitespaste.vim
View
@@ -196,7 +196,7 @@ The default definitions can be seen in "plugin/whitespaste.vim". At this time,
the global definitions handle curly braces, as demonstrated in the above
example, remove whitespace at the top and bottom of the buffer, and compress
all other pasting operations to only one blank line. There are also specific
-definitions for ruby and vimscript.
+definitions for ruby, vimscript, and a few HTML-like filetypes.
==============================================================================
View
@@ -0,0 +1,11 @@
+<div class="foo">
+ <ul>
+ <li>one</li>
+ <li>two</li>
+ </ul>
+
+ <ul>
+ <li>three</li>
+ <li>four</li>
+ </ul>
+</div>
View
@@ -64,6 +64,17 @@ autocmd FileType vim let b:whitespaste_linewise_definitions = {
\ ]
\ }
+autocmd FileType html,php,eruby,eco let b:whitespaste_linewise_definitions = {
+ \ 'top': [
+ \ { 'target_text': '^\s*<\k\+[^<]*>\s*$', 'blank_lines': 0 },
+ \ { 'target_text': '^\s*</\k\+>\s*$', 'blank_lines': 1 },
+ \ ],
+ \ 'bottom': [
+ \ { 'target_text': '^\s*</\k\+>\s*$', 'blank_lines': 0 },
+ \ { 'target_text': '^\s*<\k\+[^<]*>\s*$', 'blank_lines': 1 },
+ \ ]
+ \ }
+
command! WhitespasteBefore call whitespaste#Paste(g:whitespaste_paste_before_command)
command! WhitespasteAfter call whitespaste#Paste(g:whitespaste_paste_after_command)
command! -range WhitespasteVisual call whitespaste#Paste(g:whitespaste_paste_visual_command)

0 comments on commit 7800730

Please sign in to comment.