# HG changeset patch # User Bram Moolenaar # Date 1280349000 -7200 # Node ID 55b20270a4ce727e5a6be03797e953c6ae304c2f # Parent 7ce8b24450dcd70ad3c359085575b0cf6facaf4b Remove Mupad indent and ftplugin files, they are not useful. diff --git a/runtime/ftplugin/AppendMatchGroup.vim b/runtime/ftplugin/AppendMatchGroup.vim deleted file mode 100644 --- a/runtime/ftplugin/AppendMatchGroup.vim +++ /dev/null @@ -1,125 +0,0 @@ -" Vim filetype plugin file utility -" Language: * (various) -" Maintainer: Dave Silvia -" Date: 6/30/2004 - -" The start of match (b:SOM) default is: -" '\<' -" The end of match (b:EOM) default is: -" '\>' -" -" If you want to use some other start/end of match, just assign the -" value to the b:SOM|EOM variable in your filetype script. -" -" SEE: :h pattern.txt -" :h pattern-searches -" :h regular-expression -" :h matchit - -let s:myName=expand(":t") - -" matchit.vim not loaded -- don't do anyting -if !exists("loaded_matchit") - echomsg s:myName.": matchit.vim not loaded -- finishing without loading" - finish -endif - -" already been here -- don't redefine -if exists("*AppendMatchGroup") - finish -endif - -" Function To Build b:match_words -" The following function, 'AppendMatchGroup', helps to increase -" readability of your filetype script if you choose to use matchit. -" It also precludes many construction errors, reducing the -" construction to simply invoking the function with the match words. -" As an example, let's take the ubiquitous if/then/else/endif type -" of construct. This is how the entry in your filetype script would look. -" -" " source the AppendMatchGroup function file -" runtime ftplugin/AppendMatchGroup.vim -" -" " fill b:match_words -" call AppendMatchGroup('if,then,else,endif') -" -" And the b:match_words constructed would look like: -" -" \:\:\:\ -" -" Use of AppendMatchGroup makes your filetype script is a little -" less busy and a lot more readable. Additionally, it -" checks three critical things: -" -" 1) Do you have at least 2 entries in your match group. -" -" 2) Does the buffer variable 'b:match_words' exist? if not, create it. -" -" 3) If the buffer variable 'b:match_words' does exist, is the last -" character a ','? If not, add it before appending. -" -" You should now be able to match 'if/then/else/endif' in succession -" in your source file, in just about any construction you may have -" chosen for them. -" -" To add another group, simply call 'AppendMatchGroup again. E.G.: -" -" call AppendMatchGroup('while,do,endwhile') - -function AppendMatchGroup(mwordList) - let List=a:mwordList - let Comma=match(List,',') - if Comma == -1 || Comma == strlen(List)-1 - echoerr "Must supply a comma separated list of at least 2 entries." - echoerr "Supplied list: <".List.">" - return - endif - let listEntryBegin=0 - let listEntryEnd=Comma - let listEntry=strpart(List,listEntryBegin,listEntryEnd-listEntryBegin) - let List=strpart(List,Comma+1) - let Comma=match(List,',') - " if listEntry is all spaces || List is empty || List is all spaces - if (match(listEntry,'\s\+') == 0 && match(listEntry,'\S\+') == -1) - \ || List == '' || (match(List,'\s\+') == 0 && match(List,'\S\+') == -1) - echoerr "Can't use all spaces for an entry <".listEntry.">" - echoerr "Remaining supplied list: <".List.">" - return - endif - - if !exists("b:SOM") - let b:SOM='\<' - endif - if !exists("b:EOM") - let b:EOM='\>' - endif - if !exists("b:match_words") - let b:match_words='' - endif - if b:match_words != '' && match(b:match_words,',$') == -1 - let b:match_words=b:match_words.',' - endif - " okay, all set add first entry in this list - let b:match_words=b:match_words.b:SOM.listEntry.b:EOM.':' - while Comma != -1 - let listEntryEnd=Comma - let listEntry=strpart(List,listEntryBegin,listEntryEnd-listEntryBegin) - let List=strpart(List,Comma+1) - let Comma=match(List,',') - " if listEntry is all spaces - if match(listEntry,'\s\+') == 0 && match(listEntry,'\S\+') == -1 - echoerr "Can't use all spaces for an entry <".listEntry."> - skipping" - echoerr "Remaining supplied list: <".List.">" - continue - endif - let b:match_words=b:match_words.b:SOM.listEntry.b:EOM.':' - endwhile - let listEntry=List - let b:match_words=b:match_words.b:SOM.listEntry.b:EOM -endfunction - -" TODO: Write a wrapper to handle multiple groups in one function call. -" Don't see a lot of utility in this as it would undoubtedly warrant -" continuation lines in the filetype script and it would be a toss -" up as to which is more readable: individual calls one to a line or -" a single call with continuation lines. I vote for the former. diff --git a/runtime/ftplugin/mupad.vim b/runtime/ftplugin/mupad.vim deleted file mode 100644 --- a/runtime/ftplugin/mupad.vim +++ /dev/null @@ -1,30 +0,0 @@ -" Vim filetype plugin file -" Language: MuPAD source files -" Maintainer: Dave Silvia -" Filenames: *.mu -" Date: 6/30/2004 - -if exists("b:did_ftplugin") | finish | endif -let b:did_ftplugin = 1 - -" Change the :browse e filter to primarily show MuPAD source files. -if has("gui_win32") - let b:browsefilter= - \ "MuPAD source (*.mu)\t*.mu\n" . - \ "All Files (*.*)\t*.*\n" -endif - -" matchit.vim not loaded -- don't do anyting below -if !exists("loaded_matchit") - " echomsg "matchit.vim not loaded -- finishing" - finish -endif - -" source the AppendMatchGroup function file -runtime ftplugin/AppendMatchGroup.vim - -" fill b:match_words for MuPAD -call AppendMatchGroup('domain,end_domain') -call AppendMatchGroup('proc,begin,end_proc') -call AppendMatchGroup('if,then,elif,else,end_if') -call AppendMatchGroup('\%(for\|while\|repeat\|case\),of,do,break,next,until,\%(end_for\|end_while\|end_repeat\|end_case\)') diff --git a/runtime/indent/GenericIndent.vim b/runtime/indent/GenericIndent.vim deleted file mode 100644 --- a/runtime/indent/GenericIndent.vim +++ /dev/null @@ -1,322 +0,0 @@ -" Vim indent file generic utility functions -" Language: * (various) -" Maintainer: Dave Silvia -" Date: 6/30/2004 - -" SUMMARY: To use GenericIndent, indent/.vim would have the -" following general format: -" -" if exists("b:did_indent") | finish | endif -" let b:did_indent = 1 -" runtime indent/GenericIndent.vim -" let b:indentStmts='' -" let b:dedentStmts='' -" let b:allStmts='' -" setlocal indentexpr=GenericIndent() -" setlocal indentkeys= -" call GenericIndentStmts() -" call GenericDedentStmts() -" call GenericAllStmts() -" -" END SUMMARY: - -" NOTE: b:indentStmts, b:dedentStmts, and b:allStmts need to be initialized -" to '' before callin the functions because 'indent.vim' explicitly -" 'unlet's b:did_indent. This means that the lists will compound if -" you change back and forth between buffers. This is true as of -" version 6.3, 6/23/2004. -" -" NOTE: By default, GenericIndent is case sensitive. -" let b:case_insensitive=1 if you want to ignore case, e.g. DOS batch files - -" The function 'GenericIndent' is data driven and handles most all cases of -" indent checking if you first set up the data. To use this function follow -" the example below (taken from the file indent/MuPAD_source.vim) -" -" Before you start, source this file in indent/.vim to have it -" define functions for your use. -" -"runtime indent/GenericIndent.vim -" -" The data is in 5 sets: -" -" First, set the data set 'indentexpr' to GenericIndent(). -" -"setlocal indentexpr=GenericIndent() -" -" Second, set the data set 'indentkeys' to the keywords/expressions that need -" to be checked for 'indenting' _as_ they typed. -" -"setlocal indentkeys==end_proc,=else,=then,=elif,=end_if,=end_case,=until,=end_repeat,=end_domain,=end_for,=end_while,=end,o,O -" -" NOTE: 'o,O' at the end of the previous line says you wish to be called -" whenever a newline is placed in the buffer. This allows the previous line -" to be checked for indentation parameters. -" -" Third, set the data set 'b:indentStmts' to the keywords/expressions that, when -" they are on a line _when_ you _press_ the __ key, -" you wish to have the next line indented. -" -"call GenericIndentStmts('begin,if,then,else,elif,case,repeat,until,domain,do') -" -" Fourth, set the data set 'b:dedentStmts' to the keywords/expressions that, when -" they are on a line you are currently typing, you wish to have that line -" 'dedented' (having already been indented because of the previous line's -" indentation). -" -"call GenericDedentStmts('end_proc,then,else,elif,end_if,end_case,until,end_repeat,end_domain,end_for,end_while,end') -" -" Fifth, set the data set 'b:allStmts' to the concatenation of the third and -" fourth data sets, used for checking when more than one keyword/expression -" is on a line. -" -"call GenericAllStmts() -" -" NOTE: GenericIndentStmts uses two variables: 'b:indentStmtOpen' and -" 'b:indentStmtClose' which default to '\<' and '\>' respectively. You can -" set (let) these to any value you wish before calling GenericIndentStmts with -" your list. Similarly, GenericDedentStmts uses 'b:dedentStmtOpen' and -" 'b:dedentStmtClose'. -" -" NOTE: Patterns may be used in the lists passed to Generic[In|De]dentStmts -" since each element in the list is copied verbatim. -" -" Optionally, you can set the DEBUGGING flag within your script to have the -" debugging messages output. See below for description. This can also be set -" (let) from the command line within your editing buffer. -" -"let b:DEBUGGING=1 -" -" See: -" :h runtime -" :set runtimepath ? -" to familiarize yourself with how this works and where you should have this -" file and your file(s) installed. -" -" For help with setting 'indentkeys' see: -" :h indentkeys -" Also, for some good examples see 'indent/sh.vim' and 'indent/vim.vim' as -" well as files for other languages you may be familiar with. -" -" -" Alternatively, if you'd rather specify yourself, you can enter -" 'b:indentStmts', 'b:dedentStmts', and 'b:allStmts' 'literally': -" -"let b:indentStmts='\\|\\|\\|\\|\\|\\|\\|\\|\\|\' -"let b:dedentStmts='\\|\\|\\|\\|\\|\\|\\|\\|\\|\\|\' -"let b:allStmts=b:indentStmts.'\|'.b:dedentStmts -" -" This is only useful if you have particularly different parameters for -" matching each statement. - -" RECAP: From indent/MuPAD_source.vim -" -"if exists("b:did_indent") | finish | endif -" -"let b:did_indent = 1 -" -"runtime indent/GenericIndent.vim -" -"setlocal indentexpr=GenericIndent() -"setlocal indentkeys==end_proc,=then,=else,=elif,=end_if,=end_case,=until,=end_repeat,=end_domain,=end_for,=end_while,=end,o,O -"call GenericIndentStmts('begin,if,then,else,elif,case,repeat,until,domain,do') -"call GenericDedentStmts('end_proc,then,else,elif,end_if,end_case,until,end_repeat,end_domain,end_for,end_while,end') -"call GenericAllStmts() -" -" END RECAP: - -let s:hit=0 -let s:lastVlnum=0 -let s:myScriptName=expand(":t") - -if exists("*GenericIndent") - finish -endif - -function GenericAllStmts() - let b:allStmts=b:indentStmts.'\|'.b:dedentStmts - call DebugGenericIndent(expand("").": "."b:indentStmts: ".b:indentStmts.", b:dedentStmts: ".b:dedentStmts.", b:allStmts: ".b:allStmts) -endfunction - -function GenericIndentStmts(stmts) - let Stmts=a:stmts - let Comma=match(Stmts,',') - if Comma == -1 || Comma == strlen(Stmts)-1 - echoerr "Must supply a comma separated list of at least 2 entries." - echoerr "Supplied list: <".Stmts.">" - return - endif - - if !exists("b:indentStmtOpen") - let b:indentStmtOpen='\<' - endif - if !exists("b:indentStmtClose") - let b:indentStmtClose='\>' - endif - if !exists("b:indentStmts") - let b:indentStmts='' - endif - if b:indentStmts != '' - let b:indentStmts=b:indentStmts.'\|' - endif - call DebugGenericIndent(expand("").": "."b:indentStmtOpen: ".b:indentStmtOpen.", b:indentStmtClose: ".b:indentStmtClose.", b:indentStmts: ".b:indentStmts.", Stmts: ".Stmts) - let stmtEntryBegin=0 - let stmtEntryEnd=Comma - let stmtEntry=strpart(Stmts,stmtEntryBegin,stmtEntryEnd-stmtEntryBegin) - let Stmts=strpart(Stmts,Comma+1) - let Comma=match(Stmts,',') - let b:indentStmts=b:indentStmts.b:indentStmtOpen.stmtEntry.b:indentStmtClose - while Comma != -1 - let stmtEntryEnd=Comma - let stmtEntry=strpart(Stmts,stmtEntryBegin,stmtEntryEnd-stmtEntryBegin) - let Stmts=strpart(Stmts,Comma+1) - let Comma=match(Stmts,',') - let b:indentStmts=b:indentStmts.'\|'.b:indentStmtOpen.stmtEntry.b:indentStmtClose - endwhile - let stmtEntry=Stmts - let b:indentStmts=b:indentStmts.'\|'.b:indentStmtOpen.stmtEntry.b:indentStmtClose -endfunction - -function GenericDedentStmts(stmts) - let Stmts=a:stmts - let Comma=match(Stmts,',') - if Comma == -1 || Comma == strlen(Stmts)-1 - echoerr "Must supply a comma separated list of at least 2 entries." - echoerr "Supplied list: <".Stmts.">" - return - endif - - if !exists("b:dedentStmtOpen") - let b:dedentStmtOpen='\<' - endif - if !exists("b:dedentStmtClose") - let b:dedentStmtClose='\>' - endif - if !exists("b:dedentStmts") - let b:dedentStmts='' - endif - if b:dedentStmts != '' - let b:dedentStmts=b:dedentStmts.'\|' - endif - call DebugGenericIndent(expand("").": "."b:dedentStmtOpen: ".b:dedentStmtOpen.", b:dedentStmtClose: ".b:dedentStmtClose.", b:dedentStmts: ".b:dedentStmts.", Stmts: ".Stmts) - let stmtEntryBegin=0 - let stmtEntryEnd=Comma - let stmtEntry=strpart(Stmts,stmtEntryBegin,stmtEntryEnd-stmtEntryBegin) - let Stmts=strpart(Stmts,Comma+1) - let Comma=match(Stmts,',') - let b:dedentStmts=b:dedentStmts.b:dedentStmtOpen.stmtEntry.b:dedentStmtClose - while Comma != -1 - let stmtEntryEnd=Comma - let stmtEntry=strpart(Stmts,stmtEntryBegin,stmtEntryEnd-stmtEntryBegin) - let Stmts=strpart(Stmts,Comma+1) - let Comma=match(Stmts,',') - let b:dedentStmts=b:dedentStmts.'\|'.b:dedentStmtOpen.stmtEntry.b:dedentStmtClose - endwhile - let stmtEntry=Stmts - let b:dedentStmts=b:dedentStmts.'\|'.b:dedentStmtOpen.stmtEntry.b:dedentStmtClose -endfunction - -" Debugging function. Displays messages in the command area which can be -" reviewed using ':messages'. To turn it on use ':let b:DEBUGGING=1'. Once -" on, turn off by using ':let b:DEBUGGING=0. If you don't want it at all and -" feel it's slowing down your editing (you must have an _awfully_ slow -" machine!;-> ), you can just comment out the calls to it from 'GenericIndent' -" below. No need to remove the function or the calls, tho', as you never can -" tell when they might come in handy!;-) -function DebugGenericIndent(msg) - if exists("b:DEBUGGING") && b:DEBUGGING - echomsg '['.s:hit.']'.s:myScriptName."::".a:msg - endif -endfunction - -function GenericIndent() - " save ignore case option. Have to set noignorecase for the match - " functions to do their job the way we want them to! - " NOTE: if you add a return to this function be sure you do - " if IgnoreCase | set ignorecase | endif - " before returning. You can just cut and paste from here. - let IgnoreCase=&ignorecase - " let b:case_insensitive=1 if you want to ignore case, e.g. DOS batch files - if !exists("b:case_insensitive") - set noignorecase - endif - " this is used to let DebugGenericIndent display which invocation of the - " function goes with which messages. - let s:hit=s:hit+1 - let lnum=v:lnum - let cline=getline(lnum) - let lnum=prevnonblank(lnum) - if lnum==0 | if IgnoreCase | set ignorecase | endif | return 0 | endif - let pline=getline(lnum) - let ndnt=indent(lnum) - if !exists("b:allStmts") - call GenericAllStmts() - endif - - call DebugGenericIndent(expand("").": "."cline=<".cline.">, pline=<".pline.">, lnum=".lnum.", v:lnum=".v:lnum.", ndnt=".ndnt) - if lnum==v:lnum - " current line, only check dedent - " - " just dedented this line, don't need to do it again. - " another dedentStmts was added or an end%[_*] was completed. - if s:lastVlnum==v:lnum - if IgnoreCase | set ignorecase | endif - return ndnt - endif - let s:lastVlnum=v:lnum - call DebugGenericIndent(expand("").": "."Checking dedent") - let srcStr=cline - let dedentKeyBegin=match(srcStr,b:dedentStmts) - if dedentKeyBegin != -1 - let dedentKeyEnd=matchend(srcStr,b:dedentStmts) - let dedentKeyStr=strpart(srcStr,dedentKeyBegin,dedentKeyEnd-dedentKeyBegin) - "only dedent if it's the beginning of the line - if match(srcStr,'^\s*\<'.dedentKeyStr.'\>') != -1 - call DebugGenericIndent(expand("").": "."It's the beginning of the line, dedent") - let ndnt=ndnt-&shiftwidth - endif - endif - call DebugGenericIndent(expand("").": "."dedent - returning ndnt=".ndnt) - else - " previous line, only check indent - call DebugGenericIndent(expand("").": "."Checking indent") - let srcStr=pline - let indentKeyBegin=match(srcStr,b:indentStmts) - if indentKeyBegin != -1 - " only indent if it's the last indentStmts in the line - let allKeyBegin=match(srcStr,b:allStmts) - let allKeyEnd=matchend(srcStr,b:allStmts) - let allKeyStr=strpart(srcStr,allKeyBegin,allKeyEnd-allKeyBegin) - let srcStr=strpart(srcStr,allKeyEnd) - let allKeyBegin=match(srcStr,b:allStmts) - if allKeyBegin != -1 - " not the end of the line, check what is and only indent if - " it's an indentStmts - call DebugGenericIndent(expand("").": "."Multiple words in line, checking if last is indent") - while allKeyBegin != -1 - let allKeyEnd=matchend(srcStr,b:allStmts) - let allKeyStr=strpart(srcStr,allKeyBegin,allKeyEnd-allKeyBegin) - let srcStr=strpart(srcStr,allKeyEnd) - let allKeyBegin=match(srcStr,b:allStmts) - endwhile - if match(b:indentStmts,allKeyStr) != -1 - call DebugGenericIndent(expand("").": "."Last word in line is indent") - let ndnt=ndnt+&shiftwidth - endif - else - " it's the last indentStmts in the line, go ahead and indent - let ndnt=ndnt+&shiftwidth - endif - endif - call DebugGenericIndent(expand("").": "."indent - returning ndnt=".ndnt) - endif - if IgnoreCase | set ignorecase | endif - return ndnt -endfunction - - -" TODO: I'm open! -" -" BUGS: You tell me! Probably. I just haven't found one yet or haven't been -" told about one. -" diff --git a/runtime/indent/mupad.vim b/runtime/indent/mupad.vim deleted file mode 100644 --- a/runtime/indent/mupad.vim +++ /dev/null @@ -1,35 +0,0 @@ -" Vim indent file -" Language: MuPAD source files -" Maintainer: Dave Silvia -" Filenames: *.mu -" Date: 6/30/2004 - -if exists("b:did_indent") - finish -endif - -let b:did_indent = 1 - -runtime indent/GenericIndent.vim - -let b:indentStmts='' -let b:dedentStmts='' -let b:allStmts='' -" NOTE: b:indentStmts, b:dedentStmts, and b:allStmts need to be initialized -" to '' before callin the functions because 'indent.vim' explicitly -" 'unlet's b:did_indent. This means that the lists will compound if -" you change back and forth between buffers. This is true as of -" version 6.3, 6/23/2004. -setlocal indentexpr=GenericIndent() -setlocal indentkeys==end_proc,=then,=else,=elif,=end_if,=end_case,=until,=end_repeat,=end_domain,=end_for,=end_while,=end,o,O - -call GenericIndentStmts('begin,if,then,else,elif,case,repeat,until,domain,do') -call GenericDedentStmts('end_proc,then,else,elif,end_if,end_case,until,end_repeat,end_domain,end_for,end_while,end') -call GenericAllStmts() - - -" TODO: More comprehensive indentstmt, dedentstmt, and indentkeys values. -" -" BUGS: You tell me! Probably. I just haven't found one yet or haven't been -" told about one. -"