-
-
Notifications
You must be signed in to change notification settings - Fork 66
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
:A creates a new file if it does not exist #5
Comments
This seemed like a good opportunity to experiment with a different default. It's pre-1.0 so it could change. I'm not big on |
Still undecided about other navigation commands, but I've decided I'm against automatic alternate creation. |
Hmm, I had considered using |
The reason I don't prefer automatic file creation is: I set up Also: buffer list is now dirty and alternate buffer command (C-^) takes me to this unwanted buffer. I do think (or just guess) file creation could be useful in many other scenarios. |
The thing that finally swayed me was porting rake.vim to use projectile.vim, and realizing that there were 6 different lib to test alternate conventions. Creating a file is iffy but overwhelming odds of creating the wrong file? Feels like a deal breaker. I vastly value predictability over configurability. I'm still open to some sort of a I'm not sure I understand this chain use case. |
It's not really a big deal. The general workflow would have a
The idea is that these 3 files are closely related, and all depend on each other in some way. I'd create a new In reality I'd probably never actually do this; it was just an idea. |
This is probably better left to scaffolding tools or something. |
I think an in-editor solution to that might work a bit like rails.vim's "affinity", but it's hard to say how to make that general purpose. |
Could it be controlled using an attribute? This would leave it to the users to decide which files were created and avoids needing {
"app/*.rb": {
"alternate": "spec/{}_spec.rb",
"create_missing": "true"
}
} |
I was complaining just the other day that I wanted a way to do this in a way that I could configure for my particular workflow. |
I would also like to have files created for me, since it reduces the need for me to make sure I'm naming the files correctly. Could we do either what @AdamWhittingham suggests of maybe have a global flag that can be opt-in to create if missing, ie. something like |
Or what if we added |
And |
So far, the best option looks like using |
I've expected |
@tpope How about a config variable that controls the behaviour? Pick a safe default and let the users who want different behaviour decide how it works. I know it's not your preferred solution but given how long we've gone without something to address this issue, maybe it's worth considering |
I don't like the config variable option because it doesn't allow for easy case-by-case control. I think separate commands (the |
I experimentally added a prompt to create if the file doesn't exist. Let me know what you think. No promises I won't revert. |
I love it! 😄 Thank you for the time and effort, I appreciate the amount you do for the Vim community. |
👍 Love this change, hoping it can be supported in vim-rails too. |
It's a lot harder on that crufty old code base, but I hope so too. |
+1 for vim-rails support. That would ease one of the most annoying parts of my workflow, esp. in older projects that don't have spec files. |
+1 for vim-rails support for this also! I'm in the same boat that was previously mentioned of needing to generate lots of spec files for a project that wasn't previously tested. |
I'd love to see this feature too. |
In rails project (using rails.vim), when in
lib/my_class.rb
and I hit:A
, I'll see an error if there's no spec file for my_class.rb.I was surprised to discover that this project's
:A
creates a new buffer if the file does not exist!Is this behavior different by accident? Or there's going to be a new "default"?
Personally, I'd prefer to get an error if the file does not exist, and then bang
:A!
to create it.Btw. fantastic plugin, just what I need - love it!
The text was updated successfully, but these errors were encountered: