aboutsummaryrefslogtreecommitdiff
path: root/dot_vim/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'dot_vim/compiler')
-rw-r--r--dot_vim/compiler/ghc.vim470
-rw-r--r--dot_vim/compiler/tex.vim293
2 files changed, 0 insertions, 763 deletions
diff --git a/dot_vim/compiler/ghc.vim b/dot_vim/compiler/ghc.vim
deleted file mode 100644
index 77a36ce..0000000
--- a/dot_vim/compiler/ghc.vim
+++ /dev/null
@@ -1,470 +0,0 @@
-
-" Vim Compiler File
-" Compiler: GHC
-" Maintainer: Claus Reinke <claus.reinke@talk21.com>
-" Last Change: 21/04/2009
-"
-" part of haskell plugins: http://projects.haskell.org/haskellmode-vim
-
-" ------------------------------ paths & quickfix settings first
-"
-
-if exists("current_compiler") && current_compiler == "ghc"
- finish
-endif
-let current_compiler = "ghc"
-
-let s:scriptname = "ghc.vim"
-
-if (!exists("g:ghc") || !executable(g:ghc))
- if !executable('ghc')
- echoerr s:scriptname.": can't find ghc. please set g:ghc, or extend $PATH"
- finish
- else
- let g:ghc = 'ghc'
- endif
-endif
-let ghc_version = substitute(system(g:ghc . ' --numeric-version'),'\n','','')
-if (!exists("b:ghc_staticoptions"))
- let b:ghc_staticoptions = ''
-endif
-
-" set makeprg (for quickfix mode)
-execute 'setlocal makeprg=' . g:ghc . '\ ' . escape(b:ghc_staticoptions,' ') .'\ -e\ :q\ %'
-"execute 'setlocal makeprg=' . g:ghc .'\ -e\ :q\ %'
-"execute 'setlocal makeprg=' . g:ghc .'\ --make\ %'
-
-" quickfix mode:
-" fetch file/line-info from error message
-" TODO: how to distinguish multiline errors from warnings?
-" (both have the same header, and errors have no common id-tag)
-" how to get rid of first empty message in result list?
-setlocal errorformat=
- \%-Z\ %#,
- \%W%f:%l:%c:\ Warning:\ %m,
- \%E%f:%l:%c:\ %m,
- \%E%>%f:%l:%c:,
- \%+C\ \ %#%m,
- \%W%>%f:%l:%c:,
- \%+C\ \ %#%tarning:\ %m,
-
-" oh, wouldn't you guess it - ghc reports (partially) to stderr..
-setlocal shellpipe=2>
-
-" ------------------------- but ghc can do a lot more for us..
-"
-
-" allow map leader override
-if !exists("maplocalleader")
- let maplocalleader='_'
-endif
-
-" initialize map of identifiers to their types
-" associate type map updates to changedtick
-if !exists("b:ghc_types")
- let b:ghc_types = {}
- let b:my_changedtick = b:changedtick
-endif
-
-if exists("g:haskell_functions")
- finish
-endif
-let g:haskell_functions = "ghc"
-
-" avoid hit-enter prompts
-set cmdheight=3
-
-" edit static GHC options
-" TODO: add completion for options/packages?
-command! GHCStaticOptions call GHC_StaticOptions()
-function! GHC_StaticOptions()
- let b:ghc_staticoptions = input('GHC static options: ',b:ghc_staticoptions)
- execute 'setlocal makeprg=' . g:ghc . '\ ' . escape(b:ghc_staticoptions,' ') .'\ -e\ :q\ %'
- let b:my_changedtick -=1
-endfunction
-
-map <LocalLeader>T :call GHC_ShowType(1)<cr>
-map <LocalLeader>t :call GHC_ShowType(0)<cr>
-function! GHC_ShowType(addTypeDecl)
- let namsym = haskellmode#GetNameSymbol(getline('.'),col('.'),0)
- if namsym==[]
- redraw
- echo 'no name/symbol under cursor!'
- return 0
- endif
- let [_,symb,qual,unqual] = namsym
- let name = qual=='' ? unqual : qual.'.'.unqual
- let pname = ( symb ? '('.name.')' : name )
- call GHC_HaveTypes()
- if !has_key(b:ghc_types,name)
- redraw
- echo pname "type not known"
- else
- redraw
- for type in split(b:ghc_types[name],' -- ')
- echo pname "::" type
- if a:addTypeDecl
- call append( line(".")-1, pname . " :: " . type )
- endif
- endfor
- endif
-endfunction
-
-" show type of identifier under mouse pointer in balloon
-if has("balloon_eval")
- set ballooneval
- set balloondelay=600
- set balloonexpr=GHC_TypeBalloon()
- function! GHC_TypeBalloon()
- if exists("b:current_compiler") && b:current_compiler=="ghc"
- let [line] = getbufline(v:beval_bufnr,v:beval_lnum)
- let namsym = haskellmode#GetNameSymbol(line,v:beval_col,0)
- if namsym==[]
- return ''
- endif
- let [start,symb,qual,unqual] = namsym
- let name = qual=='' ? unqual : qual.'.'.unqual
- let pname = name " ( symb ? '('.name.')' : name )
- silent call GHC_HaveTypes()
- if has("balloon_multiline")
- return (has_key(b:ghc_types,pname) ? split(b:ghc_types[pname],' -- ') : '')
- else
- return (has_key(b:ghc_types,pname) ? b:ghc_types[pname] : '')
- endif
- else
- return ''
- endif
- endfunction
-endif
-
-map <LocalLeader>si :call GHC_ShowInfo()<cr>
-function! GHC_ShowInfo()
- let namsym = haskellmode#GetNameSymbol(getline('.'),col('.'),0)
- if namsym==[]
- redraw
- echo 'no name/symbol under cursor!'
- return 0
- endif
- let [_,symb,qual,unqual] = namsym
- let name = qual=='' ? unqual : (qual.'.'.unqual)
- let output = GHC_Info(name)
- pclose | new
- setlocal previewwindow
- setlocal buftype=nofile
- setlocal noswapfile
- put =output
- wincmd w
- "redraw
- "echo output
-endfunction
-
-" fill the type map, unless nothing has changed since the last attempt
-function! GHC_HaveTypes()
- if b:ghc_types == {} && (b:my_changedtick != b:changedtick)
- let b:my_changedtick = b:changedtick
- return GHC_BrowseAll()
- endif
-endfunction
-
-" update b:ghc_types after successful make
-au QuickFixCmdPost make if GHC_CountErrors()==0 | silent call GHC_BrowseAll() | endif
-
-" count only error entries in quickfix list, ignoring warnings
-function! GHC_CountErrors()
- let c=0
- for e in getqflist() | if e.type=='E' && e.text !~ "^[ \n]*Warning:" | let c+=1 | endif | endfor
- return c
-endfunction
-
-command! GHCReload call GHC_BrowseAll()
-function! GHC_BrowseAll()
- " let imports = haskellmode#GatherImports()
- " let modules = keys(imports[0]) + keys(imports[1])
- let imports = {} " no need for them at the moment
- let current = GHC_NameCurrent()
- let module = current==[] ? 'Main' : current[0]
- if GHC_VersionGE([6,8,1])
- return GHC_BrowseBangStar(module)
- else
- return GHC_BrowseMultiple(imports,['*'.module])
- endif
-endfunction
-
-function! GHC_VersionGE(target)
- let current = split(g:ghc_version, '\.' )
- let target = a:target
- for i in current
- if ((target==[]) || (i>target[0]))
- return 1
- elseif (i==target[0])
- let target = target[1:]
- else
- return 0
- endif
- endfor
- return 1
-endfunction
-
-function! GHC_NameCurrent()
- let last = line("$")
- let l = 1
- while l<last
- let ml = matchlist( getline(l), '^module\s*\([^ (]*\)')
- if ml != []
- let [_,module;x] = ml
- return [module]
- endif
- let l += 1
- endwhile
- redraw
- echo "cannot find module header for file " . expand("%")
- return []
-endfunction
-
-function! GHC_BrowseBangStar(module)
- redraw
- echo "browsing module " a:module
- let command = ":browse! *" . a:module
- let orig_shellredir = &shellredir
- let &shellredir = ">" " ignore error/warning messages, only output or lack of it
- let output = system(g:ghc . ' ' . b:ghc_staticoptions . ' -v0 --interactive ' . expand("%") , command )
- let &shellredir = orig_shellredir
- return GHC_ProcessBang(a:module,output)
-endfunction
-
-function! GHC_BrowseMultiple(imports,modules)
- redraw
- echo "browsing modules " a:modules
- let command = ":browse " . join( a:modules, " \n :browse ")
- let command = substitute(command,'\(:browse \(\S*\)\)','putStrLn "-- \2" \n \1','g')
- let output = system(g:ghc . ' ' . b:ghc_staticoptions . ' -v0 --interactive ' . expand("%") , command )
- return GHC_Process(a:imports,output)
-endfunction
-
-function! GHC_Info(what)
- " call GHC_HaveTypes()
- let output = system(g:ghc . ' ' . b:ghc_staticoptions . ' -v0 --interactive ' . expand("%"), ":i ". a:what)
- return output
-endfunction
-
-function! GHC_ProcessBang(module,output)
- let module = a:module
- let b = a:output
- let linePat = '^\(.\{-}\)\n\(.*\)'
- let contPat = '\s\+\(.\{-}\)\n\(.*\)'
- let typePat = '^\(\)\(\S*\)\s*::\(.*\)'
- let commentPat = '^-- \(\S*\)'
- let definedPat = '^-- defined locally'
- let importedPat = '^-- imported via \(.*\)'
- if !(b=~commentPat)
- echo s:scriptname.": GHCi reports errors (try :make?)"
- return 0
- endif
- let b:ghc_types = {}
- let ml = matchlist( b , linePat )
- while ml != []
- let [_,l,rest;x] = ml
- let mlDecl = matchlist( l, typePat )
- if mlDecl != []
- let [_,indent,id,type;x] = mlDecl
- let ml2 = matchlist( rest , '^'.indent.contPat )
- while ml2 != []
- let [_,c,rest;x] = ml2
- let type .= c
- let ml2 = matchlist( rest , '^'.indent.contPat )
- endwhile
- let id = substitute( id, '^(\(.*\))$', '\1', '')
- let type = substitute( type, '\s\+', " ", "g" )
- " using :browse! *<current>, we get both unqualified and qualified ids
- let qualified = (id =~ '\.') && (id =~ '[A-Z]')
- let b:ghc_types[id] = type
- if !qualified
- for qual in qualifiers
- let b:ghc_types[qual.'.'.id] = type
- endfor
- endif
- else
- let mlImported = matchlist( l, importedPat )
- let mlDefined = matchlist( l, definedPat )
- if mlImported != []
- let [_,modules;x] = mlImported
- let qualifiers = split( modules, ', ' )
- elseif mlDefined != []
- let qualifiers = [module]
- endif
- endif
- let ml = matchlist( rest , linePat )
- endwhile
- return 1
-endfunction
-
-function! GHC_Process(imports,output)
- let b = a:output
- let imports = a:imports
- let linePat = '^\(.\{-}\)\n\(.*\)'
- let contPat = '\s\+\(.\{-}\)\n\(.*\)'
- let typePat = '^\(\s*\)\(\S*\)\s*::\(.*\)'
- let modPat = '^-- \(\S*\)'
- " add '-- defined locally' and '-- imported via ..'
- if !(b=~modPat)
- echo s:scriptname.": GHCi reports errors (try :make?)"
- return 0
- endif
- let b:ghc_types = {}
- let ml = matchlist( b , linePat )
- while ml != []
- let [_,l,rest;x] = ml
- let mlDecl = matchlist( l, typePat )
- if mlDecl != []
- let [_,indent,id,type;x] = mlDecl
- let ml2 = matchlist( rest , '^'.indent.contPat )
- while ml2 != []
- let [_,c,rest;x] = ml2
- let type .= c
- let ml2 = matchlist( rest , '^'.indent.contPat )
- endwhile
- let id = substitute(id, '^(\(.*\))$', '\1', '')
- let type = substitute( type, '\s\+', " ", "g" )
- " using :browse *<current>, we get both unqualified and qualified ids
- if current_module " || has_key(imports[0],module)
- if has_key(b:ghc_types,id) && !(matchstr(b:ghc_types[id],escape(type,'[].'))==type)
- let b:ghc_types[id] .= ' -- '.type
- else
- let b:ghc_types[id] = type
- endif
- endif
- if 0 " has_key(imports[1],module)
- let qualid = module.'.'.id
- let b:ghc_types[qualid] = type
- endif
- else
- let mlMod = matchlist( l, modPat )
- if mlMod != []
- let [_,module;x] = mlMod
- let current_module = module[0]=='*'
- let module = current_module ? module[1:] : module
- endif
- endif
- let ml = matchlist( rest , linePat )
- endwhile
- return 1
-endfunction
-
-let s:ghc_templates = ["module _ () where","class _ where","class _ => _ where","instance _ where","instance _ => _ where","type family _","type instance _ = ","data _ = ","newtype _ = ","type _ = "]
-
-" use ghci :browse index for insert mode omnicompletion (CTRL-X CTRL-O)
-function! GHC_CompleteImports(findstart, base)
- if a:findstart
- let namsym = haskellmode#GetNameSymbol(getline('.'),col('.'),-1) " insert-mode: we're 1 beyond the text
- if namsym==[]
- redraw
- echo 'no name/symbol under cursor!'
- return -1
- endif
- let [start,symb,qual,unqual] = namsym
- return (start-1)
- else " find keys matching with "a:base"
- let res = []
- let l = len(a:base)-1
- call GHC_HaveTypes()
- for key in keys(b:ghc_types)
- if key[0 : l]==a:base
- let res += [{"word":key,"menu":":: ".b:ghc_types[key],"dup":1}]
- endif
- endfor
- return res
- endif
-endfunction
-set omnifunc=GHC_CompleteImports
-set completeopt=menu,menuone,longest
-
-map <LocalLeader>ct :call GHC_CreateTagfile()<cr>
-function! GHC_CreateTagfile()
- redraw
- echo "creating tags file"
- let output = system(g:ghc . ' ' . b:ghc_staticoptions . ' -e ":ctags" ' . expand("%"))
- " for ghcs older than 6.6, you would need to call another program
- " here, such as hasktags
- echo output
-endfunction
-
-command! -nargs=1 GHCi redraw | echo system(g:ghc. ' ' . b:ghc_staticoptions .' '.expand("%").' -e "'.escape(<f-args>,'"').'"')
-
-" use :make 'not in scope' errors to explicitly list imported ids
-" cursor needs to be on import line, in correctly loadable module
-map <LocalLeader>ie :call GHC_MkImportsExplicit()<cr>
-function! GHC_MkImportsExplicit()
- let save_cursor = getpos(".")
- let line = getline('.')
- let lineno = line('.')
- let ml = matchlist(line,'^import\(\s*qualified\)\?\s*\([^( ]\+\)')
- if ml!=[]
- let [_,q,mod;x] = ml
- silent make
- if getqflist()==[]
- if line=~"import[^(]*Prelude"
- call setline(lineno,substitute(line,"(.*","","").'()')
- else
- call setline(lineno,'-- '.line)
- endif
- silent write
- silent make
- let qflist = getqflist()
- call setline(lineno,line)
- silent write
- let ids = {}
- for d in qflist
- let ml = matchlist(d.text,'Not in scope: \([^`]*\)`\([^'']*\)''')
- if ml!=[]
- let [_,what,qid;x] = ml
- let id = ( qid =~ "^[A-Z]" ? substitute(qid,'.*\.\([^.]*\)$','\1','') : qid )
- let pid = ( id =~ "[a-zA-Z0-9_']\\+" ? id : '('.id.')' )
- if what =~ "data"
- call GHC_HaveTypes()
- if has_key(b:ghc_types,id)
- let pid = substitute(b:ghc_types[id],'^.*->\s*\(\S*\).*$','\1','').'('.pid.')'
- else
- let pid = '???('.pid.')'
- endif
- endif
- let ids[pid] = 1
- endif
- endfor
- call setline(lineno,'import'.q.' '.mod.'('.join(keys(ids),',').')')
- else
- copen
- endif
- endif
- call setpos('.', save_cursor)
-endfunction
-
-if GHC_VersionGE([6,8,2])
- let opts = filter(split(substitute(system(g:ghc . ' -v0 --interactive', ':set'), ' ', '','g'), '\n'), 'v:val =~ "-f"')
-else
- let opts = ["-fglasgow-exts","-fallow-undecidable-instances","-fallow-overlapping-instances","-fno-monomorphism-restriction","-fno-mono-pat-binds","-fno-cse","-fbang-patterns","-funbox-strict-fields"]
-endif
-
-amenu ]OPTIONS_GHC.- :echo '-'<cr>
-aunmenu ]OPTIONS_GHC
-for o in opts
- exe 'amenu ]OPTIONS_GHC.'.o.' :call append(0,"{-# OPTIONS_GHC '.o.' #-}")<cr>'
-endfor
-if has("gui_running")
- map <LocalLeader>opt :popup ]OPTIONS_GHC<cr>
-else
- map <LocalLeader>opt :emenu ]OPTIONS_GHC.
-endif
-
-amenu ]LANGUAGES_GHC.- :echo '-'<cr>
-aunmenu ]LANGUAGES_GHC
-if GHC_VersionGE([6,8])
- let ghc_supported_languages = split(system(g:ghc . ' --supported-languages'),'\n')
- for l in ghc_supported_languages
- exe 'amenu ]LANGUAGES_GHC.'.l.' :call append(0,"{-# LANGUAGE '.l.' #-}")<cr>'
- endfor
- if has("gui_running")
- map <LocalLeader>lang :popup ]LANGUAGES_GHC<cr>
- else
- map <LocalLeader>lang :emenu ]LANGUAGES_GHC.
- endif
-endif
diff --git a/dot_vim/compiler/tex.vim b/dot_vim/compiler/tex.vim
deleted file mode 100644
index 993ecfe..0000000
--- a/dot_vim/compiler/tex.vim
+++ /dev/null
@@ -1,293 +0,0 @@
-" File: tex.vim
-" Type: compiler plugin for LaTeX
-" Original Author: Artem Chuprina <ran@ran.pp.ru>
-" Customization: Srinath Avadhanula <srinath@fastmail.fm>
-" CVS: $Id: tex.vim 997 2006-03-20 09:45:45Z srinathava $
-" Description: {{{
-" This file sets the 'makeprg' and 'errorformat' options for the LaTeX
-" compiler. It is customizable to optionally ignore certain warnings and
-" provides the ability to set a dynamic 'ignore-warning' level.
-"
-" By default it is set up in a 'non-verbose', 'ignore-common-warnings' mode,
-" which means that irrelevant lines from the compilers output will be
-" ignored and also some very common warnings are ignored.
-"
-" Depending on the 'ignore-level', the following kinds of messages are
-" ignored. An ignore level of 3 for instance means that messages 1-3 will be
-" ignored. By default, the ignore level is set to 4.
-"
-" 1. LaTeX Warning: Specifier 'h' changed to 't'.
-" This errors occurs when TeX is not able to correctly place a floating
-" object at a specified location, because of which it defaulted to the
-" top of the page.
-" 2. LaTeX Warning: Underfull box ...
-" 3. LaTeX Warning: Overfull box ...
-" both these warnings (very common) are due to \hbox settings not being
-" satisfied nicely.
-" 4. LaTeX Warning: You have requested ...,
-" This warning occurs in slitex when using the xypic package.
-" 5. Missing number error:
-" Usually, when the name of an included eps file is spelled incorrectly,
-" then the \bb-error message is accompanied by a bunch of "missing
-" number, treated as zero" error messages. This level ignores these
-" warnings.
-" NOTE: number 5 is actually a latex error, not a warning!
-"
-" Use
-" TCLevel <level>
-" where level is a number to set the ignore level dynamically.
-"
-" When TCLevel is called with the unquoted string strict
-" TClevel strict
-" then the 'efm' switches to a 'verbose', 'no-lines-ignored' mode which is
-" useful when you want to make final checks of your document and want to be
-" careful not to let things slip by.
-"
-" TIP: MikTeX has a bug where it sometimes erroneously splits a line number
-" into multiple lines. i.e, if the warning is on line 1234. the compiler
-" output is:
-" LaTeX Warning: ... on input line 123
-" 4.
-" In this case, vim will wrongly interpret the line-number as 123 instead
-" of 1234. If you have cygwin, a simple remedy around this is to first
-" copy the file vimlatex (provided) into your $PATH, make sure its
-" executable and then set the variable g:tex_flavor to vimlatex in your
-" ~/.vimrc (i.e putting let "g:tex_flavor = 'vimlatex'" in your .vimrc).
-" This problem occurs rarely enough that its not a botheration for most
-" people.
-"
-" TODO:
-" 1. menu items for dynamically selecting a ignore warning level.
-" }}}
-
-" avoid reinclusion for the same buffer. keep it buffer local so it can be
-" externally reset in case of emergency re-sourcing.
-if exists('b:doneTexCompiler') && !exists('b:forceRedoTexCompiler')
- finish
-endif
-let b:doneTexCompiler = 1
-
-" ==============================================================================
-" Customization of 'efm': {{{
-" This section contains the customization variables which the user can set.
-" g:Tex_IgnoredWarnings: This variable contains a ¡ seperated list of
-" patterns which will be ignored in the TeX compiler's output. Use this
-" carefully, otherwise you might end up losing valuable information.
-if !exists('g:Tex_IgnoredWarnings')
- let g:Tex_IgnoredWarnings =
- \'Underfull'."\n".
- \'Overfull'."\n".
- \'specifier changed to'."\n".
- \'You have requested'."\n".
- \'Missing number, treated as zero.'."\n".
- \'There were undefined references'."\n".
- \'Citation %.%# undefined'
-endif
-" This is the number of warnings in the g:Tex_IgnoredWarnings string which
-" will be ignored.
-if !exists('g:Tex_IgnoreLevel')
- let g:Tex_IgnoreLevel = 7
-endif
-" There will be lots of stuff in a typical compiler output which will
-" completely fall through the 'efm' parsing. This options sets whether or not
-" you will be shown those lines.
-if !exists('g:Tex_IgnoreUnmatched')
- let g:Tex_IgnoreUnmatched = 1
-endif
-" With all this customization, there is a slight risk that you might be
-" ignoring valid warnings or errors. Therefore before getting the final copy
-" of your work, you might want to reset the 'efm' with this variable set to 1.
-" With that value, all the lines from the compiler are shown irrespective of
-" whether they match the error or warning patterns.
-" NOTE: An easier way of resetting the 'efm' to show everything is to do
-" TCLevel strict
-if !exists('g:Tex_ShowallLines')
- let g:Tex_ShowallLines = 0
-endif
-
-" }}}
-" ==============================================================================
-" Customization of 'makeprg': {{{
-
-" There are several alternate ways in which 'makeprg' is set up.
-"
-" Case 1
-" ------
-" The first is when this file is a part of latex-suite. In this case, a
-" variable called g:Tex_DefaultTargetFormat exists, which gives the default
-" format .tex files should be compiled into. In this case, we use the TTarget
-" command provided by latex-suite.
-"
-" Case 2
-" ------
-" The user is using this file without latex-suite AND he wants to directly
-" specify the complete 'makeprg'. Then he should set the g:Tex_CompileRule_dvi
-" variable. This is a string which should be directly be able to be cast into
-" &makeprg. An example of one such string is:
-"
-" g:Tex_CompileRule_dvi = 'pdflatex \\nonstopmode \\input\{$*\}'
-"
-" NOTE: You will need to escape back-slashes, {'s etc yourself if you are
-" using this file independently of latex-suite.
-" TODO: Should we also have a check for backslash escaping here based on
-" platform?
-"
-" Case 3
-" ------
-" The use is using this file without latex-suite and he doesnt want any
-" customization. In this case, this file makes some intelligent guesses based
-" on the platform. If he doesn't want to specify the complete 'makeprg' but
-" only the name of the compiler program (for example 'pdflatex' or 'latex'),
-" then he sets b:tex_flavor or g:tex_flavor.
-
-if exists('g:Tex_DefaultTargetFormat')
- exec 'TTarget '.g:Tex_DefaultTargetFormat
-elseif exists('g:Tex_CompileRule_dvi')
- let &l:makeprg = g:Tex_CompileRule_dvi
-else
- " If buffer-local variable 'tex_flavor' exists, it defines TeX flavor,
- " otherwize the same for global variable with same name, else it will be LaTeX
- if exists("b:tex_flavor")
- let current_compiler = b:tex_flavor
- elseif exists("g:tex_flavor")
- let current_compiler = g:tex_flavor
- else
- let current_compiler = "latex"
- end
- if has('win32')
- let escChars = ''
- else
- let escChars = '{}\'
- endif
- " Furthermore, if 'win32' is detected, then we want to set the arguments up so
- " that miktex can handle it.
- if has('win32')
- let options = '--src-specials'
- else
- let options = ''
- endif
- let &l:makeprg = current_compiler . ' ' . options .
- \ escape(' \nonstopmode \input{$*}', escChars)
-endif
-
-" }}}
-" ==============================================================================
-" Functions for setting up a customized 'efm' {{{
-
-" IgnoreWarnings: parses g:Tex_IgnoredWarnings for message customization {{{
-" Description:
-function! <SID>IgnoreWarnings()
- let i = 1
- while s:Strntok(g:Tex_IgnoredWarnings, "\n", i) != '' &&
- \ i <= g:Tex_IgnoreLevel
- let warningPat = s:Strntok(g:Tex_IgnoredWarnings, "\n", i)
- let warningPat = escape(substitute(warningPat, '[\,]', '%\\\\&', 'g'), ' ')
- exe 'setlocal efm+=%-G%.%#'.warningPat.'%.%#'
- let i = i + 1
- endwhile
-endfunction
-
-" }}}
-" SetLatexEfm: sets the 'efm' for the latex compiler {{{
-" Description:
-function! <SID>SetLatexEfm()
-
- let pm = ( g:Tex_ShowallLines == 1 ? '+' : '-' )
-
- set efm=
-
- if !g:Tex_ShowallLines
- call s:IgnoreWarnings()
- endif
-
- setlocal efm+=%E!\ LaTeX\ %trror:\ %m
- setlocal efm+=%E!\ %m
-
- setlocal efm+=%+WLaTeX\ %.%#Warning:\ %.%#line\ %l%.%#
- setlocal efm+=%+W%.%#\ at\ lines\ %l--%*\\d
- setlocal efm+=%+WLaTeX\ %.%#Warning:\ %m
-
- exec 'setlocal efm+=%'.pm.'Cl.%l\ %m'
- exec 'setlocal efm+=%'.pm.'Cl.%l\ '
- exec 'setlocal efm+=%'.pm.'C\ \ %m'
- exec 'setlocal efm+=%'.pm.'C%.%#-%.%#'
- exec 'setlocal efm+=%'.pm.'C%.%#[]%.%#'
- exec 'setlocal efm+=%'.pm.'C[]%.%#'
- exec 'setlocal efm+=%'.pm.'C%.%#%[{}\\]%.%#'
- exec 'setlocal efm+=%'.pm.'C<%.%#>%m'
- exec 'setlocal efm+=%'.pm.'C\ \ %m'
- exec 'setlocal efm+=%'.pm.'GSee\ the\ LaTeX%m'
- exec 'setlocal efm+=%'.pm.'GType\ \ H\ <return>%m'
- exec 'setlocal efm+=%'.pm.'G\ ...%.%#'
- exec 'setlocal efm+=%'.pm.'G%.%#\ (C)\ %.%#'
- exec 'setlocal efm+=%'.pm.'G(see\ the\ transcript%.%#)'
- exec 'setlocal efm+=%'.pm.'G\\s%#'
- exec 'setlocal efm+=%'.pm.'O(%*[^()])%r'
- exec 'setlocal efm+=%'.pm.'P(%f%r'
- exec 'setlocal efm+=%'.pm.'P\ %\\=(%f%r'
- exec 'setlocal efm+=%'.pm.'P%*[^()](%f%r'
- exec 'setlocal efm+=%'.pm.'P(%f%*[^()]'
- exec 'setlocal efm+=%'.pm.'P[%\\d%[^()]%#(%f%r'
- if g:Tex_IgnoreUnmatched && !g:Tex_ShowallLines
- setlocal efm+=%-P%*[^()]
- endif
- exec 'setlocal efm+=%'.pm.'Q)%r'
- exec 'setlocal efm+=%'.pm.'Q%*[^()])%r'
- exec 'setlocal efm+=%'.pm.'Q[%\\d%*[^()])%r'
- if g:Tex_IgnoreUnmatched && !g:Tex_ShowallLines
- setlocal efm+=%-Q%*[^()]
- endif
- if g:Tex_IgnoreUnmatched && !g:Tex_ShowallLines
- setlocal efm+=%-G%.%#
- endif
-
-endfunction
-
-" }}}
-" Strntok: extract the n^th token from a list {{{
-" example: Strntok('1,23,3', ',', 2) = 23
-fun! <SID>Strntok(s, tok, n)
- return matchstr( a:s.a:tok[0], '\v(\zs([^'.a:tok.']*)\ze['.a:tok.']){'.a:n.'}')
-endfun
-
-" }}}
-" SetTexCompilerLevel: sets the "level" for the latex compiler {{{
-function! <SID>SetTexCompilerLevel(...)
- if a:0 > 0
- let level = a:1
- else
- call Tex_ResetIncrementNumber(0)
- echo substitute(g:Tex_IgnoredWarnings,
- \ '^\|\n\zs\S', '\=Tex_IncrementNumber(1)." ".submatch(0)', 'g')
- let level = input("\nChoose an ignore level: ")
- if level == ''
- return
- endif
- endif
- if level == 'strict'
- let g:Tex_ShowallLines = 1
- elseif level =~ '^\d\+$'
- let g:Tex_ShowallLines = 0
- let g:Tex_IgnoreLevel = level
- else
- echoerr "SetTexCompilerLevel: Unkwown option [".level."]"
- end
- call s:SetLatexEfm()
-endfunction
-
-com! -nargs=? TCLevel :call <SID>SetTexCompilerLevel(<f-args>)
-" }}}
-
-" }}}
-" ==============================================================================
-
-call s:SetLatexEfm()
-
-if !exists('*Tex_Debug')
- function! Tex_Debug(...)
- endfunction
-endif
-
-call Tex_Debug("compiler/tex.vim: sourcing this file", "comp")
-
-" vim: fdm=marker:commentstring=\ \"\ %s