Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: none; used to see highlighting |
| 3 | " Maintainer: Ronald Schild <rs@scutum.de> |
Bram Moolenaar | f55e4c8 | 2017-08-01 20:44:53 +0200 | [diff] [blame] | 4 | " Last Change: 2017 Jul 28 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 5 | " Version: 5.4n.1 |
| 6 | |
| 7 | " To see your current highlight settings, do |
| 8 | " :so $VIMRUNTIME/syntax/hitest.vim |
| 9 | |
| 10 | " save global options and registers |
| 11 | let s:hidden = &hidden |
| 12 | let s:lazyredraw = &lazyredraw |
| 13 | let s:more = &more |
| 14 | let s:report = &report |
| 15 | let s:shortmess = &shortmess |
| 16 | let s:wrapscan = &wrapscan |
| 17 | let s:register_a = @a |
| 18 | let s:register_se = @/ |
| 19 | |
| 20 | " set global options |
| 21 | set hidden lazyredraw nomore report=99999 shortmess=aoOstTW wrapscan |
| 22 | |
| 23 | " print current highlight settings into register a |
| 24 | redir @a |
| 25 | highlight |
| 26 | redir END |
| 27 | |
| 28 | " Open a new window if the current one isn't empty |
| 29 | if line("$") != 1 || getline(1) != "" |
| 30 | new |
| 31 | endif |
| 32 | |
| 33 | " edit temporary file |
| 34 | edit Highlight\ test |
| 35 | |
| 36 | " set local options |
| 37 | setlocal autoindent noexpandtab formatoptions=t shiftwidth=16 noswapfile tabstop=16 |
| 38 | let &textwidth=&columns |
| 39 | |
| 40 | " insert highlight settings |
| 41 | % delete |
| 42 | put a |
| 43 | |
| 44 | " remove the colored xxx items |
| 45 | g/xxx /s///e |
| 46 | |
| 47 | " remove color settings (not needed here) |
| 48 | global! /links to/ substitute /\s.*$//e |
| 49 | |
| 50 | " move linked groups to the end of file |
| 51 | global /links to/ move $ |
| 52 | |
| 53 | " move linked group names to the matching preferred groups |
| 54 | % substitute /^\(\w\+\)\s*\(links to\)\s*\(\w\+\)$/\3\t\2 \1/e |
| 55 | global /links to/ normal mz3ElD0#$p'zdd |
| 56 | |
| 57 | " delete empty lines |
| 58 | global /^ *$/ delete |
| 59 | |
| 60 | " precede syntax command |
| 61 | % substitute /^[^ ]*/syn keyword &\t&/ |
| 62 | |
| 63 | " execute syntax commands |
| 64 | syntax clear |
| 65 | % yank a |
| 66 | @a |
| 67 | |
| 68 | " remove syntax commands again |
| 69 | % substitute /^syn keyword // |
| 70 | |
| 71 | " pretty formatting |
| 72 | global /^/ exe "normal Wi\<CR>\t\eAA\ex" |
| 73 | global /^\S/ join |
| 74 | |
| 75 | " find out first syntax highlighting |
| 76 | let b:various = &highlight.',:Normal,:Cursor,:,' |
| 77 | let b:i = 1 |
| 78 | while b:various =~ ':'.substitute(getline(b:i), '\s.*$', ',', '') |
| 79 | let b:i = b:i + 1 |
| 80 | if b:i > line("$") | break | endif |
| 81 | endwhile |
| 82 | |
| 83 | " insert headlines |
| 84 | call append(0, "Highlighting groups for various occasions") |
| 85 | call append(1, "-----------------------------------------") |
| 86 | |
| 87 | if b:i < line("$")-1 |
| 88 | let b:synhead = "Syntax highlighting groups" |
| 89 | if exists("hitest_filetypes") |
| 90 | redir @a |
| 91 | let |
| 92 | redir END |
| 93 | let @a = substitute(@a, 'did_\(\w\+\)_syn\w*_inits\s*#1', ', \1', 'g') |
| 94 | let @a = substitute(@a, "\n\\w[^\n]*", '', 'g') |
| 95 | let @a = substitute(@a, "\n", '', 'g') |
| 96 | let @a = substitute(@a, '^,', '', 'g') |
| 97 | if @a != "" |
| 98 | let b:synhead = b:synhead." - filetype" |
| 99 | if @a =~ ',' |
| 100 | let b:synhead = b:synhead."s" |
| 101 | endif |
| 102 | let b:synhead = b:synhead.":".@a |
| 103 | endif |
| 104 | endif |
| 105 | call append(b:i+1, "") |
| 106 | call append(b:i+2, b:synhead) |
| 107 | call append(b:i+3, substitute(b:synhead, '.', '-', 'g')) |
| 108 | endif |
| 109 | |
| 110 | " remove 'hls' highlighting |
| 111 | nohlsearch |
| 112 | normal 0 |
| 113 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 114 | " we don't want to save this temporary file |
| 115 | set nomodified |
| 116 | |
| 117 | " the following trick avoids the "Press RETURN ..." prompt |
| 118 | 0 append |
| 119 | . |
| 120 | |
| 121 | " restore global options and registers |
| 122 | let &hidden = s:hidden |
| 123 | let &lazyredraw = s:lazyredraw |
| 124 | let &more = s:more |
| 125 | let &report = s:report |
| 126 | let &shortmess = s:shortmess |
| 127 | let &wrapscan = s:wrapscan |
| 128 | let @a = s:register_a |
| 129 | |
| 130 | " restore last search pattern |
| 131 | call histdel("search", -1) |
| 132 | let @/ = s:register_se |
| 133 | |
| 134 | " remove variables |
| 135 | unlet s:hidden s:lazyredraw s:more s:report s:shortmess |
| 136 | unlet s:wrapscan s:register_a s:register_se |
| 137 | |
| 138 | " vim: ts=8 |