6

In gVim, I want to open a file that starts with an exclamationmark, say, for example, !this_is_my_file_whose_name_is_rather_long.txt.

So, I type :e !this followed by pressing the tabulator.

gVim expands the filename, but also prepends it with a backslash, so that the command line reads

:e \!this_is_my_file_whose_name_is_rather_long.txt

When I now press enter, thinking this will open my desired file, gVim will instead create a new buffer whose name also has the backslash.

This is of course not what I want. So after pressing the tabulator, I move the cursor to the backslash and delete it. Then, gVim will open the file that I want.

I assume that behaviour is ms-Windows related. Currently, I cannot go to a Unix machine to verify if I'd encounter this problem on Unix as well.

So, is there a way to turn this behaviour off?

7
  • 6
    FYI: I can't reproduce this problem on my Linux machine. Mar 28, 2015 at 18:29
  • I cannot reproduce this problem on my Mac either. Looks like you might have found a bug.
    – akshay
    Mar 29, 2015 at 7:08
  • I just reproduced this with GVim 7.4 on Windows. If the backslash is not deleted a new buffer is created. An error is issued 'E303: Unable to open swap file for "\!file.txt", recovery impossible.' This must be because \ is ilegal in Windows filenames. Apr 4, 2015 at 18:37
  • @GonçaloRibeiro: yes, this is what I have observed and why I have posted my question. But I want to use the tabulator so that vim opens the right (and existing) file without backslash. Apr 5, 2015 at 9:17
  • @RenéNyffenegger, yes, I understand. Unfortunately I am not aware of an option that can solve this. This could possibly be considered a bug. Apr 5, 2015 at 11:06

1 Answer 1

4

Since this issue was found to be a bug in the combination of your Windows version and version 7.4 of gvim (the latest as of 08/2015), the only answers are:

  • Wait until a newer version of vim for your Windows version. (7.3 came out 2010, 7.4 in 2013, so perhaps even this year)
  • Don't use the Windows version of gvim on your Windows version. You did not mention , if you tried different variants (vim native/cygwin, a "portable version"). So you could try those, or the recent vim fork neovim.
  • Use a different Windows Version. User mguiffrida found 8.1 to be unaffected. Perhaps the "fix" carried over into Windows 10 as well.

I realize, this is not the answer you wanted to hear, but -for now- this seems like the only answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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