I'm using Janus (isn't pivotal to understand the question though). Basically what they do, is rewrite :e to be :Edit to work with NERDTree, but NERDTree doesn't support force opening a file (e.g. e!). So I had written something that rewrites :Edit! to :e!, but I like the benefits of using just :Edit!, so I'm trying to spoof if as if it was already built in. This is what I came up with:
ca Edit! e! <bar> Edit
The only problem, is that you can't do that for files that haven't been saved at least once. But I know doing
ca Edit! bd! <bar> Edit
will work: it will close the unsaved buffer and keep moving like nothing happened. All I need to do is write logic that will use the correct command in the right scenario all the time. Preferably the logic doesn't run on every page: only when I actually run the command should it attempt to figure it out. Any ideas?
Edit: I tried asking the #vim channel (gave me tons of help)... they said using expand("%") and checking to see if it exists might help my case? Don't know, just providing as much detail as I can.