vim.js (10366B)
1 /* 2 Language: Vim Script 3 Author: Jun Yang <yangjvn@126.com> 4 Description: full keyword and built-in from http://vimdoc.sourceforge.net/htmldoc/ 5 Website: https://www.vim.org 6 Category: scripting 7 */ 8 9 function vim(hljs) { 10 return { 11 name: 'Vim Script', 12 keywords: { 13 $pattern: /[!#@\w]+/, 14 keyword: 15 // express version except: ! & * < = > !! # @ @@ 16 'N|0 P|0 X|0 a|0 ab abc abo al am an|0 ar arga argd arge argdo argg argl argu as au aug aun b|0 bN ba bad bd be bel bf bl bm bn bo bp br brea breaka breakd breakl bro bufdo buffers bun bw c|0 cN cNf ca cabc caddb cad caddf cal cat cb cc ccl cd ce cex cf cfir cgetb cgete cg changes chd che checkt cl cla clo cm cmapc cme cn cnew cnf cno cnorea cnoreme co col colo com comc comp con conf cope '+ 17 'cp cpf cq cr cs cst cu cuna cunme cw delm deb debugg delc delf dif diffg diffo diffp diffpu diffs diffthis dig di dl dell dj dli do doautoa dp dr ds dsp e|0 ea ec echoe echoh echom echon el elsei em en endfo endf endt endw ene ex exe exi exu f|0 files filet fin fina fini fir fix fo foldc foldd folddoc foldo for fu go gr grepa gu gv ha helpf helpg helpt hi hid his ia iabc if ij il im imapc '+ 18 'ime ino inorea inoreme int is isp iu iuna iunme j|0 ju k|0 keepa kee keepj lN lNf l|0 lad laddb laddf la lan lat lb lc lch lcl lcs le lefta let lex lf lfir lgetb lgete lg lgr lgrepa lh ll lla lli lmak lm lmapc lne lnew lnf ln loadk lo loc lockv lol lope lp lpf lr ls lt lu lua luad luaf lv lvimgrepa lw m|0 ma mak map mapc marks mat me menut mes mk mks mksp mkv mkvie mod mz mzf nbc nb nbs new nm nmapc nme nn nnoreme noa no noh norea noreme norm nu nun nunme ol o|0 om omapc ome on ono onoreme opt ou ounme ow p|0 '+ 19 'profd prof pro promptr pc ped pe perld po popu pp pre prev ps pt ptN ptf ptj ptl ptn ptp ptr pts pu pw py3 python3 py3d py3f py pyd pyf quita qa rec red redi redr redraws reg res ret retu rew ri rightb rub rubyd rubyf rund ru rv sN san sa sal sav sb sbN sba sbf sbl sbm sbn sbp sbr scrip scripte scs se setf setg setl sf sfir sh sim sig sil sl sla sm smap smapc sme sn sni sno snor snoreme sor '+ 20 'so spelld spe spelli spellr spellu spellw sp spr sre st sta startg startr star stopi stj sts sun sunm sunme sus sv sw sy synti sync tN tabN tabc tabdo tabe tabf tabfir tabl tabm tabnew '+ 21 'tabn tabo tabp tabr tabs tab ta tags tc tcld tclf te tf th tj tl tm tn to tp tr try ts tu u|0 undoj undol una unh unl unlo unm unme uns up ve verb vert vim vimgrepa vi viu vie vm vmapc vme vne vn vnoreme vs vu vunme windo w|0 wN wa wh wi winc winp wn wp wq wqa ws wu wv x|0 xa xmapc xm xme xn xnoreme xu xunme y|0 z|0 ~ '+ 22 // full version 23 'Next Print append abbreviate abclear aboveleft all amenu anoremenu args argadd argdelete argedit argglobal arglocal argument ascii autocmd augroup aunmenu buffer bNext ball badd bdelete behave belowright bfirst blast bmodified bnext botright bprevious brewind break breakadd breakdel breaklist browse bunload '+ 24 'bwipeout change cNext cNfile cabbrev cabclear caddbuffer caddexpr caddfile call catch cbuffer cclose center cexpr cfile cfirst cgetbuffer cgetexpr cgetfile chdir checkpath checktime clist clast close cmap cmapclear cmenu cnext cnewer cnfile cnoremap cnoreabbrev cnoremenu copy colder colorscheme command comclear compiler continue confirm copen cprevious cpfile cquit crewind cscope cstag cunmap '+ 25 'cunabbrev cunmenu cwindow delete delmarks debug debuggreedy delcommand delfunction diffupdate diffget diffoff diffpatch diffput diffsplit digraphs display deletel djump dlist doautocmd doautoall deletep drop dsearch dsplit edit earlier echo echoerr echohl echomsg else elseif emenu endif endfor '+ 26 'endfunction endtry endwhile enew execute exit exusage file filetype find finally finish first fixdel fold foldclose folddoopen folddoclosed foldopen function global goto grep grepadd gui gvim hardcopy help helpfind helpgrep helptags highlight hide history insert iabbrev iabclear ijump ilist imap '+ 27 'imapclear imenu inoremap inoreabbrev inoremenu intro isearch isplit iunmap iunabbrev iunmenu join jumps keepalt keepmarks keepjumps lNext lNfile list laddexpr laddbuffer laddfile last language later lbuffer lcd lchdir lclose lcscope left leftabove lexpr lfile lfirst lgetbuffer lgetexpr lgetfile lgrep lgrepadd lhelpgrep llast llist lmake lmap lmapclear lnext lnewer lnfile lnoremap loadkeymap loadview '+ 28 'lockmarks lockvar lolder lopen lprevious lpfile lrewind ltag lunmap luado luafile lvimgrep lvimgrepadd lwindow move mark make mapclear match menu menutranslate messages mkexrc mksession mkspell mkvimrc mkview mode mzscheme mzfile nbclose nbkey nbsart next nmap nmapclear nmenu nnoremap '+ 29 'nnoremenu noautocmd noremap nohlsearch noreabbrev noremenu normal number nunmap nunmenu oldfiles open omap omapclear omenu only onoremap onoremenu options ounmap ounmenu ownsyntax print profdel profile promptfind promptrepl pclose pedit perl perldo pop popup ppop preserve previous psearch ptag ptNext '+ 30 'ptfirst ptjump ptlast ptnext ptprevious ptrewind ptselect put pwd py3do py3file python pydo pyfile quit quitall qall read recover redo redir redraw redrawstatus registers resize retab return rewind right rightbelow ruby rubydo rubyfile rundo runtime rviminfo substitute sNext sandbox sargument sall saveas sbuffer sbNext sball sbfirst sblast sbmodified sbnext sbprevious sbrewind scriptnames scriptencoding '+ 31 'scscope set setfiletype setglobal setlocal sfind sfirst shell simalt sign silent sleep slast smagic smapclear smenu snext sniff snomagic snoremap snoremenu sort source spelldump spellgood spellinfo spellrepall spellundo spellwrong split sprevious srewind stop stag startgreplace startreplace '+ 32 'startinsert stopinsert stjump stselect sunhide sunmap sunmenu suspend sview swapname syntax syntime syncbind tNext tabNext tabclose tabedit tabfind tabfirst tablast tabmove tabnext tabonly tabprevious tabrewind tag tcl tcldo tclfile tearoff tfirst throw tjump tlast tmenu tnext topleft tprevious '+'trewind tselect tunmenu undo undojoin undolist unabbreviate unhide unlet unlockvar unmap unmenu unsilent update vglobal version verbose vertical vimgrep vimgrepadd visual viusage view vmap vmapclear vmenu vnew '+ 33 'vnoremap vnoremenu vsplit vunmap vunmenu write wNext wall while winsize wincmd winpos wnext wprevious wqall wsverb wundo wviminfo xit xall xmapclear xmap xmenu xnoremap xnoremenu xunmap xunmenu yank', 34 built_in: //built in func 35 'synIDtrans atan2 range matcharg did_filetype asin feedkeys xor argv ' + 36 'complete_check add getwinposx getqflist getwinposy screencol ' + 37 'clearmatches empty extend getcmdpos mzeval garbagecollect setreg ' + 38 'ceil sqrt diff_hlID inputsecret get getfperm getpid filewritable ' + 39 'shiftwidth max sinh isdirectory synID system inputrestore winline ' + 40 'atan visualmode inputlist tabpagewinnr round getregtype mapcheck ' + 41 'hasmapto histdel argidx findfile sha256 exists toupper getcmdline ' + 42 'taglist string getmatches bufnr strftime winwidth bufexists ' + 43 'strtrans tabpagebuflist setcmdpos remote_read printf setloclist ' + 44 'getpos getline bufwinnr float2nr len getcmdtype diff_filler luaeval ' + 45 'resolve libcallnr foldclosedend reverse filter has_key bufname ' + 46 'str2float strlen setline getcharmod setbufvar index searchpos ' + 47 'shellescape undofile foldclosed setqflist buflisted strchars str2nr ' + 48 'virtcol floor remove undotree remote_expr winheight gettabwinvar ' + 49 'reltime cursor tabpagenr finddir localtime acos getloclist search ' + 50 'tanh matchend rename gettabvar strdisplaywidth type abs py3eval ' + 51 'setwinvar tolower wildmenumode log10 spellsuggest bufloaded ' + 52 'synconcealed nextnonblank server2client complete settabwinvar ' + 53 'executable input wincol setmatches getftype hlID inputsave ' + 54 'searchpair or screenrow line settabvar histadd deepcopy strpart ' + 55 'remote_peek and eval getftime submatch screenchar winsaveview ' + 56 'matchadd mkdir screenattr getfontname libcall reltimestr getfsize ' + 57 'winnr invert pow getbufline byte2line soundfold repeat fnameescape ' + 58 'tagfiles sin strwidth spellbadword trunc maparg log lispindent ' + 59 'hostname setpos globpath remote_foreground getchar synIDattr ' + 60 'fnamemodify cscope_connection stridx winbufnr indent min ' + 61 'complete_add nr2char searchpairpos inputdialog values matchlist ' + 62 'items hlexists strridx browsedir expand fmod pathshorten line2byte ' + 63 'argc count getwinvar glob foldtextresult getreg foreground cosh ' + 64 'matchdelete has char2nr simplify histget searchdecl iconv ' + 65 'winrestcmd pumvisible writefile foldlevel haslocaldir keys cos ' + 66 'matchstr foldtext histnr tan tempname getcwd byteidx getbufvar ' + 67 'islocked escape eventhandler remote_send serverlist winrestview ' + 68 'synstack pyeval prevnonblank readfile cindent filereadable changenr ' + 69 'exp' 70 }, 71 illegal: /;/, 72 contains: [ 73 hljs.NUMBER_MODE, 74 { 75 className: 'string', 76 begin: '\'', end: '\'', 77 illegal: '\\n' 78 }, 79 80 /* 81 A double quote can start either a string or a line comment. Strings are 82 ended before the end of a line by another double quote and can contain 83 escaped double-quotes and post-escaped line breaks. 84 85 Also, any double quote at the beginning of a line is a comment but we 86 don't handle that properly at the moment: any double quote inside will 87 turn them into a string. Handling it properly will require a smarter 88 parser. 89 */ 90 { 91 className: 'string', 92 begin: /"(\\"|\n\\|[^"\n])*"/ 93 }, 94 hljs.COMMENT('"', '$'), 95 96 { 97 className: 'variable', 98 begin: /[bwtglsav]:[\w\d_]*/ 99 }, 100 { 101 className: 'function', 102 beginKeywords: 'function function!', end: '$', 103 relevance: 0, 104 contains: [ 105 hljs.TITLE_MODE, 106 { 107 className: 'params', 108 begin: '\\(', end: '\\)' 109 } 110 ] 111 }, 112 { 113 className: 'symbol', 114 begin: /<[\w-]+>/ 115 } 116 ] 117 }; 118 } 119 120 module.exports = vim;