Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
zimbu.vim211 linesDownload Raw Back to ftplugin
1" Vim filetype plugin file2" Language:	Zimbu3" Maintainer:	The Vim Project <https://github.com/vim/vim>4" Last Change:	2025 Jun 085" Former Maintainer:	Bram Moolenaar <Bram@vim.org>6" Note:	Zimbu was the programming language invented by Bram,7"	but it seems to be lost by now8 9" Only do this when not done yet for this buffer10if exists("b:did_ftplugin")11  finish12endif13 14" Don't load another plugin for this buffer15let b:did_ftplugin = 116 17" Using line continuation here.18let s:cpo_save = &cpo19set cpo-=C20 21let b:undo_ftplugin = "setl fo< com< cms< ofu< efm< tw< et< sts< sw< | if has('vms') | setl isk< | endif"22 23" Set 'formatoptions' to break comment lines but not other lines,24" and insert the comment leader when hitting <CR> or using "o".25setlocal fo-=t fo+=croql26 27" Set completion with CTRL-X CTRL-O to autoloaded function.28if exists('&ofu')29  setlocal ofu=ccomplete#Complete30endif31 32" Set 'comments' to format dashed lists in comments.33" And to keep Zudocu comment characters.34setlocal comments=sO:#\ -,mO:#\ \ ,exO:#/,s:/*,m:\ ,ex:*/,:#=,:#-,:#%,:#35setlocal commentstring=#\ %s36 37setlocal errorformat^=%f\ line\ %l\ col\ %c:\ %m,ERROR:\ %m38 39" When the matchit plugin is loaded, this makes the % command skip parens and40" braces in comments.41if exists("loaded_matchit") && !exists("b:match_words")42  let b:match_words = '\(^\s*\)\@<=\(MODULE\|CLASS\|INTERFACE\|BITS\|ENUM\|SHARED\|FUNC\|REPLACE\|DEFINE\|PROC\|EQUAL\|MAIN\|IF\|GENERATE_IF\|WHILE\|REPEAT\|WITH\|DO\|FOR\|SWITCH\|TRY\)\>\|{\s*$:\(^\s*\)\@<=\(ELSE\|ELSEIF\|GENERATE_ELSE\|GENERATE_ELSEIF\|CATCH\|FINALLY\)\>:\(^\s*\)\@<=\(}\|\<UNTIL\>\)'43  let b:match_skip = 's:comment\|string\|zimbuchar'44  let b:undo_ftplugin ..= " | unlet! b:match_words b:match_skip"45endif46 47setlocal tw=7848setlocal et sts=2 sw=249 50" Does replace when a dot, space or closing brace is typed.51func! GCUpperDot(what)52  if v:char != ' ' && v:char != "\r" && v:char != "\x1b" && v:char != '.' && v:char != ')' && v:char != '}' && v:char != ','53    " no space or dot after the typed text54    let g:got_char = v:char55    return a:what56  endif57  return GCUpperCommon(a:what)58endfunc59 60" Does not replace when a dot is typed.61func! GCUpper(what)62  if v:char != ' ' && v:char != "\r" && v:char != "\x1b" && v:char != ')' && v:char != ','63    " no space or other "terminating" character after the typed text64    let g:got_char = v:char65    return a:what66  endif67  return GCUpperCommon(a:what)68endfunc69 70" Only replaces when a space is typed.71func! GCUpperSpace(what)72  if v:char != ' '73    " no space after the typed text74    let g:got_char = v:char75    return a:what76  endif77  return GCUpperCommon(a:what)78endfunc79 80func! GCUpperCommon(what)81  let col = col(".") - strlen(a:what)82  if col > 1 && getline('.')[col - 2] != ' '83    " no space before the typed text84    let g:got_char = 99985    return a:what86  endif87  let synName = synIDattr(synID(line("."), col(".") - 2, 1), "name")88  if synName =~ 'Comment\|String\|zimbuCregion\|\<c'89    " inside a comment or C code90    let g:got_char = 77791    return a:what92  endif93    let g:got_char = 111194  return toupper(a:what)95endfunc96 97iabbr <buffer> <expr> alias GCUpperSpace("alias")98iabbr <buffer> <expr> arg GCUpperDot("arg")99iabbr <buffer> <expr> break GCUpper("break")100iabbr <buffer> <expr> case GCUpperSpace("case")101iabbr <buffer> <expr> catch GCUpperSpace("catch")102iabbr <buffer> <expr> check GCUpperDot("check")103iabbr <buffer> <expr> class GCUpperSpace("class")104iabbr <buffer> <expr> interface GCUpperSpace("interface")105iabbr <buffer> <expr> implements GCUpperSpace("implements")106iabbr <buffer> <expr> shared GCUpperSpace("shared")107iabbr <buffer> <expr> continue GCUpper("continue")108iabbr <buffer> <expr> default GCUpper("default")109iabbr <buffer> <expr> extends GCUpper("extends")110iabbr <buffer> <expr> do GCUpper("do")111iabbr <buffer> <expr> else GCUpper("else")112iabbr <buffer> <expr> elseif GCUpperSpace("elseif")113iabbr <buffer> <expr> enum GCUpperSpace("enum")114iabbr <buffer> <expr> exit GCUpper("exit")115iabbr <buffer> <expr> false GCUpper("false")116iabbr <buffer> <expr> fail GCUpper("fail")117iabbr <buffer> <expr> finally GCUpper("finally")118iabbr <buffer> <expr> for GCUpperSpace("for")119iabbr <buffer> <expr> func GCUpperSpace("func")120iabbr <buffer> <expr> if GCUpperSpace("if")121iabbr <buffer> <expr> import GCUpperSpace("import")122iabbr <buffer> <expr> in GCUpperSpace("in")123iabbr <buffer> <expr> io GCUpperDot("io")124iabbr <buffer> <expr> main GCUpper("main")125iabbr <buffer> <expr> module GCUpperSpace("module")126iabbr <buffer> <expr> new GCUpper("new")127iabbr <buffer> <expr> nil GCUpper("nil")128iabbr <buffer> <expr> ok GCUpper("ok")129iabbr <buffer> <expr> proc GCUpperSpace("proc")130iabbr <buffer> <expr> proceed GCUpper("proceed")131iabbr <buffer> <expr> return GCUpper("return")132iabbr <buffer> <expr> step GCUpperSpace("step")133iabbr <buffer> <expr> switch GCUpperSpace("switch")134iabbr <buffer> <expr> sys GCUpperDot("sys")135iabbr <buffer> <expr> this GCUpperDot("this")136iabbr <buffer> <expr> throw GCUpperSpace("throw")137iabbr <buffer> <expr> try GCUpper("try")138iabbr <buffer> <expr> to GCUpperSpace("to")139iabbr <buffer> <expr> true GCUpper("true")140iabbr <buffer> <expr> until GCUpperSpace("until")141iabbr <buffer> <expr> while GCUpperSpace("while")142iabbr <buffer> <expr> repeat GCUpper("repeat")143 144let b:undo_ftplugin ..=145      \ " | iunabbr <buffer> alias" ..146      \ " | iunabbr <buffer> arg" ..147      \ " | iunabbr <buffer> break" ..148      \ " | iunabbr <buffer> case" ..149      \ " | iunabbr <buffer> catch" ..150      \ " | iunabbr <buffer> check" ..151      \ " | iunabbr <buffer> class" ..152      \ " | iunabbr <buffer> interface" ..153      \ " | iunabbr <buffer> implements" ..154      \ " | iunabbr <buffer> shared" ..155      \ " | iunabbr <buffer> continue" ..156      \ " | iunabbr <buffer> default" ..157      \ " | iunabbr <buffer> extends" ..158      \ " | iunabbr <buffer> do" ..159      \ " | iunabbr <buffer> else" ..160      \ " | iunabbr <buffer> elseif" ..161      \ " | iunabbr <buffer> enum" ..162      \ " | iunabbr <buffer> exit" ..163      \ " | iunabbr <buffer> false" ..164      \ " | iunabbr <buffer> fail" ..165      \ " | iunabbr <buffer> finally" ..166      \ " | iunabbr <buffer> for" ..167      \ " | iunabbr <buffer> func" ..168      \ " | iunabbr <buffer> if" ..169      \ " | iunabbr <buffer> import" ..170      \ " | iunabbr <buffer> in" ..171      \ " | iunabbr <buffer> io" ..172      \ " | iunabbr <buffer> main" ..173      \ " | iunabbr <buffer> module" ..174      \ " | iunabbr <buffer> new" ..175      \ " | iunabbr <buffer> nil" ..176      \ " | iunabbr <buffer> ok" ..177      \ " | iunabbr <buffer> proc" ..178      \ " | iunabbr <buffer> proceed" ..179      \ " | iunabbr <buffer> return" ..180      \ " | iunabbr <buffer> step" ..181      \ " | iunabbr <buffer> switch" ..182      \ " | iunabbr <buffer> sys" ..183      \ " | iunabbr <buffer> this" ..184      \ " | iunabbr <buffer> throw" ..185      \ " | iunabbr <buffer> try" ..186      \ " | iunabbr <buffer> to" ..187      \ " | iunabbr <buffer> true" ..188      \ " | iunabbr <buffer> until" ..189      \ " | iunabbr <buffer> while" ..190      \ " | iunabbr <buffer> repeat"191 192if !exists("no_plugin_maps") && !exists("no_zimbu_maps")193  nnoremap <silent> <buffer> [[ m`:call ZimbuGoStartBlock()<CR>194  nnoremap <silent> <buffer> ]] m`:call ZimbuGoEndBlock()<CR>195  let b:undo_ftplugin ..=196	\ " | silent! exe 'nunmap <buffer> [['" ..197	\ " | silent! exe 'nunmap <buffer> ]]'"198endif199 200" Using a function makes sure the search pattern is restored201func! ZimbuGoStartBlock()202  ?^\s*\(FUNC\|PROC\|MAIN\|ENUM\|CLASS\|INTERFACE\)\>203endfunc204func! ZimbuGoEndBlock()205  /^\s*\(FUNC\|PROC\|MAIN\|ENUM\|CLASS\|INTERFACE\)\>206endfunc207 208 209let &cpo = s:cpo_save210unlet s:cpo_save211 
codekingpro/portable-devtools · Team Ai