gph.vim (2615B)
1 " Syntax colouring for gopher .gph files used by geomyidae 2 " Muddled about a bit by dive @ freenode / #gopherproject 3 " 2017-11-15 4 5 set shiftwidth=4 6 set tabstop=4 7 set noexpandtab 8 9 if version < 600 10 syntax clear 11 elseif exists("b:current_syntax") 12 finish 13 endif 14 15 " Use default terminal colours 16 hi Normal ctermbg=NONE ctermfg=NONE guifg=NONE guibg=NONE 17 18 " Use italics for comments. If this fails and you get reverse video 19 " then you may want to comment it out. 20 hi Comment cterm=italic 21 22 " Err colour (not sure about this one. It's a bit bright). 23 hi Err cterm=bold ctermbg=NONE ctermfg=130 guibg=NONE guifg=red 24 25 hi def link gopherComment comment 26 hi def link gopherType preproc 27 hi def link gopherURL statement 28 hi def link gopherHtml statement 29 hi def link gopherLink statement 30 hi def link gopherServerPort statement 31 hi def link gopherBracket preproc 32 hi def link gopherPipe preproc 33 hi def link gopherCGI type 34 hi def link gopherCGI2 type 35 hi def link gopherQuery type 36 hi def link gopherErr err 37 hi def link SynError error 38 39 " Format of lines: 40 " [<type>|<desc>|<path>|<host>|<port>] 41 42 "<desc> = description of gopher item. Most printable characters should work. 43 " 44 "<path> = full path to gopher item (base value is "/" ). Use the "Err" path for 45 "items not intended to be served. 46 " 47 "<host> = hostname or IP hosting the gopher item. Must be resolvable for the 48 "intended clients. If this is set to "server" , the server's hostname is used. 49 " 50 "<port> = TCP port number (usually 70) If this is set to "port" , the default 51 "port of the server is used. 52 53 " Comments 54 syn region gopherComment start="<!--" end="-->" 55 56 " URLs 57 syn match gopherURL "http:" 58 syn region gopherLink start="http:"lc=5 end="|"me=e-1 59 syn match gopherURL "gopher:" 60 syn match gopherURL "URL:" 61 syn match gopherURL "URI:" 62 syn region gopherLink start="gopher:"lc=7 end="|"me=e-1 63 64 " Pipes 65 syn match gopherPipe "|" containedin=gopherServerPort 66 67 " Queries and CGI 68 syn match gopherQuery "^\[7"lc=1 69 syn match gopherCGI "|[^|]*\.cgi[^|]*"lc=1 70 syn match gopherCGI2 "|[^|]*\.dcgi[^|]*"lc=1 71 72 " Server|Port 73 syn match gopherServerPort "|[^|]*|[^|]*]" 74 75 " Start and end brackets 76 match gopherBracket "[\[\]]" 77 78 " Entity 79 syn region gopherType start="^\[[0123456789ghHmswITi\+:;<PcMd\*\.]"lc=1 end="|" oneline 80 81 " HTML and networking 82 syn match gopherHtml "^\[[hHw8]"lc=1 83 84 " Text comments beginning with 't' 85 syn match gopherComment "^t" 86 87 " Err 88 syn match gopherErr "Err" 89 syn match gopherErr "^\[3"lc=1 90