Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:e can't create nonexistent files automatically anymore like #2274 described #4134

Open
escape0707 opened this issue Oct 4, 2019 · 4 comments

Comments

@escape0707
Copy link

Describe the bug
Typing ":e example.txt" opens a tab with a named file which is not created or saved on the disk.

To Reproduce
Enter a file name that doesn't exist in that path.

Expected behavior
I expect the new file to be created on the disk automatically like in the previous version did, especially cause in my workflow I need to frequently create files, make use of auto save, and compile and run files.

Environment

  • Issue Type: Bug
  • Extension Name: vim
  • Extension Version: 1.11.0
  • OS Version: Windows_NT x64 10.0.18362
  • VSCode version: 1.38.1
@escape0707
Copy link
Author

Is this a regression to #2274 or by new design?

@joanrieu
Copy link

joanrieu commented Oct 12, 2019

Quoting f70c8aa:

In the actual Vim, commands like ":e" do not create a file first if the path in the cmd doesn't exist. Rather, it creates an empty buffer and only create the file on write.
This commits changes the behavior to be more consistent with actual Vim by using untitled document instead creating the file if the file on the cmd is not found.

I'd say the behavior you describe is by design since it follows the original Vim behavior.

@escape0707
Copy link
Author

@joanrieu thanks for your in-depth reply.

I understand the current behavior equals to the original Vim. But I have a few more consideration over whether to apply it to VS Code Vim Extension as well. Let me explain:

  1. I'm not sure about whether the overall goal of this extension project is to reproduce every stock behavior of the original Vim in VS Code, or, to make use of Vim philosophy together with VS Code to save people time especially on typing and moving their hand.

  2. For VS Code environment, it's weird to draw an analogy between File: New Untitled File and :e filename.ext because the first command don't accept a filename at all. When you run the better analogy which I suppose is File: New File, VS Code will actually create and save an empty file with the given name.

  3. Vim don't have features like auto-save, IntelliSense, Git, etc. out of the box, so the original behavior doesn't suit VS Code workflow very well in many aspects:

    1. Auto-save won't work until you manually save it first.
    2. IntelliSense won't work, too. At least in my C++ workspace, it won't suggest a header file placed just in the same folder.
    3. Integrated source control won't reflect that you have untracked code at all even if you have many lines entered already.

    According to these and maybe some other underlying problems like "won't work with another extension until I saved it first", I'll 99% definitely need to save it just after the creation. The 1% is I mistyped the filename. It‘s bother and a waste of time to type :e filename.ext then :w for every file.

  4. VS Code Vim is not as easy to customize as original Vim using .vimrc or .vim plugins. I can't come up with a better way to do :e xxx and :w in a strike easily. (BTW, I can't use VS Code Vim to easily rename current file either.)

  5. The previous behavior is discussed and seems to work very well without complaints back to the old :e needs to create nonexistent files automatically #2274 time. People expressed that they expect this behavior ever since then.

Anyway, if the previous behavior won't be reverted to, then this will be a major obstacle for me to upgrade the extension starting from this version. And I'd like (and have) to learn some new way to come through it like "an option", or some emulated plugins.

@johnyoonh
Copy link

johnyoonh commented Feb 27, 2020

Similar complaint here:
for vsp:
#4098
It also affects gf for me:
#2683

@J-Fields J-Fields changed the title :e can't create nonexistent files automatically anymore like #2274 described :e can't create nonexistent files automatically anymore like #2274 described Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants