adding new stuff
This commit is contained in:
parent
f84d7183aa
commit
9ef8a96f9a
1580 changed files with 0 additions and 0 deletions
17
plugins/bundle/xptemplate/doc/xpt/credit.txt
Normal file
17
plugins/bundle/xptemplate/doc/xpt/credit.txt
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
Thanks to:
|
||||
|
||||
Agassi
|
||||
Agassi Yu
|
||||
chen
|
||||
Florian Preinstorfer
|
||||
Gautier DI FOLCO
|
||||
grassofhust
|
||||
italiafreeware
|
||||
kikijump
|
||||
Kirill Klenov
|
||||
liu
|
||||
Lowe Thiderman
|
||||
twinside
|
||||
Vincent Berthoux
|
||||
@bstaint
|
||||
胡晋
|
||||
25
plugins/bundle/xptemplate/doc/xpt/indent.md
Normal file
25
plugins/bundle/xptemplate/doc/xpt/indent.md
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
- 4-space indent:
|
||||
Used in snippet file.
|
||||
Consistent with different 'tabstop', 'shiftwidth' setting.
|
||||
|
||||
- tab indent:
|
||||
Used internally in XPTemplate.
|
||||
Produced by converting 4 leading space to one tab.
|
||||
|
||||
These two above are VIM setting irrelavent. Snippet file can use either of
|
||||
them, but 4-space indent is recommended.
|
||||
|
||||
- space indent:
|
||||
Produced by expanding a `tab` char to `&shiftwidth` spaces.
|
||||
These spaces occupies the same room as actual indent.
|
||||
This is the second last step before putting text onto screen.
|
||||
|
||||
space indent texts are used internally.
|
||||
Wrapped text is passing through in this style.
|
||||
|
||||
- actual indent:
|
||||
Produced by convert `&tabstop` space to one tab if 'expandtab' not set.
|
||||
This is the actual indent
|
||||
|
||||
The last two are VIM setting relavent.
|
||||
354
plugins/bundle/xptemplate/doc/xpt/option.txt
Normal file
354
plugins/bundle/xptemplate/doc/xpt/option.txt
Normal file
|
|
@ -0,0 +1,354 @@
|
|||
*xpt-option*
|
||||
==============================================================================
|
||||
|
||||
Table of Content ~
|
||||
|
||||
|g:xptemplate_always_show_pum|
|
||||
|g:xptemplate_brace_complete|
|
||||
|g:xptemplate_break_undo|
|
||||
|g:xptemplate_bundle|
|
||||
|g:xptemplate_close_pum|
|
||||
|g:xptemplate_cwd_snippet|
|
||||
|g:xptemplate_debug_log|
|
||||
|g:xptemplate_highlight|
|
||||
|g:xptemplate_highlight_nested|
|
||||
|g:xptemplate_hook_before_cr|
|
||||
|g:xptemplate_lib_filter|
|
||||
|g:xptemplate_minimal_prefix|
|
||||
|g:xptemplate_move_even_with_pum|
|
||||
|g:xptemplate_ph_pum_accept_empty|
|
||||
|g:xptemplate_pum_quick_back|
|
||||
|g:xptemplate_pum_tab_nav|
|
||||
|g:xptemplate_snippet_folders|
|
||||
|g:xptemplate_strict|
|
||||
|g:xptemplate_strip_left|
|
||||
|g:xptemplate_vars|
|
||||
|
||||
*g:xptemplate_always_show_pum*
|
||||
{default:0}
|
||||
If set to 1, snippets is not triggered but popup menu shows even when
|
||||
text user typed before cursor matches a snippet name.
|
||||
|
||||
For example, you have three snippets defined of names: "for", "forever"
|
||||
and "forr". Typing "for<C-\>" results in a popup menu if
|
||||
|g:xptemplate_always_show_pum| set to 1: >
|
||||
for
|
||||
|for |
|
||||
|forloop |
|
||||
|forr |
|
||||
< Otherwise, "for<C-\>" triggers snippet "for".
|
||||
|
||||
See also: |g:xptemplate_key_force_pum|.
|
||||
|
||||
|
||||
*g:xptemplate_brace_complete*
|
||||
{default:1}
|
||||
If set to 1, bracket characters are automatically expanded to bracket
|
||||
pairs. For example typing "(" results in: >
|
||||
( )
|
||||
\______| cursor stops in mid of pairs of bracket
|
||||
< "(", "[", "{", "'" and '"' are affected by this setting.
|
||||
|
||||
If set to string, only bracket or quote chars included in this setting
|
||||
will be mapped. For example: >
|
||||
let g:xptemplate_brace_complete = '([{'
|
||||
< With this setting, quotes are not mapped.
|
||||
|
||||
|
||||
*g:xptemplate_break_undo*
|
||||
{default:0}
|
||||
If set to 1, undo sequence will be broken with |i_CTRL-G_u| before
|
||||
snippet triggered. This would help on rolling back when mistake was
|
||||
made.
|
||||
|
||||
|
||||
*g:xptemplate_bundle*
|
||||
|
||||
This option specifies what libraries will always be load to its file
|
||||
type. For example: >
|
||||
let g:xptemplate_bundle = 'javascript_jquery'
|
||||
< This tells XPT to load jquery snippet to javascript language.
|
||||
Or: >
|
||||
let g:xptemplate_bundle = 'javascript_jquery,c_*'
|
||||
< It tells XPT to load jquery, and all supplied library snippets for C
|
||||
language.
|
||||
|
||||
Another way to load bundles is |g:XPTaddBundle()|.
|
||||
|
||||
|
||||
*g:xptemplate_close_pum*
|
||||
{default:0}
|
||||
If set to 1, when trigger key(|g:xptemplate_key|) is pressed, before
|
||||
doing anything, popup menu will be closed.
|
||||
|
||||
|
||||
*g:xptemplate_cwd_snippet*
|
||||
{default:0}
|
||||
Set this to 1 to enable each vim buffer to automatically load file
|
||||
".xpt.vim" from current working directory, as snippet file specific to
|
||||
current directory( or project ).
|
||||
|
||||
Current ".xpt.vim" accepts only the most simple form of snippet, the
|
||||
function call form: >
|
||||
call XPTemplate( 'foo', '`foo^ says hello' )
|
||||
<
|
||||
|
||||
|
||||
*g:xptemplate_debug_log*
|
||||
{default:''}
|
||||
|
||||
This option specifies whether and where to store debug log emitted
|
||||
during xptemplate running. Unless you are a developer of xptempalte,
|
||||
do not touch it.
|
||||
|
||||
Empty string disables any logging.
|
||||
|
||||
Non-empty string is interpreted as log file path. "~/" at start will
|
||||
be replaced with "$HOME/".
|
||||
|
||||
Example: >
|
||||
let g:xptemplate_debug_log = '~/.xpt.log'
|
||||
<
|
||||
|
||||
*g:xptemplate_highlight*
|
||||
{default:'next'}
|
||||
Specifies which place holders are high lighted. The value of
|
||||
|g:xptemplate_highlight| is a comma separated string.
|
||||
|
||||
Possible values are: "current", "following" and "next". Example: >
|
||||
let g:xptemplate_highlight = 'following,next'
|
||||
<
|
||||
"current" lets XPTemplate highlight the place holder you are currently
|
||||
editing. See |XPTcurrentPH|.
|
||||
For example the first "i" in "for" snippet of C language: >
|
||||
for ( i = 0; i < len; ++i ) {
|
||||
\__________________________ highlighted
|
||||
<
|
||||
"following" lets XPTemplate highlight slave place holders which are
|
||||
updated automatically. See |XPTfollowingPH|.
|
||||
For example the second and third "i" in "for" snippet of C language: >
|
||||
for ( i = 0; i < len; ++i ) {
|
||||
\__________\________ highlighted
|
||||
<
|
||||
"next" lets XPTemplate highlight the place holders you are going to
|
||||
edit. See |XPTnextItem|.
|
||||
For example the "0" and "len" if "for" snippet of C language: >
|
||||
for ( i = 0; i < len; ++i ) {
|
||||
\______\\\_____________ highlighted
|
||||
<
|
||||
Set |g:xptemplate_highlight| to '' to disable highlight.
|
||||
|
||||
|
||||
*g:xptemplate_highlight_nested*
|
||||
{default:0}
|
||||
If set to 1, highlight is also applied to outer snippet, not only the
|
||||
deepest nested one. For example, If set to 1, the following positions
|
||||
are highlighted: >
|
||||
________________________| highlighted
|
||||
_/ _/ ___/
|
||||
for ( call( me ) = 0; call < len; call++ ) {
|
||||
/* cursor */
|
||||
~~~~~~~~~~~\__________________________| highlighted
|
||||
}
|
||||
< The first highlight position is from nested snippet "(". Others are
|
||||
from outer snippet "for".
|
||||
|
||||
|
||||
*g:xptemplate_hook_before_cr*
|
||||
{default:''}
|
||||
Add additional action before default xptemplate action when <CR>
|
||||
pressed.
|
||||
|
||||
By default, xptemplate override key mapping of <CR>(local to
|
||||
buffer)every time starting to applying a snippet. This might change
|
||||
user prefered <CR> behavior if user has his own key mapping of <CR>
|
||||
defined.
|
||||
This conf let user to fix issues like this.
|
||||
|
||||
The following line in .vimrc appends "abc" every time <CR> pressed
|
||||
during applying snippet: >
|
||||
let g:xptemplate_hook_before_cr = 'abc'
|
||||
<
|
||||
And this appends current time every time <CR> pressed: >
|
||||
fun! s:OutputDate()
|
||||
return strftime('%c')
|
||||
endfunction
|
||||
inoremap <expr> <Plug>do_my_work <SID>OutputDate()
|
||||
let g:xptemplate_hook_before_cr = '<Plug>do_my_work'
|
||||
<
|
||||
NOTE:
|
||||
|g:xptemplate_hook_before_cr| does not accept <SID>.
|
||||
|
||||
And if you want to use <expr> mapping with
|
||||
|g:xptemplate_hook_before_cr| , you need a in-the-middle
|
||||
mapping like it does in the second example.
|
||||
|
||||
|
||||
*g:xptemplate_lib_filter*
|
||||
{default:.}
|
||||
Value: unset: do not filter, load any snippet found.
|
||||
string: regular expression.
|
||||
list: list of regular expression.
|
||||
|
||||
If set, XPT loads only snippets(*.xpt.vim) from 'runtimepath' that
|
||||
matches it or one of its elements.
|
||||
|
||||
NOTE: This option tries to match actual path of a snippet file.
|
||||
Symbolic link would be resolved.
|
||||
|
||||
NOTE: Included snippet like "*/_common/common.xpt.vim" is essential
|
||||
for other snippet to work thus it won't be affected by this
|
||||
option.
|
||||
|
||||
For example: >
|
||||
let g:xptemplate_lib_filter = [
|
||||
\ '/my_snippets\>',
|
||||
\ '/all_user_snippets/ftplugin/xml/' ]
|
||||
< The above setting tells XPT to ignore snippet supplied by XPT but to
|
||||
load only "*/my_snippets/ftplugin/*/*.xpt.vim", and use only "xml"
|
||||
snippets from "*/all_user_snippets/ftplugin/xml/*.xpt.vim".
|
||||
|
||||
It would works the same as with: >
|
||||
let g:xptemplate_lib_filter = '/my_snippets\>\|/all_user_snippets/ftplugin/xml/'
|
||||
<
|
||||
|
||||
*g:xptemplate_minimal_prefix*
|
||||
{default:0}
|
||||
Posssible values: number or "full".
|
||||
|
||||
If set it to a number( N ), it means snippet is triggered( or pum
|
||||
shows ) only when there are at least N |word| letters before cursor.
|
||||
|
||||
If set to "full", |g:xptemplate_key| searches for a snippet of name
|
||||
matching exactly the word before cursor.
|
||||
|
||||
For example, you have only one snippet defined with name "xpt". The
|
||||
following input will trigger "xpt" snippet, if
|
||||
|g:xptemplate_minimal_prefix| set to 0 ( it also works with value 1 and
|
||||
2, but not with 3 ): >
|
||||
xp<C-\>
|
||||
< "<C-\>" is the default trigger key.
|
||||
|
||||
If |g:xptemplate_minimal_prefix| set to "full", the above input can not
|
||||
trigger "xpt" snippet.
|
||||
|
||||
|
||||
*g:xptemplate_move_even_with_pum*
|
||||
{default:0}
|
||||
If set to 1, |g:xptemplate_nav_next| does not care whether pop up menu
|
||||
shown or not. It will always move cursor to next item.
|
||||
|
||||
Otherwise, |g:xptemplate_nav_next| fall back to original mapping. This
|
||||
could be helpfull for xpt working with supertab together.
|
||||
|
||||
|
||||
*g:xptemplate_ph_pum_accept_empty*
|
||||
{default:1}
|
||||
When set to 1 popup menus for place holders accepts an empty input. So
|
||||
when nothing typed pressing <Tab> closes the popup menu and sends the
|
||||
cursor to the next place holder.
|
||||
When not set <Tab> expands the text to the longest match and keeps the
|
||||
popup menu open.
|
||||
|
||||
|
||||
*g:xptemplate_pum_quick_back*
|
||||
{default:1}
|
||||
With popup menu, pressing "<BS>" removes minimal chars to reveil
|
||||
more options.
|
||||
If this is set to 0, pressing "<BS>" removes only 1 char.
|
||||
|
||||
For example, popup menu created with 3 options: >
|
||||
"foo", "fooba", "foobar"
|
||||
<
|
||||
Typing "fooba" shrinks menu to: >
|
||||
fooba
|
||||
foobar
|
||||
< Now pressing "<BS>" will remove 2 chars: "ba", and leave "foo", the
|
||||
longest prefix that has 3 options.
|
||||
|
||||
Pressing "<BS>" again will remove "foo".
|
||||
|
||||
NOTE: Very large list might hang VIM for seconds. In this case set
|
||||
this to 0 to get better performance.
|
||||
|
||||
This feature depends on a prefix dictionary of all of the
|
||||
options. The prefix dictionary will be created every time
|
||||
popup menu is called.
|
||||
|
||||
|
||||
*g:xptemplate_pum_tab_nav*
|
||||
{default:0}
|
||||
Set to 1 to use <tab>/<S-tab>( shift + tab ) to navigate through pop
|
||||
up menu. <tab> behaves like <C-n> and <S-tab> behaves like <C-p>. And
|
||||
<CR> expands snippet.
|
||||
|
||||
|
||||
*g:xptemplate_snippet_folders*
|
||||
{default:[]}
|
||||
NOTE: Unless you really want XPTemplate to touch your 'runtimepath',
|
||||
do NOT use this. This setting changes 'runtimepath' and is
|
||||
less recommended to use than 'runtimepath'. As you may already
|
||||
know well about 'runtimepath' and 'ftplugin', it is better for
|
||||
you to organize snippet files yourself, with 'runtimepath'.
|
||||
|
||||
A list to specify which other folders are used as snippet folders.
|
||||
For example: >
|
||||
let g:xptemplate_snippet_folders = [
|
||||
\ $HOME . '/my_snippets',
|
||||
\ '/all_user_snippets' ]
|
||||
< Thus the snippet file "$HOME/my_snippets/ftplugin/c/my.c.xpt.vim" can
|
||||
be loaded to C files.
|
||||
And "/all_user_snippets/ftplugins/html/all.html.xpt.vim" can be loaded
|
||||
to HTML files.
|
||||
|
||||
|
||||
*g:xptemplate_strict*
|
||||
{default:2}
|
||||
Set to 0 to let XPTemplate do the best maintaining snippet rendering,
|
||||
even if you have changed text outside of place holders.
|
||||
|
||||
Set to 1 to prevent incautious changing text outside place holders.
|
||||
Otherwise you are free to change text outside of place holders.
|
||||
|
||||
Set to 2 to let XPTemplate stop rendering if ANY changes taken to text
|
||||
outside of place holders.
|
||||
|
||||
Example : >
|
||||
let g:xptemplate_strict = 1
|
||||
<
|
||||
|
||||
|
||||
*g:xptemplate_strip_left*
|
||||
{default:1}
|
||||
When set to 1 wrapper snippets |xpt-wrapper-snippet| remove space
|
||||
before the first line.
|
||||
|
||||
|
||||
*xpt-personal-var* *g:xptemplate_vars*
|
||||
g:xptemplate_vars sets personal information variables used in
|
||||
snippets, like "author" and "email", see |xpt-snippet-variable|.
|
||||
|
||||
Variables set with g:xptemplate_vars have the highest priority and
|
||||
override any other variables set in *.xpt.vim. Syntax: >
|
||||
let g:xptemplate_vars = 'name=value&name=value...'
|
||||
< Example: >
|
||||
let g:xptemplate_vars = '$author=xp\ \&\\\&123&$email=bal@bla'
|
||||
let g:xptemplate_vars = 'author=xp\ \&\\\&123&email=bal@bla'
|
||||
|
||||
< Both the 2 lines above result in: >
|
||||
'xp\ &\&123' and 'bal@bla'
|
||||
|
||||
< Or: >
|
||||
let g:xptemplate_vars = exists('g:xptemplate_vars') ?
|
||||
\ g:xptemplate_vars . '&' . '$other=bla'
|
||||
\ : '$other=bla'
|
||||
<
|
||||
Entries are separated with '&'.
|
||||
|
||||
You can also set these settings in ftplugin/_common/personal.xpt.vim
|
||||
in your runtime path using XPTvar |xpt-snippet-variable| (see also
|
||||
|xpt-customize-variable|).
|
||||
|
||||
|
||||
|
||||
" vim: tw=78:ts=8:sw=8:sts=8:noet:ft=help:norl:
|
||||
107
plugins/bundle/xptemplate/doc/xpt/snippet-function.txt
Normal file
107
plugins/bundle/xptemplate/doc/xpt/snippet-function.txt
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
*xpt-snippet-function*
|
||||
==============================================================================
|
||||
|
||||
Table of Content ~
|
||||
|
||||
|Build|
|
||||
|BuildSnippet|
|
||||
|Echo|
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
|xpt-snippet-function| can be used in :
|
||||
|xpt-snippet-instant-value|
|
||||
|xpt-snippet-preset-value|
|
||||
|xpt-snippet-default-value|
|
||||
|xpt-snippet-post-filter|
|
||||
|xpt-placeholder-ontime-filter|
|
||||
To define |xpt-snippet-function|, the function container must be
|
||||
fetched by using |XPTfuncs()|. For example : >
|
||||
let s:f = XPTfuncs()
|
||||
fun! s:f.c_printfElts( v )
|
||||
...
|
||||
endfunction
|
||||
< Then function 'c_printfElts' can be used in the snippet : >
|
||||
XPT printf " printf\(...)
|
||||
XSET elts=c_printfElts( R( 'pattern' ) )
|
||||
printf( "`pattern^"`elts^ )
|
||||
<
|
||||
NOTE By convention the names of |xpt-snippet-function|s supplied by
|
||||
XPTemplate start with an upper-case letter. User defined
|
||||
function names should starts with a lower-case letter.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
*Build()*
|
||||
Build({snippet_text})
|
||||
Build a piece of snippet text to replace the place holder on which
|
||||
Build() is called.
|
||||
|
||||
Argument {snippet_text} is the content of snippet to build.
|
||||
|
||||
After calling it, place holder is removed and the first place holder
|
||||
in this piece of snippet built is selected.
|
||||
|
||||
Context: >
|
||||
XSET ph=Build('`a^ = `0^')
|
||||
XSET ph|post=Build('`a^ = `0^')
|
||||
<
|
||||
See also: |BuildSnippet()|
|
||||
|
||||
|
||||
*BuildSnippet()*
|
||||
BuildSnippet({snippet})
|
||||
Build an existent snippet to replace the place holder on which
|
||||
BuildSnippet() is called.
|
||||
|
||||
Argument {snippet} is the name of snippet to build.
|
||||
|
||||
After calling it, place holder is removed and the first place holder
|
||||
in this piece of snippet is selected.
|
||||
|
||||
Example snippets: >
|
||||
XPT parent
|
||||
XSET x=BuildSnippet( "child" )
|
||||
-`x^=
|
||||
|
||||
XPT child
|
||||
(`a^, `b^)
|
||||
<
|
||||
Type: >
|
||||
parent<C-\>
|
||||
< Got: >
|
||||
-(a, b)=
|
||||
< {a} and {b} is place holder
|
||||
|
||||
Context: >
|
||||
XSET ph=BuildSnippet('a')
|
||||
XSET ph|post=BuildSnippet('a')
|
||||
<
|
||||
See also: |Build()|
|
||||
|
||||
|
||||
*Echo()*
|
||||
Echo({string})
|
||||
Put literal text {string} where it is called.
|
||||
|
||||
{string} can be any valid expression.
|
||||
|
||||
Place holders in {string} will not be built.
|
||||
|
||||
Context it works in: >
|
||||
`Echo('a')^
|
||||
XSET ph=Echo('a')
|
||||
XSET ph|def=Echo('a')
|
||||
XSET ph|pre=Echo('a')
|
||||
XSET ph|post=Echo('a')
|
||||
<
|
||||
Example: >
|
||||
XPT now
|
||||
`Echo( strftime("%c") )^
|
||||
<
|
||||
See also: |Build()| |BuildSnippet()|
|
||||
See also: |xpt-snippet-XSET|
|
||||
|
||||
|
||||
|
||||
" vim: tw=78:ts=8:sw=8:sts=8:noet:ft=help:norl:
|
||||
Loading…
Add table
Add a link
Reference in a new issue