Moved several options

This commit is contained in:
Karl Yngve Lervåg 2015-01-26 15:41:40 +01:00
parent e4082bf27a
commit cc0a8e35dc
9 changed files with 93 additions and 87 deletions

View File

@ -206,68 +206,12 @@ function! s:init_errorformat() " {{{1
endfunction endfunction
" }}}1 " }}}1
function! s:init_options() " {{{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_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_ignore_all_warnings', 0)
call latex#util#set_default('g:latex_quickfix_ignored_warnings', []) 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#error_deprecated('g:latex_errorformat_ignore_warnings')
call latex#util#set_default('g:latex_toc_enabled', 1) call latex#util#error_deprecated('g:latex_errorformat_show_warnings')
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)
endfunction endfunction
" }}}1 " }}}1

View File

@ -5,20 +5,26 @@
" "
function! latex#complete#init(initialized) " {{{1 function! latex#complete#init(initialized) " {{{1
call latex#util#set_default('g:latex_complete_enabled', 1)
if !g:latex_complete_enabled | return | endif 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 " Check if bibtex is available
"
if !executable('bibtex') if !executable('bibtex')
echom "Warning: bibtex completion not available" echom "Warning: bibtex completion not available"
echom " Missing executable: bibtex" echom " Missing executable: bibtex"
let s:bibtex = 0 let s:bibtex = 0
endif endif
"
" Check if kpsewhich is required and available " Check if kpsewhich is required and available
"
if g:latex_complete_recursive_bib && !executable('kpsewhich') if g:latex_complete_recursive_bib && !executable('kpsewhich')
echom "Warning: bibtex completion not available" echom "Warning: bibtex completion not available"
echom " Missing executable: kpsewhich" echom " Missing executable: kpsewhich"

View File

@ -5,8 +5,29 @@
" "
function! latex#fold#init(initialized) " {{{1 function! latex#fold#init(initialized) " {{{1
call latex#util#set_default('g:latex_fold_enabled', 1)
if !g:latex_fold_enabled | return | endif 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 " Set fold options
setl foldmethod=expr setl foldmethod=expr
setl foldexpr=latex#fold#level(v:lnum) setl foldexpr=latex#fold#level(v:lnum)

View File

