]> Pileus Git - vpaste/blob - 2html.patch
Adding ls and head
[vpaste] / 2html.patch
1 --- /usr/share/vim/vim72/syntax/2html.vim       2009-12-03 18:45:27.000000000 +0000
2 +++ /home/andy/.vim/syntax/2html.vim    2009-11-23 04:52:46.000000000 +0000
3 @@ -22,6 +22,13 @@
4    let s:htmlfont = "monospace"
5  endif
6  
7 +" Whitespace
8 +if &wrap
9 +  let s:whitespace = "white-space: pre-wrap; "
10 +else
11 +  let s:whitespace = ""
12 +endif
13 +
14  " When not in gui we can only guess the colors.
15  if has("gui_running")
16    let s:whatterm = "gui"
17 @@ -192,7 +199,6 @@
18  let s:old_report = &report
19  let s:old_search = @/
20  set notitle noicon
21 -setlocal et
22  set report=1000000
23  
24  " Split window to create a buffer with the HTML file.
25 @@ -245,7 +251,7 @@
26  " HTML header, with the title and generator ;-). Left free space for the CSS,
27  " to be filled at the end.
28  exe "normal! a<html>\n\e"
29 -exe "normal! a<head>\n<title>" . expand("%:p:~") . "</title>\n\e"
30 +exe "normal! a<head>\n<title>" . &titlestring . "</title>\n\e"
31  exe "normal! a<meta name=\"Generator\" content=\"Vim/" . v:version/100 . "." . v:version %100 . '"' . s:tag_close . "\n\e"
32  if s:html_encoding != ""
33    exe "normal! a<meta http-equiv=\"content-type\" content=\"text/html; charset=" . s:html_encoding . '"' . s:tag_close . "\n\e"
34 @@ -257,7 +263,7 @@
35  if exists("html_no_pre")
36    exe "normal! a</head>\n<body>\n\e"
37  else
38 -  exe "normal! a</head>\n<body>\n<pre>\n\e"
39 +  exe "normal! a</head>\n<body><pre>\n\e"
40  endif
41  
42  exe s:orgwin . "wincmd w"
43 @@ -393,12 +399,16 @@
44  
45        " Expand tabs
46        let s:expandedtab = strpart(s:line, s:startcol - 1, s:col - s:startcol)
47 -      let idx = stridx(s:expandedtab, "\t")
48 -      while idx >= 0
49 -       let i = &ts - ((idx + s:startcol - 1) % &ts)
50 -       let s:expandedtab = substitute(s:expandedtab, '\t', repeat(' ', i), '')
51 -       let idx = stridx(s:expandedtab, "\t")
52 -      endwhile
53 +      if &et
54 +        let idx = stridx(s:expandedtab, "\t")
55 +        while idx >= 0
56 +          let i = &ts - ((idx + s:startcol - 1) % &ts)
57 +          let s:expandedtab = substitute(s:expandedtab, '\t', repeat(' ', i), '')
58 +          let idx = stridx(s:expandedtab, "\t")
59 +        endwhile
60 +      else
61 +        setlocal isprint+=9
62 +      endif
63  
64        " Output the text with the same synID, with class set to {s:id_name}
65        let s:id = synIDtrans(s:id)
66 @@ -423,7 +433,7 @@
67  if exists("html_no_pre")
68    exe "normal! a</body>\n</html>\e"
69  else
70 -  exe "normal! a</pre>\n</body>\n</html>\e"
71 +  exe "normal! a</pre></body>\n</html>\e"
72  endif
73  
74  
75 @@ -449,7 +459,7 @@
76    if exists("html_no_pre")
77      execute "normal! A\nbody { color: " . s:fgc . "; background-color: " . s:bgc . "; font-family: ". s:htmlfont ."; }\e"
78    else
79 -    execute "normal! A\npre { font-family: ". s:htmlfont ."; color: " . s:fgc . "; background-color: " . s:bgc . "; }\e"
80 +    execute "normal! A\npre { " . s:whitespace . "font-family: ". s:htmlfont ."; color: " . s:fgc . "; background-color: " . s:bgc . "; }\e"
81      yank
82      put
83      execute "normal! ^cwbody\e"