-
Notifications
You must be signed in to change notification settings - Fork 137
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
feature request: on file created hook #527
Comments
There is a User autocmd that is dispatched after performing file mutations oil.nvim/lua/oil/mutator/init.lua Lines 423 to 426 in 3c2de37
The type definition for actions is above oil.nvim/lua/oil/mutator/init.lua Lines 19 to 49 in 3c2de37
You'll need to process the urls to get the actual filename, but it should be relatively straightforward |
:o huge news, ty :) |
Did you check existing requests?
Describe the feature
When i create new files with oil, i want the file to be filled with some basic content. A hook which takes the file path would be perfect. I can handle writing to the file in the hook. This makes it a bit more versatile as you're not locked into writing content to the file, it can be used for anything else where you might need the file path or just the filetype.
Provide background
When creating .cs files i (almost) always want it to contain a line with the namespace that c# code in the file should exist within. In the most popular IDEs this just happens by itself, but since nvim is a text editor, i have to manually write it in. I just want to avoid that because its boilerplate and i don't really care about it, but it has to be done. Adding a hook which is invoked after a file is created will allow me to do this with a little configuration on my part.
I tried using an autocmd with
"BufNewFile"
, but that falls short because its only whenWhat is the significance of this feature?
strongly desired
Additional details
I would say this is
strongly desired
for me, but i'm betting its anice to have
for most.i imagine the configuration like this:
the key (
lua
,cs
) is the neovim filetype and thepath
is the full path to the fileThe text was updated successfully, but these errors were encountered: