- REDIRECT Use eval to create dynamic templates
(Redirect, no useful input) |
(remove old content) |
||
| Line 1: | Line 1: | ||
#REDIRECT [[Use eval to create dynamic templates]] |
#REDIRECT [[Use eval to create dynamic templates]] |
||
| − | {{dodgy}} |
||
| − | {{review}} |
||
| − | {{TipImported |
||
| − | |id=375 |
||
| − | |previous=374 |
||
| − | |next=376 |
||
| − | |created=November 25, 2002 |
||
| − | |complexity=basic |
||
| − | |author=Dan Allen |
||
| − | |version=5.7 |
||
| − | |rating=19/7 |
||
| − | |category1=HTML |
||
| − | |category2=Templates |
||
| − | }} |
||
| − | How about starting your new html document with a nice shiny skeleton! Add this in your autocmd section in your [[vimrc]]: |
||
| − | <pre> |
||
| − | " Start with an html skeleton document when opening a new *.html file |
||
| − | au BufNewFile *.html | execute "normal! :set ai!\<kEnter>i<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\<kEnter><html>\<kEnter> <head>\<kEnter> <style>\<kEnter> </style>\<kEnter> <script>\<kEnter> </script>\<kEnter> </head>\<kEnter> <body>\<kEnter> </body>\<kEnter></html>\<Esc>:set ai\<kEnter>gg" |
||
| − | </pre> |
||
| − | |||
| − | ==References== |
||
| − | *{{help|BufNewFile}} |
||
| − | *{{help|:execute}} |
||
| − | *{{help|:normal}} |
||
| − | *{{help|template}} |
||
| − | |||
| − | ==Comments== |
||
| − | Slight Variant (without tabs/spaces) |
||
| − | au BufNewFile *.html | execute "normal! :\<kEnter>i\<html>\<kEnter><head>\<kEnter><title>title</title>\<kEnter><script>\<kEnter></script>\<kEnter></head>\<kEnter><body>\<kEnter></body>\<kEnter></html>\<Esc>gg" |
||
| − | |||
| − | ---- |
||
| − | I added some spaces to make the indentation a little prettier: |
||
| − | au BufNewFile *.html | execute "normal! :\<kEnter>i\<html>\<kEnter> <head>\<kEnter> <title></title>\<kEnter> <script language=\"javascript\">\<kEnter> </script>\<kEnter> </head>\<kEnter> <body>\<kEnter> </body>\<kEnter></html>\<Esc>gg" |
||
| − | |||
| − | ---- |
||
| − | '''TODO''' Make a choice/fix the snippets. None of the code snippets really looked good in my environment (because of indenting issues). Morevover all three have a little something the others don't have. (May I say using a template-file loader/expander provides templates easier to tweak?... :-/ -> {{help|template}}). |
||
| − | |||
| − | Anyway, I'm quite sure there are many template/snippets tips out there. Let's start by finding them all. |
||
| − | |||
| − | ---- |
||