" Vim filetype plugin file " Language: Zimbu " Maintainer: Bram Moolenaar " Last Change: 2012 May 18 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") finish endif " Don't load another plugin for this buffer let b:did_ftplugin = 1 " Using line continuation here. let s:cpo_save = &cpo set cpo-=C let b:undo_ftplugin = "setl fo< com< ofu< efm< tw< et< sts< sw< | if has('vms') | setl isk< | endif" " Set 'formatoptions' to break comment lines but not other lines, " and insert the comment leader when hitting or using "o". setlocal fo-=t fo+=croql " Set completion with CTRL-X CTRL-O to autoloaded function. if exists('&ofu') setlocal ofu=ccomplete#Complete endif " Set 'comments' to format dashed lists in comments. " And to keep Zudocu comment characters. setlocal comments=sO:#\ -,mO:#\ \ ,:#=,:#-,:#%,:# setlocal errorformat^=%f\ line\ %l\ col\ %c:\ %m,ERROR:\ %m " When the matchit plugin is loaded, this makes the % command skip parens and " braces in comments. 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*\)\@<=}\|\' let b:match_skip = 's:comment\|string\|zimbuchar' setlocal tw=78 setlocal et sts=2 sw=2 " Does replace when a dot, space or closing brace is typed. func! GCUpperDot(what) let col = col(".") - strlen(a:what) if v:char != ' ' && v:char != "\r" && v:char != "\x1b" && v:char != '.' && v:char != ')' && v:char != '}' " no space or dot after the typed text let g:got_char = v:char return a:what endif if col > 1 && getline('.')[col - 2] != ' ' " no space before the typed text let g:got_char = 999 return a:what endif let synName = synIDattr(synID(line("."), col(".") - 2, 1), "name") if synName =~ 'Comment\|String\|zimbuCregion\|\ alias GCUpperSpace("alias") iabbr arg GCUpperDot("arg") iabbr bad GCUpper("bad") iabbr break GCUpper("break") iabbr case GCUpperSpace("case") iabbr catch GCUpperSpace("catch") iabbr check GCUpperDot("check") iabbr class GCUpperSpace("class") iabbr shared GCUpperSpace("shared") iabbr continue GCUpper("continue") iabbr default GCUpper("default") iabbr extends GCUpper("extends") iabbr do GCUpper("do") iabbr else GCUpper("else") iabbr elseif GCUpperSpace("elseif") iabbr enum GCUpperSpace("enum") iabbr exit GCUpper("exit") iabbr false GCUpper("false") iabbr fail GCUpper("fail") iabbr finally GCUpper("finally") iabbr for GCUpperSpace("for") iabbr func GCUpperSpace("func") iabbr if GCUpperSpace("if") iabbr import GCUpperSpace("import") iabbr in GCUpperSpace("in") iabbr io GCUpperDot("io") iabbr main GCUpper("main") iabbr module GCUpperSpace("module") iabbr new GCUpper("new") iabbr nil GCUpper("nil") iabbr ok GCUpper("ok") iabbr proc GCUpperSpace("proc") iabbr proceed GCUpper("proceed") iabbr return GCUpper("return") iabbr step GCUpperSpace("step") iabbr switch GCUpperSpace("switch") iabbr sys GCUpperDot("sys") iabbr this GCUpperDot("this") iabbr throw GCUpperSpace("throw") iabbr try GCUpper("try") iabbr to GCUpperSpace("to") iabbr true GCUpper("true") iabbr until GCUpperSpace("until") iabbr while GCUpperSpace("while") iabbr repeat GCUpper("repeat") nnoremap [[ m`:call ZimbuGoStartBlock() nnoremap ]] m`:call ZimbuGoEndBlock() " Using a function makes sure the search pattern is restored func! ZimbuGoStartBlock() ?^\s*\(FUNC\|PROC\|MAIN\|ENUM\|CLASS\|INTERFACE\)\> endfunc func! ZimbuGoEndBlock() /^\s*\(FUNC\|PROC\|MAIN\|ENUM\|CLASS\|INTERFACE\)\> endfunc let &cpo = s:cpo_save unlet s:cpo_save