On 20.03.2012 13:31, Benjamin R. Haskell wrote:
On Mon, 19 Mar 2012, Timothy Madden wrote:

[...]
Now, since 'runtimepath' is a user setting, that is 'runtimepath' is
meant to be set and modified by the user, not automatically by my
script, than I want to try to make my script as non-intrusive as
possible.

So, don't modify 'runtimepath' in your script. Unless you're writing a
plugin manager of some sort, you really shouldn't be changing &rtp
anyway. And even then, you shouldn't be changing &rtp.

&rtp is just like PATH. If you're distributing a script, you shouldn't
be modifying it. It's the user's responsibility for setting it up
properly and/or installing files into the right locations in the first
place.


That means I want to at least put my directory, which is ~/.vim, in
the right position in &runtimepath, in front of the $VIMRUNTIME
directory.

It's still completely unclear to me why you can't do exactly that.

Well, I want to do this automatically from my script (that is, from my plugin). Which, as I said, is not really a good thing to do, so I want to be as non-intrusive as I can. That means I want to put "~/.vim" in exactly the right place within the existing 'runtimepath'. The right place is in front of the $VIMRUNTIME directory found there. Again, I want to do this by script (and I also want to restore &runtimepath back after my plug-in is done with it).

For this, I have to search the contents of the existing &runtimepath and look for a directory named by $VIMRUNTIME. While we are at it, I want to look for a directory named "~/.vim/" in there, too, in case it is already listed.

To search I have to repeatedly perform directory name comparison.

However, such a comparison is not trivial as it may seem, because directory names may or may not be case-sensitive, depending on the underlaying file system (recall that vim is portable across many platforms, too, and I expect my script to also be portable).

So I need a function (or some other way) to transform a given directory name to its canonical form with the right casing. After I have the right casing I can perform a case-sensitive string comparison to compare directory names.

For (Linux-like) case-sensitive file systems, the right casing for the directory name is exactly the name given for it in the first place, and requires no extra processing.

For (NTFS-like) case-insensitive file systems, the right casing can only be retrieved after looking for the file in the file system (on disk, file must exist) and reading its name from there.

Such a function is what I am complaining about. As I said, the best solution I could find was to use
        : python import os.path
        : python print os.path.normcase('dir-name/file-name')

That is, to use the similar functionality from python. However python does not retrieve the canonical case either, it just converts the file name to lower-case if the underlaying file system is case-insensitive. Although admittedly this achieves the result I want, I still do not find it to be a good solution.

Thank you,
Timothy Madden

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to