Skip to content

Commit

Permalink
Version 9.4.2: Fixes for 9.4 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcin Szamotulski authored and vim-scripts committed May 11, 2011
1 parent 506190d commit a8791ea
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 86 deletions.
10 changes: 6 additions & 4 deletions doc/automatic-tex-plugin.txt
@@ -1,6 +1,6 @@
*automatic-tex-plugin.txt* For Vim version 7.3 Last change: 08 May 2011

An Introduction to AUTOMATIC (La)TeX PLUGIN (ver. 9.4.1)
An Introduction to AUTOMATIC (La)TeX PLUGIN (ver. 9.4.2)
by Marcin Szamotulski
mszamot [AT] gmail [DOT] com
----------------------------------------
Expand Down Expand Up @@ -327,9 +327,11 @@ you can always read the svn logs at |atp-sourceforge|.

Motion commands, and mappings (like |CTRL-F|, |S-ScrollWheelUp|,
|CTRL-D|, etc) will update the highlighted chapter. If you do not want
the keys to be remapped set g:atp_MapUpdateToCLine to 0. The keys |j|,
|k|, |gj| and |gk| are also remapped, if you have a defined map from
|j| to |gj| (or |k| to |gk|) it will be respected.
the keys to be remapped set g:atp_MapUpdateToCLine (this was changed
in ver 9.4.2, the keys are not remapped, instead an autocommand is
used) to 0. The keys |j|, |k|, |gj| and |gk| are also
remapped, if you have a defined map from |j| to |gj| (or |k| to |gk|)
it will be respected.

For XeTeX (and XeLaTeX) users the maps ]e, [e (to go to next/previous
error message) in a log file (see |atp-maps-log|) will work better.
Expand Down
35 changes: 23 additions & 12 deletions ftplugin/ATP_files/compiler.vim
Expand Up @@ -186,17 +186,23 @@ function! <SID>SyncShow( page_nr, y_coord)
endif
endfunction "}}}
function! <SID>SyncTex(mouse, ...) "{{{
if g:atp_debugSyncTex
exe "redir! > ".g:atp_TempDir."/SyncTex.log"
endif
let output_check = ( a:0 >= 1 && a:1 == 0 ? 0 : 1 )
let dryrun = ( a:0 >= 2 && a:2 == 1 ? 1 : 0 )
" Mouse click <S-LeftMouse> is mapped to <LeftMouse>... => thus it first changes
" the cursor position.
let [ line, col ] = [ line("."), col(".") ]
" let [ g:line, g:col ] = [ line, col ]
let atp_MainFile = atplib#FullPath(b:atp_MainFile)
let ext = get(g:atp_CompilersDict, matchstr(b:atp_TexCompiler, '^\s*\zs\S\+\ze'), ".pdf")
let output_file = fnamemodify(atp_MainFile,":p:r") . ext
if !filereadable(output_file) && output_check
ViewOutput sync
if g:atp_debugSyncTex
silent echo "ViewOutput sync"
redir END
endif
return 2
endif
if b:atp_Viewer == "xpdf"
Expand All @@ -207,32 +213,30 @@ function! <SID>SyncTex(mouse, ...) "{{{
"There is a bug in xpdf. We need to sleep between sending commands to it.:
let sleep = ( g:atp_XpdfSleepTime ? 'sleep '.string(g:atp_XpdfSleepTime).'s;' : '' )
let sync_cmd = "(".sync_cmd_page.";".sleep.sync_cmd_y.";".sleep.sync_cmd_x.")&"
" let sync_cmd = sync_cmd_page.";".sync_cmd_y.";".sync_cmd_x
if !dryrun
call system(sync_cmd)
" redraw!
call <SID>SyncShow(page_nr, y_coord)
endif
" let g:sync_cmd_page = sync_cmd_page
" let g:sync_cmd_y = sync_cmd_y
" let g:sync_cmd_x = sync_cmd_x
" let g:sync_cmd = sync_cmd
if g:atp_debugSyncTex
silent echo "sync_cmd=".sync_cmd
endif
elseif b:atp_Viewer == "okular"
let [ page_nr, y_coord, x_coord ] = <SID>GetSyncData(line, col)
" This will not work in project files. (so where it is mostly needed.)
let sync_cmd = "okular --unique ".shellescape(expand("%:p:r")).".pdf\\#src:".line.shellescape(expand("%:p"))." &"
let sync_args = " ".shellescape(expand("%:p:r")).".pdf\\#src:".line.shellescape(expand("%:p"))." "
if !dryrun
call system(sync_cmd)
" redraw!
call <SID>SyncShow(page_nr, y_coord)
endif
" let g:sync_cmd = sync_cmd
if g:atp_debugSyncTex
silent echo "sync_cmd=".sync_cmd
endif
" elseif b:atp_Viewer == "evince"
" let rev_searchcmd="synctex view -i ".line(".").":".col(".").":".fnameescape(b:atp_MainFile). " -o ".fnameescape(fnamemodify(b:atp_MainFile, ":p:r").".pdf") . " -x 'evince %{output} -i %{page}'"
" endif
elseif b:atp_Viewer =~ '^\s*xdvi\>'
let options = (exists("g:atp_xdviOptions") ? g:atp_xdviOptions : "" ) . getbufvar(bufnr(""), "atp_xdviOptions")
let options = (exists("g:atp_xdviOptions") ? " ".join(g:atp_xdviOptions, " ") : " " ) ." ".join(getbufvar(bufnr(""), "atp_xdviOptions"), " ")
let sync_cmd = "xdvi ".options.
\ " -editor '".v:progname." --servername ".v:servername.
\ " --remote-wait +%l %f' -sourceposition ".
Expand All @@ -242,11 +246,18 @@ function! <SID>SyncTex(mouse, ...) "{{{
if !dryrun
call system(sync_cmd)
endif
" let g:sync_cmd = sync_cmd
if g:atp_debugSyncTex
silent echo "sync_cmd=".sync_cmd
endif
else
let sync_cmd=""
" let g:sync_cmd = sync_cmd
if g:atp_debugSyncTex
silent echo "sync_cmd=EMPTY"
endif
endif
if g:atp_debugSyncTex
redir END
endif
return
endfunction
nmap <buffer> <Plug>SyncTexKeyStroke :call <SID>SyncTex(0)<CR>
Expand Down
63 changes: 0 additions & 63 deletions ftplugin/ATP_files/mappings.vim
Expand Up @@ -31,69 +31,6 @@ else
endif
cmap <buffer> <C-_> \_s\+
if g:atp_MapUpdateToCLine
nmap <buffer> <silent> <C-F> <C-F>:call UpdateToCLine()<CR>
nmap <buffer> <silent> <S-Down> <S-Down>:call UpdateToCLine()<CR>
nmap <buffer> <silent> <PageDown> <PageDown>:call UpdateToCLine()<CR>
nmap <buffer> <silent> z+ z+:call UpdateToCLine()<CR>
nmap <buffer> <silent> <S-ScrollWheelUp> <S-ScrollWheelUp>:call UpdateToCLine()<CR>
nmap <buffer> <silent> <C-ScrollWheelUp> <C-ScrollWheelUp>:call UpdateToCLine()<CR>
nmap <buffer> <silent> <ScrollWheelUp> <ScrollWheelUp>:call UpdateToCLine()<CR>
nmap <buffer> <silent> <C-U> <C-U>:call UpdateToCLine()<CR>
" nmap <buffer> <silent> <C-E> <C-E>:call UpdateToCLine()<CR>

nmap <buffer> <silent> <C-B> <C-B>:call UpdateToCLine()<CR>
nmap <buffer> <silent> <S-ScrollWheelDown> <S-ScrollWheelDown>:call UpdateToCLine()<CR>
nmap <buffer> <silent> <C-ScrollWheelDown> <C-ScrollWheelDown>:call UpdateToCLine()<CR>
nmap <buffer> <silent> <ScrollWheelDown> <ScrollWheelDown>:call UpdateToCLine()<CR>
nmap <buffer> <silent> <S-Up> <S-Up>:call UpdateToCLine()<CR>
nmap <buffer> <silent> <PageUp> <PageUp>:call UpdateToCLine()<CR>
map <buffer> <silent> <C-D> <C-D>:call UpdateToCLine()<CR>
" nmap <buffer> <silent> <C-Y> <C-Y>:call UpdateToCLine()<CR>

function! ATP_GJ(i, count)
exe "normal! ".a:count."j"
let g:count=a:count
call UpdateToCLine(a:i)
endfunction
nnoremap <buffer> <silent> gj :<C-U>call ATP_GJ(0, v:count1)<CR>
function! ATP_GK(i, count)
exe "normal! ".a:count."gk"
let g:count=a:count
call UpdateToCLine(a:i)
endfunction
nnoremap <buffer> <silent> gk :<C-U>call ATP_GK(0, v:count1)<CR>
function! ATP_J(i, count)
exe "normal! ".a:count."j"
let g:count=a:count
call UpdateToCLine(a:i)
endfunction
function! ATP_K(i, count)
exe "normal! ".a:count."k"
let g:count=a:count
call UpdateToCLine(a:i)
endfunction

nmap <buffer> <silent> gj :<C-U>call ATP_GJ(1, v:count1)<CR>
nmap <buffer> <silent> gk :<C-U>call ATP_GK(1, v:count1)<CR>
if maparg('j', 'n') == ''
nnoremap <buffer> <silent> j :<C-U>call ATP_J(0, v:count1)<CR>
elseif maparg('j', 'n') == 'gj'
nmap <buffer> <silent> j :<C-U>call ATP_GJ(0, v:count1)<CR>
endif

if maparg('k', 'n') == ''
nnoremap <buffer> <silent> k :<C-U>call ATP_K(1, v:count1)<CR>
elseif maparg('j', 'n') == 'gj'
nnoremap <buffer> <silent> k :<C-U>call ATP_GK(1, v:count1)<CR>
endif

endif


command! -buffer -bang -nargs=* FontSearch :call atplib#FontSearch(<q-bang>, <f-args>)
command! -buffer -bang -nargs=* FontPreview :call atplib#FontPreview(<q-bang>,<f-args>)
command! -buffer -nargs=1 -complete=customlist,atplib#Fd_completion OpenFdFile :call atplib#OpenFdFile(<f-args>)
Expand Down
7 changes: 5 additions & 2 deletions ftplugin/ATP_files/motion.vim
Expand Up @@ -490,6 +490,9 @@ function! <SID>ToCbufnr()
endfunction
" {{{3 UpdateToCLine
function! UpdateToCLine(...)
if !g:atp_UpdateToCLine
return
endif
let toc_bufnr = <SID>ToCbufnr()
let check_line = (a:0>=1 ? a:1 : -1)
if toc_bufnr == -1 || check_line != -1 &&
Expand All @@ -510,7 +513,7 @@ function! UpdateToCLine(...)
if cline>=line
let num+=1
endif
keepjumps call setpos('.',[bufnr(""),num,1,0])
keepjumps call setpos('.',[bufnr(""),num,1,0])
endfor
exe cwinnr."wincmd w"
endfunction
Expand Down Expand Up @@ -988,7 +991,7 @@ function! <SID>JumptoEnvironment(backward)
endif
call search('^\%([^%]\|\\%\)*\zs\\begin\>', 'W')
else
let found = search('^\%([^%]\|\\%\)*\\end\>', 'bW')
let found = search('^\%([^%]\|\\%\)*\\end\>', 'bcW')
if getline(line(".")) !~ '^\%([^%]\|\\%\)*\\end\s*{\s*document\s*}' && found
exe "normal %"
elseif !found
Expand Down
17 changes: 13 additions & 4 deletions ftplugin/ATP_files/options.vim
Expand Up @@ -40,8 +40,12 @@ endif

" ATP Debug Variables: (to debug atp behaviour)
" {{{ debug variables
if !exists("g:atp_debugSyncTex")
" debug SyncTex (compiler.vim)
let g:atp_debugSyncTex = 0
endif
if !exists("g:atp_debugInsertItem")
" debug UpdateATP (various.vim)
" debug SyncTex (various.vim)
let g:atp_debugInsertItem = 0
endif
if !exists("g:atp_debugUpdateATP")
Expand Down Expand Up @@ -569,8 +573,8 @@ if !exists("g:atp_Python") || g:atp_reload_variables
let g:atp_Python = "python"
endif
endif
if !exists("g:atp_MapUpdateToCLine") || g:atp_reload_variables
let g:atp_MapUpdateToCLine = 1
if !exists("g:atp_UpdateToCLine") || g:atp_reload_variables
let g:atp_UpdateToCLine = 1
endif
if !exists("g:atp_DeleteWithBang") || g:atp_reload_variables
let g:atp_DeleteWithBang = [ 'synctex.gz', 'tex.project.vim']
Expand Down Expand Up @@ -1571,7 +1575,7 @@ function! ATP_ToggleDebugMode(mode,...)
exe "ErrorFormat ".efm
silent! cg
if len(getqflist()) > 0
exe "silent copen ".min([atplb#qflength(), g:atp_DebugModeQuickFixHeight])
exe "silent copen ".min([atplib#qflength(), g:atp_DebugModeQuickFixHeight])
exe winnr . " wincmd w"
else
echo "[ATP:] no errors for b:atp_ErrorFormat=".efm
Expand Down Expand Up @@ -2170,6 +2174,11 @@ let g:atp_pagenumbering = [ 'arabic', 'roman', 'Roman', 'alph', 'Alph' ]

if !s:did_options

augroup ATP_UpdateToCLine
au!
au CursorHold *.tex nested :call UpdateToCLine()
augroup END

let g:atp_eventignore = &l:eventignore
let g:atp_eventignoreInsertEnter = 0
function! <SID>InsertLeave_InsertEnter()
Expand Down
2 changes: 1 addition & 1 deletion ftplugin/tex_atp.vim
Expand Up @@ -3,7 +3,7 @@
" URL: https://sourceforge.net/projects/atp-vim/
" BUGS: https://lists.sourceforge.net/lists/listinfo/atp-vim-list
" Do NOT DELETE the line just below, it is used by :UpdateATP (':help atp-:UpdateATP')
" Time Stamp: 08-05-11_15-39
" Time Stamp: 08-05-11_23-05
" (but you can edit, if there is a reason for doing this. The format is dd-mm-yy_HH-MM)
" Language: tex
" Last Change: Sun May 01 07:00 2011 W
Expand Down

0 comments on commit a8791ea

Please sign in to comment.