Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use gvim in a windows environment and have ClearCase for source control.

My problem is that windows paths aren't case-sensitive, however, ClearCase enforces case sensitivity. So, when editing a file in gvim, the path isnt necessarily cased properly (e.g., c:\WiNdOwS\Something.txt vs. C:\Windows\Something.txt), so when I try to check the file out the current working file in gvim via the command line, ClearCase barfs and complains that it can't find the file.

C:\WiNdOwS\Something.txt --> C:\Windows\Something.txt
   ^^^^^^^                      ^^^^^^^

Is there any way to:

  1. make vim autocorrect path casing, or,
  2. make clearcase not care about casing

Right now I have to either make sure the path case is correct or open windows explorer whenever I want to do anything to a file that's source control-related... which totally sucks.

share|improve this question

You could try using expand('%:p'). That should give you the current file name expanded to the full path.

From what I've seen it also returns a string with the correct case on MS windows, but I haven't tried that myself.

If expand doesn't work, you'll probably have to reach down in to the win32 API to get the correct case for the path, something like GetFullPathName(). I'm not sure if it is possible to use that directly from vim (without hacking the vim source code), but if you wrap that up into a small program you could certainly call that from vim. If your vim is compiled with Python support, you could use Python's ctypes module to call win32 functions.

share|improve this answer
That doesn't correct the casing for the full path, perhaps only the filename. I say "perhaps" because the filename casing is already corrected when I open the file, so I can't verify that it explicitly corrects it (though I suspect it might). The incorrect casing remains, however, in the path to the file, e.g., C:\testdir\bAdCaSiNg\goodCasing.txt. – ash Aug 26 '13 at 19:48
I've edited the question to more clearly state the problem. – ash Aug 26 '13 at 19:53
You might have to reach down into the win32 API see updated answer. – Roland Smith Aug 26 '13 at 20:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.