vim-latex-cvs Mailing List for Vim-Latex (Page 35)
Brought to you by:
srinathava,
tmaas
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(82) |
Dec
(124) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(104) |
Feb
(3) |
Mar
(6) |
Apr
(48) |
May
(34) |
Jun
(62) |
Jul
(33) |
Aug
(24) |
Sep
(32) |
Oct
(16) |
Nov
(36) |
Dec
(39) |
2004 |
Jan
|
Feb
(3) |
Mar
(8) |
Apr
|
May
(29) |
Jun
(13) |
Jul
(4) |
Aug
(6) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(3) |
Oct
|
Nov
(6) |
Dec
(9) |
2006 |
Jan
(9) |
Feb
(2) |
Mar
(16) |
Apr
(5) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(22) |
Jun
(1) |
Jul
|
Aug
(6) |
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
(1) |
Feb
|
Mar
(2) |
Apr
(2) |
May
|
Jun
(1) |
Jul
|
Aug
(17) |
Sep
(3) |
Oct
(4) |
Nov
(1) |
Dec
(3) |
2010 |
Jan
(25) |
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(8) |
Nov
|
Dec
|
2011 |
Jan
|
Feb
(5) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
(10) |
Oct
(1) |
Nov
|
Dec
(1) |
2012 |
Jan
(5) |
Feb
(1) |
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
(1) |
Aug
(1) |
Sep
|
Oct
(4) |
Nov
(1) |
Dec
|
2013 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(15) |
Dec
|
2015 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
(1) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
|
From: <sri...@us...> - 2002-11-20 11:10:02
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite In directory sc8-pr-cvs1:/tmp/cvs-serv20883 Modified Files: compiler.vim Log Message: Implemented Carl's idea of having the log file also being shown when RunLaTeX() is run. This is what happens presently: When you press \ll, then the quickfix window with one error on each line opens up. Beneath the quickfix window, the log file is opened in a "preview" window. The display within the preview window is adjusted to match with the error currently being examined by the user. When the user moves around within the quickfix window, this display is automatically adjusted to keep in sync. When the user presses <enter> in the quickfix window, then he is taken to the correct line and column number of the .tex file. The column number is computed either from the length of the broken line after l.\d\+ in the log file or if we have a undefined citation, then search for the missing citation word... New functions added: PositionPreviewWindow() : positions the display of the log file UpdatePreviewWindow() : positions the display of the log file and then returns to the quickfix window. GotoErrorLocation() : goes to the correct line and column number of the .tex file being edited. TODO: 1. multiple errors on the same line dont work. the preview window gets stuck on the first error. 2. test more robustly. 3. Ask people about various formats of LaTeX warnings, so we can guess column numbers in other situations too. As of now, only undefined citations and errors are caught well. For all other kinds, we goto the first column of the correct line number. Index: compiler.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/compiler.vim,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** compiler.vim 14 Nov 2002 17:30:45 -0000 1.12 --- compiler.vim 20 Nov 2002 11:09:58 -0000 1.13 *************** *** 2,8 **** " File: compiler.vim " Author: Srinath Avadhanula - " Version: 1.0 " Created: Tue Apr 23 05:00 PM 2002 PST ! " Last Change: Thu Nov 14 09:00 AM 2002 PST " " Description: functions for compiling/viewing/searching latex documents --- 2,7 ---- " File: compiler.vim " Author: Srinath Avadhanula " Created: Tue Apr 23 05:00 PM 2002 PST ! " Last Change: Wed Nov 20 03:00 AM 2002 PST " " Description: functions for compiling/viewing/searching latex documents *************** *** 90,93 **** --- 89,95 ---- exec 'cd '.expand("%:p:h") + " close any preview windows left open. + pclose! + " if a makefile exists, just use the make utility if glob('makefile') != '' || glob('Makefile') != '' *************** *** 112,118 **** let winnum = winnr() cwindow ! " just open the cwindow, do not remain there... ! execute winnum "wincmd w" exec 'cd '.curd --- 114,136 ---- let winnum = winnr() + + " close the quickfix window before trying to open it again, otherwise + " whether or not we end up in the quickfix window after the :cwindow + " command is not fixed. + cclose cwindow ! " if we moved to a different window, then it means we had some errors. ! if winnum != winnr() ! call UpdatePreviewWindow(mainfname) ! exe 'nnoremap <buffer> <silent> j j:call UpdatePreviewWindow("'.mainfname.'")<CR>' ! exe 'nnoremap <buffer> <silent> k k:call UpdatePreviewWindow("'.mainfname.'")<CR>' ! exe 'nnoremap <buffer> <silent> <up> <up>:call UpdatePreviewWindow("'.mainfname.'")<CR>' ! exe 'nnoremap <buffer> <silent> <down> <down>:call UpdatePreviewWindow("'.mainfname.'")<CR>' ! exe 'nnoremap <buffer> <silent> <enter> :call GotoErrorLocation("'.mainfname.'", '.winnum.')<CR>' ! ! " resize the window to just fit in with the number of lines. ! exec ( line('$') < 4 ? line('$') : 4 ).' wincmd _' ! call GotoErrorLocation(mainfname, winnum) ! endif exec 'cd '.curd *************** *** 217,220 **** --- 235,310 ---- " }}} + " PositionPreviewWindow: positions the preview window correctly. {{{ + " Description: + function! PositionPreviewWindow(filename) + if getline('.') !~ '|\d\+ \(error\|warning\)|' + if !search('|\d\+ \(error\|warning\)|') + pclose! + return + endif + endif + let linenum = matchstr(getline('.'), '|\zs\d\+\ze \(error\|warning\)|') + if getline('.') =~ '|\d\+ warning|' + let searchpat = escape(matchstr(getline('.'), '|\d\+ warning|\s*\zs.*'), '\ ') + else + let searchpat = 'l.'.linenum + endif + exec 'bot pedit +/'.searchpat.'/ '.a:filename.'.log' + " TODO: This is not robust enough. Check that a wincmd j actually takes + " us to the preview window. Moreover, the resizing should be done only the + " first time around. + wincmd j + endfunction " }}} + " UpdatePreviewWindow: updates the view of the log file {{{ + " Description: + " This function should be called when focus is in a quickfix window. + " It opens the log file in a preview window and makes it display that + " part of the log file which corresponds to the error which the user is + " currently on in the quickfix window. Control returns to the quickfix + " window when the function returns. + " + function! UpdatePreviewWindow(filename) + call PositionPreviewWindow(a:filename) + 6 wincmd _ + wincmd k + endfunction " }}} + " GotoErrorLocation: goes to the correct location of error in the tex file {{{ + " Description: + " This function should be called when focus is in a quickfix window. This + " function will first open the preview window of the log file (if it is not + " already open), position the display of the preview to coincide with the + " current error under the cursor and then take the user to the file in + " which this error has occured. + " + " The position is both the correct line number and the column number. + " + " TODO: When there are multiple errors on the same line, this only takes you + " to the very first error every time. + function! GotoErrorLocation(filename, winnum) + + let linenum = matchstr(getline('.'), '|\zs\d\+\ze \(warning\|error\)|') + call PositionPreviewWindow(a:filename) + + if getline('.') =~ 'l.\d\+' + + let brokenline = matchstr(getline('.'), 'l.'.linenum.' \zs.*\ze') + let column = strlen(brokenline) + let normcmd = column.'|' + + elseif getline('.') =~ 'LaTeX Warning: Citation `.*' + + let ref = matchstr(getline('.'), "LaTeX Warning: Citation `\\zs[^']\\+\\ze'") + let normcmd = '0/'.ref."\<CR>" + + else + + let normcmd = '0' + + endif + + exec a:winnum.' wincmd w' + exec 'silent! '.linenum.' | normal! '.normcmd + + endfunction " }}} " vim:fdm=marker:ts=4:sw=4 |
From: <mi...@us...> - 2002-11-20 10:04:24
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite In directory sc8-pr-cvs1:/tmp/cvs-serv26857 Modified Files: envmacros.vim Log Message: - star math environments don't ask for label - in s:common_environments corrected [ to \[ - Tex_change_envronment uses PropmtForEnvironment - corrected difference between EFI from menu and EFI shortcut - introduced g:Tex_UseMenuWizard in texrc Index: envmacros.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/envmacros.vim,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** envmacros.vim 17 Nov 2002 03:40:07 -0000 1.8 --- envmacros.vim 20 Nov 2002 10:04:21 -0000 1.9 *************** *** 3,7 **** " Author: Mikolaj Machowski " Created: Tue Apr 23 08:00 PM 2002 PST ! " Last Change: Sat Nov 16 07:00 PM 2002 PST " " Description: mappings/menus for environments. --- 3,7 ---- " Author: Mikolaj Machowski " Created: Tue Apr 23 08:00 PM 2002 PST ! " Last Change: ¶ro lis 20 10:00 2002 C " " Description: mappings/menus for environments. *************** *** 17,20 **** --- 17,35 ---- imap <silent> <script> <C-o><plug> <Nop> + " Define environments for IMAP evaluation " {{{ + let s:figure = "\\begin{figure}[«htpb»]\<cr>\\begin{center}\<cr>\\psfig{figure=«eps file»}\<cr>\\end{center}\<cr>\\caption{«caption text»}\<cr>\\label{fig:«label»}\<cr>\\end{figure}«»" + let s:minipage = "\\begin{minipage}[«tb»]{«width»}\<cr>«»\<cr>\\end{minipage}«»" + let s:picture = "\\begin{picture}(«width», «height»)(«xoff»,«yoff»)\<cr>\\put(«xoff»,«yoff»){\\framebox(«»,«»){«»}}\<cr>\\end{picture}«»" + let s:list = "\\begin{list}{«label»}{«commands»}\<cr>\\item «»\<cr>\\end{list}«»" + let s:enumerate = "\\begin{enumerate}{«label»}{«commands»}\<cr>\\item «»\<cr>\\end{enumerate}«»" + let s:itemize = "\\begin{itemize}{«label»}{«commands»}\<cr>\\item «»\<cr>\\end{itemize}«»" + let s:theindex = "\\begin{theindex}{«label»}{«commands»}\<cr>\\item «»\<cr>\\end{theindex}«»" + let s:trivlist = "\\begin{trivlist}{«label»}{«commands»}\<cr>\\item «»\<cr>\\end{trivlist}«»" + let s:table = "\\begin{table}\<cr>\\centering\<cr>\\caption{tab:ä}\<cr>\\begin{tabular}{«dimensions»}\<cr>«»\<cr>\\end{tabular}\<cr>\\label{tab:«label»}\<cr>\\end{table}«»" + let s:array = "\\leftä\<cr>\\begin{array}{«dimension»}\<cr>«elements»\<cr>\\end{array}\<cr>\\right«»" + let s:description ="\\begin{description}\<cr>\\item[«label»]«»\<cr>\\end{description}«»" + let s:document = "\\documentclass[«options»]{«class»}\<cr>\<cr>\\begin{document}\<cr>«»\<cr>\\end{document}" + + " }}} " define environments with special behavior in line wise selection. {{{ if !exists('s:vis_center_left') *************** *** 191,195 **** " }}} " Lists {{{ ! call s:Tex_SpecialMacros('ELI', '&Lists.', 'list', "\\begin{list}{«label»}{«commands»}\<cr>\\item «»\<cr>\\end{list}«»") call s:Tex_EnvMacros('EEN', '&Lists.', 'enumerate') call s:Tex_EnvMacros('EIT', '&Lists.', 'itemize') --- 206,210 ---- " }}} " Lists {{{ ! call s:Tex_SpecialMacros('ELI', '&Lists.', 'list', s:list) call s:Tex_EnvMacros('EEN', '&Lists.', 'enumerate') call s:Tex_EnvMacros('EIT', '&Lists.', 'itemize') *************** *** 198,202 **** " }}} " Tables {{{ ! call s:Tex_SpecialMacros('ETE', '&Tables.', 'table', "\\begin{table}\<cr>\\centering\<cr>\\caption{tab:ä}\<cr>\\begin{tabular}{«dimensions»}\<cr>«»\<cr>\\end{tabular}\<cr>\\label{tab:«label»}\<cr>\\end{table}«»") call s:Tex_EnvMacros('ETG', '&Tables.', 'tabbing') call s:Tex_EnvMacros('', '&Tables.', 'table*') --- 213,217 ---- " }}} " Tables {{{ ! call s:Tex_SpecialMacros('ETE', '&Tables.', 'table', s:table) call s:Tex_EnvMacros('ETG', '&Tables.', 'tabbing') call s:Tex_EnvMacros('', '&Tables.', 'table*') *************** *** 214,218 **** " }}} " Structure {{{ ! call s:Tex_SpecialMacros('EAR', 'Math.', 'array', "\\leftä\<cr>\\begin{array}{«dimension»}\<cr>«elements»\<cr>\\end{array}\<cr>\\right«»") call s:Tex_EnvMacros('EAB', '&Structure.', 'abstract') call s:Tex_EnvMacros('EAP', '&Structure.', 'appendix') --- 229,233 ---- " }}} " Structure {{{ ! call s:Tex_SpecialMacros('EAR', 'Math.', 'array', s:array) call s:Tex_EnvMacros('EAB', '&Structure.', 'abstract') call s:Tex_EnvMacros('EAP', '&Structure.', 'appendix') *************** *** 248,256 **** " Miscellaneous {{{ call s:Tex_SpecialMacros('', '', '-sepenv1-', ' :', 0) ! call s:Tex_SpecialMacros('EFI', '', 'figure', "\\begin{figure}[«htpb»]\<cr>\\centerline{\\psfig{figure=«eps file»}}\<cr>\\caption{«caption text»}\<cr>\\label{fig:«label»}\<cr>\\end{figure}«»") call s:Tex_EnvMacros('', '', 'figure*') call s:Tex_EnvMacros('ELR', '', 'lrbox') ! call s:Tex_SpecialMacros('EMP', '', 'minipage', "\\begin{minipage}[«tb»]{«width»}\<cr>«»\<cr>\\end{minipage}«»") ! call s:Tex_SpecialMacros('EPI', '', 'picture', "\\begin{picture}(«width», «height»)(«xoff»,«yoff»)\<cr>\\put(«xoff»,«yoff»){\\framebox(«»,«»){«»}}\<cr>\\end{picture}«»") " }}} --- 263,271 ---- " Miscellaneous {{{ call s:Tex_SpecialMacros('', '', '-sepenv1-', ' :', 0) ! call s:Tex_SpecialMacros('EFI', '', 'figure', s:figure) call s:Tex_EnvMacros('', '', 'figure*') call s:Tex_EnvMacros('ELR', '', 'lrbox') ! call s:Tex_SpecialMacros('EMP', '', 'minipage', s:minipage) ! call s:Tex_SpecialMacros('EPI', '', 'picture', s:picture) " }}} *************** *** 276,430 **** " Tex_description: {{{ function! Tex_description(env) ! let itlabel = input('(Optional) Item label? ') ! if itlabel != '' ! let itlabel = '['.itlabel.']' endif - return IMAP_PutTextWithMovement("\\begin{description}\<cr>\\item".itlabel." «»\<cr>\\end{description}«»") endfunction " }}} " Tex_figure: {{{ function! Tex_figure(env) ! let flto = input('Float to (htbp)? ') ! let caption = input('Caption? ') ! let center = input('Center ([y]/n)? ') ! let label = input('Label (for use with \ref)? ') ! " additional to AUC Tex since my pics are usually external files ! let pic = input('Name of Pic-File? ') ! if flto != '' ! let flto = '['.flto."]\<cr>" ! else ! let flto = "\<cr>" ! endif ! if pic != '' ! let pic = '\input{'.pic."}\<cr>" ! else ! let pic = "ä\<cr>" ! endif ! if caption != '' ! let caption = '\caption{'.caption."}\<cr>" ! endif ! if label != '' ! let label = '\label{fig:'.label."}\<cr>" ! endif ! if (center == 'y' || center == '') ! let centr = "\\begin{center}\<cr>" ! let centr = centr . pic ! let centr = centr . caption ! let centr = centr . label ! let centr = centr . "\\end{center}\<cr>" ! else ! let centr = pic ! let centr = centr . caption ! let centr = centr . label ! endif ! let figure = '\begin{'.a:env.'}'.flto ! let figure = figure . centr ! let figure = figure . '\end{'.a:env.'}' ! return IMAP_PutTextWithMovement(figure) endfunction " }}} " Tex_table: {{{ function! Tex_table(env) ! let flto = input('Float to (htbp)? ') ! let caption = input('Caption? ') ! let center = input('Center (y/n)? ') ! let label = input('Label? ') ! if flto != '' ! let flto ='['.flto."]\<cr>" ! else ! let flto = '' ! endif ! let ret='\begin{table}'.flto ! if center == 'y' ! let ret=ret."\\begin{center}\<cr>" ! endif ! let foo = '\begin{tabular}' ! let pos = input('(Optional) Position (t b)? ') ! if pos != '' ! let foo = foo.'['.pos.']' else ! let foo = foo."\<cr>" ! endif ! let format = input("Format ( l r c p{width} | @{text} )? ") ! if format == '' ! let format = '«»' endif - let ret = ret.foo.'{'.format."}\<cr>ä\<cr>\\end{tabular}«»\<cr>" - if center == 'y' - let ret=ret."\\end{center}\<cr>" - endif - if caption != '' - let ret=ret.'\caption{'.caption."}\<cr>" - endif - if label != '' - let ret=ret.'\label{tab:'.label."}\<cr>" - endif - let ret=ret.'\end{table}«»' - return IMAP_PutTextWithMovement(ret) endfunction " }}} " Tex_tabular: {{{ function! Tex_tabular(env) ! let pos = input('(Optional) Position (t b)? ') ! let format = input("Format ( l r c p{width} | @{text} )? ") ! if pos != '' ! let pos = '['.pos.']' ! endif ! if format != '' ! let format = '{'.format.'}' ! endif ! return IMAP_PutTextWithMovement('\begin{'.a:env.'}'.pos.format."\<cr> \<cr>\\end{".a:env."}«»") endfunction " }}} " Tex_eqnarray: {{{ function! Tex_eqnarray(env) ! let label = input('Label? ') ! if label != '' ! let arrlabel = '\label{'.label."}\<cr> " ! else ! let arrlabel = '' ! endif ! return IMAP_PutTextWithMovement('\begin{'.a:env."}\<cr>".arrlabel."«»\<cr>\\end{".a:env."}«»") endfunction " }}} " Tex_list: {{{ function! Tex_list(env) ! let label = input('Label (for \item)? ') ! if label != '' ! let label = '{'.label.'}' ! let addcmd = input('Additional commands? ') ! if addcmd != '' ! let label = label . '{'.addcmd.'}' endif else ! let label = '' endif - return IMAP_PutTextWithMovement('\begin{list}'.label."\<cr>\\item \<cr>\\end{list}«»") endfunction " }}} " Tex_document: {{{ function! Tex_document(env) ! let dstyle = input('Document style? ') ! let opts = input('(Optional) Options? ') ! let foo = '\documentclass' ! if opts == '' ! let foo = foo.'{'.dstyle.'}' ! else ! let foo = foo.'['.opts.']'.'{'.dstyle.'}' ! endif ! return IMAP_PutTextWithMovement(foo."\<cr>\<cr>\\begin{document}\<cr>«»\<cr>\\end{document}") endfunction " }}} " Tex_minipage: {{{ function! Tex_minipage(env) ! let foo = '\begin{minipage}' ! let pos = input('(Optional) Position (t b)? ') ! let width = input('Width? ') ! if pos == '' ! let foo = foo.'{'.width.'}' ! else ! let foo = foo.'['.pos.']{'.width.'}' ! endif ! return IMAP_PutTextWithMovement(foo."\<cr>«»\<cr>\\end{minipage}«»") endfunction " }}} --- 291,486 ---- " Tex_description: {{{ function! Tex_description(env) ! if g:Tex_UseMenuWizard == 1 ! let itlabel = input('(Optional) Item label? ') ! if itlabel != '' ! let itlabel = '['.itlabel.']' ! endif ! return IMAP_PutTextWithMovement("\\begin{description}\<cr>\\item".itlabel." «»\<cr>\\end{description}«»") ! else ! return IMAP_PutTextWithMovement(s:description) endif endfunction " }}} " Tex_figure: {{{ function! Tex_figure(env) ! if g:Tex_UseMenuWizard == 1 ! let flto = input('Float to (htbp)? ') ! let caption = input('Caption? ') ! let center = input('Center ([y]/n)? ') ! let label = input('Label (for use with \ref)? ') ! " additional to AUC Tex since my pics are usually external files ! let pic = input('Name of Pic-File? ') ! if flto != '' ! let flto = '['.flto."]\<cr>" ! else ! let flto = "\<cr>" ! endif ! if pic != '' ! let pic = '\input{'.pic."}\<cr>" ! else ! let pic = "ä\<cr>" ! endif ! if caption != '' ! let caption = '\caption{'.caption."}\<cr>" ! endif ! if label != '' ! let label = '\label{fig:'.label."}\<cr>" ! endif ! if center == 'y' ! let centr = '\begin{center}' . "\<cr>" ! let centr = centr . pic ! let centr = centr . caption ! let centr = centr . label ! let centr = centr . '\end{center}' . "\<cr>" ! else ! let centr = pic ! let centr = centr . caption ! let centr = centr . label ! endif ! let figure = '\begin{'.a:env.'}'.flto ! let figure = figure . centr ! let figure = figure . '\end{'.a:env.'}' ! return IMAP_PutTextWithMovement(figure) ! else ! return IMAP_PutTextWithMovement(s:figure) ! endif endfunction " }}} " Tex_table: {{{ function! Tex_table(env) ! if g:Tex_UseMenuWizard == 1 ! let flto = input('Float to (htbp)? ') ! let caption = input('Caption? ') ! let center = input('Center (y/n)? ') ! let label = input('Label? ') ! if flto != '' ! let flto ='['.flto."]\<cr>" ! else ! let flto = '' ! endif ! let ret='\begin{table}'.flto ! if center == 'y' ! let ret=ret."\\begin{center}\<cr>" ! endif ! let foo = '\begin{tabular}' ! let pos = input('(Optional) Position (t b)? ') ! if pos != '' ! let foo = foo.'['.pos.']' ! else ! let foo = foo."\<cr>" ! endif ! let format = input("Format ( l r c p{width} | @{text} )? ") ! if format == '' ! let format = '«»' ! endif ! let ret = ret.foo.'{'.format."}\<cr>ä\<cr>\\end{tabular}«»\<cr>" ! if center == 'y' ! let ret=ret."\\end{center}\<cr>" ! endif ! if caption != '' ! let ret=ret.'\caption{'.caption."}\<cr>" ! endif ! if label != '' ! let ret=ret.'\label{tab:'.label."}\<cr>" ! endif ! let ret=ret.'\end{table}«»' ! return IMAP_PutTextWithMovement(ret) else ! return IMAP_PutTextWithMovement(s:table) endif endfunction " }}} " Tex_tabular: {{{ function! Tex_tabular(env) ! if Tex_UseMenuWizard == 1 ! let pos = input('(Optional) Position (t b)? ') ! let format = input("Format ( l r c p{width} | @{text} )? ") ! if pos != '' ! let pos = '['.pos.']' ! endif ! if format != '' ! let format = '{'.format.'}' ! endif ! return IMAP_PutTextWithMovement('\begin{'.a:env.'}'.pos.format."\<cr> \<cr>\\end{".a:env.'}«»') ! else ! return IMAP_PutTextWithMovement('\begin{'.a:env.'}[«position»]{«format»}'."\<cr>«»\<cr>\\end{".a:env.'}«»') ! endif endfunction " }}} " Tex_eqnarray: {{{ function! Tex_eqnarray(env) ! if g:Tex_UseMenuWizard == 1 ! if a:env !~ '\*' ! let label = input('Label? ') ! if label != '' ! let arrlabel = '\label{'.label."}\<cr> " ! else ! let arrlabel = '' ! endif ! else ! let arrlabel = '' ! endif ! return IMAP_PutTextWithMovement('\begin{'.a:env."}\<cr>".arrlabel."«»\<cr>\\end{".a:env."}«»") ! else ! if a:env !~ '\*' ! let arrlabel = '\label{«»}«»' ! else ! let arrlabel = '«»' ! endif ! return IMAP_PutTextWithMovement('\begin{'.a:env."}\<cr>".arrlabel."\<cr>".'\end{'.a:env.'}«»') ! endif endfunction " }}} " Tex_list: {{{ function! Tex_list(env) ! if g:Tex_UseMenuWizard == 1 ! let label = input('Label (for \item)? ') ! if label != '' ! let label = '{'.label.'}' ! let addcmd = input('Additional commands? ') ! if addcmd != '' ! let label = label . '{'.addcmd.'}' ! endif ! else ! let label = '' endif + return IMAP_PutTextWithMovement('\begin{list}'.label."\<cr>\\item \<cr>\\end{list}«»") else ! return IMAP_PutTextWithMovement(s:list) endif endfunction " }}} " Tex_document: {{{ function! Tex_document(env) ! if g:Tex_UseMenuWizard == 1 ! let dstyle = input('Document style? ') ! let opts = input('(Optional) Options? ') ! let foo = '\documentclass' ! if opts == '' ! let foo = foo.'{'.dstyle.'}' ! else ! let foo = foo.'['.opts.']'.'{'.dstyle.'}' ! endif ! return IMAP_PutTextWithMovement(foo."\<cr>\<cr>\\begin{document}\<cr>«»\<cr>\\end{document}") ! else ! return IMAP_PutTextWithMovement(s:document) ! endif endfunction " }}} " Tex_minipage: {{{ function! Tex_minipage(env) ! if g:Tex_UseMenuWizard == 1 ! let foo = '\begin{minipage}' ! let pos = input('(Optional) Position (t b)? ') ! let width = input('Width? ') ! if pos == '' ! let foo = foo.'{'.width.'}' ! else ! let foo = foo.'['.pos.']{'.width.'}' ! endif ! return IMAP_PutTextWithMovement(foo."\<cr>«»\<cr>\\end{minipage}«»") ! else ! return IMAP_PutTextWithMovement(s:minipage) ! endif endfunction " }}} *************** *** 448,452 **** " Contributions / suggestions from Carl Mueller (auctex.vim) " ============================================================================== ! let s:common_environments = 'equation,equation*,eqnarray,eqnarray*,[,$$,align,align*' " SetUpEnvironmentsPrompt: sets up a prompt string using s:common_environments {{{ --- 504,508 ---- " Contributions / suggestions from Carl Mueller (auctex.vim) " ============================================================================== ! let s:common_environments = 'equation,equation*,eqnarray,eqnarray*,\[,$$,align,align*' " SetUpEnvironmentsPrompt: sets up a prompt string using s:common_environments {{{ *************** *** 464,472 **** let env2 = Tex_Strntok(s:common_environments, ',', i + 1) ! let s:common_env_prompt = s:common_env_prompt."(".i.") ".env1."\t".( strlen(env1) < 4 ? "\t" : "" )."(".(i+1).") ".env2."\n" let i = i + 2 endwhile ! let s:common_env_prompt = s:common_env_prompt."\n".'Enter number or name of environment :' endfunction " }}} " PromptForEnvironment: prompts for an environment {{{ --- 520,528 ---- let env2 = Tex_Strntok(s:common_environments, ',', i + 1) ! let s:common_env_prompt = s:common_env_prompt.'('.i.') '.env1."\t".( strlen(env1) < 4 ? "\t" : '' ).'('.(i+1).') '.env2."\n" let i = i + 2 endwhile ! let s:common_env_prompt = s:common_env_prompt.'Enter number or name of environment: ' endfunction " }}} " PromptForEnvironment: prompts for an environment {{{ *************** *** 498,502 **** let env = matchstr(getline('.'), '^\s*\zs\w*\*\=\ze\s*$') if env == '' ! let env = PromptForEnvironment('Choose which environment to insert :') if env != '' return Tex_PutEnvironment(env) --- 554,558 ---- let env = matchstr(getline('.'), '^\s*\zs\w*\*\=\ze\s*$') if env == '' ! let env = PromptForEnvironment('Choose which environment to insert: ') if env != '' return Tex_PutEnvironment(env) *************** *** 514,518 **** " Based on input argument, it calls various specialized functions. function! Tex_PutEnvironment(env) ! if a:env =~ "theorem\\|lemma\\|equation\\|eqnarray\\|align\\|multline" return Tex_eqnarray(a:env) elseif a:env =~ "enumerate\\|itemize\\|theindex\\|trivlist" --- 570,574 ---- " Based on input argument, it calls various specialized functions. function! Tex_PutEnvironment(env) ! if a:env =~ "equation*\\|eqnarray*\\|align*\\|theorem\\|lemma\\|equation\\|eqnarray\\|align\\|multline" return Tex_eqnarray(a:env) elseif a:env =~ "enumerate\\|itemize\\|theindex\\|trivlist" *************** *** 604,645 **** return 0 endif ! if s:math_environment =~ env_name ! exe "let change_env = input('You are within a \"".env_name."\" environment.\n". ! \ "Do you want to change it to?\n". ! \ "(1) eqnarray (2) eqnarray*\n". ! \ "(3) align (4) align*\n". ! \ "(5) equation* (6) other\n". ! \ "<cr> leave unchanged\n". ! \ "Enter number: ')" ! if change_env == 1 ! call <SID>Change('eqnarray', 1, '', 1) ! elseif change_env == 2 ! call <SID>Change('eqnarray*', 0, '\\nonumber', 0) ! elseif change_env == 3 ! call <SID>Change('align', 1, '', 1) ! elseif change_env == 4 ! call <SID>Change('align*', 0, '\\nonumber', 0) ! elseif change_env == 5 ! call <SID>Change('equation*', 0, '&\|\\lefteqn{\|\\nonumber\|\\\\', 0) ! elseif change_env == 6 ! let env = input('Environment? ') ! if env != '' ! call <SID>Change(env, 0, '', '') ! endif ! return 0 ! elseif change_env == '' ! return 0 ! else ! echomsg 'Wrong argument' ! return 0 ! endif else ! exe "let change_env = input('You are within a \"".env_name."\" environment.\n". ! \ "You want to change it for (<cr> to abandon): ')" ! if change_env == '' ! return 0 ! else ! call <SID>Change(change_env, 0, '', '') ! endif endif endfunction " }}} --- 660,680 ---- return 0 endif ! exe 'echomsg "You are within a '.env_name.' environment."' ! let s:change_env = PromptForEnvironment('Do you want to change it to (number or name)? ') ! if s:change_env == 'eqnarray' ! call <SID>Change('eqnarray', 1, '', 1) ! elseif s:change_env == 'eqnarray*' ! call <SID>Change('eqnarray*', 0, '\\nonumber', 0) ! elseif s:change_env == 'align' ! call <SID>Change('align', 1, '', 1) ! elseif s:change_env == 'align*' ! call <SID>Change('align*', 0, '\\nonumber', 0) ! elseif s:change_env == 'equation*' ! call <SID>Change('equation*', 0, '&\|\\lefteqn{\|\\nonumber\|\\\\', 0) ! elseif s:change_env == '' ! return 0 else ! call <SID>Change(s:change_env, 0, '', '') ! return 0 endif endfunction " }}} |
From: <mi...@us...> - 2002-11-20 10:04:16
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite In directory sc8-pr-cvs1:/tmp/cvs-serv26956 Modified Files: texrc Log Message: new setting g:Tex_UseMenuWizard Index: texrc =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/texrc,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** texrc 17 Nov 2002 01:01:46 -0000 1.11 --- texrc 20 Nov 2002 10:04:13 -0000 1.12 *************** *** 4,8 **** " Author: Srinath Avadhanula " Created: Mon Apr 01 11:00 AM 2002 PST ! " Last Change: Sat Nov 16 05:00 PM 2002 PST " " Description: This file contains resource configuration information for the --- 4,8 ---- " Author: Srinath Avadhanula " Created: Mon Apr 01 11:00 AM 2002 PST ! " Last Change: pon lis 18 11:00 2002 C " " Description: This file contains resource configuration information for the *************** *** 249,252 **** --- 249,256 ---- TexLet g:Tex_EnvironmentMaps = 1 TexLet g:Tex_EnvironmentMenus = 1 + + " Use wizards for environments during choosing from menu or templates as from + " shortcuts. + TexLet g:Tex_UseMenuWizard = 0 " }}} |
From: <sri...@us...> - 2002-11-20 07:35:31
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite In directory sc8-pr-cvs1:/tmp/cvs-serv9614 Modified Files: folding.vim Log Message: Bug: an \appendix after a \section gets folded in with it. Make section folds end also with an \appendix\W line. When will this all end? There could presumably be hundreds of other things which can end a section? Is there a _correct_ way to do this? Index: folding.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/folding.vim,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** folding.vim 16 Nov 2002 10:14:04 -0000 1.6 --- folding.vim 20 Nov 2002 07:35:28 -0000 1.7 *************** *** 4,8 **** " Version: 1.0 " Created: Tue Apr 23 05:00 PM 2002 PST ! " Last Change: Sat Nov 16 02:00 AM 2002 PST " " Description: functions to interact with Syntaxfolds.vim --- 4,8 ---- " Version: 1.0 " Created: Tue Apr 23 05:00 PM 2002 PST ! " Last Change: Tue Nov 19 11:00 PM 2002 PST " " Description: functions to interact with Syntaxfolds.vim *************** *** 163,167 **** call AddSyntaxFoldItem ( \ '^\s*\\subsubsection\W', ! \ '^\s*\\subsubsection\W\|^\s*\\subsection\W\|^\s*\\section\W\|^\s*%%fakesection\|^\s*\\chapter\W\|^\s*\\begin{slide', \ 0, \ -1, --- 163,167 ---- call AddSyntaxFoldItem ( \ '^\s*\\subsubsection\W', ! \ '^\s*\\appendix\W\|^\s*\\subsubsection\W\|^\s*\\subsection\W\|^\s*\\section\W\|^\s*%%fakesection\|^\s*\\chapter\W\|^\s*\\begin{slide', \ 0, \ -1, *************** *** 171,175 **** call AddSyntaxFoldItem ( \ '^\s*\\subsection\W', ! \ '^\s*\\subsection\W\|^\s*\\section\W\|^\s*%%fakesection\|^\s*\\chapter\W\|^\s*\\begin{slide', \ 0, \ -1, --- 171,175 ---- call AddSyntaxFoldItem ( \ '^\s*\\subsection\W', ! \ '^\s*\\appendix\W\|^\s*\\subsection\W\|^\s*\\section\W\|^\s*%%fakesection\|^\s*\\chapter\W\|^\s*\\begin{slide', \ 0, \ -1, *************** *** 179,183 **** call AddSyntaxFoldItem ( \ '^\s*\\section\W', ! \ '^\s*\\section\W\|^\s*%%fakesection\|^\s*\\chapter\W\|^\s*\\begin{slide', \ 0, \ -1, --- 179,183 ---- call AddSyntaxFoldItem ( \ '^\s*\\section\W', ! \ '^\s*\\appendix\W\|^\s*\\section\W\|^\s*%%fakesection\|^\s*\\chapter\W\|^\s*\\begin{slide', \ 0, \ -1, *************** *** 187,191 **** call AddSyntaxFoldItem ( \ '^\s*%%fakesection', ! \ '^\s\\section\W\|^\s*%%fakesection\|^\s*\\chapter\W\|^\s*\\begin{slide', \ 0, \ -1, --- 187,191 ---- call AddSyntaxFoldItem ( \ '^\s*%%fakesection', ! \ '^\s*\\appendix\W\|^\s\\section\W\|^\s*%%fakesection\|^\s*\\chapter\W\|^\s*\\begin{slide', \ 0, \ -1, *************** *** 195,199 **** call AddSyntaxFoldItem( \ '^\s*\\chapter\W', ! \ '^\s*\\chapter\W\|^\s*\\begin{slide', \ 0, \ -1 --- 195,199 ---- call AddSyntaxFoldItem( \ '^\s*\\chapter\W', ! \ '^\s*\\appendix\W\|^\s*\\chapter\W\|^\s*\\begin{slide', \ 0, \ -1 *************** *** 203,207 **** call AddSyntaxFoldItem ( \ '^\s*\\begin{slide', ! \ '^\s*\\chapter\W\|^\s*\\begin{slide', \ 0, \ 0 --- 203,207 ---- call AddSyntaxFoldItem ( \ '^\s*\\begin{slide', ! \ '^\s*\\appendix\W\|^\s*\\chapter\W\|^\s*\\begin{slide', \ 0, \ 0 |
From: <sri...@us...> - 2002-11-20 06:27:58
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite In directory sc8-pr-cvs1:/tmp/cvs-serv26671 Modified Files: main.vim Log Message: remove the TCTarget and TVTarget commands from main.vim. These commands are now issued from compiler/tex.vim Index: main.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/main.vim,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** main.vim 17 Nov 2002 03:38:00 -0000 1.8 --- main.vim 20 Nov 2002 06:27:55 -0000 1.9 *************** *** 4,8 **** " Email: sr...@fa... " URL: ! " Last Change: Sat Nov 16 06:00 PM 2002 PST " " Help: --- 4,8 ---- " Email: sr...@fa... " URL: ! " Last Change: Tue Nov 19 10:00 PM 2002 PST " " Help: *************** *** 523,530 **** end end ! exe 'TCTarget '.g:Tex_DefaultTargetFormat ! exe 'TVTarget '.g:Tex_DefaultTargetFormat ! " compiler. if the user has put another compiler before ours, then we dont ! " get into our compiler/tex.vim. runtime compiler/tex.vim endfunction --- 523,529 ---- end end ! " This line seems to be necessary to source our compiler/tex.vim file. ! " The docs are unclear why this needs to be done even though this file is ! " the first compiler plugin in 'runtimepath'. runtime compiler/tex.vim endfunction |
From: <sri...@us...> - 2002-11-20 06:11:36
|
Update of /cvsroot/vim-latex/vimfiles In directory sc8-pr-cvs1:/tmp/cvs-serv22271 Modified Files: makefile Log Message: . also add in .vim files from ftplugin/tex/ directory. That directory will contain externally contributed packages from now on. Index: makefile =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/makefile,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** makefile 4 Nov 2002 15:39:24 -0000 1.7 --- makefile 20 Nov 2002 06:11:34 -0000 1.8 *************** *** 14,17 **** --- 14,18 ---- # ftplugins zip latexSuite.zip ftplugin/tex_latexSuite.vim + zip latexSuite.zip ftplugin/tex/*.vim # files in the latex-suite directory. Skip the CVS files. zip -R latexSuite.zip `find ftplugin/latex-suite -name '*' | grep -v CVS` |
From: <sri...@us...> - 2002-11-20 05:54:01
|
Update of /cvsroot/vim-latex/vimfiles/compiler In directory sc8-pr-cvs1:/tmp/cvs-serv17917 Modified Files: tex.vim Log Message: Changed the algorithm for setting &makeprg to minimize the duplication in here and in ftplugin/latex-suite/compiler.vim. Therefore if g:Tex_DefaultTargetFormat exists, then it is assumed that that variable came from latex-suite, which means that TTarget exists. Therefore use that to set the &makeprg. Please take a look and see if this is better than before. NOTE: I will also change main.vim shortly, so that the TCTarget and TVTarget commands are removed from SetTexOptions, because that part is now being taken care of here. Index: tex.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/compiler/tex.vim,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tex.vim 8 Nov 2002 18:05:20 -0000 1.3 --- tex.vim 20 Nov 2002 05:53:56 -0000 1.4 *************** *** 3,7 **** " Original Author: Artem Chuprina <ra...@ra...> " Customization: Srinath Avadhanula <sr...@fa...> ! " Last Change: Fri Nov 08 05:00 AM 2002 P " Description: {{{ " This file sets the 'makeprg' and 'errorformat' options for the LaTeX --- 3,7 ---- " Original Author: Artem Chuprina <ra...@ra...> " Customization: Srinath Avadhanula <sr...@fa...> ! " Last Change: Tue Nov 19 09:00 PM 2002 PST " Description: {{{ " This file sets the 'makeprg' and 'errorformat' options for the LaTeX *************** *** 107,128 **** " ============================================================================== " Customization of 'makeprg': {{{ ! " 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 the user wants a particular way in which the latex compiler needs to be ! " called, then he should use the g:Tex_CompilerFormat variable. This variable ! " needs to be complete, i.e it should contain $* and stuff. ! if exists('g:Tex_CompilerFormat') ! let &l:makeprg = current_compiler.' '.g:Tex_CompilerFormat else ! if exists('g:Tex_EscapeChars') " Use this if LaTeX Suite is installed. ! let escChars = g:Tex_EscapeChars ! elseif has('win32') let escChars = '' else --- 107,157 ---- " ============================================================================== " 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 |
From: <sri...@us...> - 2002-11-17 03:45:42
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/tex In directory usw-pr-cvs1:/tmp/cvs-serv13322 Added Files: brackets.vim Log Message: Various polymorphic macros from Carl Mueller (auctex.vim) . <M-b> encloses the previous character in \mathbf{} . <M-c> is polymorphic as follows: Insert mode: 1. If the previous character is a letter or number, then capitalize it and enclose it in \mathcal{} 2. otherwise insert \cite{} Visual Mode: 1. Enclose selection in \mathcal{} . <M-l> is also polymorphic as follows: If the character before typing <M-l> is one of '([{|<q', then do the following: 1. (<M-l> \left(\right similarly for [, | {<M-l> \left\{\right\} 2. <<M-l> \langle\rangle 3. q<M-l> \lefteqn{} otherwise insert \label{} These functions make it extremeley easy to do all the \left \right stuff in latex. Thanks to Carl Mueller for these. --- NEW FILE: brackets.vim --- " ============================================================================== " Author: Carl Mueller " (incorporated into latex-suite by Srinath Avadhanula) " Last Change: Sat Nov 16 06:00 PM 2002 PST " Desciption: " ============================================================================== " ============================================================================== " Boldface: Mapping <M-b> to insert \mathbf{} {{{ " Insert Mode: " Typing <M-b> after a character capitalizes it and encloses it in \mathbf{} " Visual Mode: " Encloses the selected portion in \mathbf{} inoremap <buffer> <silent> <M-b> <Left>\mathbf{<Right>}<Esc>hvUla vnoremap <buffer> <silent> <M-b> <C-C>`>a}<Esc>`<i\mathbf{<Esc> " }}} " ============================================================================== " MathCal: Mapping <M-c> to insert \mathcal{} or \cite{} {{{ " Insert Mode: " 1. If the previous character is a letter or number, then capitalize it and " enclose it in \mathcal{} " 2. otherwise insert \cite{«»}«» " Visual Mode: " 1. Enclose selection in \mathcal{} inoremap <buffer> <silent> <M-c> <C-R>=<SID>MathCal()<CR> if !exists('*s:MathCal') function! s:MathCal() let line = getline(line(".")) let char = line[col(".")-2] if char =~ '[a-zA-Z0-9]' return "\<BS>".'\mathcal{'.toupper(char).'}' else return IMAP_PutTextWithMovement('\cite{«»}«»') endif endfunction endif vnoremap <buffer> <silent> <M-c> <C-C>`>a}<Esc>`<i\mathcal{<Esc> " }}} " ============================================================================== " LeftRight: Function for inserting \left and \right in front of bracket chars " in various ways using <M-l>. If not possible, insert \label{«»}«» " {{{ " inoremap <buffer> <silent> <M-l> <C-r>=<SID>LeftRight()<CR> nnoremap <buffer> <silent> <M-l> :call <SID>PutLeftRight()<CR> if !exists('*s:LeftRight') " LeftRight: maps <M-l> in insert mode. {{{ " This is a polymorphic function, which maps the behaviour of <M-l> in the " following way: " If the character before typing <M-l> is one of '([{|<q', then do the " following: " 1. (<M-l> \left(«»\right«» " similarly for [, | " {<M-l> \left\{«»\right\}«» " 2. <<M-l> \langle«»\rangle«» " 3. q<M-l> \lefteqn{«»}«» " otherwise insert \label{«»}«» function! s:LeftRight() let line = getline(line(".")) let char = line[col(".")-2] let previous = line[col(".")-3] let matchedbrackets = '()[]{}||' if char =~ '(\|\[\|{\||' let add = '' if char =~ '{' let add = "\\" endif let rhs = matchstr(matchedbrackets, char.'\zs.\ze') return "\<BS>".IMAP_PutTextWithMovement('\left'.add.char.'«»\right'.add.rhs.'«»') elseif char == '<' return "\<BS>".IMAP_PutTextWithMovement('langle«»\rangle«»') elseif char == 'q' return "\<BS>".IMAP_PutTextWithMovement('\lefteqn{«»}«»') else return '\label{«»}«»' endif endfunction " }}} " PutLeftRight: maps <M-l> in normal mode {{{ " Put \left...\right in front of the matched brackets. function! s:PutLeftRight() let previous = getline(line("."))[col(".") - 2] let char = getline(line("."))[col(".") - 1] if previous == '\' if char == '{' exe "normal ileft\\\<Esc>l%iright\\\<Esc>l%" elseif char == '}' exe "normal iright\\\<Esc>l%ileft\\\<Esc>l%" endif elseif char =~ '\[\|(' exe "normal i\\left\<Esc>l%i\\right\<Esc>l%" elseif char =~ '\]\|)' exe "normal i\\right\<Esc>l%i\\left\<Esc>l%" endif endfunction " }}} endif " }}} " ============================================================================== " vim:fdm=marker |
From: <sri...@us...> - 2002-11-17 03:40:10
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite In directory usw-pr-cvs1:/tmp/cvs-serv11884 Modified Files: envmacros.vim Log Message: In Tex_DoEnvironment, only use the current line if it is of the form word or word* i.e, ignore lines which contain non word characters. Index: envmacros.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/envmacros.vim,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** envmacros.vim 17 Nov 2002 00:43:27 -0000 1.7 --- envmacros.vim 17 Nov 2002 03:40:07 -0000 1.8 *************** *** 3,7 **** " Author: Mikolaj Machowski " Created: Tue Apr 23 08:00 PM 2002 PST ! " Last Change: Sat Nov 16 04:00 PM 2002 PST " " Description: mappings/menus for environments. --- 3,7 ---- " Author: Mikolaj Machowski " Created: Tue Apr 23 08:00 PM 2002 PST ! " Last Change: Sat Nov 16 07:00 PM 2002 PST " " Description: mappings/menus for environments. *************** *** 495,501 **** " that as the name of a new environment. function! Tex_DoEnvironment(...) - let l = getline('.') if a:0 < 1 ! let env = matchstr(l, '^\s*\zs.*') if env == '' let env = PromptForEnvironment('Choose which environment to insert :') --- 495,500 ---- " that as the name of a new environment. function! Tex_DoEnvironment(...) if a:0 < 1 ! let env = matchstr(getline('.'), '^\s*\zs\w*\*\=\ze\s*$') if env == '' let env = PromptForEnvironment('Choose which environment to insert :') *************** *** 504,510 **** endif else ! let ind = matchstr(l, '^\s*\ze') ! normal 0D ! return Tex_PutEnvironment(ind, env) endif else --- 503,508 ---- endif else ! normal! 0D ! return Tex_PutEnvironment(env) endif else *************** *** 526,529 **** --- 524,531 ---- elseif exists('*Tex_'.a:env) exe 'return Tex_'.a:env.'(a:env)' + elseif a:env == '$$' + return IMAP_PutTextWithMovement('$$«»$$') + elseif a:env == '[' + return IMAP_PutTextWithMovement("\\[\<CR>«»\<CR>\\]«»") else return IMAP_PutTextWithMovement('\begin{'.a:env."}\<cr>«»\<cr>\\end{".a:env."}«»") |
From: <sri...@us...> - 2002-11-17 03:38:08
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite In directory usw-pr-cvs1:/tmp/cvs-serv10862 Modified Files: main.vim Log Message: . added the function TexFormatLine and TexFill from Carl Mueller. These functions map the <space> key in a way that $'s are not split across lines. Index: main.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/main.vim,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** main.vim 12 Nov 2002 18:54:53 -0000 1.7 --- main.vim 17 Nov 2002 03:38:00 -0000 1.8 *************** *** 4,8 **** " Email: sr...@fa... " URL: ! " Last Change: Mon Nov 11 09:00 PM 2002 PST " " Help: --- 4,8 ---- " Email: sr...@fa... " URL: ! " Last Change: Sat Nov 16 06:00 PM 2002 PST " " Help: *************** *** 316,319 **** --- 316,371 ---- endif endfunction " }}} + " TexFormatLine: format line retaining $$'s on the same line. {{{ + function! s:TexFill(width) " {{{ + if col(".") > a:width + exe "normal! a##\<Esc>" + call <SID>TexFormatLine(a:width) + exe "normal! ?##\<CR>2s\<Esc>" + endif + endfunction + + " }}} + function! s:TexFormatLine(width) " {{{ + let first = strpart(getline(line(".")),0,1) + normal! $ + let length = col(".") + let go = 1 + while length > a:width+2 && go + let between = 0 + let string = strpart(getline(line(".")),0,a:width) + " Count the dollar signs + let number_of_dollars = 0 + let evendollars = 1 + let counter = 0 + while counter <= a:width-1 + if string[counter] == '$' && string[counter-1] != '\' " Skip \$. + let evendollars = 1 - evendollars + let number_of_dollars = number_of_dollars + 1 + endif + let counter = counter + 1 + endwhile + " Get ready to split the line. + exe "normal! " . (a:width + 1) . "|" + if evendollars + " Then you are not between dollars. + exe "normal! ?\\$\\| \<CR>W" + else + " Then you are between dollars. + normal! F$ + if col(".") == 1 || strpart(getline(line(".")),col(".")-1,1) != "$" + let go = 0 + endif + endif + if first == '$' && number_of_dollars == 1 + let go = 0 + else + exe "normal! i\<CR>\<Esc>$" + let first = strpart(getline(line(".")),0,1) + endif + let length = col(".") + endwhile + endfunction + " }}} + " }}} " ============================================================================== *************** *** 449,452 **** --- 501,514 ---- inoremap <buffer> <silent> <BS> <C-R>=<SID>SmartBS(<SID>SmartBS_pat())<CR> inoremap <buffer> <silent> . <C-R>=<SID>SmartDots()<CR> + " for FormatLine {{{ + if &l:tw > 0 + let b:tw = &l:tw + else + let b:tw = 79 + endif + " The following is necessary for TexFormatLine() and TexFill() + setlocal tw=0 + inoremap <buffer> <silent> <Space> <Space><Esc>:call <SID>TexFill(b:tw)<CR>a + " }}} " viewing/searching if !hasmapto('RunLaTeX') |
From: <sri...@us...> - 2002-11-17 01:01:52
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite In directory usw-pr-cvs1:/tmp/cvs-serv25753 Modified Files: texrc Log Message: . extended g:Tex_IgnoredWarnings by \'There were undefined references¡'. \'Citation %.%# undefined¡' These are for ignoring undefined citations. The user sets TClevel to 4 when he does want to bother with citations. Document this! Index: texrc =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/texrc,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** texrc 11 Nov 2002 08:54:17 -0000 1.10 --- texrc 17 Nov 2002 01:01:46 -0000 1.11 *************** *** 4,8 **** " Author: Srinath Avadhanula " Created: Mon Apr 01 11:00 AM 2002 PST ! " Last Change: Mon Nov 11 12:00 AM 2002 PST " " Description: This file contains resource configuration information for the --- 4,8 ---- " Author: Srinath Avadhanula " Created: Mon Apr 01 11:00 AM 2002 PST ! " Last Change: Sat Nov 16 05:00 PM 2002 PST " " Description: This file contains resource configuration information for the *************** *** 133,149 **** " This is a handy way of specifying which warnings/errors to ignore. This is a " list of patterns seperated by '¡' ! " NOTE: There is trailing space at the end of the next line. This is ! " necessary!!! ! TexLet g:Tex_IgnoredWarnings = \'Underfull¡'. \'Overfull¡'. \'specifier changed to¡'. \'You have requested¡'. ! \'Missing number, treated as zero.' " the 'ignore level' of the 'efm'. A value of 4 says that the first 4 kinds of " warnings in the list above will be ignored. Use the command TCLevel to set a " level dynamically. ! TexLet g:Tex_IgnoreLevel = 4 " NOTE: The values of g:Tex_Flavor and g:Tex_CompilerFlags are provided as a --- 133,149 ---- " This is a handy way of specifying which warnings/errors to ignore. This is a " list of patterns seperated by '¡' ! TexLet g:Tex_IgnoredWarnings = \'Underfull¡'. \'Overfull¡'. \'specifier changed to¡'. \'You have requested¡'. ! \'Missing number, treated as zero.¡'. ! \'There were undefined references¡'. ! \'Citation %.%# undefined¡' " the 'ignore level' of the 'efm'. A value of 4 says that the first 4 kinds of " warnings in the list above will be ignored. Use the command TCLevel to set a " level dynamically. ! TexLet g:Tex_IgnoreLevel = 7 " NOTE: The values of g:Tex_Flavor and g:Tex_CompilerFlags are provided as a |
From: <sri...@us...> - 2002-11-17 00:43:31
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite In directory usw-pr-cvs1:/tmp/cvs-serv11836 Modified Files: envmacros.vim Log Message: changed the Tex_itemize and such functions (the specialized environment functions) to all use IMAP_PutTexWithMovement(). This allows the user's placeholder settings to be respected and also filetype specific indentation to be preserved even from menus. Previously, a choice made from the menu used to insert the placeholders even if the user had g:Imap_UsePlaceHolders = 0. New functions SetUpEnvironmentsPrompt() and PromptForEnvironment() for providing a consistent prompt for the user input. These functions will also be used in the coming version in Tex_Change... so that the same prompt is used. General janitorial work. Code clean up and prettification. Please check and report any bugs. Index: envmacros.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/envmacros.vim,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** envmacros.vim 15 Nov 2002 22:30:16 -0000 1.6 --- envmacros.vim 17 Nov 2002 00:43:27 -0000 1.7 *************** *** 3,7 **** " Author: Mikolaj Machowski " Created: Tue Apr 23 08:00 PM 2002 PST ! " Last Change: pi± lis 15 11:00 2002 C " " Description: mappings/menus for environments. --- 3,7 ---- " Author: Mikolaj Machowski " Created: Tue Apr 23 08:00 PM 2002 PST ! " Last Change: Sat Nov 16 04:00 PM 2002 PST " " Description: mappings/menus for environments. *************** *** 106,110 **** if g:Tex_Menus && g:Tex_EnvironmentMenus if wiz ! exe 'amenu '.location.' <plug><C-r>=Tex_MenuWizard("'.a:submenu.'", "'.a:name.'")<CR>' else exe 'amenu '.location." <plug><C-r>=IMAP_PutTextWithMovement('".a:irhs."')<CR>" --- 106,110 ---- if g:Tex_Menus && g:Tex_EnvironmentMenus if wiz ! exe 'amenu '.location.' <plug><C-r>=Tex_DoEnvironment("'.a:name.'")<CR>' else exe 'amenu '.location." <plug><C-r>=IMAP_PutTextWithMovement('".a:irhs."')<CR>" *************** *** 261,281 **** " ============================================================================== " Specialized functions for various environments " ============================================================================== " Tex_itemize: {{{ ! function! Tex_itemize(indent, env) ! exe 'normal i'.a:indent.'\begin{'.a:env."}\<cr>\\item \<cr>\\end{".a:env."}«»\<Up>" endfunction " }}} " Tex_description: {{{ ! function! Tex_description(indent, env) let itlabel = input('(Optional) Item label? ') if itlabel != '' let itlabel = '['.itlabel.']' endif ! exe 'normal i'.a:indent."\\begin{description}\<cr>\\item".itlabel." \<cr>\\end{description}«»\<Up>" endfunction " }}} " Tex_figure: {{{ ! function! Tex_figure(indent, env) let flto = input('Float to (htbp)? ') let caption = input('Caption? ') --- 261,288 ---- " ============================================================================== " Specialized functions for various environments + " + " All these functions are to be used as: + " + " inoremap <lhs> <C-r>=Tex_itemize('enumerate')<CR> + " nnoremap <lhs> i<C-r>=Tex_itemize('enumerate')<CR> + " + " and so on... " ============================================================================== " Tex_itemize: {{{ ! function! Tex_itemize(env) ! return IMAP_PutTextWithMovement('\begin{'.a:env."}\<cr>\\item «»\<cr>\\end{".a:env."}«»") endfunction " }}} " Tex_description: {{{ ! function! Tex_description(env) let itlabel = input('(Optional) Item label? ') if itlabel != '' let itlabel = '['.itlabel.']' endif ! return IMAP_PutTextWithMovement("\\begin{description}\<cr>\\item".itlabel." «»\<cr>\\end{description}«»") endfunction " }}} " Tex_figure: {{{ ! function! Tex_figure(env) let flto = input('Float to (htbp)? ') let caption = input('Caption? ') *************** *** 314,322 **** let figure = figure . centr let figure = figure . '\end{'.a:env.'}' ! exe 'normal i'.a:indent.figure."\<Esc>$" endfunction " }}} " Tex_table: {{{ ! function! Tex_table(indent, env) let flto = input('Float to (htbp)? ') let caption = input('Caption? ') --- 321,329 ---- let figure = figure . centr let figure = figure . '\end{'.a:env.'}' ! return IMAP_PutTextWithMovement(figure) endfunction " }}} " Tex_table: {{{ ! function! Tex_table(env) let flto = input('Float to (htbp)? ') let caption = input('Caption? ') *************** *** 354,362 **** endif let ret=ret.'\end{table}«»' ! exe 'normal i'.ret."\<Esc>?ä\<cr>:nohl\<cr>C" endfunction " }}} " Tex_tabular: {{{ ! function! Tex_tabular(indent, env) let pos = input('(Optional) Position (t b)? ') let format = input("Format ( l r c p{width} | @{text} )? ") --- 361,369 ---- endif let ret=ret.'\end{table}«»' ! return IMAP_PutTextWithMovement(ret) endfunction " }}} " Tex_tabular: {{{ ! function! Tex_tabular(env) let pos = input('(Optional) Position (t b)? ') let format = input("Format ( l r c p{width} | @{text} )? ") *************** *** 367,386 **** let format = '{'.format.'}' endif ! exe 'normal i'.a:indent.'\begin{'.a:env.'}'.pos.format."\<cr> \<cr>\\end{".a:env."}«»\<Up>" endfunction " }}} " Tex_eqnarray: {{{ ! function! Tex_eqnarray(indent, env) let label = input('Label? ') if label != '' let arrlabel = '\label{'.label."}\<cr> " else ! let arrlabel = ' ' endif ! exe 'normal i'.a:indent.'\begin{'.a:env."}\<cr>".arrlabel."\<cr>\\end{".a:env."}«»\<Up>" endfunction " }}} " Tex_list: {{{ ! function! Tex_list(indent, env) let label = input('Label (for \item)? ') if label != '' --- 374,393 ---- let format = '{'.format.'}' endif ! return IMAP_PutTextWithMovement('\begin{'.a:env.'}'.pos.format."\<cr> \<cr>\\end{".a:env."}«»") endfunction " }}} " Tex_eqnarray: {{{ ! function! Tex_eqnarray(env) let label = input('Label? ') if label != '' let arrlabel = '\label{'.label."}\<cr> " else ! let arrlabel = '' endif ! return IMAP_PutTextWithMovement('\begin{'.a:env."}\<cr>".arrlabel."«»\<cr>\\end{".a:env."}«»") endfunction " }}} " Tex_list: {{{ ! function! Tex_list(env) let label = input('Label (for \item)? ') if label != '' *************** *** 393,401 **** let label = '' endif ! exe 'normal i'.a:indent.'\begin{list}'.label."\<cr>\\item \<cr>\\end{list}«»\<Up>" endfunction " }}} " Tex_document: {{{ ! function! Tex_document(indent, env) let dstyle = input('Document style? ') let opts = input('(Optional) Options? ') --- 400,408 ---- let label = '' endif ! return IMAP_PutTextWithMovement('\begin{list}'.label."\<cr>\\item \<cr>\\end{list}«»") endfunction " }}} " Tex_document: {{{ ! function! Tex_document(env) let dstyle = input('Document style? ') let opts = input('(Optional) Options? ') *************** *** 406,414 **** let foo = foo.'['.opts.']'.'{'.dstyle.'}' endif ! exe 'normal i'.a:indent.foo."\<cr>\<cr>\\begin{document}\<cr>\<cr>\\end{document}\<Up>" endfunction " }}} " Tex_minipage: {{{ ! function! Tex_minipage(indent, env) let foo = '\begin{minipage}' let pos = input('(Optional) Position (t b)? ') --- 413,421 ---- let foo = foo.'['.opts.']'.'{'.dstyle.'}' endif ! return IMAP_PutTextWithMovement(foo."\<cr>\<cr>\\begin{document}\<cr>«»\<cr>\\end{document}") endfunction " }}} " Tex_minipage: {{{ ! function! Tex_minipage(env) let foo = '\begin{minipage}' let pos = input('(Optional) Position (t b)? ') *************** *** 419,427 **** let foo = foo.'['.pos.']{'.width.'}' endif ! exe 'normal i'.a:indent.foo."\<cr> \<cr>\\end{minipage}«»\<Up>" endfunction " }}} " Tex_thebibliography: {{{ ! function! Tex_thebibliography(indent, env) " AUC Tex: "Label for BibItem: 99" let indent = input('Indent for BibItem? ') --- 426,434 ---- let foo = foo.'['.pos.']{'.width.'}' endif ! return IMAP_PutTextWithMovement(foo."\<cr>«»\<cr>\\end{minipage}«»") endfunction " }}} " Tex_thebibliography: {{{ ! function! Tex_thebibliography(env) " AUC Tex: "Label for BibItem: 99" let indent = input('Indent for BibItem? ') *************** *** 434,466 **** endif let bar = bar.'{'.key.'}' ! exe 'normal i'.a:indent.'\begin{thebibliography}'.foo."\<cr>".bar." \<cr>\\end{thebibliography}«»\<Up>" endfunction " }}} ! " Merged contributions from Carl Mueller ! " asdf is a fake argument to recognize if call is coming from keyboard or from ! " menu ! inoremap <F5> <C-O>:call Tex_FFive_intelligent()<cr> ! noremap <F5> :call Tex_FFive_intelligent()<cr> ! function! Tex_FFive_intelligent() " {{{ let start_line = line('.') let pos = line('.').' | normal! '.virtcol('.').'|' if search('\\documentclass', 'bW') && search('\\begin{document}') let begin_line = search('\\begin{document}') if start_line < begin_line exe pos ! call Tex_package_from_line() else exe pos ! call Tex_DoEnvironment('asdf') endif elseif search('\\documentclass') exe pos ! call Tex_package_from_line() else exe pos ! call Tex_DoEnvironment('asdf') endif ! endfunction " }}} function! Tex_package_from_line() " {{{ " Function Tex_PutPackage is defined in packages.vim --- 441,561 ---- endif let bar = bar.'{'.key.'}' ! return IMAP_PutTextWithMovement('\begin{thebibliography}'.foo."\<cr>".bar." \<cr>\\end{thebibliography}«»\<Up>") endfunction " }}} ! " ============================================================================== ! " Contributions / suggestions from Carl Mueller (auctex.vim) ! " ============================================================================== ! let s:common_environments = 'equation,equation*,eqnarray,eqnarray*,[,$$,align,align*' ! ! " SetUpEnvironmentsPrompt: sets up a prompt string using s:common_environments {{{ ! " Description: ! " ! function! SetUpEnvironmentsPrompt() ! let num_common = GetListCount(s:common_environments) ! ! let i = 1 ! let s:common_env_prompt = "\n" ! ! while i < num_common ! ! let env1 = Tex_Strntok(s:common_environments, ',', i) ! let env2 = Tex_Strntok(s:common_environments, ',', i + 1) ! ! let s:common_env_prompt = s:common_env_prompt."(".i.") ".env1."\t".( strlen(env1) < 4 ? "\t" : "" )."(".(i+1).") ".env2."\n" ! ! let i = i + 2 ! endwhile ! let s:common_env_prompt = s:common_env_prompt."\n".'Enter number or name of environment :' ! endfunction " }}} ! " PromptForEnvironment: prompts for an environment {{{ ! " Description: ! function! PromptForEnvironment(ask) ! ! if !exists('s:common_env_prompt') ! call SetUpEnvironmentsPrompt() ! endif ! ! let inp = input(a:ask.s:common_env_prompt) ! if inp =~ '^[0-9]$' ! let env = Tex_Strntok(s:common_environments, ',', inp) ! else ! let env = inp ! endif ! ! return env ! endfunction " }}} ! " Tex_DoEnvironment: fast insertion of environments {{{ ! " Description: ! " The menus call this function with an argument (the name of the environment ! " to insert). The maps call this without any arguments. In this case, it ! " prompts for an environment to enter if the current line is empty. If ! " called without arguments and there is a word on the current line, then use ! " that as the name of a new environment. ! function! Tex_DoEnvironment(...) ! let l = getline('.') ! if a:0 < 1 ! let env = matchstr(l, '^\s*\zs.*') ! if env == '' ! let env = PromptForEnvironment('Choose which environment to insert :') ! if env != '' ! return Tex_PutEnvironment(env) ! endif ! else ! let ind = matchstr(l, '^\s*\ze') ! normal 0D ! return Tex_PutEnvironment(ind, env) ! endif ! else ! return Tex_PutEnvironment(a:1) ! endif ! endfunction " }}} ! " Tex_PutEnvironment: calls various specialized functions {{{ ! " Description: ! " Based on input argument, it calls various specialized functions. ! function! Tex_PutEnvironment(env) ! if a:env =~ "theorem\\|lemma\\|equation\\|eqnarray\\|align\\|multline" ! return Tex_eqnarray(a:env) ! elseif a:env =~ "enumerate\\|itemize\\|theindex\\|trivlist" ! return Tex_itemize(a:env) ! elseif a:env =~ "table\\|table*" ! return Tex_table(a:env) ! elseif a:env =~ "tabular\\|tabular*\\|array\\|array*" ! return Tex_tabular(a:env) ! elseif exists('*Tex_'.a:env) ! exe 'return Tex_'.a:env.'(a:env)' ! else ! return IMAP_PutTextWithMovement('\begin{'.a:env."}\<cr>«»\<cr>\\end{".a:env."}«»") ! endif ! endfunction " }}} ! ! inoremap <F5> <C-r>=Tex_FastEnvironmentInsert()<cr> ! nnoremap <F5> i<C-r>=Tex_FastEnvironmentInsert()<cr> ! ! function! Tex_FastEnvironmentInsert() " {{{ ! let start_line = line('.') let pos = line('.').' | normal! '.virtcol('.').'|' + if search('\\documentclass', 'bW') && search('\\begin{document}') let begin_line = search('\\begin{document}') if start_line < begin_line exe pos ! return Tex_package_from_line() else exe pos ! return Tex_DoEnvironment() endif elseif search('\\documentclass') exe pos ! return Tex_package_from_line() else exe pos ! return Tex_DoEnvironment() endif ! endfunction ! ! " }}} function! Tex_package_from_line() " {{{ " Function Tex_PutPackage is defined in packages.vim *************** *** 470,515 **** let pack = input('Package? ') if pack != '' ! call Tex_PutPackage(pack) endif return 0 else normal 0D ! call Tex_PutPackage(pack) ! endif ! endfunction " }}} ! ! ! function! Tex_DoEnvironment(env) " {{{ ! let l = getline('.') ! if a:env == 'asdf' ! let env = matchstr(l, '^\s*\zs.*') ! if env == '' ! let env = input('Environment? ') ! if env != '' ! call Tex_PutEnvironment(l, env) ! endif ! else ! let ind = matchstr(l, '^\s*\ze') ! normal 0D ! call Tex_PutEnvironment(ind, env) ! endif ! else ! call Tex_PutEnvironment(l, a:env) ! endif ! startinsert ! endfunction " }}} ! function! Tex_PutEnvironment(indent, env) " {{{ ! if a:env =~ "theorem\\|lemma\\|equation\\|eqnarray\\|align\\|multline" ! call Tex_eqnarray(a:indent, a:env) ! elseif a:env =~ "enumerate\\|itemize\\|theindex\\|trivlist" ! call Tex_itemize(a:indent, a:env) ! elseif a:env =~ "table\\|table*" ! call Tex_table(a:indent, a:env) ! elseif a:env =~ "tabular\\|tabular*\\|array\\|array*" ! call Tex_tabular(a:indent, a:env) ! elseif exists('*Tex_'.a:env) ! exe 'call Tex_'.a:env.'(a:indent, a:env)' ! else ! exe 'normal i'.a:indent.'\begin{'.a:env."}\<cr> \<cr>\\end{".a:env."}«»\<Up>" endif endfunction " }}} --- 565,574 ---- let pack = input('Package? ') if pack != '' ! return Tex_PutPackage(pack) endif return 0 else normal 0D ! return Tex_PutPackage(pack) endif endfunction " }}} *************** *** 530,534 **** let s:math_environment = 'eqnarray,eqnarray*,align,align*,equation,equation*,[,$$' let s:item_environment = 'list,trivlist,enumerate,itemize,theindex' ! function Tex_change_environment() " {{{ let env_line = searchpair("\\[\\|begin{", '', "\\]\\|end{", "bn") if env_line != 0 --- 589,593 ---- let s:math_environment = 'eqnarray,eqnarray*,align,align*,equation,equation*,[,$$' let s:item_environment = 'list,trivlist,enumerate,itemize,theindex' ! function! Tex_change_environment() " {{{ let env_line = searchpair("\\[\\|begin{", '', "\\]\\|end{", "bn") if env_line != 0 *************** *** 660,662 **** " vim:fdm=marker:nowrap:noet - --- 719,720 ---- |
From: <sri...@us...> - 2002-11-16 10:14:08
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite In directory usw-pr-cvs1:/tmp/cvs-serv26041 Modified Files: folding.vim Log Message: Bug: folding of a section flows doesn't stop with the beginning of next chapter. Redefined the end fold pattern for all section environments more consistently and completely. Index: folding.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/folding.vim,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** folding.vim 28 Oct 2002 06:37:23 -0000 1.5 --- folding.vim 16 Nov 2002 10:14:04 -0000 1.6 *************** *** 4,8 **** " Version: 1.0 " Created: Tue Apr 23 05:00 PM 2002 PST ! " Last Change: Sun Oct 27 10:00 PM 2002 PST " " Description: functions to interact with Syntaxfolds.vim --- 4,8 ---- " Version: 1.0 " Created: Tue Apr 23 05:00 PM 2002 PST ! " Last Change: Sat Nov 16 02:00 AM 2002 PST " " Description: functions to interact with Syntaxfolds.vim *************** *** 163,167 **** call AddSyntaxFoldItem ( \ '^\s*\\subsubsection\W', ! \ '^\s*%%fakesection\|^\s*\\section\|^\s*\\subsection\|^\s*\\subsubsection\|^\s*\\end{document}', \ 0, \ -1, --- 163,167 ---- call AddSyntaxFoldItem ( \ '^\s*\\subsubsection\W', ! \ '^\s*\\subsubsection\W\|^\s*\\subsection\W\|^\s*\\section\W\|^\s*%%fakesection\|^\s*\\chapter\W\|^\s*\\begin{slide', \ 0, \ -1, *************** *** 171,175 **** call AddSyntaxFoldItem ( \ '^\s*\\subsection\W', ! \ '^\s*%%fakesection\|^\s*\\section\|^\s*\\subsection\|^\s*\\end{document}', \ 0, \ -1, --- 171,175 ---- call AddSyntaxFoldItem ( \ '^\s*\\subsection\W', ! \ '^\s*\\subsection\W\|^\s*\\section\W\|^\s*%%fakesection\|^\s*\\chapter\W\|^\s*\\begin{slide', \ 0, \ -1, *************** *** 179,191 **** call AddSyntaxFoldItem ( \ '^\s*\\section\W', ! \ '^\s*%%fakesection\|^\s*\\section\|^\s*\\end{document}', \ 0, \ -1, \ ) " }}} ! " {{{ fakesection (for forcing a fold item manually) call AddSyntaxFoldItem ( \ '^\s*%%fakesection', ! \ '^\s*%%fakesection\|^\s*\\section\|^\s*\\subsection\|^\s*\\subsubsection\|^\s*\\end{document}', \ 0, \ -1, --- 179,191 ---- call AddSyntaxFoldItem ( \ '^\s*\\section\W', ! \ '^\s*\\section\W\|^\s*%%fakesection\|^\s*\\chapter\W\|^\s*\\begin{slide', \ 0, \ -1, \ ) " }}} ! " {{{ fakesection (for forcinga fold item manually) call AddSyntaxFoldItem ( \ '^\s*%%fakesection', ! \ '^\s\\section\W\|^\s*%%fakesection\|^\s*\\chapter\W\|^\s*\\begin{slide', \ 0, \ -1, *************** *** 193,199 **** " }}} " {{{ chapter ! call AddSyntaxFoldItem ( ! \ '^\s*\\chapter\*\={', ! \ '^\s*\\section', \ 0, \ -1 --- 193,199 ---- " }}} " {{{ chapter ! call AddSyntaxFoldItem( ! \ '^\s*\\chapter\W', ! \ '^\s*\\chapter\W\|^\s*\\begin{slide', \ 0, \ -1 *************** *** 203,207 **** call AddSyntaxFoldItem ( \ '^\s*\\begin{slide', ! \ '^\s*\\end{slide', \ 0, \ 0 --- 203,207 ---- call AddSyntaxFoldItem ( \ '^\s*\\begin{slide', ! \ '^\s*\\chapter\W\|^\s*\\begin{slide', \ 0, \ 0 |
From: <mi...@us...> - 2002-11-15 22:31:11
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/packages In directory usw-pr-cvs1:/tmp/cvs-serv30300 Added Files: amsthm amsxtra Log Message: new package files --- NEW FILE: amsthm --- let TeX_package_option_amsthm = '' let TeX_package_amsthm = \ 'env:proof,' \.'nor:swapnumbers,' \.'brd:newtheorem,' \.'brd:newtheorem*,' \.'nor:theoremstyle{plain},' \.'nor:theoremstyle{definition},' \.'nor:theoremstyle{remark},' \.'nor:newtheoremstyle,' \.'nor:qedsymbol,' \.'nor:qed,' \.'nor:qedhere' --- NEW FILE: amsxtra --- let g:TeX_package_option_amsxtra = '' let g:TeX_package_amsxtra = \ 'nor:sphat,' \.'nor:sptilde' |
From: <mi...@us...> - 2002-11-15 22:30:27
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite In directory usw-pr-cvs1:/tmp/cvs-serv30001 Modified Files: packages.vim Log Message: Added Tex_PutPackage() - inserting package from line and updating menus if available Index: packages.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/packages.vim,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** packages.vim 10 Nov 2002 18:09:39 -0000 1.8 --- packages.vim 15 Nov 2002 22:30:25 -0000 1.9 *************** *** 4,8 **** " Version: 1.0 " Created: Tue Apr 23 06:00 PM 2002 PST ! " Last Change: nie lis 10 06:00 2002 C " " Description: handling packages from within vim --- 4,8 ---- " Version: 1.0 " Created: Tue Apr 23 06:00 PM 2002 PST ! " Last Change: pi± lis 15 11:00 2002 C " " Description: handling packages from within vim *************** *** 361,364 **** --- 361,374 ---- " }}} + " Tex_PutPackage: inserts package from line {{{ + " (see Tex_package_from_line in envmacros.vim) + function! Tex_PutPackage(package) + if filereadable(s:path."/packages/".a:package) + call Tex_pack_supp(a:package) + call Tex_pack_updateall() + else + exe 'normal i\usepackage{'.a:package."}\<Esc>$" + endif + endfunction " }}} if g:Tex_Menus |
From: <mi...@us...> - 2002-11-15 22:30:19
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite In directory usw-pr-cvs1:/tmp/cvs-serv29927 Modified Files: envmacros.vim Log Message: - replaced "" with '' wherever it was possible. Vim parses each "" looking for special chars, reducing number of these even if this is worth only 1/1000s (or less) per "" can be worth over 1s for whole lS. And 1s is looong for Vim users :) If you agree I will do it for all files. - Removed bugs mentioned by Srinatha: wrong detection of environment with <S-F5> and inserting second label. Could you describe more bugs? - <F5> in now "intelligent". It can recognize if it is in preamble or body of the document. If in preamble takes line as an argument or asks for it and inserts \usepackage{argument} line. If package is supported makes appropriate corrections. If in body similar actions ar taken with environment. - removed function s:ChangeEnvironment and shortcuts as redundant Index: envmacros.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/envmacros.vim,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** envmacros.vim 14 Nov 2002 23:02:53 -0000 1.5 --- envmacros.vim 15 Nov 2002 22:30:16 -0000 1.6 *************** *** 3,7 **** " Author: Mikolaj Machowski " Created: Tue Apr 23 08:00 PM 2002 PST ! " Last Change: pi± lis 15 12:00 2002 C " " Description: mappings/menus for environments. --- 3,7 ---- " Author: Mikolaj Machowski " Created: Tue Apr 23 08:00 PM 2002 PST ! " Last Change: pi± lis 15 11:00 2002 C " " Description: mappings/menus for environments. *************** *** 59,63 **** if g:Tex_EnvironmentMaps && !exists('s:doneOnce') ! call IMAP (a:lhs, "\\begin{".a:name."}\<CR>".extra."«»\<CR>\\end{".a:name."}«»", 'tex') exec 'vnoremap <silent> '.vlhs.' '.vrhs endif --- 59,63 ---- if g:Tex_EnvironmentMaps && !exists('s:doneOnce') ! call IMAP (a:lhs, '\begin{'.a:name."}\<CR>".extra."«»\<CR>\\end{".a:name."}«»", 'tex') exec 'vnoremap <silent> '.vlhs.' '.vrhs endif *************** *** 123,127 **** if g:Tex_SectionMaps && !exists('s:doneOnce') exe 'vnoremap '.vlhs.' '.vrhs ! call IMAP (a:lhs, "\\".a:name."{«»}«»", 'tex') endif --- 123,127 ---- if g:Tex_SectionMaps && !exists('s:doneOnce') exe 'vnoremap '.vlhs.' '.vrhs ! call IMAP (a:lhs, "\\".a:name.'{«»}«»', 'tex') endif *************** *** 135,142 **** let advvrhs = "\<C-\\>\<C-N>:call Tex_VisSecAdv('".a:name."')\<CR>" ! exe 'amenu '.advlocation." <plug>".advirhs exe 'vnoremenu '.advlocation." ".advvrhs ! exe 'amenu '.location." <plug>".irhs exe 'vnoremenu '.location." ".vrhs endif --- 135,142 ---- let advvrhs = "\<C-\\>\<C-N>:call Tex_VisSecAdv('".a:name."')\<CR>" ! exe 'amenu '.advlocation.' <plug>'.advirhs exe 'vnoremenu '.advlocation." ".advvrhs ! exe 'amenu '.location.' <plug>'.irhs exe 'vnoremenu '.location." ".vrhs endif *************** *** 191,195 **** " }}} " Lists {{{ ! call s:Tex_SpecialMacros("ELI", '&Lists.', 'list', "\\begin{list}{«label»}{«commands»}\<cr>\\item «»\<cr>\\end{list}«»") call s:Tex_EnvMacros('EEN', '&Lists.', 'enumerate') call s:Tex_EnvMacros('EIT', '&Lists.', 'itemize') --- 191,195 ---- " }}} " Lists {{{ ! call s:Tex_SpecialMacros('ELI', '&Lists.', 'list', "\\begin{list}{«label»}{«commands»}\<cr>\\item «»\<cr>\\end{list}«»") call s:Tex_EnvMacros('EEN', '&Lists.', 'enumerate') call s:Tex_EnvMacros('EIT', '&Lists.', 'itemize') *************** *** 198,202 **** " }}} " Tables {{{ ! call s:Tex_SpecialMacros("ETE", '&Tables.', 'table', "\\begin{table}\<cr>\\centering\<cr>\\caption{tab:ä}\<cr>\\begin{tabular}{«dimensions»}\<cr>«»\<cr>\\end{tabular}\<cr>\\label{tab:«label»}\<cr>\\end{table}«»") call s:Tex_EnvMacros('ETG', '&Tables.', 'tabbing') call s:Tex_EnvMacros('', '&Tables.', 'table*') --- 198,202 ---- " }}} " Tables {{{ ! call s:Tex_SpecialMacros('ETE', '&Tables.', 'table', "\\begin{table}\<cr>\\centering\<cr>\\caption{tab:ä}\<cr>\\begin{tabular}{«dimensions»}\<cr>«»\<cr>\\end{tabular}\<cr>\\label{tab:«label»}\<cr>\\end{table}«»") call s:Tex_EnvMacros('ETG', '&Tables.', 'tabbing') call s:Tex_EnvMacros('', '&Tables.', 'table*') *************** *** 214,218 **** " }}} " Structure {{{ ! call s:Tex_SpecialMacros("EAR", 'Math.', 'array', "\\leftä\<cr>\\begin{array}{«dimension»}\<cr>«elements»\<cr>\\end{array}\<cr>\\right«»") call s:Tex_EnvMacros('EAB', '&Structure.', 'abstract') call s:Tex_EnvMacros('EAP', '&Structure.', 'appendix') --- 214,218 ---- " }}} " Structure {{{ ! call s:Tex_SpecialMacros('EAR', 'Math.', 'array', "\\leftä\<cr>\\begin{array}{«dimension»}\<cr>«elements»\<cr>\\end{array}\<cr>\\right«»") call s:Tex_EnvMacros('EAB', '&Structure.', 'abstract') call s:Tex_EnvMacros('EAP', '&Structure.', 'appendix') *************** *** 248,260 **** " Miscellaneous {{{ call s:Tex_SpecialMacros('', '', '-sepenv1-', ' :', 0) ! call s:Tex_SpecialMacros("EFI", '', 'figure', "\\begin{figure}[«htpb»]\<cr>\\centerline{\\psfig{figure=«eps file»}}\<cr>\\caption{«caption text»}\<cr>\\label{fig:«label»}\<cr>\\end{figure}«»") call s:Tex_EnvMacros('', '', 'figure*') call s:Tex_EnvMacros('ELR', '', 'lrbox') ! call s:Tex_SpecialMacros("EMP", '', 'minipage', "\\begin{minipage}[«tb»]{«width»}\<cr>«»\<cr>\\end{minipage}«»") ! call s:Tex_SpecialMacros("EPI", '', 'picture', "\\begin{picture}(«width», «height»)(«xoff»,«yoff»)\<cr>\\put(«xoff»,«yoff»){\\framebox(«»,«»){«»}}\<cr>\\end{picture}«»") " }}} if g:Tex_CatchVisMapErrors ! exe "vnoremap ".g:Tex_Leader2." :\<C-u>call ExecMap('".g:Tex_Leader2."', 'v')\<CR>" endif --- 248,260 ---- " Miscellaneous {{{ call s:Tex_SpecialMacros('', '', '-sepenv1-', ' :', 0) ! call s:Tex_SpecialMacros('EFI', '', 'figure', "\\begin{figure}[«htpb»]\<cr>\\centerline{\\psfig{figure=«eps file»}}\<cr>\\caption{«caption text»}\<cr>\\label{fig:«label»}\<cr>\\end{figure}«»") call s:Tex_EnvMacros('', '', 'figure*') call s:Tex_EnvMacros('ELR', '', 'lrbox') ! call s:Tex_SpecialMacros('EMP', '', 'minipage', "\\begin{minipage}[«tb»]{«width»}\<cr>«»\<cr>\\end{minipage}«»") ! call s:Tex_SpecialMacros('EPI', '', 'picture', "\\begin{picture}(«width», «height»)(«xoff»,«yoff»)\<cr>\\put(«xoff»,«yoff»){\\framebox(«»,«»){«»}}\<cr>\\end{picture}«»") " }}} if g:Tex_CatchVisMapErrors ! exe 'vnoremap '.g:Tex_Leader2." :\<C-u>call ExecMap('".g:Tex_Leader2."', 'v')\<CR>" endif *************** *** 264,274 **** " Tex_itemize: {{{ function! Tex_itemize(indent, env) ! exe 'normal i'.a:indent."\\begin{".a:env."}\<cr>\\item \<cr>\\end{".a:env."}«»\<Up>" endfunction " }}} " Tex_description: {{{ function! Tex_description(indent, env) ! let itlabel = input("(Optional) Item label? ") ! if (itlabel != "") let itlabel = '['.itlabel.']' endif --- 264,274 ---- " Tex_itemize: {{{ function! Tex_itemize(indent, env) ! exe 'normal i'.a:indent.'\begin{'.a:env."}\<cr>\\item \<cr>\\end{".a:env."}«»\<Up>" endfunction " }}} " Tex_description: {{{ function! Tex_description(indent, env) ! let itlabel = input('(Optional) Item label? ') ! if itlabel != '' let itlabel = '['.itlabel.']' endif *************** *** 278,304 **** " Tex_figure: {{{ function! Tex_figure(indent, env) ! let flto = input("Float to (htbp)? ") ! let caption = input("Caption? ") ! let center = input("Center ([y]/n)? ") let label = input('Label (for use with \ref)? ') " additional to AUC Tex since my pics are usually external files ! let pic = input("Name of Pic-File? ") ! if (flto != "") ! let flto = "[".flto."]\<cr>" else let flto = "\<cr>" endif ! if (pic != "") ! let pic = "\\input{".pic."}\<cr>" else let pic = "ä\<cr>" endif ! if (caption != "") ! let caption = "\\caption{".caption."}\<cr>" endif ! if (label != "") ! let label = "\\label{fig:".label."}\<cr>" endif ! if (center == "y" || center == "") let centr = "\\begin{center}\<cr>" let centr = centr . pic --- 278,304 ---- " Tex_figure: {{{ function! Tex_figure(indent, env) ! let flto = input('Float to (htbp)? ') ! let caption = input('Caption? ') ! let center = input('Center ([y]/n)? ') let label = input('Label (for use with \ref)? ') " additional to AUC Tex since my pics are usually external files ! let pic = input('Name of Pic-File? ') ! if flto != '' ! let flto = '['.flto."]\<cr>" else let flto = "\<cr>" endif ! if pic != '' ! let pic = '\input{'.pic."}\<cr>" else let pic = "ä\<cr>" endif ! if caption != '' ! let caption = '\caption{'.caption."}\<cr>" endif ! if label != '' ! let label = '\label{fig:'.label."}\<cr>" endif ! if (center == 'y' || center == '') let centr = "\\begin{center}\<cr>" let centr = centr . pic *************** *** 311,317 **** let centr = centr . label endif ! let figure = "\\begin{".a:env."}".flto let figure = figure . centr ! let figure = figure . "\\end{".a:env."}" exe 'normal i'.a:indent.figure."\<Esc>$" endfunction --- 311,317 ---- let centr = centr . label endif ! let figure = '\begin{'.a:env.'}'.flto let figure = figure . centr ! let figure = figure . '\end{'.a:env.'}' exe 'normal i'.a:indent.figure."\<Esc>$" endfunction *************** *** 323,327 **** let center = input('Center (y/n)? ') let label = input('Label? ') ! if (flto != "") let flto ='['.flto."]\<cr>" else --- 323,327 ---- let center = input('Center (y/n)? ') let label = input('Label? ') ! if flto != '' let flto ='['.flto."]\<cr>" else *************** *** 329,339 **** endif let ret='\begin{table}'.flto ! if (center == "y") let ret=ret."\\begin{center}\<cr>" endif ! let foo = "\\begin{tabular}" let pos = input('(Optional) Position (t b)? ') ! if (pos!='') ! let foo = foo.'['.pos."]" else let foo = foo."\<cr>" --- 329,339 ---- endif let ret='\begin{table}'.flto ! if center == 'y' let ret=ret."\\begin{center}\<cr>" endif ! let foo = '\begin{tabular}' let pos = input('(Optional) Position (t b)? ') ! if pos != '' ! let foo = foo.'['.pos.']' else let foo = foo."\<cr>" *************** *** 344,365 **** endif let ret = ret.foo.'{'.format."}\<cr>ä\<cr>\\end{tabular}«»\<cr>" ! if (center == 'y') let ret=ret."\\end{center}\<cr>" endif ! if (caption != '') let ret=ret.'\caption{'.caption."}\<cr>" endif ! if (label != "") let ret=ret.'\label{tab:'.label."}\<cr>" endif ! let ret=ret."\\end{table}«»" ! exe "normal i".ret."\<Esc>?ä\<cr>:nohl\<cr>C" endfunction " }}} " Tex_tabular: {{{ function! Tex_tabular(indent, env) ! let pos = input("(Optional) Position (t b)? ") let format = input("Format ( l r c p{width} | @{text} )? ") ! if (pos != '') let pos = '['.pos.']' endif --- 344,365 ---- endif let ret = ret.foo.'{'.format."}\<cr>ä\<cr>\\end{tabular}«»\<cr>" ! if center == 'y' let ret=ret."\\end{center}\<cr>" endif ! if caption != '' let ret=ret.'\caption{'.caption."}\<cr>" endif ! if label != '' let ret=ret.'\label{tab:'.label."}\<cr>" endif ! let ret=ret.'\end{table}«»' ! exe 'normal i'.ret."\<Esc>?ä\<cr>:nohl\<cr>C" endfunction " }}} " Tex_tabular: {{{ function! Tex_tabular(indent, env) ! let pos = input('(Optional) Position (t b)? ') let format = input("Format ( l r c p{width} | @{text} )? ") ! if pos != '' let pos = '['.pos.']' endif *************** *** 367,382 **** let format = '{'.format.'}' endif ! exe 'normal i'.a:indent."\\begin{".a:env.'}'.pos.format."\<cr> \<cr>\\end{".a:env."}«»\<Up>" endfunction " }}} " Tex_eqnarray: {{{ function! Tex_eqnarray(indent, env) ! let label = input("Label? ") ! if (label != "") let arrlabel = '\label{'.label."}\<cr> " else ! let arrlabel = " " endif ! exe 'normal i'.a:indent."\\begin{".a:env."}\<cr>".arrlabel."\<cr>\\end{".a:env."}«»\<Up>" endfunction " }}} --- 367,382 ---- let format = '{'.format.'}' endif ! exe 'normal i'.a:indent.'\begin{'.a:env.'}'.pos.format."\<cr> \<cr>\\end{".a:env."}«»\<Up>" endfunction " }}} " Tex_eqnarray: {{{ function! Tex_eqnarray(indent, env) ! let label = input('Label? ') ! if label != '' let arrlabel = '\label{'.label."}\<cr> " else ! let arrlabel = ' ' endif ! exe 'normal i'.a:indent.'\begin{'.a:env."}\<cr>".arrlabel."\<cr>\\end{".a:env."}«»\<Up>" endfunction " }}} *************** *** 384,391 **** function! Tex_list(indent, env) let label = input('Label (for \item)? ') ! if (label != '') let label = '{'.label.'}' let addcmd = input('Additional commands? ') ! if (addcmd != '') let label = label . '{'.addcmd.'}' endif --- 384,391 ---- function! Tex_list(indent, env) let label = input('Label (for \item)? ') ! if label != '' let label = '{'.label.'}' let addcmd = input('Additional commands? ') ! if addcmd != '' let label = label . '{'.addcmd.'}' endif *************** *** 393,397 **** let label = '' endif ! exe 'normal i'.a:indent."\\begin{list}".label."\<cr>\\item \<cr>\\end{list}«»\<Up>" endfunction " }}} --- 393,397 ---- let label = '' endif ! exe 'normal i'.a:indent.'\begin{list}'.label."\<cr>\\item \<cr>\\end{list}«»\<Up>" endfunction " }}} *************** *** 401,405 **** let opts = input('(Optional) Options? ') let foo = '\documentclass' ! if (opts == '') let foo = foo.'{'.dstyle.'}' else --- 401,405 ---- let opts = input('(Optional) Options? ') let foo = '\documentclass' ! if opts == '' let foo = foo.'{'.dstyle.'}' else *************** *** 414,418 **** let pos = input('(Optional) Position (t b)? ') let width = input('Width? ') ! if (pos=="") let foo = foo.'{'.width.'}' else --- 414,418 ---- let pos = input('(Optional) Position (t b)? ') let width = input('Width? ') ! if pos == '' let foo = foo.'{'.width.'}' else *************** *** 428,434 **** let foo = '{'.indent.'}' let biblabel = input('(Optional) Bibitem label? ') ! let key = input("Add key? ") let bar = '\bibitem' ! if (biblabel != '') let bar = bar.'['.biblabel.']' endif --- 428,434 ---- let foo = '{'.indent.'}' let biblabel = input('(Optional) Bibitem label? ') ! let key = input('Add key? ') let bar = '\bibitem' ! if biblabel != '' let bar = bar.'['.biblabel.']' endif *************** *** 441,453 **** " asdf is a fake argument to recognize if call is coming from keyboard or from " menu ! inoremap <buffer> <F5> <C-0>:call Tex_DoEnvironment("asdf")<CR> ! noremap <buffer> <F5> :call Tex_DoEnvironment("asdf")<CR> function! Tex_DoEnvironment(env) " {{{ ! let l = getline(".") ! if a:env == "asdf" let env = matchstr(l, '^\s*\zs.*') if env == '' ! call Tex_PutEnvironment(l, input("Environment? ")) else let ind = matchstr(l, '^\s*\ze') --- 441,492 ---- " asdf is a fake argument to recognize if call is coming from keyboard or from " menu ! inoremap <F5> <C-O>:call Tex_FFive_intelligent()<cr> ! noremap <F5> :call Tex_FFive_intelligent()<cr> ! function! Tex_FFive_intelligent() " {{{ ! let start_line = line('.') ! let pos = line('.').' | normal! '.virtcol('.').'|' ! if search('\\documentclass', 'bW') && search('\\begin{document}') ! let begin_line = search('\\begin{document}') ! if start_line < begin_line ! exe pos ! call Tex_package_from_line() ! else ! exe pos ! call Tex_DoEnvironment('asdf') ! endif ! elseif search('\\documentclass') ! exe pos ! call Tex_package_from_line() ! else ! exe pos ! call Tex_DoEnvironment('asdf') ! endif ! endfunction " }}} ! function! Tex_package_from_line() " {{{ ! " Function Tex_PutPackage is defined in packages.vim ! let l = getline(".") ! let pack = matchstr(l, '^\s*\zs.*') ! if pack == '' ! let pack = input('Package? ') ! if pack != '' ! call Tex_PutPackage(pack) ! endif ! return 0 ! else ! normal 0D ! call Tex_PutPackage(pack) ! endif ! endfunction " }}} ! function! Tex_DoEnvironment(env) " {{{ ! let l = getline('.') ! if a:env == 'asdf' let env = matchstr(l, '^\s*\zs.*') if env == '' ! let env = input('Environment? ') ! if env != '' ! call Tex_PutEnvironment(l, env) ! endif else let ind = matchstr(l, '^\s*\ze') *************** *** 469,474 **** elseif a:env =~ "tabular\\|tabular*\\|array\\|array*" call Tex_tabular(a:indent, a:env) ! elseif exists("*Tex_".a:env) ! exe "call Tex_".a:env."(a:indent, a:env)" else exe 'normal i'.a:indent.'\begin{'.a:env."}\<cr> \<cr>\\end{".a:env."}«»\<Up>" --- 508,513 ---- elseif a:env =~ "tabular\\|tabular*\\|array\\|array*" call Tex_tabular(a:indent, a:env) ! elseif exists('*Tex_'.a:env) ! exe 'call Tex_'.a:env.'(a:indent, a:env)' else exe 'normal i'.a:indent.'\begin{'.a:env."}\<cr> \<cr>\\end{".a:env."}«»\<Up>" *************** *** 478,488 **** let b:DoubleDollars = 0 - inoremap <buffer> <C-F5> <C-O>:call <SID>ChangeEnvironment(input("Environment? "))<CR> - noremap <buffer> <C-F5> :call <SID>ChangeEnvironment(input("Environment? "))<CR> inoremap <buffer> <S-F5> <C-O>:call Tex_change_environment()<CR> ! noremap <buffer> <S-F5> :call Tex_change_environment()<CR> function! Tex_AmsLatex() " {{{ ! if g:Tex_package_supported =~ "amsmath" let amslatex = 1 endif --- 517,525 ---- let b:DoubleDollars = 0 inoremap <buffer> <S-F5> <C-O>:call Tex_change_environment()<CR> ! noremap <buffer> <S-F5> :call Tex_change_environment()<CR> function! Tex_AmsLatex() " {{{ ! if g:Tex_package_supported =~ 'amsmath' let amslatex = 1 endif *************** *** 494,506 **** let s:item_environment = 'list,trivlist,enumerate,itemize,theindex' function Tex_change_environment() " {{{ ! let env_line = searchpair("\\[\\|begin{", "", "\\]\\|end{", "bn") if env_line != 0 ! if getline(env_line) =~ "\\[" ! let env_name = "[" else let env_name = matchstr(getline(env_line), 'begin{\zs.\{-}\ze}') endif endif ! if !exists("env_name") echomsg "You are not inside environment" return 0 --- 531,543 ---- let s:item_environment = 'list,trivlist,enumerate,itemize,theindex' function Tex_change_environment() " {{{ ! let env_line = searchpair("\\[\\|begin{", '', "\\]\\|end{", "bn") if env_line != 0 ! if getline(env_line) !~ 'begin{' ! let env_name = '[' else let env_name = matchstr(getline(env_line), 'begin{\zs.\{-}\ze}') endif endif ! if !exists('env_name') echomsg "You are not inside environment" return 0 *************** *** 512,516 **** \ "(3) align (4) align*\n". \ "(5) equation* (6) other\n". ! \ "(7) leave unchanged\n". \ "Enter number: ')" if change_env == 1 --- 549,553 ---- \ "(3) align (4) align*\n". \ "(5) equation* (6) other\n". ! \ "<cr> leave unchanged\n". \ "Enter number: ')" if change_env == 1 *************** *** 525,533 **** call <SID>Change('equation*', 0, '&\|\\lefteqn{\|\\nonumber\|\\\\', 0) elseif change_env == 6 ! call <SID>Change(input('Environment? '), 0, '', '') ! elseif change_env == 7 return 0 else ! echomsg "Wrong argument" return 0 endif --- 562,574 ---- call <SID>Change('equation*', 0, '&\|\\lefteqn{\|\\nonumber\|\\\\', 0) elseif change_env == 6 ! let env = input('Environment? ') ! if env != '' ! call <SID>Change(env, 0, '', '') ! endif ! return 0 ! elseif change_env == '' return 0 else ! echomsg 'Wrong argument' return 0 endif *************** *** 574,578 **** exe top call search('\\end\|\\\\') ! if line(".") != bottom exe '.+1,' . bottom . 's/\\\\/\\nonumber\\\\/e' exe (bottom-1) . 's/\s*$/ \\nonumber/' --- 615,619 ---- exe top call search('\\end\|\\\\') ! if line('.') != bottom exe '.+1,' . bottom . 's/\\\\/\\nonumber\\\\/e' exe (bottom-1) . 's/\s*$/ \\nonumber/' *************** *** 581,585 **** if a:label == 1 exe top ! if getline(top+1) !~ '.*label.*' let local_label = input('Label? ') if local_label != '' --- 622,627 ---- if a:label == 1 exe top ! if search("\\label", "W") > bottom ! exe top let local_label = input('Label? ') if local_label != '' *************** *** 591,595 **** exe 'silent '.top . ',' . bottom . ' g/\\label/delete' endif ! if exists("local_label") && local_label != '' exe start_line + 1.' | normal! '.start_col.'|' else --- 633,637 ---- exe 'silent '.top . ',' . bottom . ' g/\\label/delete' endif ! if exists('local_label') && local_label != '' exe start_line + 1.' | normal! '.start_col.'|' else *************** *** 604,642 **** endfunction " }}} - function! s:ChangeEnvironment(env) " {{{ - if b:DoubleDollars == 0 - call searchpair('\\\[\|\\begin{','','\\\]\|\\end{','') - else - call search('\$\$\|\\end{') - end - let l = getline(line(".")) - let indent = strpart(l, 0, match(l, '\S')) - if b:DoubleDollars == 0 - s/\\\]\|\\end{.\{-}}/\='\\end{' . a:env . '}'/ - call searchpair('\\\[\|\\begin{','','\\\]\|\\end{','b') - s/\\\[\|\\begin{.\{-}}/\='\\begin{' . a:env . '}'/ - else - s/\$\$\|\\end{.\{-}}/\='\\end{' . a:env . '}'/ - call search('\$\$\|\\begin{','b') - s/\$\$\|\\begin{.\{-}}/\='\\begin{' . a:env . '}'/ - endif - if a:env =~# '^\(theorem\|lemma\|equation\|eqnarray\|align\|multline\)$' - if (-1 == match(getline(line(".")),"\\label")) - let label = input("Label? ") - if label != '' - put! = indent . '\label{' . label . '}' - endif - endif - elseif a:env[strlen(a:env)-1] == '*' - if (-1 != match(getline(line(".")),"\\label")) - delete - endif - endif - echo '' - endfunction - " }}} function! s:PutInNonumber() " {{{ call search('\\end\|\\\\') ! if getline(line("."))[col(".")] != "e" .+1,'>s/\\\\/\\nonumber\\\\/e normal `>k --- 646,652 ---- endfunction " }}} function! s:PutInNonumber() " {{{ call search('\\end\|\\\\') ! if getline(line('.'))[col('.')] != "e" .+1,'>s/\\\\/\\nonumber\\\\/e normal `>k *************** *** 650,651 **** --- 660,662 ---- " vim:fdm=marker:nowrap:noet + |
From: <mi...@us...> - 2002-11-14 23:02:57
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite In directory usw-pr-cvs1:/tmp/cvs-serv30857 Modified Files: envmacros.vim Log Message: now changing of environments works for all of them cursor stays at the position Index: envmacros.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/envmacros.vim,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** envmacros.vim 14 Nov 2002 09:39:14 -0000 1.4 --- envmacros.vim 14 Nov 2002 23:02:53 -0000 1.5 *************** *** 3,7 **** " Author: Mikolaj Machowski " Created: Tue Apr 23 08:00 PM 2002 PST ! " Last Change: czw lis 14 01:00 2002 C " " Description: mappings/menus for environments. --- 3,7 ---- " Author: Mikolaj Machowski " Created: Tue Apr 23 08:00 PM 2002 PST ! " Last Change: pi± lis 15 12:00 2002 C " " Description: mappings/menus for environments. *************** *** 443,446 **** --- 443,447 ---- inoremap <buffer> <F5> <C-0>:call Tex_DoEnvironment("asdf")<CR> noremap <buffer> <F5> :call Tex_DoEnvironment("asdf")<CR> + function! Tex_DoEnvironment(env) " {{{ let l = getline(".") *************** *** 490,493 **** --- 491,496 ---- "let b:searchmax = 100 + let s:math_environment = 'eqnarray,eqnarray*,align,align*,equation,equation*,[,$$' + let s:item_environment = 'list,trivlist,enumerate,itemize,theindex' function Tex_change_environment() " {{{ let env_line = searchpair("\\[\\|begin{", "", "\\]\\|end{", "bn") *************** *** 496,500 **** let env_name = "[" else ! let env_name = matchstr(getline(line), 'begin{\zs.\{-}\ze}') endif endif --- 499,503 ---- let env_name = "[" else ! let env_name = matchstr(getline(env_line), 'begin{\zs.\{-}\ze}') endif endif *************** *** 503,530 **** return 0 endif ! exe "let change_env = input('You are within a \"".env_name."\" environment.\n". ! \ "Do you want to change it to?\n". ! \ "(1) eqnarray (2) eqnarray*\n". ! \ "(3) align (4) align*\n". ! \ "(5) equation* (6) leave unchanged\n". ! \ "Enter number: ')" ! if change_env == 1 ! call <SID>Change('eqnarray', 1, '', 1) ! elseif change_env == 2 ! call <SID>Change('eqnarray*', 0, '\\nonumber', 0) ! elseif change_env == 3 ! call <SID>Change('align', 1, '', 1) ! elseif change_env == 4 ! call <SID>Change('align*', 0, '\\nonumber', 0) ! elseif change_env == 5 ! call <SID>Change('equation*', 0, '&\|\\lefteqn{\|\\nonumber\|\\\\', 0) ! elseif change_env == 6 ! return 0 else ! echomsg "Wrong argument" ! return 0 endif endfunction " }}} function! s:Change(env, label, delete, putInNonumber) " {{{ if a:env == '[' if b:DoubleDollars == 0 --- 506,548 ---- return 0 endif ! if s:math_environment =~ env_name ! exe "let change_env = input('You are within a \"".env_name."\" environment.\n". ! \ "Do you want to change it to?\n". ! \ "(1) eqnarray (2) eqnarray*\n". ! \ "(3) align (4) align*\n". ! \ "(5) equation* (6) other\n". ! \ "(7) leave unchanged\n". ! \ "Enter number: ')" ! if change_env == 1 ! call <SID>Change('eqnarray', 1, '', 1) ! elseif change_env == 2 ! call <SID>Change('eqnarray*', 0, '\\nonumber', 0) ! elseif change_env == 3 ! call <SID>Change('align', 1, '', 1) ! elseif change_env == 4 ! call <SID>Change('align*', 0, '\\nonumber', 0) ! elseif change_env == 5 ! call <SID>Change('equation*', 0, '&\|\\lefteqn{\|\\nonumber\|\\\\', 0) ! elseif change_env == 6 ! call <SID>Change(input('Environment? '), 0, '', '') ! elseif change_env == 7 ! return 0 ! else ! echomsg "Wrong argument" ! return 0 ! endif else ! exe "let change_env = input('You are within a \"".env_name."\" environment.\n". ! \ "You want to change it for (<cr> to abandon): ')" ! if change_env == '' ! return 0 ! else ! call <SID>Change(change_env, 0, '', '') ! endif endif endfunction " }}} function! s:Change(env, label, delete, putInNonumber) " {{{ + let start_line = line('.') + let start_col = virtcol('.') if a:env == '[' if b:DoubleDollars == 0 *************** *** 564,572 **** exe top if getline(top+1) !~ '.*label.*' ! put ='\label{}' normal $ endif else exe 'silent '.top . ',' . bottom . ' g/\\label/delete' endif endfunction " }}} --- 582,598 ---- exe top if getline(top+1) !~ '.*label.*' ! let local_label = input('Label? ') ! if local_label != '' ! put = '\label{'.local_label.'}' ! endif normal $ endif else exe 'silent '.top . ',' . bottom . ' g/\\label/delete' + endif + if exists("local_label") && local_label != '' + exe start_line + 1.' | normal! '.start_col.'|' + else + exe start_line.' | normal! '.start_col.'|' endif endfunction " }}} |
From: <sri...@us...> - 2002-11-14 17:30:49
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite In directory usw-pr-cvs1:/tmp/cvs-serv26481 Modified Files: compiler.vim Log Message: Bug: 'makefile's in current directory are ignored. Cause: used if glob('makefile') ... for testing whether makefile exists. However, in vim, a string evaluates to 0 in the if test. Use if glob('makefile') != '' ... instead. Index: compiler.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/compiler.vim,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** compiler.vim 14 Nov 2002 02:49:23 -0000 1.11 --- compiler.vim 14 Nov 2002 17:30:45 -0000 1.12 *************** *** 4,8 **** " Version: 1.0 " Created: Tue Apr 23 05:00 PM 2002 PST ! " Last Change: Wed Nov 13 06:00 PM 2002 PST " " Description: functions for compiling/viewing/searching latex documents --- 4,8 ---- " Version: 1.0 " Created: Tue Apr 23 05:00 PM 2002 PST ! " Last Change: Thu Nov 14 09:00 AM 2002 PST " " Description: functions for compiling/viewing/searching latex documents *************** *** 29,33 **** let curd = getcwd() exe 'cd '.expand('%:p:h') ! if glob('makefile*') == '' if has('gui_running') call confirm( --- 29,33 ---- let curd = getcwd() exe 'cd '.expand('%:p:h') ! if glob('makefile*') == '' && glob('Makefile*') == '' if has('gui_running') call confirm( *************** *** 91,95 **** " if a makefile exists, just use the make utility ! if glob('makefile') || glob('Makefile') let _makeprg = &l:makeprg let &l:makeprg = 'make $*' --- 91,95 ---- " if a makefile exists, just use the make utility ! if glob('makefile') != '' || glob('Makefile') != '' let _makeprg = &l:makeprg let &l:makeprg = 'make $*' *************** *** 104,113 **** elseif Tex_GetMainFileName() != '' let mainfname = Tex_GetMainFileName() else " otherwise just use this file. let mainfname = expand("%:t:r") endif - - exec 'make '.mainfname let winnum = winnr() --- 104,113 ---- elseif Tex_GetMainFileName() != '' let mainfname = Tex_GetMainFileName() + exec 'make '.mainfname else " otherwise just use this file. let mainfname = expand("%:t:r") + exec 'make '.mainfname endif let winnum = winnr() |
From: <mi...@us...> - 2002-11-14 09:39:16
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite In directory usw-pr-cvs1:/tmp/cvs-serv25306 Modified Files: envmacros.vim Log Message: I merged functions proposed by Carl. Removed extensed mappings. Now it is <F5> in empty line asks for environment in non empty line reads line and use word in it as name of the function <S-F5> gives menu and asks for use one of options <C-F5> asks for environment and changes \begin, \end tags I also moved stuff responsible for envs from wizardfuncs.vim to envmacros.vim Removed Tex_MenuWizard and replaced it with Tex_DoEnvironment Mikolaj Index: envmacros.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/envmacros.vim,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** envmacros.vim 4 Nov 2002 20:39:43 -0000 1.3 --- envmacros.vim 14 Nov 2002 09:39:14 -0000 1.4 *************** *** 3,7 **** " Author: Mikolaj Machowski " Created: Tue Apr 23 08:00 PM 2002 PST ! " Last Change: pon lis 04 09:00 2002 C " " Description: mappings/menus for environments. --- 3,7 ---- " Author: Mikolaj Machowski " Created: Tue Apr 23 08:00 PM 2002 PST ! " Last Change: czw lis 14 01:00 2002 C " " Description: mappings/menus for environments. *************** *** 66,70 **** if g:Tex_Menus && g:Tex_EnvironmentMenus && has("gui_running") ! exe 'amenu '.location.' <plug><C-r>=Tex_MenuWizard("'.a:submenu.'", "'.a:name.'")<CR>' exe 'vmenu '.location.' '.vrhs endif --- 66,70 ---- if g:Tex_Menus && g:Tex_EnvironmentMenus && has("gui_running") ! exe 'amenu '.location.' <plug><C-r>=Tex_DoEnvironment("'.a:name.'")<CR>' exe 'vmenu '.location.' '.vrhs endif *************** *** 258,261 **** --- 258,622 ---- exe "vnoremap ".g:Tex_Leader2." :\<C-u>call ExecMap('".g:Tex_Leader2."', 'v')\<CR>" endif + + " ============================================================================== + " Specialized functions for various environments + " ============================================================================== + " Tex_itemize: {{{ + function! Tex_itemize(indent, env) + exe 'normal i'.a:indent."\\begin{".a:env."}\<cr>\\item \<cr>\\end{".a:env."}«»\<Up>" + endfunction + " }}} + " Tex_description: {{{ + function! Tex_description(indent, env) + let itlabel = input("(Optional) Item label? ") + if (itlabel != "") + let itlabel = '['.itlabel.']' + endif + exe 'normal i'.a:indent."\\begin{description}\<cr>\\item".itlabel." \<cr>\\end{description}«»\<Up>" + endfunction + " }}} + " Tex_figure: {{{ + function! Tex_figure(indent, env) + let flto = input("Float to (htbp)? ") + let caption = input("Caption? ") + let center = input("Center ([y]/n)? ") + let label = input('Label (for use with \ref)? ') + " additional to AUC Tex since my pics are usually external files + let pic = input("Name of Pic-File? ") + if (flto != "") + let flto = "[".flto."]\<cr>" + else + let flto = "\<cr>" + endif + if (pic != "") + let pic = "\\input{".pic."}\<cr>" + else + let pic = "ä\<cr>" + endif + if (caption != "") + let caption = "\\caption{".caption."}\<cr>" + endif + if (label != "") + let label = "\\label{fig:".label."}\<cr>" + endif + if (center == "y" || center == "") + let centr = "\\begin{center}\<cr>" + let centr = centr . pic + let centr = centr . caption + let centr = centr . label + let centr = centr . "\\end{center}\<cr>" + else + let centr = pic + let centr = centr . caption + let centr = centr . label + endif + let figure = "\\begin{".a:env."}".flto + let figure = figure . centr + let figure = figure . "\\end{".a:env."}" + exe 'normal i'.a:indent.figure."\<Esc>$" + endfunction + " }}} + " Tex_table: {{{ + function! Tex_table(indent, env) + let flto = input('Float to (htbp)? ') + let caption = input('Caption? ') + let center = input('Center (y/n)? ') + let label = input('Label? ') + if (flto != "") + let flto ='['.flto."]\<cr>" + else + let flto = '' + endif + let ret='\begin{table}'.flto + if (center == "y") + let ret=ret."\\begin{center}\<cr>" + endif + let foo = "\\begin{tabular}" + let pos = input('(Optional) Position (t b)? ') + if (pos!='') + let foo = foo.'['.pos."]" + else + let foo = foo."\<cr>" + endif + let format = input("Format ( l r c p{width} | @{text} )? ") + if format == '' + let format = '«»' + endif + let ret = ret.foo.'{'.format."}\<cr>ä\<cr>\\end{tabular}«»\<cr>" + if (center == 'y') + let ret=ret."\\end{center}\<cr>" + endif + if (caption != '') + let ret=ret.'\caption{'.caption."}\<cr>" + endif + if (label != "") + let ret=ret.'\label{tab:'.label."}\<cr>" + endif + let ret=ret."\\end{table}«»" + exe "normal i".ret."\<Esc>?ä\<cr>:nohl\<cr>C" + endfunction + " }}} + " Tex_tabular: {{{ + function! Tex_tabular(indent, env) + let pos = input("(Optional) Position (t b)? ") + let format = input("Format ( l r c p{width} | @{text} )? ") + if (pos != '') + let pos = '['.pos.']' + endif + if format != '' + let format = '{'.format.'}' + endif + exe 'normal i'.a:indent."\\begin{".a:env.'}'.pos.format."\<cr> \<cr>\\end{".a:env."}«»\<Up>" + endfunction + " }}} + " Tex_eqnarray: {{{ + function! Tex_eqnarray(indent, env) + let label = input("Label? ") + if (label != "") + let arrlabel = '\label{'.label."}\<cr> " + else + let arrlabel = " " + endif + exe 'normal i'.a:indent."\\begin{".a:env."}\<cr>".arrlabel."\<cr>\\end{".a:env."}«»\<Up>" + endfunction + " }}} + " Tex_list: {{{ + function! Tex_list(indent, env) + let label = input('Label (for \item)? ') + if (label != '') + let label = '{'.label.'}' + let addcmd = input('Additional commands? ') + if (addcmd != '') + let label = label . '{'.addcmd.'}' + endif + else + let label = '' + endif + exe 'normal i'.a:indent."\\begin{list}".label."\<cr>\\item \<cr>\\end{list}«»\<Up>" + endfunction + " }}} + " Tex_document: {{{ + function! Tex_document(indent, env) + let dstyle = input('Document style? ') + let opts = input('(Optional) Options? ') + let foo = '\documentclass' + if (opts == '') + let foo = foo.'{'.dstyle.'}' + else + let foo = foo.'['.opts.']'.'{'.dstyle.'}' + endif + exe 'normal i'.a:indent.foo."\<cr>\<cr>\\begin{document}\<cr>\<cr>\\end{document}\<Up>" + endfunction + " }}} + " Tex_minipage: {{{ + function! Tex_minipage(indent, env) + let foo = '\begin{minipage}' + let pos = input('(Optional) Position (t b)? ') + let width = input('Width? ') + if (pos=="") + let foo = foo.'{'.width.'}' + else + let foo = foo.'['.pos.']{'.width.'}' + endif + exe 'normal i'.a:indent.foo."\<cr> \<cr>\\end{minipage}«»\<Up>" + endfunction + " }}} + " Tex_thebibliography: {{{ + function! Tex_thebibliography(indent, env) + " AUC Tex: "Label for BibItem: 99" + let indent = input('Indent for BibItem? ') + let foo = '{'.indent.'}' + let biblabel = input('(Optional) Bibitem label? ') + let key = input("Add key? ") + let bar = '\bibitem' + if (biblabel != '') + let bar = bar.'['.biblabel.']' + endif + let bar = bar.'{'.key.'}' + exe 'normal i'.a:indent.'\begin{thebibliography}'.foo."\<cr>".bar." \<cr>\\end{thebibliography}«»\<Up>" + endfunction + " }}} + + " Merged contributions from Carl Mueller + " asdf is a fake argument to recognize if call is coming from keyboard or from + " menu + inoremap <buffer> <F5> <C-0>:call Tex_DoEnvironment("asdf")<CR> + noremap <buffer> <F5> :call Tex_DoEnvironment("asdf")<CR> + function! Tex_DoEnvironment(env) " {{{ + let l = getline(".") + if a:env == "asdf" + let env = matchstr(l, '^\s*\zs.*') + if env == '' + call Tex_PutEnvironment(l, input("Environment? ")) + else + let ind = matchstr(l, '^\s*\ze') + normal 0D + call Tex_PutEnvironment(ind, env) + endif + else + call Tex_PutEnvironment(l, a:env) + endif + startinsert + endfunction " }}} + function! Tex_PutEnvironment(indent, env) " {{{ + if a:env =~ "theorem\\|lemma\\|equation\\|eqnarray\\|align\\|multline" + call Tex_eqnarray(a:indent, a:env) + elseif a:env =~ "enumerate\\|itemize\\|theindex\\|trivlist" + call Tex_itemize(a:indent, a:env) + elseif a:env =~ "table\\|table*" + call Tex_table(a:indent, a:env) + elseif a:env =~ "tabular\\|tabular*\\|array\\|array*" + call Tex_tabular(a:indent, a:env) + elseif exists("*Tex_".a:env) + exe "call Tex_".a:env."(a:indent, a:env)" + else + exe 'normal i'.a:indent.'\begin{'.a:env."}\<cr> \<cr>\\end{".a:env."}«»\<Up>" + endif + endfunction " }}} + + let b:DoubleDollars = 0 + + inoremap <buffer> <C-F5> <C-O>:call <SID>ChangeEnvironment(input("Environment? "))<CR> + noremap <buffer> <C-F5> :call <SID>ChangeEnvironment(input("Environment? "))<CR> + inoremap <buffer> <S-F5> <C-O>:call Tex_change_environment()<CR> + noremap <buffer> <S-F5> :call Tex_change_environment()<CR> + + function! Tex_AmsLatex() " {{{ + if g:Tex_package_supported =~ "amsmath" + let amslatex = 1 + endif + return amslatex + endfunction " }}} + + "let b:searchmax = 100 + function Tex_change_environment() " {{{ + let env_line = searchpair("\\[\\|begin{", "", "\\]\\|end{", "bn") + if env_line != 0 + if getline(env_line) =~ "\\[" + let env_name = "[" + else + let env_name = matchstr(getline(line), 'begin{\zs.\{-}\ze}') + endif + endif + if !exists("env_name") + echomsg "You are not inside environment" + return 0 + endif + exe "let change_env = input('You are within a \"".env_name."\" environment.\n". + \ "Do you want to change it to?\n". + \ "(1) eqnarray (2) eqnarray*\n". + \ "(3) align (4) align*\n". + \ "(5) equation* (6) leave unchanged\n". + \ "Enter number: ')" + if change_env == 1 + call <SID>Change('eqnarray', 1, '', 1) + elseif change_env == 2 + call <SID>Change('eqnarray*', 0, '\\nonumber', 0) + elseif change_env == 3 + call <SID>Change('align', 1, '', 1) + elseif change_env == 4 + call <SID>Change('align*', 0, '\\nonumber', 0) + elseif change_env == 5 + call <SID>Change('equation*', 0, '&\|\\lefteqn{\|\\nonumber\|\\\\', 0) + elseif change_env == 6 + return 0 + else + echomsg "Wrong argument" + return 0 + endif + endfunction " }}} + function! s:Change(env, label, delete, putInNonumber) " {{{ + if a:env == '[' + if b:DoubleDollars == 0 + let first = '\\[' + let second = '\\]' + else + let first = '$$' + let second = '$$' + endif + else + let first = '\\begin{' . a:env . '}' + let second = '\\end{' . a:env . '}' + endif + if b:DoubleDollars == 0 + let bottom = searchpair('\\\[\|\\begin{','','\\\]\|\\end{','') + s/\\\]\|\\end{.\{-}}/\=second/ + let top = searchpair('\\\[\|\\begin{','','\\\]\|\\end{','b') + s/\\\[\|\\begin{.\{-}}/\=first/ + else + let bottom = search('\$\$\|\\end{') + s/\$\$\|\\end{.\{-}}/\=second/ + let top = search('\$\$\|\\begin{','b') + s/\$\$\|\\begin{.\{-}}/\=first/ + end + if a:delete != '' + exe 'silent '. top . "," . bottom . 's/' . a:delete . '//e' + endif + if a:putInNonumber == 1 + exe top + call search('\\end\|\\\\') + if line(".") != bottom + exe '.+1,' . bottom . 's/\\\\/\\nonumber\\\\/e' + exe (bottom-1) . 's/\s*$/ \\nonumber/' + endif + endif + if a:label == 1 + exe top + if getline(top+1) !~ '.*label.*' + put ='\label{}' + normal $ + endif + else + exe 'silent '.top . ',' . bottom . ' g/\\label/delete' + endif + endfunction " }}} + + " Due to Ralf Arens <ral...@gm...> + function! s:ArgumentsForArray(arg) " {{{ + put! = '{' . a:arg . '}' + normal kgJj + endfunction + " }}} + function! s:ChangeEnvironment(env) " {{{ + if b:DoubleDollars == 0 + call searchpair('\\\[\|\\begin{','','\\\]\|\\end{','') + else + call search('\$\$\|\\end{') + end + let l = getline(line(".")) + let indent = strpart(l, 0, match(l, '\S')) + if b:DoubleDollars == 0 + s/\\\]\|\\end{.\{-}}/\='\\end{' . a:env . '}'/ + call searchpair('\\\[\|\\begin{','','\\\]\|\\end{','b') + s/\\\[\|\\begin{.\{-}}/\='\\begin{' . a:env . '}'/ + else + s/\$\$\|\\end{.\{-}}/\='\\end{' . a:env . '}'/ + call search('\$\$\|\\begin{','b') + s/\$\$\|\\begin{.\{-}}/\='\\begin{' . a:env . '}'/ + endif + if a:env =~# '^\(theorem\|lemma\|equation\|eqnarray\|align\|multline\)$' + if (-1 == match(getline(line(".")),"\\label")) + let label = input("Label? ") + if label != '' + put! = indent . '\label{' . label . '}' + endif + endif + elseif a:env[strlen(a:env)-1] == '*' + if (-1 != match(getline(line(".")),"\\label")) + delete + endif + endif + echo '' + endfunction + " }}} + function! s:PutInNonumber() " {{{ + call search('\\end\|\\\\') + if getline(line("."))[col(".")] != "e" + .+1,'>s/\\\\/\\nonumber\\\\/e + normal `>k + s/\s*$/ \\nonumber/ + endif + endfunction + " }}} " this statement has to be at the end. |
From: <mi...@us...> - 2002-11-14 09:39:04
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite In directory usw-pr-cvs1:/tmp/cvs-serv25281 Modified Files: wizardfuncs.vim Log Message: moving envs part to envmacros.vim Index: wizardfuncs.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/wizardfuncs.vim,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** wizardfuncs.vim 27 Oct 2002 09:18:04 -0000 1.3 --- wizardfuncs.vim 14 Nov 2002 09:39:01 -0000 1.4 *************** *** 1,5 **** ! " File: texwizards.vim " Author: Mikolaj Machowski <mi...@wp...> ! " Last Change: Sun Oct 27 01:00 AM 2002 PST " Description: " --- 1,5 ---- ! " File: wizardfuncs.vim " Author: Mikolaj Machowski <mi...@wp...> ! " Last change: wto lis 12 09:00 2002 C " Description: " *************** *** 14,236 **** endif let s:doneOnce = 1 - - " Tex_MenuWizard: the king of the wizards {{{ - " - function! Tex_MenuWizard(submenu, env) - if (a:env=="figure" || a:env=="figure*" ) - return Tex_figure(a:env) - elseif (a:env=="table" || a:env=="table*") - return Tex_table(a:env) - elseif (a:env=="tabular" || a:env=="tabular*" || - \a:env=="array" || a:env=="array*") - return Tex_tabular(a:env) - elseif (a:env=="eqnarray" || a:env=="equation*") - return Tex_eqnarray(a:env) - elseif (a:env=="list") - return Tex_list(a:env) - elseif (a:env=="itemize" || a:env=="theindex" || - \a:env=="trivlist" || a:env=="enumerate") - return Tex_itemize(a:env) - elseif (a:env=="description") - return Tex_description(a:env) - elseif (a:env=="document") - return Tex_document(a:env) - elseif (a:env=="minipage") - return Tex_minipage(a:env) - elseif (a:env=="thebibliography") - return Tex_thebibliography(a:env) - else - return IMAP_PutTextWithMovement("\\begin{".a:env."}\<cr>«»\<cr>\\end{".a:env."}«»") - endif - endfunction - - " }}} - " ============================================================================== ! " Specialized functions for various environments " ============================================================================== - " Tex_itemize: {{{ - function! Tex_itemize(env) - return "\\begin{".a:env."}\<cr>\\item \<cr>\\end{".a:env."}«»\<Up>" - endfunction - - " }}} - " Tex_description: {{{ - function! Tex_description(env) - let itlabel = input("(Optional) Item label? ") - if (itlabel != "") - let itlabel = '['.itlabel.']' - endif - return IMAP_PutTextWithMovement("\\begin{description}\<cr>\\item".itlabel." \<cr>\\end{description}«»\<Up>") - endfunction - - " }}} - " Tex_figure: {{{ - function! Tex_figure(env) - let flto = input("Float to (htbp)? ") - let caption = input("Caption? ") - let center = input("Center ([y]/n)? ") - let label = input('Label (for use with \ref)? ') - " additional to AUC Tex since my pics are usually external files - let pic = input("Name of Pic-File? ") - if (flto != "") - let flto = "[".flto."]\<cr>" - else - let flto = "\<cr>" - endif - if (pic != "") - let pic = "\\input{".pic."}\<cr>" - else - let pic = "ä\<cr>" - endif - if (caption != "") - let caption = "\\caption{".caption."}\<cr>" - endif - if (label != "") - let label = "\\label{fig:".label."}\<cr>" - endif - if (center == "y" || center == "") - let centr = "\\begin{center}\<cr>" - let centr = centr . pic - let centr = centr . caption - let centr = centr . label - let centr = centr . "\\end{center}\<cr>" - else - let centr = pic - let centr = centr . caption - let centr = centr . label - endif - let figure = "\\begin{".a:env."}".flto - let figure = figure . centr - let figure = figure . "\\end{".a:env."}«»" - return IMAP_PutTextWithMovement(figure) - endfunction - - " }}} - " Tex_table: {{{ - function! Tex_table(env) - let flto = input("Float to (htbp)? ") - let caption = input("Caption? ") - let center = input("Center (y/n)? ") - let label = input('Label (for use with \ref)? ') - if (flto != "") - let flto ="[".flto."]\<cr>" - else - let flto = "" - endif - let ret="\\begin{table}".flto - if (center == "y") - let ret=ret."\<cr>\\begin{center}" - endif - let foo = "\<cr>\\begin{tabular}" - let pos = input("(Optional) Position (t b)? ") - if (pos!="") - let foo = foo.'['.pos.']' - endif - let format = input("Format ( l r c p{width} | @{text} )? ") - if format == '' - let format = '«»' - endif - let ret = ret.foo.'{'.format."}\<cr>«»\<cr>\\end{tabular}«»\<cr>" - if (center == "y") - let ret=ret."\\end{center}\<cr>" - endif - if (caption != "") - let ret=ret."\\caption{".caption."}\<cr>" - endif - if (label != "") - let ret=ret."\\label{tab:".label."}\<cr>" - endif - let ret=ret."\\end{table}«»" - return IMAP_PutTextWithMovement(ret) - endfunction - - " }}} - " Tex_tabular: {{{ - function! Tex_tabular(env) - let pos = input("(Optional) Position (t b)? ") - if (pos!="") - let pos = '['.pos.']' - endif - let format = input("Format ( l r c p{width} | @{text} )? ") - if format != "" - let format = '{'.format.'}' - endif - return IMAP_PutTextWithMovement("\\begin{".a:env."}".pos.format."\<cr> \<cr>\\end{".a:env."}«»\<Up>\<Left>") - endfunction - - " }}} - " Tex_eqnarray: {{{ - function! Tex_eqnarray(env) - let label = input("Label (for use with \ref)? ") - if (label != "") - let arrlabel = "\\label{eqn:".label."}\<cr> " - else - let arrlabel = " " - endif - return IMAP_PutTextWithMovement("\\begin{".a:env."}\<cr>".arrlabel."\<cr>\\end{".a:env."}«»\<Up>\<Left>") - endfunction - - " }}} - " Tex_list: {{{ - function! Tex_list(env) - let label = input("Label (for \item)? ") - if (label != "") - let label = "{".label."}" - let addcmd = input("Additional commands? ") - if (addcmd != "") - let label = label . "{".addcmd."}" - endif - else - let label = "" - endif - return IMAP_PutTextWithMovement("\\begin{list}".label."\<cr>\\item \<cr>\\end{list}«»\<Up>") - endfunction - - " }}} - " Tex_document: {{{ - function! Tex_document(env) - let dstyle = input("Document style? ") - let opts = input("(Optional) Options? ") - let foo = '\documentclass' - if (opts=="") - let foo = foo.'{'.dstyle.'}' - else - let foo = foo.'['.opts.']'.'{'.dstyle.'}' - endif - return IMAP_PutTextWithMovement(foo . "\<cr>\<cr>\\begin{document}\<cr>\<cr>\\end{document}\<Up>") - endfunction - - " }}} - " Tex_minipage: {{{ - function! Tex_minipage(env) - let foo = '\begin{minipage}' - let pos = input("(Optional) Position (t b)? ") - let width = input("Width? ") - if (pos=="") - let foo = foo.'{'.width.'}' - else - let foo = foo.'['.pos.']{'.width.'}' - endif - return IMAP_PutTextWithMovement(foo . "\<cr> \<cr>\\end{minipage}\<Up>\<Left>") - endfunction ! " }}} ! " Tex_thebibliography: {{{ ! function! Tex_thebibliography() ! " AUC Tex: "Label for BibItem: 99" ! let indent = input("Indent for BibItem? ") ! let foo = "{".indent."}" ! let biblabel = input("(Optional) Bibitem label? ") ! let key = input("Add key? ") ! let bar = "\\bibitem" ! if (biblabel != "") ! let bar = bar.'['.biblabel.']' ! endif ! let bar = bar.'{'.key.'}' ! return IMAP_PutTextWithMovement("\\begin{thebibliography}".foo."\<cr>".bar." \<cr>\\end{thebibliography}\<Up>\<Left>") ! endfunction - " }}} " Tex_VisSecAdv: handles visual selection for sections {{{ function! Tex_VisSecAdv(section) --- 14,24 ---- endif let s:doneOnce = 1 " ============================================================================== ! " Specialized functions for handling sections from command line " ============================================================================== ! com! -nargs=? TSection call Tex_section(<f-args>) ! com! -nargs=? TSectionAdvanced call Tex_section_adv(<f-args>) " Tex_VisSecAdv: handles visual selection for sections {{{ function! Tex_VisSecAdv(section) *************** *** 246,250 **** let shorttitle = '['.shorttitle.']' endif ! exe IMAP_PutTextWithMovement("normal `>a}\<cr>\<esc>`<i".sstructure.toc.shorttitle."{") endfunction --- 34,38 ---- let shorttitle = '['.shorttitle.']' endif ! exe "normal `>a}\<cr>\<esc>`<i".sstructure.toc.shorttitle."{" endfunction *************** *** 275,286 **** " }}} - - " ============================================================================== - " Specialized functions for handling sections from command line - " ============================================================================== - - com! -nargs=? TSection call Tex_section(<f-args>) - com! -nargs=? TSectionAdvanced call Tex_section_adv(<f-args>) - function! Tex_section(...) "{{{ silent let pos = line('.').' | normal! '.virtcol('.').'|' --- 63,66 ---- |
From: <sri...@us...> - 2002-11-14 02:49:26
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite In directory usw-pr-cvs1:/tmp/cvs-serv14141 Modified Files: compiler.vim Log Message: I must be drunk!!! After saying winnr() doesnt take any arguments, I wrote it down as winnr(''). Wow! Fixed it (finally). Hint to myself: Do not do any mode coding today. Index: compiler.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/compiler.vim,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** compiler.vim 14 Nov 2002 02:46:08 -0000 1.10 --- compiler.vim 14 Nov 2002 02:49:23 -0000 1.11 *************** *** 111,115 **** exec 'make '.mainfname ! let winnum = winnr('') cwindow " just open the cwindow, do not remain there... --- 111,115 ---- exec 'make '.mainfname ! let winnum = winnr() cwindow " just open the cwindow, do not remain there... |
From: <sri...@us...> - 2002-11-14 02:46:11
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite In directory usw-pr-cvs1:/tmp/cvs-serv12341 Modified Files: compiler.vim Log Message: . winnr() doesn't take any arguments. PS: discard the last log message. I deleted that revision and replaced it with the current one. Index: compiler.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/compiler.vim,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** compiler.vim 13 Nov 2002 03:39:21 -0000 1.9 --- compiler.vim 14 Nov 2002 02:46:08 -0000 1.10 *************** *** 4,8 **** " Version: 1.0 " Created: Tue Apr 23 05:00 PM 2002 PST ! " Last Change: Tue Nov 12 08:00 AM 2002 PST " " Description: functions for compiling/viewing/searching latex documents --- 4,8 ---- " Version: 1.0 " Created: Tue Apr 23 05:00 PM 2002 PST ! " Last Change: Wed Nov 13 06:00 PM 2002 PST " " Description: functions for compiling/viewing/searching latex documents *************** *** 111,115 **** exec 'make '.mainfname ! let winnum = winnr('%') cwindow " just open the cwindow, do not remain there... --- 111,115 ---- exec 'make '.mainfname ! let winnum = winnr('') cwindow " just open the cwindow, do not remain there... |
From: <sri...@us...> - 2002-11-14 02:36:20
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite In directory usw-pr-cvs1:/tmp/cvs-serv7618 Modified Files: compiler.vim Log Message: . winnr() doesnt take any arguments. Index: compiler.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/compiler.vim,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** compiler.vim 13 Nov 2002 03:39:21 -0000 1.9 --- compiler.vim 14 Nov 2002 02:36:11 -0000 1.10 *************** *** 4,8 **** " Version: 1.0 " Created: Tue Apr 23 05:00 PM 2002 PST ! " Last Change: Tue Nov 12 08:00 AM 2002 PST " " Description: functions for compiling/viewing/searching latex documents --- 4,8 ---- " Version: 1.0 " Created: Tue Apr 23 05:00 PM 2002 PST ! " Last Change: Wed Nov 13 06:00 PM 2002 PST " " Description: functions for compiling/viewing/searching latex documents |
From: <ma...@us...> - 2002-11-13 03:39:25
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite In directory usw-pr-cvs1:/tmp/cvs-serv16601/ftplugin/latex-suite Modified Files: compiler.vim Log Message: Fix it so that, after opening the error window, we return to the right window, even if there is more than one other window. Index: compiler.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/compiler.vim,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** compiler.vim 12 Nov 2002 16:47:23 -0000 1.8 --- compiler.vim 13 Nov 2002 03:39:21 -0000 1.9 *************** *** 111,120 **** exec 'make '.mainfname ! let bufnum = bufnr('%') cwindow " just open the cwindow, do not remain there... ! if bufnr('%') != bufnum ! wincmd w ! endif exec 'cd '.curd --- 111,118 ---- exec 'make '.mainfname ! let winnum = winnr('%') cwindow " just open the cwindow, do not remain there... ! execute winnum "wincmd w" exec 'cd '.curd |
From: Benji F. <be...@me...> - 2002-11-12 22:13:12
|
sri...@us... wrote: > Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite > In directory usw-pr-cvs1:/tmp/cvs-serv22754 > > Modified Files: > main.vim > Log Message: > Always source texrc whether or not user texrc exists. This is because the > user texrc could be from an older version where not all variables are > defined. All the other files depend on the variables existing. Another possibility is :runtime! ftplugin/tex/texrc This is simpler, and it has the advantage that it allows for sourcing a user's texrc, then the one installed (and customized) by the sysadmin, and finally the default one (with a separate :source command). If you only plan to have a single user texrc, why use TexLet ? I may try this myself, in a separate branch. Whoever gets around to it first should update the lines " NOTE: This file should NOT be edited directly. The recommended usage " is to make a copy somewhere, edit that copy and then source " that copy in your ftplugin/tex.vim file. near the top of texrc. The texrc file is automatically loaded, so the user need not add anything to ftplugin/tex.vim . --Benji |