aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authormattn <mattn.jp@gmail.com>2011-10-27 20:19:21 +0900
committermattn <mattn.jp@gmail.com>2011-10-27 20:19:21 +0900
commit1ef6348ddbc6afcfe99ee4600e8d00b53710bd8c (patch)
tree20b06289c0cdca28419cd61cd0d91fc8c005739f /doc
parent52e6c754c0e1b320d282f03cee669418e192104d (diff)
downloadvim-sonictemplate-1ef6348ddbc6afcfe99ee4600e8d00b53710bd8c.tar.gz
vim-sonictemplate-1ef6348ddbc6afcfe99ee4600e8d00b53710bd8c.tar.bz2
vim-sonictemplate-1ef6348ddbc6afcfe99ee4600e8d00b53710bd8c.zip
add document.
Diffstat (limited to 'doc')
-rw-r--r--doc/template-vim.txt154
1 files changed, 154 insertions, 0 deletions
diff --git a/doc/template-vim.txt b/doc/template-vim.txt
new file mode 100644
index 0000000..4e75628
--- /dev/null
+++ b/doc/template-vim.txt
@@ -0,0 +1,154 @@
+*template.txt* Template for Vim
+
+ -------------------------------------------------------
+ Template: easy way coding
+ -------------------------------------------------------
+
+Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
+WebSite: http://mattn.kaoriya.net/
+Repository: http://github.com/mattn/template-vim
+Site: http://mattn.github.com/template-vim
+License: BSD style license
+
+==============================================================================
+CONTENTS *template-contents*
+
+Introduction |template-introduction|
+Install |template-install|
+Tutorial |template-tutorial|
+Customize |template-customize|
+Write Your Template |template-writetemplate|
+
+==============================================================================
+INTRODUCTION *template-introduction* *template*
+
+|Template| is easy way to coding.
+
+ * Choose template for the filetype
+ * Few typings.
+ * Flexible customization.
+
+==============================================================================
+INSTALL *template-install*
+
+Install the distributed files into Vim runtime directory which is usually
+~/.vim/, or $HOME/vimfiles on Windows.
+
+If you install pathogen that provided from Tim Pope, you should extract the
+file into 'bundle' directory.
+
+==============================================================================
+TUTORIAL *template-tutorial*
+
+For example, you are writing C++ file.
+
+1. Create main function
+
+ Open new C++ file, and type following.
+>
+ :Template boost-main
+<
+ Then you can see following.
+>
+ #include <iostream>
+ #include <string>
+ #include <boost/foreach.hpp>
+
+ int
+ main(int argc, char* argv[]) {
+ _
+ return 0;
+ }
+<
+ The cursor is in the position of |_|.
+
+2. Add foreach loop
+
+ Type following.
+>
+ :Template boost-for
+<
+ Then you will be asked like following.
+>
+ variable:
+<
+ Then type "foo".
+>
+ #include <iostream>
+ #include <string>
+ #include <boost/foreach.hpp>
+
+ int
+ main(int argc, char* argv[]) {
+ BOOST_FOREACH(auto x, foo) {
+ _
+ }
+ return 0;
+ }
+<
+3. Add std::cout << xxx << std::endl;
+>
+ :Template cout
+<
+ Answer "x" for the question "string:".
+>
+ #include <iostream>
+ #include <string>
+ #include <boost/foreach.hpp>
+
+ int
+ main(int argc, char* argv[]) {
+ BOOST_FOREACH(auto x, foo) {
+ std::cout << x << std::endl;
+ }
+ return 0;
+ }
+<
+==============================================================================
+CUSTOMIZE *template-customize*
+
+You can modify template directory for your-self templates.
+>
+ let g:template_vim_template_dir = '/path/to/your/template/directory'
+<
+==============================================================================
+WRITE YOUR TEMPLATE *template-writetemplate*
+
+Templates are stored in the directory that "g:template_vim_template_dir"
+variable specified. On unix, directory structure is following.
+Note that I'm using pathogen-vim.
+>
+ ~/.vim/bundle/template-vim
+ plugin
+ template.vim
+ doc
+ template.txt
+ template
+ main.go
+ package.go
+ package.perl
+ script.perl
+ ...
+<
+Template can have some keywords.
+
+|{{_name_}}| the filename without extension.
+
+ If you are opening "foo.pl" for perl, {{_name_}} become "foo".
+
+|{{_cursor_}}| : cursor position.
+
+ When expanded template, cursor will be moved to there.
+
+|{{_input_:var}}| : ask the value of "var".
+
+ When expanded template, cursor will be moved to there.
+
+|{{_expr_:xxx}}| : expression in vimscript.
+
+ For example, "Current Time:|{{_expr_:strftime('%c')}}|" will be
+>
+ Current Time: 2011/10/27 20:19:00
+<
+==============================================================================
+vim:tw=78:ts=8:ft=help:norl:noet:fen:fdl=0: