*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" results in a popup menu if |g:xptemplate_always_show_pum| set to 1: > for |for | |forloop | |forr | < Otherwise, "for" 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 pressed. By default, xptemplate override key mapping of (local to buffer)every time starting to applying a snippet. This might change user prefered behavior if user has his own key mapping of defined. This conf let user to fix issues like this. The following line in .vimrc appends "abc" every time pressed during applying snippet: > let g:xptemplate_hook_before_cr = 'abc' < And this appends current time every time pressed: > fun! s:OutputDate() return strftime('%c') endfunction inoremap do_my_work OutputDate() let g:xptemplate_hook_before_cr = 'do_my_work' < NOTE: |g:xptemplate_hook_before_cr| does not accept . And if you want to use 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 < "" 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 closes the popup menu and sends the cursor to the next place holder. When not set expands the text to the longest match and keeps the popup menu open. *g:xptemplate_pum_quick_back* {default:1} With popup menu, pressing "" removes minimal chars to reveil more options. If this is set to 0, pressing "" removes only 1 char. For example, popup menu created with 3 options: > "foo", "fooba", "foobar" < Typing "fooba" shrinks menu to: > fooba foobar < Now pressing "" will remove 2 chars: "ba", and leave "foo", the longest prefix that has 3 options. Pressing "" 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 /( shift + tab ) to navigate through pop up menu. behaves like and behaves like . And 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: