Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Support for HTML tags

  • Loading branch information...
commit 780073054e83dd9c0fa82c3e33963611e188955b 1 parent 1543150
Andrew Radev authored
2  doc/whitespaste.txt
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.
==============================================================================
11 examples/example.html
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>
11 plugin/whitespaste.vim
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)
Please sign in to comment.
Something went wrong with that request. Please try again.