Thread: [Vim-latex-devel] Revolution! :)
Brought to you by:
srinathava,
tmaas
From: <mi...@wp...> - 2003-09-25 17:55:32
|
OK. Subject is exaggeration, but not so much. Attaching two files: packages.diff packages.vim (Files are ff=unix) Big comments inside. First is only diff (diff -u -3 -p), second is complete file packages.vim. Revolution is: now functions in packages.vim looks in all rtp directories for package files and creates complete list. Sounds unimpressive but it allow for creating real distribution packages and real *nix behaviour with system wide files and local modifications. I am dusting off 'man rpm' ;) Jokes aside. There are still issues: creating menus is based on list returned by globpath(). How to sort endresults and remove duplicate entries? I remember long discussions on vim-list about Sort and Uniq. I didn't follow it closely. Could someone suggest the best solutions? I tested it on Linux. Vim does good job with globpath() and directory separators but could someone check it on Windows (on this machine I cannot install Vim)? Currently I don't have access to cvs. Srinath, could you commit this (after win-test) with Tex_file_rtp() in main.vim? I can proceed with implementation for templates and macros. m. |
From: Luc H. <her...@fr...> - 2003-09-25 18:51:25
|
Hello, * On Thu, Sep 25, 2003 at 08:15:50PM +0200, mi...@wp... <mi...@wp...> wrote: > First is only diff (diff -u -3 -p), second is complete file > packages.vim. Revolution is: now functions in packages.vim looks in > all rtp directories for package files and creates complete list. > Sounds unimpressive but it allow for creating real distribution > packages and real *nix behaviour with system wide files and local > modifications. I am dusting off 'man rpm' ;) Sounds important : one of the first things I added into mu-template -- thanks to searchInRuntime.vim (which defines some hybrid commands between :runtime and the unix's `find' tool) > Jokes aside. There are still issues: > creating menus is based on list returned by globpath(). How to sort > endresults and remove duplicate entries? The last entry according to 'runtimepath' should be the one! Or the first, as you wish. I'm not sure sort or uniq will be very useful here. Just in case, with :SearchInRuntime, I would have written something like: function s:AddFileToList(file) let fn = fnamemodify(a:file, ':t') if s:list =~ a:file " use the "keep the last entry"-policy let s:list = substitute(s:list, \ "^\\(\\|\n\\)\\zs[^\\n]*".fn."\\ze\\(\n\|$\\)", a:file, 'g') else let s:list = s:list . "\n".a:file endif endfunction command! -nargs=1 LetFiles :call s:AddFileToList('<q-args>') let s:list = '' SearchInRuntime! :LetFile packages/foo*.vim > I remember long discussions on vim-list about Sort and Uniq. I didn't > follow it closely. Could someone suggest the best solutions? The best solutions for uniq and sort have been included into system_utils.vim avaible on my web site. http://hermitte.free.fr/vim/ressources/vimfiles/plugin/system_utils.vim Regars, -- Luc Hermitte http://hermitte.free.fr/vim/ |
From: Srinath A. <sr...@fa...> - 2003-09-26 01:46:46
|
Hello! Unfortunately, I am really busy nowadays with some studying. I have a big oral examination coming up in the next few weeks and I have promised myself that I will not be doing any coding till after the exam is done. On Thu, 25 Sep 2003 mi...@wp... wrote: > OK. Subject is exaggeration, but not so much. > Sounds unimpressive but it allow for creating real distribution > packages and real *nix behaviour with system wide files and local > modifications. I am dusting off 'man rpm' ;) > :) The changes sound excellent. I will incorporate them into the tree as soon as I get back. > Jokes aside. There are still issues: creating menus is based on list > returned by globpath(). How to sort endresults and remove duplicate > entries? I remember long discussions on vim-list about Sort and Uniq. I do not think we want to remove duplicates. After all, how do we know that $VIM/ftplugin/latex-suite/packages/amsmath.vim is the same as $VIM/ftplugin/latex-suite/packages/amsmath.vim? Hmmm... Maybe have a single menu item for amsmath but source every ftplugin/latex-suite/packages/packages.vim in the runtimepath... just a simple: runtime! ftplugin/latex-suite/amsmath.vim > (after win-test) with Tex_file_rtp() in main.vim? I can proceed with > implementation for templates and macros. I thought we had decided on the CamelCase convention for function names. Could you please follow the convention as well? I am kinda anal about being consistent :) Please! Let me recap: 1. Code according to the following modeline: vim:noet:sw=4:ts=4 2. Follow CamelCase for function names, variable names etc. 3. Function names should be verbs. For example, if Tex_file_rtp() is supposed to find a file in 'rtp', use Tex_FindInRTP() instead of Tex_file_rtp(). 4. Variable names should be nouns as far as possible. Anyway, please try to maintain this convention... Srinath |
From: <mi...@wp...> - 2003-09-26 23:16:17
|
On 25 Sep 2003 at 20:53, Luc Hermitte wrote: > > Jokes aside. There are still issues: > > creating menus is based on list returned by globpath(). How to sort > > endresults and remove duplicate entries? > > The last entry according to 'runtimepath' should be the one! Or the > first, as you wish. I'm not sure sort or uniq will be very useful here. Hmm. I think you are right here. I will do it another way: for package files add common plugin header (if exists() finish etc.) and source them if repeated as regular runtime files are treated. for templates/macros :read in only first entry. Sourcing last has no sense. Files in $HOME obviously should have priority. dictionaries: add all dictionaries with asked name. > > Just in case, with :SearchInRuntime, I would have written something > like: > function s:AddFileToList(file) > let fn = fnamemodify(a:file, ':t') > if s:list =~ a:file > " use the "keep the last entry"-policy > let s:list = substitute(s:list, > \ "^\\(\\|\n\\)\\zs[^\\n]*".fn."\\ze\\(\n\|$\\)", a:file, 'g') > else > let s:list = s:list . "\n".a:file > endif > endfunction > command! -nargs=1 LetFiles :call s:AddFileToList('<q-args>') > > let s:list = '' > SearchInRuntime! :LetFile packages/foo*.vim This function is nice but requires iterating through list of files which is sloooow in VimL. > The best solutions for uniq and sort have been included into > system_utils.vim avaible on my web site. > http://hermitte.free.fr/vim/ressources/vimfiles/plugin/system_utils.vim Thanks. I will look into it. m. |