I'm using the latest vim/gvim (8.0.118), but have noticed this problem in the past, with other versions. I created a file named fizzbuzz.java (outside of gvim), and opened it in a new tab in gvim on my Windows 7 PC at work, using the context menu of my file manager. After closing the tab, using :x, I discovered that I had to rename the file to FizzBuzz.java, to match the name of the class I wrote, which I did using outside of gvim. However, when I went to reopen it in the same instance of gvim, again using the context menu of my file manager, it reverts to the original casing, and when I close it with :x, it saves it as such, so that I had to rename the file again. It was only after deleting the buffer, and refreshing the buffer list in the menu that I was able to get gvim to correctly recognize the new casing of the filename.

This does not happen in gvim 7.4 on Linux (PCLinuxOS)

Is there an easier way to get gvim to recognize, and retain the change in casing of a filename on Windows?

  • 1
    I can't reproduce your problem, but your wording is not precise so I might be mising something: I created a file named fizzbuzz.java you manually created it in your explorer or used :e fizzbuzz.java? After closing the file do you mean closing the buffer fizzbuzz.java with :bd? I had to rename it to FizzBuzz.java in your explorer, not with :saveas? it reverts to the original casing, and saves it as such where do you see it with the original name? so that I had to rename the file again again how did you renamed it? refreshing the buffer list in the menu which menu? – statox Jan 6 '17 at 9:05
  • Updated the question to add answers to your questions. Created and renamed the file outside of gvim. The original casing displays in the status bar when I reopen the file in gvim using my file manager. – Herb Wolfe Jan 6 '17 at 12:24
  • Thank you for the edit. Following your workflow I still can not reproduce this problem. I think it is a strange behavior since the filename is completely handled by the OS... I hope someone will be able to help you :) – statox Jan 6 '17 at 12:29
  • 1
    Yeah, vim seems to reuse the original name since it remembers the buffer. As a workaround, try :f %. – Antony Jan 6 '17 at 12:43

Close vim completely, and reopen the file manually (ie :edit FileName.ext instead of :MRU), ensuring there's no badly-cased names in the path.

I just solved a similar problem where my filename in vim was lowercase, but the actual path was uppercase, and Fugitive couldn't find the lowercased file for whatever reason. It seemed to persist even after I relaunched vim and opened the file.

The problem was actually that the MRU plugin I was using (CtrlP) had managed to store the lowercase filename, so after restarting vim, when I manually typed :e UpperCaseFileName.type, instead of going through the MRU file via a plugin, it used the correct path.

  • I'm not using a MRU plugin. It appears that it's an internal buffer issue. – Herb Wolfe Mar 27 '18 at 15:00
  • It's the same problem, you've opened the file as lowercase.cpp and want to open LowerCase.cpp. It's probably a bug but it's the same solution. – TankorSmash Mar 27 '18 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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