Wednesday, February 5, 2014

Adding a file name to a template

I would like to know if I can put the file name into the template automatically. This is what I have in my .vimrc to create the template:

augroup filetype_html
    autocmd!
    autocmd BufNewFile * silent! 0r $HOME/.vim/templates/%:e.tpl
augroup END


So if I do this:

$ vim testing.c

I get this:

// title:

#include <stdio.h>

int main(void)
{
   
    return 0;
}



This is what I want:

// title: testing.c

#include <stdio.h>

int main(void)
{

return 0;
}

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
 
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment