Case sensitive :write

1 view
Skip to first unread message

bgold12

unread,
Nov 30, 2008, 10:49:21 PM11/30/08
to vim_use
Hey, I've just discovered that vim doesn't retain the case of the
filename you provide as the argument to the :write command if there's
a filename by the same name but different case in the folder you're
saving to, or if you're writing a file that's already has the same
name but different case as the one you're saving.

This is usually not a problem, and I can circumvent it by just
renaming the file outside of vim, but i'm wondering why vim won't let
you write a new file with a different case (but the same name)? Is
there a setting for this?

Thanks.

Matt Wozniski

unread,
Nov 30, 2008, 11:06:55 PM11/30/08
to vim...@googlegroups.com
On Sun, Nov 30, 2008 at 10:49 PM, bgold12 wrote:
>
> Hey, I've just discovered that vim doesn't retain the case of the
> filename you provide as the argument to the :write command if there's
> a filename by the same name but different case in the folder you're
> saving to, or if you're writing a file that's already has the same
> name but different case as the one you're saving.

Works fine for me on Linux.

rm [aA]; touch a; vim -c 'w A' -c q; ls -1i [aA]

My wild-assed guess is that you're running on DOS or Windows, where
filenames are case insensitive and 'a' and 'A' are the same file.

~Matt

Mr. Shawn H. Corey

unread,
Nov 30, 2008, 11:09:51 PM11/30/08
to vim...@googlegroups.com

Are you running under Windows or Linux?


--
Just my 0.00000002 million dollars worth,
Shawn

The key to success is being too stupid to realize you can fail.

John Beckett

unread,
Nov 30, 2008, 11:51:59 PM11/30/08
to vim...@googlegroups.com
bgold12 wrote:
> Hey, I've just discovered that vim doesn't retain the case of
> the filename you provide as the argument to the :write
> command if there's a filename by the same name but different
> case in the folder you're saving to, or if you're writing a
> file that's already has the same name but different case as
> the one you're saving.

This is a feature of Windows. You can try this at command prompt (no Vim running):

echo 111111 > juNK.txt
dir junk.txt
echo 222222 > Junk.txt
dir junk.txt

The second dir is the same as the first.

John

Reply all
Reply to author
Forward
0 new messages