I am having an issue with Vim, NeoVim in this case if it makes a difference. I have an autocmd that includes a boilerplate when creating a file of a certain type, a Vue file in this case. Here is the code:
autocmd BufNewFile *.vue silent! 0r ~/.dotfiles/skeletons/vue-pug-scss.vue
This simple thing works great except when using CTRL-^ it goes back to the boilerplate file and I don't want this. I don't want the boilerplate file to be in my history of visited files so to speak.
I've tried many things but I struggle to understand how the buffer list works together with CTRL-^. The thing is that if I run :ls, the boilerplate file does not appear even though it is what I get when doing CTRL-^. It only appears in :ls once I've been back on it.
What I thought would work is to add | bd# but it says no buffer was deleted. When I am on the newly created file, :bd# does not work whereas :b# works. This sounds completely illogical to me, or inconsistent at best. Although I am probably mixing up an alternate buffer and previous buffer or something.
Does anybody know how I can make this work?