diff --git a/autoload/latex.vim b/autoload/latex.vim index d7b15cb..f644049 100644 --- a/autoload/latex.vim +++ b/autoload/latex.vim @@ -206,68 +206,12 @@ function! s:init_errorformat() " {{{1 endfunction " }}}1 function! s:init_options() " {{{1 - call latex#util#error_deprecated('g:latex_errorformat_ignore_warnings') - call latex#util#error_deprecated('g:latex_errorformat_show_warnings') - call latex#util#error_deprecated('g:latex_latexmk_autojump') - call latex#util#error_deprecated('g:latex_latexmk_quickfix') - call latex#util#error_deprecated('g:latex_latexmk_output') - call latex#util#error_deprecated('g:latex_toc_split_side') - - call latex#util#set_default('g:latex_build_dir', '.') - call latex#util#set_default('g:latex_complete_enabled', 1) - call latex#util#set_default('g:latex_complete_close_braces', 0) - call latex#util#set_default('g:latex_complete_recursive_bib', 0) - call latex#util#set_default('g:latex_complete_patterns', - \ { - \ 'ref' : '\C\\v\?\(eq\|page\|[cC]\|labelc\)\?ref\*\?\_\s*{[^{}]*', - \ 'bib' : '\C\\\a*cite\a*\*\?\(\[[^\]]*\]\)*\_\s*{[^{}]*', - \ }) - call latex#util#set_default('g:latex_fold_enabled', 1) - call latex#util#set_default('g:latex_fold_automatic', 1) - call latex#util#set_default('g:latex_fold_preamble', 1) - call latex#util#set_default('g:latex_fold_envs', 1) - call latex#util#set_default('g:latex_fold_parts', - \ [ - \ "part", - \ "appendix", - \ "frontmatter", - \ "mainmatter", - \ "backmatter", - \ ]) - call latex#util#set_default('g:latex_fold_sections', - \ [ - \ "chapter", - \ "section", - \ "subsection", - \ "subsubsection", - \ ]) - call latex#util#set_default('g:latex_indent_enabled', 1) - call latex#util#set_default('g:latex_latexmk_enabled', 1) - call latex#util#set_default('g:latex_latexmk_callback', 1) - call latex#util#set_default('g:latex_latexmk_continuous', 1) - call latex#util#set_default('g:latex_latexmk_background', 0) - call latex#util#set_default('g:latex_latexmk_options', '-pdf') call latex#util#set_default('g:latex_mappings_enabled', 1) - call latex#util#set_default('g:latex_motion_enabled', 1) - call latex#util#set_default('g:latex_motion_matchparen', 1) - call latex#util#set_default('g:latex_quickfix_autojump', '0') call latex#util#set_default('g:latex_quickfix_ignore_all_warnings', 0) call latex#util#set_default('g:latex_quickfix_ignored_warnings', []) - call latex#util#set_default('g:latex_quickfix_mode', '2') - call latex#util#set_default('g:latex_quickfix_open_on_warning', '1') - call latex#util#set_default('g:latex_toc_enabled', 1) - call latex#util#set_default('g:latex_toc_fold', 0) - call latex#util#set_default('g:latex_toc_fold_levels', 10) - call latex#util#set_default('g:latex_toc_hide_help', 0) - call latex#util#set_default('g:latex_toc_hide_preamble', 0) - call latex#util#set_default('g:latex_toc_hide_line_numbers', 1) - call latex#util#set_default('g:latex_toc_numbers', 1) - call latex#util#set_default('g:latex_toc_numbers_width', 0) - call latex#util#set_default('g:latex_toc_resize', 1) - call latex#util#set_default('g:latex_toc_secnumdepth', 3) - call latex#util#set_default('g:latex_toc_split_pos', 'vert leftabove') - call latex#util#set_default('g:latex_toc_width', 30) - call latex#util#set_default('g:latex_view_enabled', 1) + + call latex#util#error_deprecated('g:latex_errorformat_ignore_warnings') + call latex#util#error_deprecated('g:latex_errorformat_show_warnings') endfunction " }}}1 diff --git a/autoload/latex/complete.vim b/autoload/latex/complete.vim index 76ba3d6..e883a48 100644 --- a/autoload/latex/complete.vim +++ b/autoload/latex/complete.vim @@ -5,20 +5,26 @@ " function! latex#complete#init(initialized) " {{{1 + call latex#util#set_default('g:latex_complete_enabled', 1) if !g:latex_complete_enabled | return | endif - " + " Set default options + call latex#util#set_default('g:latex_complete_close_braces', 0) + call latex#util#set_default('g:latex_complete_recursive_bib', 0) + call latex#util#set_default('g:latex_complete_patterns', + \ { + \ 'ref' : '\C\\v\?\(eq\|page\|[cC]\|labelc\)\?ref\*\?\_\s*{[^{}]*', + \ 'bib' : '\C\\\a*cite\a*\*\?\(\[[^\]]*\]\)*\_\s*{[^{}]*', + \ }) + " Check if bibtex is available - " if !executable('bibtex') echom "Warning: bibtex completion not available" echom " Missing executable: bibtex" let s:bibtex = 0 endif - " " Check if kpsewhich is required and available - " if g:latex_complete_recursive_bib && !executable('kpsewhich') echom "Warning: bibtex completion not available" echom " Missing executable: kpsewhich" diff --git a/autoload/latex/fold.vim b/autoload/latex/fold.vim index d33ceaa..7ee3347 100644 --- a/autoload/latex/fold.vim +++ b/autoload/latex/fold.vim @@ -5,8 +5,29 @@ " function! latex#fold#init(initialized) " {{{1 + call latex#util#set_default('g:latex_fold_enabled', 1) if !g:latex_fold_enabled | return | endif + " Set default options + call latex#util#set_default('g:latex_fold_automatic', 1) + call latex#util#set_default('g:latex_fold_preamble', 1) + call latex#util#set_default('g:latex_fold_envs', 1) + call latex#util#set_default('g:latex_fold_parts', + \ [ + \ "part", + \ "appendix", + \ "frontmatter", + \ "mainmatter", + \ "backmatter", + \ ]) + call latex#util#set_default('g:latex_fold_sections', + \ [ + \ "chapter", + \ "section", + \ "subsection", + \ "subsubsection", + \ ]) + " Set fold options setl foldmethod=expr setl foldexpr=latex#fold#level(v:lnum) diff --git a/autoload/latex/latexmk.vim b/autoload/latex/latexmk.vim index 712bea0..3d95206 100644 --- a/autoload/latex/latexmk.vim +++ b/autoload/latex/latexmk.vim @@ -5,23 +5,31 @@ " function! latex#latexmk#init(initialized) " {{{1 + call latex#util#set_default('g:latex_latexmk_enabled', 1) if !g:latex_latexmk_enabled | return | endif - " + " Set default options + call latex#util#set_default('g:latex_latexmk_callback', 1) + call latex#util#set_default('g:latex_latexmk_continuous', 1) + call latex#util#set_default('g:latex_latexmk_background', 0) + call latex#util#set_default('g:latex_latexmk_options', '-pdf') + call latex#util#set_default('g:latex_latexmk_build_dir', '.') + call latex#util#set_default('g:latex_quickfix_autojump', '0') + call latex#util#set_default('g:latex_quickfix_mode', '2') + call latex#util#set_default('g:latex_quickfix_open_on_warning', '1') + call latex#util#error_deprecated('g:latex_latexmk_autojump') + call latex#util#error_deprecated('g:latex_latexmk_quickfix') + call latex#util#error_deprecated('g:latex_latexmk_output') + " Check system compatibility - " if s:system_incompatible() | return | endif - " " Initialize pid for current tex file - " if !has_key(g:latex#data[b:latex.id], 'pid') let g:latex#data[b:latex.id].pid = 0 endif - " " Define commands - " com! -buffer VimLatexCompile call latex#latexmk#compile() com! -buffer VimLatexCompileToggle call latex#latexmk#toggle() com! -buffer VimLatexStop call latex#latexmk#stop() @@ -33,9 +41,7 @@ function! latex#latexmk#init(initialized) " {{{1 com! -buffer -bang VimLatexCompileSS \ call latex#latexmk#compile_singleshot( == "!") - " " Set default mappings - " if g:latex_mappings_enabled nnoremap ll :call latex#latexmk#toggle() nnoremap lc :call latex#latexmk#clean(0) @@ -51,10 +57,8 @@ function! latex#latexmk#init(initialized) " {{{1 " The remaining part is only relevant for continuous mode if !g:latex_latexmk_continuous | return | endif - " " Ensure that all latexmk processes are stopped when vim exits " Note: Only need to define this once, globally. - " if !a:initialized augroup latex_latexmk autocmd! @@ -62,11 +66,9 @@ function! latex#latexmk#init(initialized) " {{{1 augroup END endif - " " If all buffers for a given latex project are closed, kill latexmk " Note: This must come after the above so that the autocmd group is properly " refreshed if necessary - " augroup latex_latexmk autocmd BufUnload call s:stop_buffer() augroup END @@ -88,7 +90,7 @@ function! latex#latexmk#clean(full) " {{{1 else let cmd = 'cd ' . shellescape(data.root) . '; ' endif - let cmd .= 'latexmk -outdir=' . g:latex_build_dir + let cmd .= 'latexmk -outdir=' . g:latex_latexmk_build_dir if a:full let cmd .= ' -C ' else @@ -334,7 +336,7 @@ function! s:latexmk_set_cmd(data) " {{{1 let cmd .= ' ' . g:latex_latexmk_options let cmd .= ' -e ' . shellescape('$pdflatex =~ s/ / -file-line-error /') - let cmd .= ' -outdir=' . g:latex_build_dir + let cmd .= ' -outdir=' . g:latex_latexmk_build_dir if g:latex_latexmk_continuous let cmd .= ' -pvc' diff --git a/autoload/latex/motion.vim b/autoload/latex/motion.vim index e773cc2..5edbe9f 100644 --- a/autoload/latex/motion.vim +++ b/autoload/latex/motion.vim @@ -5,8 +5,12 @@ " function! latex#motion#init(initialized) " {{{1 + call latex#util#set_default('g:latex_motion_enabled', 1) if !g:latex_motion_enabled | return | endif + " Set default options + call latex#util#set_default('g:latex_motion_matchparen', 1) + if g:latex_mappings_enabled nnoremap % :call latex#motion#find_matching_pair() xnoremap % diff --git a/autoload/latex/toc.vim b/autoload/latex/toc.vim index b55ed67..48b3e28 100644 --- a/autoload/latex/toc.vim +++ b/autoload/latex/toc.vim @@ -5,8 +5,23 @@ " function! latex#toc#init(initialized) " {{{1 + call latex#util#set_default('g:latex_toc_enabled', 1) if !g:latex_toc_enabled | return | endif + " Set default options + call latex#util#set_default('g:latex_toc_fold', 0) + call latex#util#set_default('g:latex_toc_fold_levels', 10) + call latex#util#set_default('g:latex_toc_hide_help', 0) + call latex#util#set_default('g:latex_toc_hide_line_numbers', 1) + call latex#util#set_default('g:latex_toc_hide_preamble', 0) + call latex#util#set_default('g:latex_toc_numbers', 1) + call latex#util#set_default('g:latex_toc_numbers_width', 0) + call latex#util#set_default('g:latex_toc_resize', 1) + call latex#util#set_default('g:latex_toc_secnumdepth', 3) + call latex#util#set_default('g:latex_toc_split_pos', 'vert leftabove') + call latex#util#set_default('g:latex_toc_width', 30) + call latex#util#error_deprecated('g:latex_toc_split_side') + " Define commands command! -buffer VimLatexTocOpen call latex#toc#open() command! -buffer VimLatexTocToggle call latex#toc#toggle() diff --git a/autoload/latex/view.vim b/autoload/latex/view.vim index b1da143..4e51202 100644 --- a/autoload/latex/view.vim +++ b/autoload/latex/view.vim @@ -5,9 +5,12 @@ " function! latex#view#init(initialized) " {{{1 + call latex#util#set_default('g:latex_view_enabled', 1) if !g:latex_view_enabled | return | endif - call latex#util#error_deprecated('g:latex_viewer') + " + " Set default options + " call latex#util#set_default('g:latex_view_method', '') call latex#util#set_default('g:latex_view_mupdf_options', '') call latex#util#set_default('g:latex_view_sumatrapdf_options', '') @@ -17,7 +20,11 @@ function! latex#view#init(initialized) " {{{1 \ 'linux' : 'xdg-open', \ 'mac' : 'open', \ }) + call latex#util#error_deprecated('g:latex_viewer') + " + " Set view functions + " let data = g:latex#data[b:latex.id] if g:latex_view_method == 'mupdf' call s:check_method_mupdf() @@ -31,12 +38,18 @@ function! latex#view#init(initialized) " {{{1 let data.view = function('latex#view#general') endif + " + " Define commands + " command! -buffer -nargs=* VimLatexView call latex#view#view('') if has_key(data, 'rsearch') command! -buffer -nargs=* VimLatexRSearch \ call g:latex#data[b:latex.id].rsearch() endif + " + " Define mappings + " if g:latex_mappings_enabled nnoremap lv :call latex#view#view() diff --git a/doc/latex.txt b/doc/latex.txt index bfb3800..fa5acc7 100644 --- a/doc/latex.txt +++ b/doc/latex.txt @@ -272,7 +272,6 @@ descriptions also list the default values. Overview:~ |g:latex_enabled| - |g:latex_build_dir| |g:latex_complete_close_braces| |g:latex_complete_enabled| |g:latex_complete_recursive_bib| @@ -284,6 +283,7 @@ Overview:~ |g:latex_fold_preamble| |g:latex_fold_sections| |g:latex_indent_enabled| + |g:latex_latexmk_build_dir| |g:latex_latexmk_callback| |g:latex_latexmk_enabled| |g:latex_latexmk_continuous| @@ -321,11 +321,6 @@ Detailed descriptions and default values:~ If this variable exists and is 0, then |vim-latex| is completely disabled. By default, it is not defined. - *g:latex_build_dir* -Set this variable in case a dedicated build dir is used with `latexmk`/`latex` -compilations. > - let g:latex_build_dir = '.' -< *g:latex_complete_close_braces* When a label or a cite has been completed, this option controls whether it will be followed by a closing brace. > @@ -390,6 +385,11 @@ List of section constructs that should be folded. > Use |vim-latex| indentation function. Not as customizable as the official indentation function, but imho it is better. > let g:latex_indent_enabled = 1 +< + *g:latex_latexmk_build_dir* +Set this variable in case a dedicated build dir is used with `latexmk`/`latex` +compilations. > + let g:latex_latexmk_build_dir = '.' < *g:latex_latexmk_callback* If enabled, this option tells `latexmk` to run |latex#latexmk#errors| after diff --git a/indent/tex.vim b/indent/tex.vim index b1d7c35..e88046e 100644 --- a/indent/tex.vim +++ b/indent/tex.vim @@ -7,10 +7,11 @@ if exists("b:did_indent") finish endif -if !g:latex_indent_enabled - finish -endif let b:did_indent = 1 + +call latex#util#set_default('g:latex_indent_enabled', 1) +if !g:latex_indent_enabled | finish | endif + let s:cpo_save = &cpo set cpo&vim