-
Notifications
You must be signed in to change notification settings - Fork 153
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
Integrate with NERDTree #17
Comments
I have never used NERDTree myself. I will need to have a look to be sure... on a quick look it seems that it would be doable. |
Any news on this? |
@koddsson Not for now... but I have been taking a quick look at the NERDTree documentation, and I see there is some API exposed by NERDTree which we could use to add items to its menus. Better than modifying the behaviour of function EditNewFilename()
let l:filename = input("filename: ")
execute "edit " . l:filename
end
call NERDTreeAddMenuItem({
\ 'text': 'New with templ(A)te',
\ 'shortcut': 'A',
\ 'callback: 'EditNewFilename' }) If the templates plugin is installed and using Actually, being this easy to add your own “new file with template” item to the NERDTree menu, I think it could be better to add the example in the documentation, instead of explicitly adding support in the templates plugin, and letting people add the snipped in their |
That sounds good to me! I've never touched on vimscript before so I had some trouble setting this in my |
@koddsson Glad to hear it worked, because the code I have posted before was completely untested. Of course I will test properly the version that finally will go into the documentation 😉 |
Only thing that needs to change is that the snippet will open the file up in the current buffer (ie. the NERDTree window). I'm hoping to get a chance to look at the API and see if I can open it up in the "main" buffer. |
I explore the answer why nerdtree add new file that do not trigger vim-template .The reason is the way which nerdtree using that touch a new file using system call , so it does not trigger BufNewFile event . function! GetCurrentContent() |
@gubei: Hey, that's an interesting find, thanks for sharing! I wonder if maybe this is a bug in NERDtree, because in my opinion creating a file from NERDtree should work in a way that the I have reported the issue in the NERDtree projects, let's see how that goes. |
For me, the code above is enough to solve the problem. |
Hi Adrian, could I make it work with NERDTree's create file method(keys: m -> a)?
https://github.com/scrooloose/nerdtree
The text was updated successfully, but these errors were encountered: