fanglingsu / vimb

Vimb - the vim like browser is a webkit based web browser that behaves like the vimperator plugin for the firefox and usage paradigms from the great editor vim. The goal of vimb is to build a completely keyboard-driven, efficient and pleasurable browsing-experience.
https://fanglingsu.github.io/vimb/
GNU General Public License v3.0
1.35k stars 100 forks source link

Add vim syntax file for vimb config #148

Open fanglingsu opened 9 years ago

fanglingsu commented 9 years ago

It would be nice if the vimb config file can be syntax highlighted. Following snipped could be a starting point. But I'm not so skilled to do this in a clean way. So I hope there is some developer here who will do this.

if version < 600
    syntax clear
elseif exists("b:current_syntax")
    finish
endif

syn keyword vimbCommand contained
    \ au[tocmd] 
    \ aug[roup] 
    \ bma 
    \ bmr 
    \ cm[ap] 
    \ cno[remap]
    \ cu[nmap]
    \ e[val] 
    \ ha[rdcopy] \
    \ handler-add 
    \ handler-remove 
    \ handler\-add
    \ im[ap] 
    \ ino[remap]
    \ iu[nmap]
    \ nm[ap] 
    \ nn[oremap]
    \ nu[nmap]
    \ o[pen] 
    \ q[uit] 
    \ qc[lear]
    \ qp[op]
    \ qpu[sh]
    \ qun[shift] 
    \ s[ave]
    \ se[t]
    \ sh[ellcmd]
    \ shortcut-add
    \ shortcut-default
    \ shortcut-remove
    \ t[abopen]

syn match vimbCmdSep "|" skipwhite nextgroup=vimbCommand,vimbSet
syn match vimbIsCommand "\<\h[-a-zA-Z]*\>" contains=vimbCommand

" Integer and float
syn match vimbInt display /\d\+\_s/
syn match vimbFloat display /\d\+\.\d\+\_s/

" $ENV and ${ENV}
syn match vimbEnvVar "\$\I\i*"
syn match vimbEnvVar "\${\I\i*}"

" Hex colors
syn match vimbHexCol display /#\x\{3}\%(\x\{3}\)\=/

" Comments #...
syn region vimbComment display start=/\s\?#/ end=/$/ contains=vimbTodo
syn keyword vimbTodo contained TODO FIXME

" Set
syn keyword vimbOption contained accelerated-compositing auto-resize-window auto-response-header auto-shrink-images ca-bundle caret completion-bg-active completion-bg-normal completion-fg-active completion-fg-normal completion-font cookie-accept cookie-expire-time cookie-timeout cursivefont defaultencoding defaultfont dns-prefetching dom-paste download-command download-path download-use-external editor-command file-access-from-file-uris fontsize frame-flattening fullscreen header hint-timeout history-max-items home-page hsts html5-database html5-local-storage hyperlink-auditing images input-autohide input-bg-error input-bg-normal input-fg-error inptu-fg-normal input-font-error input-font-normal insecure-content-run insecure-content-show java-applet javascript-can-access-clipboard javascript-can-open-windows-automatically maximum-cache-size media-playback-allow-inline media-playback-require-user-gesture mediasource media-stream minimumfontsize monofont monofontsize nextpattern offlinecache pagecache plugins previouspattern print-backgrounds private-browsing proxy resizable-text-areas respect-image-orientation sansfont scripts scrollstep seriffont site-specific-quirks smooth-scrolling spacial-navigation spell-checking spell-checking-language statusbar status-color-bg status-color-fg status-font status-ssl-color-bg status-ssl-color-fg status-ssl-font status-sslinvalid-color-bg status-sslinvalid-color-fg status-sslinvalid-font strict-focus strict-ssl stylesheet tyb-key-cycles-through-elements timeoutlen universal-access-from-file-uris useragent webaudio webgl webinspector x-hint-command xssauditor
syn region vimbSet matchgroup=vimbCommand start="se\%[t]" end="$" end="|"me=e-1 keepend oneline contains=vimbOption,vimbSetEqual
syn region vimbSetEqual contained start="=\|[-+^]="ms=s+1 skip="\\\\" end="$" end="|"me=e-1 contains=vimbEnvVar,vimbInt,vimbFloat,vimbHexCol oneline

hi def link vimbCommand Keyword
hi def link vimbComment Comment
hi def link vimbTodo Todo
hi def link vimbEnvVar Number
hi def link vimbFloat Float
hi def link vimbHexCol Constant
hi def link vimbInt Number
hi def link vimbSetEqual String 
hi def link vimbOption PreProc

let b:current_syntax = 'vimb'
stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had activity within the last 60 days. It will be closed after 7 days if no further activity occurs. Thank you for your contributions.