[Vim-latex-cvs] vimfiles/ftplugin/latex-suite custommacros.vim,1.17,1.18
Brought to you by:
srinathava,
tmaas
|
From: <mi...@us...> - 2003-09-29 06:04:46
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite
In directory sc8-pr-cvs1:/tmp/cvs-serv2971
Modified Files:
custommacros.vim
Log Message:
More polishing and catching bugs with combination of opening, writing, overwriting, etc. of local and system macros.
Index: custommacros.vim
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/custommacros.vim,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** custommacros.vim 29 Sep 2003 02:23:49 -0000 1.17
--- custommacros.vim 29 Sep 2003 03:55:24 -0000 1.18
***************
*** 109,114 ****
endif
- " Remove only if filename is in local directory
if !filereadable(s:macrodirpath.filename)
call confirm('This file is not in your local directory: '.filename."\n".
\ 'It will not be deleted.' , '&OK', 1)
--- 109,114 ----
endif
if !filereadable(s:macrodirpath.filename)
+ " When file is not in local directory decline to remove it.
call confirm('This file is not in your local directory: '.filename."\n".
\ 'It will not be deleted.' , '&OK', 1)
***************
*** 133,138 ****
--- 133,142 ----
if filereadable(s:macrodirpath.filename)
+ " If file exists in local directory open it.
exe 'split '.s:macrodirpath.filename
else
+ " But if file doesn't exist in local dir it probably is in user
+ " restricted area. Instead opening try to copy it to local dir.
+ " Pity VimL doesn't have mkdir() function :)
let ch = confirm("You are trying to edit file which is probably read-only.\n".
\ "It will be copied to your local LaTeX-Suite macros directory\n".
***************
*** 141,147 ****
\ "Do you agree?", "&Yes\n&No", 1)
if ch == 1
! new
! exe '0read '.Tex_FindInRtp(filename, 'macros')
! exe 'write '.s:macrodirpath.filename.'-local'
endif
--- 145,174 ----
\ "Do you agree?", "&Yes\n&No", 1)
if ch == 1
! " But there is possibility we already created local modification.
! " Check it and offer opening this file.
! if filereadable(s:macrodirpath.filename.'-local')
! let ch = confirm('Local version of '.filename." already exists.\n".
! \ 'Do you want to open it or overwrite with original version?',
! \ "&Open\nOver&write\n&Cancel", 1)
! if ch == 1
! exe 'split '.s:macrodirpath.filename.'-local'
! elseif ch == 2
! new
! exe '0read '.Tex_FindInRtp(filename, 'macros')
! " This is possible macro was edited before, wipe it out.
! if bufexists(s:macrodirpath.filename.'-local')
! exe 'bwipe '.s:macrodirpath.filename.'-local'
! endif
! exe 'write! '.s:macrodirpath.filename.'-local'
! else
! return
! endif
! else
! " If file doesn't exist, open new file, read in system macro and
! " save it in local macro dir with suffix -local
! new
! exe '0read '.Tex_FindInRtp(filename, 'macros')
! exe 'write '.s:macrodirpath.filename.'-local'
! endif
endif
|