@ -5,23 +5,31 @@
" "
function! latex#latexmk#init(initialized) " {{{1 function! latex#latexmk#init(initialized) " {{{1
call latex#util#set_default('g:latex_latexmk_enabled', 1)
if !g:latex_latexmk_enabled | return | endif 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 " Check system compatibility
"
if s:system_incompatible() | return | endif if s:system_incompatible() | return | endif
"
" Initialize pid for current tex file " Initialize pid for current tex file
"
if !has_key(g:latex#data[b:latex.id], 'pid') if !has_key(g:latex#data[b:latex.id], 'pid')
let g:latex#data[b:latex.id].pid = 0 let g:latex#data[b:latex.id].pid = 0
endif endif
"
" Define commands " Define commands
"
com! -buffer VimLatexCompile call latex#latexmk#compile() com! -buffer VimLatexCompile call latex#latexmk#compile()
com! -buffer VimLatexCompileToggle call latex#latexmk#toggle() com! -buffer VimLatexCompileToggle call latex#latexmk#toggle()
com! -buffer VimLatexStop call latex#latexmk#stop() com! -buffer VimLatexStop call latex#latexmk#stop()
@ -33,9 +41,7 @@ function! latex#latexmk#init(initialized) " {{{1
com! -buffer -bang VimLatexCompileSS com! -buffer -bang VimLatexCompileSS
\ call latex#latexmk#compile_singleshot(<q-bang> == "!") \ call latex#latexmk#compile_singleshot(<q-bang> == "!")
"
" Set default mappings " Set default mappings
"
if g:latex_mappings_enabled if g:latex_mappings_enabled
nnoremap <silent><buffer> <localleader>ll :call latex#latexmk#toggle()<cr> nnoremap <silent><buffer> <localleader>ll :call latex#latexmk#toggle()<cr>
nnoremap <silent><buffer> <localleader>lc :call latex#latexmk#clean(0)<cr> nnoremap <silent><buffer> <localleader>lc :call latex#latexmk#clean(0)<cr>
@ -51,10 +57,8 @@ function! latex#latexmk#init(initialized) " {{{1
" The remaining part is only relevant for continuous mode " The remaining part is only relevant for continuous mode
if !g:latex_latexmk_continuous | return | endif if !g:latex_latexmk_continuous | return | endif
"
" Ensure that all latexmk processes are stopped when vim exits " Ensure that all latexmk processes are stopped when vim exits
" Note: Only need to define this once, globally. " Note: Only need to define this once, globally.
"
if !a:initialized if !a:initialized
augroup latex_latexmk augroup latex_latexmk
autocmd! autocmd!
@ -62,11 +66,9 @@ function! latex#latexmk#init(initialized) " {{{1
augroup END augroup END
endif endif
"
" If all buffers for a given latex project are closed, kill latexmk " 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 " Note: This must come after the above so that the autocmd group is properly
" refreshed if necessary " refreshed if necessary
"
augroup latex_latexmk augroup latex_latexmk
autocmd BufUnload <buffer> call s:stop_buffer() autocmd BufUnload <buffer> call s:stop_buffer()
augroup END augroup END
@ -88,7 +90,7 @@ function! latex#latexmk#clean(full) " {{{1
else else
let cmd = 'cd ' . shellescape(data.root) . '; ' let cmd = 'cd ' . shellescape(data.root) . '; '
endif endif
let cmd .= 'latexmk -outdir=' . g:latex_build_dir let cmd .= 'latexmk -outdir=' . g:latex_latexmk_build_dir
if a:full if a:full
let cmd .= ' -C ' let cmd .= ' -C '
else else
@ -334,7 +336,7 @@ function! s:latexmk_set_cmd(data) " {{{1
let cmd .= ' ' . g:latex_latexmk_options let cmd .= ' ' . g:latex_latexmk_options
let cmd .= ' -e ' . shellescape('$pdflatex =~ s/ / -file-line-error /') 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 if g:latex_latexmk_continuous
let cmd .= ' -pvc' let cmd .= ' -pvc'

View File

@ -5,8 +5,12 @@
" "
function! latex#motion#init(initialized) " {{{1 function! latex#motion#init(initialized) " {{{1
call latex#util#set_default('g:latex_motion_enabled', 1)
if !g:latex_motion_enabled | return | endif 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 if g:latex_mappings_enabled
nnoremap <silent><buffer> % :call latex#motion#find_matching_pair()<cr> nnoremap <silent><buffer> % :call latex#motion#find_matching_pair()<cr>
xnoremap <silent><buffer> % xnoremap <silent><buffer> %

View File

@ -5,8 +5,23 @@
" "
function! latex#toc#init(initialized) " {{{1 function! latex#toc#init(initialized) " {{{1
call latex#util#set_default('g:latex_toc_enabled', 1)
if !g:latex_toc_enabled | return | endif 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 " Define commands
command! -buffer VimLatexTocOpen call latex#toc#open() command! -buffer VimLatexTocOpen call latex#toc#open()
command! -buffer VimLatexTocToggle call latex#toc#toggle() command! -buffer VimLatexTocToggle call latex#toc#toggle()

View File

@ -5,9 +5,12 @@
" "
function! latex#view#init(initialized) " {{{1 function! latex#view#init(initialized) " {{{1
call latex#util#set_default('g:latex_view_enabled', 1)
if !g:latex_view_enabled | return | endif 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_method', '')
call latex#util#set_default('g:latex_view_mupdf_options', '') call latex#util#set_default('g:latex_view_mupdf_options', '')
call latex#util#set_default('g:latex_view_sumatrapdf_options', '') call latex#util#set_default('g:latex_view_sumatrapdf_options', '')
@ -17,7 +20,11 @@ function! latex#view#init(initialized) " {{{1
\ 'linux' : 'xdg-open', \ 'linux' : 'xdg-open',
\ 'mac' : 'open', \ 'mac' : 'open',
\ }) \ })
call latex#util#error_deprecated('g:latex_viewer')
"
" Set view functions
"
let data = g:latex#data[b:latex.id] let data = g:latex#data[b:latex.id]
if g:latex_view_method == 'mupdf' if g:latex_view_method == 'mupdf'
call s:check_method_mupdf() call s:check_method_mupdf()
@ -31,12 +38,18 @@ function! latex#view#init(initialized) " {{{1
let data.view = function('latex#view#general') let data.view = function('latex#view#general')
endif endif
"
" Define commands
"
command! -buffer -nargs=* VimLatexView call latex#view#view('<args>') command! -buffer -nargs=* VimLatexView call latex#view#view('<args>')
if has_key(data, 'rsearch') if has_key(data, 'rsearch')
command! -buffer -nargs=* VimLatexRSearch command! -buffer -nargs=* VimLatexRSearch
\ call g:latex#data[b:latex.id].rsearch() \ call g:latex#data[b:latex.id].rsearch()
endif endif
"
" Define mappings
"
if g:latex_mappings_enabled if g:latex_mappings_enabled
nnoremap <silent><buffer> <localleader>lv :call latex#view#view()<cr> nnoremap <silent><buffer> <localleader>lv :call latex#view#view()<cr>

View File

@ -272,7 +272,6 @@ descriptions also list the default values.
Overview:~ Overview:~
|g:latex_enabled| |g:latex_enabled|
|g:latex_build_dir|
|g:latex_complete_close_braces| |g:latex_complete_close_braces|
|g:latex_complete_enabled| |g:latex_complete_enabled|
|g:latex_complete_recursive_bib| |g:latex_complete_recursive_bib|
@ -284,6 +283,7 @@ Overview:~
|g:latex_fold_preamble| |g:latex_fold_preamble|
|g:latex_fold_sections| |g:latex_fold_sections|
|g:latex_indent_enabled| |g:latex_indent_enabled|
|g:latex_latexmk_build_dir|
|g:latex_latexmk_callback| |g:latex_latexmk_callback|
|g:latex_latexmk_enabled| |g:latex_latexmk_enabled|
|g:latex_latexmk_continuous| |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 If this variable exists and is 0, then |vim-latex| is completely disabled. By
default, it is not defined. 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* *g:latex_complete_close_braces*
When a label or a cite has been completed, this option controls whether it When a label or a cite has been completed, this option controls whether it
will be followed by a closing brace. > 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 Use |vim-latex| indentation function. Not as customizable as the official
indentation function, but imho it is better. > indentation function, but imho it is better. >
let g:latex_indent_enabled = 1 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* *g:latex_latexmk_callback*
If enabled, this option tells `latexmk` to run |latex#latexmk#errors| after If enabled, this option tells `latexmk` to run |latex#latexmk#errors| after

View File

@ -7,10 +7,11 @@
if exists("b:did_indent") if exists("b:did_indent")
finish finish
endif endif
if !g:latex_indent_enabled
finish
endif
let b:did_indent = 1 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 let s:cpo_save = &cpo
set cpo&vim set cpo&vim