Is there a function that can be called to open a file for editing? I know how to open and edit files in Vim, and I know I can use
:e filename, but is there a built in function I can call that does this?
If a function exists that does this, there probably is a reason for it to exist in addition to the
:e command and knowing about its existence and what it is called would enable me to look at it in the help and see the purpose of its existence.
One problem with using
:e filepath is it gets confused when there are spaces in the path. I tried surrounding the path in quotes, and this allows the command to run without error. But then I can't save, as it seems to think the file is inside a non-existent directory. If I escaped the spaces with a
\ character, it works when the command is run directly, but it is causing problems inside a plugin test of mine. I haven't figured out a good way to ask for help with that exact problem yet, so I want to keep this question focused on how to consistently open a path for editing regardless of what characters may be in it. A built in function to do this would be nice, but now I see making my own would be good as well.