You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

835 lines
24 KiB

  1. *neosnippet.txt*
  2. The neo-snippet plugin contains snippet source
  3. Version: 5.0
  4. Author: Shougo <Shougo.Matsu@gmail.com>
  5. License: MIT license
  6. CONTENTS *neosnippet-contents*
  7. Introduction |neosnippet-introduction|
  8. Install |neosnippet-install|
  9. Interface |neosnippet-interface|
  10. Commands |neosnippet-commands|
  11. Variables |neosnippet-variables|
  12. Key mappings |neosnippet-key-mappings|
  13. Functions |neosnippet-functions|
  14. Examples |neosnippet-examples|
  15. Snippet syntax |neosnippet-snippet-syntax|
  16. FAQ |neosnippet-faq|
  17. ==============================================================================
  18. INTRODUCTION *neosnippet-introduction*
  19. *neosnippet* offers functionality similar to snipMate.vim or snippetsEmu.vim.
  20. This analyzes snippet files which you can use for the completion. Since you
  21. can choose snippets with the neocomplcache/neocomplete interface, you might
  22. have less trouble using them, because you do not have to remember each snippet
  23. name.
  24. ==============================================================================
  25. INSTALL *neosnippet-install*
  26. 1: Extract the file and put files in your Vim directory
  27. (usually ~/.vim/ or Program Files/Vim/vimfiles on Windows).
  28. Note: If you want to complete snippets, you must install either neocomplcache
  29. (https://github.com/Shougo/neocomplcache.vim) or neocomplete
  30. (https://github.com/Shougo/neocomplete.vim). It's not required, but highly
  31. recommended.
  32. Default snippets files are available in neosnippet-snippets.
  33. https://github.com/Shougo/neosnippet-snippets
  34. Note: Installing the default snippets is optional. If you choose not to install
  35. them, you must set |g:neosnippet#disable_runtime_snippets|. >
  36. let g:neosnippet#disable_runtime_snippets = {
  37. \ '_' : 1,
  38. \ }
  39. Extra snippets files are also available. e.g.:
  40. https://github.com/honza/vim-snippets
  41. Note: To enable context-filetype feature, you must install
  42. context_filetype.vim. This allows you to use snippets not only depend on the
  43. current 'filetype' of the file, but also depends on the cursor location, such
  44. as javascript inside html, or lua inside Vim scripts.
  45. https://github.com/Shougo/context_filetype.vim
  46. ==============================================================================
  47. INTERFACE *neosnippet-interface*
  48. ------------------------------------------------------------------------------
  49. COMMANDS *neosnippet-commands*
  50. *:NeoSnippetMakeCache*
  51. :NeoSnippetMakeCache [filetype]
  52. Creates a cache for the snippets of the given [filetype]. It
  53. automatically chooses the current buffer's file type unless you
  54. specify another one by [filetype].
  55. *:NeoSnippetEdit*
  56. :NeoSnippetEdit [{options}] [filetype]
  57. Opens the snippets for a given [filetype] to edit. It
  58. automatically selects the current buffer's filetype unless you
  59. specify another one by [filetype].
  60. If the path to [filetype] snippets is a directory, it
  61. automatically selects "[filetype].snip" in the [filetype]
  62. subdirectory.
  63. It edits a snippet file in |g:neosnippet#snippets_directory|
  64. with precedence. The snippets are re-cached automatically
  65. when you save the file after edit.
  66. The following parameters can be used as {options} to modify
  67. the behavior of the command. Note: You must escape spaces with
  68. a backslash "\".
  69. Note: You must set |g:neosnippet#snippets_directory| before
  70. using it.
  71. *neosnippet-edit-options-vertical*
  72. -vertical
  73. Split the window vertically.
  74. *neosnippet-edit-options-horizontal*
  75. -horizontal
  76. Split the window horizontally.
  77. Note: The behavior is undefined when both options are set.
  78. *neosnippet-edit-options-direction*
  79. -direction={direction}
  80. Define the split position rule. The default value is
  81. "belowleft".
  82. *neosnippet-edit-options-split*
  83. -split
  84. Split the buffer.
  85. *neosnippet-edit-options-runtime*
  86. -runtime
  87. Edit the runtime snippets (built-in defaults) instead of the
  88. user snippets defined by 'g:neosnippet#snippets_directory'.
  89. *:NeoSnippetSource*
  90. :NeoSnippetSource [filename]
  91. Load the snippets of a [filetype].
  92. Note: The loaded snippets are enabled in current buffer only.
  93. *:NeoSnippetClearMarkers*
  94. :NeoSnippetClearMarkers
  95. Clear current markers.
  96. Note: If you delete markers, you cannot jump to next
  97. placeholder.
  98. ------------------------------------------------------------------------------
  99. VARIABLES *neosnippet-variables*
  100. g:neosnippet#snippets_directory *g:neosnippet#snippets_directory*
  101. This variable appoints a path to user-defined snippet files.
  102. You can set multiple values in comma-separated string or list.
  103. Non existing directories are ignored.
  104. User defined snippet files are read after the built-in snippet
  105. files. If redundant snippets occur they get overwritten and
  106. only the last one remains.
  107. Note: The neosnippet plug-in loads file type snippets from
  108. several files if available. For example if you edit a "Vim"
  109. file it loads the snippets from:
  110. - "vim.snip"
  111. - "vim.snippets"
  112. - "vim_*.snip"
  113. - "vim_*.snippets"
  114. - "vim/**/*.snip"
  115. - "vim/**/*.snippets"
  116. The default value is ''.
  117. *g:neosnippet#disable_select_mode_mappings*
  118. g:neosnippet#disable_select_mode_mappings
  119. This variable disables key-mappings in |Select-mode| where the
  120. neosnippet performs the snippet completion. Usually it is
  121. better to leave it as it is. But if you have troubles with the
  122. buffer switcher LustyJuggler you can switch them off.
  123. The default value is 1.
  124. *g:neosnippet#disable_runtime_snippets*
  125. g:neosnippet#disable_runtime_snippets
  126. This is a dictionary variable which uses file types as key.
  127. If you set the value of a file type entry to 1, this prevents
  128. loading "neosnippets" directories from 'runtimepath'. This is
  129. very useful to prevent snippet conflicts between self defined
  130. snippet files and the built-in snippet files of neosnippet. If
  131. you use an "_" as key for an entry this will treat the value of
  132. the entry as default value for all file types.
  133. Note: This dictionary must be set in your .vimrc.
  134. For example:
  135. >
  136. let g:neosnippet#disable_runtime_snippets = {
  137. \ 'c' : 1, 'cpp' : 1,
  138. \ }
  139. " which disables all runtime snippets
  140. let g:neosnippet#disable_runtime_snippets = {
  141. \ '_' : 1,
  142. \ }
  143. <
  144. The default value is {}.
  145. *g:neosnippet#enable_snipmate_compatibility*
  146. g:neosnippet#enable_snipmate_compatibility
  147. If this variable is not 0, neosnippet will enable the snipMate
  148. compatibility features:
  149. 1. Define Filename() function.
  150. 2. Load |g:snippets_dir| and snipMate snippets files from
  151. 'runtimepath'.
  152. 3. Enable file snippets feature in snipMate.
  153. The default value is 0.
  154. *g:neosnippet#expand_word_boundary*
  155. g:neosnippet#expand_word_boundary
  156. If it is not 0, neosnippet will expand snippets by a word
  157. boundary.
  158. Note: It must be initialized before snippet loading.
  159. The default value is 0.
  160. *g:neosnippet#enable_conceal_markers*
  161. g:neosnippet#enable_conceal_markers
  162. If this variable is not 0, neosnippet will use the |conceal|
  163. markers.
  164. The default value is 1.
  165. *g:neosnippet#enable_completed_snippet*
  166. g:neosnippet#enable_completed_snippet
  167. If this variable is not 0, neosnippet can expand the function
  168. prototype.
  169. The default value is 0.
  170. *g:neosnippet#enable_auto_clear_markers*
  171. g:neosnippet#enable_auto_clear_markers
  172. If this variable is not 0, neosnippet will clear the markers
  173. in the buffer when |BufWritePost|, |CursorMoved| and
  174. |CursorMovedI| autocmd.
  175. Note: The feature does not work for multi lines snippets.
  176. If you want to clear them, you should use
  177. |:NeoSnippetClearMarkers| instead.
  178. The default value is 1.
  179. *g:neosnippet#scope_aliases*
  180. g:neosnippet#scope_aliases
  181. It is a dictionary that associating certain filetypes with
  182. other snippet files.
  183. The key is filetype, and the value is comma separated snippet
  184. filenames excluded extensions.
  185. It works like |g:snipMate.scope_aliases|.
  186. The default value is {}. >
  187. let g:neosnippet#scope_aliases = {}
  188. let g:neosnippet#scope_aliases['ruby'] = 'ruby,ruby-rails'
  189. g:neosnippet#data_directory *g:neosnippet#data_directory*
  190. Specifies directory for neosnippet cache. If the directory
  191. doesn't exist the directory will be automatically generated.
  192. Default value is "$XDG_CACHE_HOME/neosnippet" or
  193. expand("~/.cache/neosnippet"); the absolute path of it.
  194. *b:neosnippet_disable_snippet_triggers*
  195. b:neosnippet_disable_snippet_triggers
  196. Specifies the triggers which disables in the buffer.
  197. It is useful to disable some snippet triggers.
  198. ------------------------------------------------------------------------------
  199. KEY MAPPINGS *neosnippet-key-mappings*
  200. *i_<Plug>(neosnippet_expand_or_jump)*
  201. i_<Plug>(neosnippet_expand_or_jump)
  202. *s_<Plug>(neosnippet_expand_or_jump)*
  203. s_<Plug>(neosnippet_expand_or_jump)
  204. Expand a snippet in the current cursor position. If there is
  205. no snippet available it jumps to the next placeholder of the
  206. buffer.
  207. *i_<Plug>(neosnippet_jump_or_expand)*
  208. i_<Plug>(neosnippet_jump_or_expand)
  209. *s_<Plug>(neosnippet_jump_or_expand)*
  210. s_<Plug>(neosnippet_jump_or_expand)
  211. Jump to the next available placeholder in the buffer. If there
  212. is no placeholder it expands a snippet in the current cursor
  213. position.
  214. *i_<Plug>(neosnippet_expand)*
  215. i_<Plug>(neosnippet_expand)
  216. *s_<Plug>(neosnippet_expand)*
  217. s_<Plug>(neosnippet_expand)
  218. Expand a snippet in current cursor position. It only takes
  219. effect if there is a snippet text to expand or if you have
  220. chosen a snippet from popup menu.
  221. *i_<Plug>(neosnippet_jump)*
  222. i_<Plug>(neosnippet_jump)
  223. *s_<Plug>(neosnippet_jump)*
  224. s_<Plug>(neosnippet_jump)
  225. Jump to the next placeholder key. It does not expand any
  226. snippets.
  227. *i_<Plug>(neosnippet_start_unite_snippet)*
  228. i_<Plug>(neosnippet_start_unite_snippet)
  229. Starts the unite snippet source. You can expand a snippet by
  230. the unite interface.
  231. Note: The plug-in |unite.vim| is required for that feature.
  232. *x_<Plug>(neosnippet_expand_target)*
  233. x_<Plug>(neosnippet_expand_target)
  234. Expand the input trigger by a selected target text.
  235. *x_<Plug>(neosnippet_register_oneshot_snippet)*
  236. x_<Plug>(neosnippet_register_oneshot_snippet)
  237. Register oneshot snippet in the current buffer.
  238. *neosnippet#expandable()*
  239. neosnippet#expandable()
  240. You can use this function with imap <expr>. It checks if
  241. the cursor text is a snippet trigger. This is useful to save
  242. key mappings.
  243. *neosnippet#jumpable()*
  244. neosnippet#jumpable()
  245. You can use this function with imap <expr>. It checks if the
  246. cursor text is an existing placeholder in current buffer. This
  247. is useful to save key mappings.
  248. *neosnippet#expandable_or_jumpable()*
  249. neosnippet#expandable_or_jumpable()
  250. You can use this function with imap <expr>. It checks if
  251. the cursor text is a snippet trigger or a placeholder. This is
  252. useful to save key mappings.
  253. Note: If you don't like to jump to the next placeholder, you must use
  254. |neosnippet#expandable()| instead of
  255. |neosnippet#expandable_or_jumpable()|.
  256. >
  257. imap <expr><C-l>
  258. \ neosnippet#expandable_or_jumpable() ?
  259. \ "\<Plug>(neosnippet_expand_or_jump)" : "\<C-n>"
  260. <
  261. *neosnippet#anonymous()*
  262. neosnippet#anonymous({snippet})
  263. It defines anonymous snippet.
  264. {snippet} is snippet definition.
  265. {options} is snippet option.
  266. You can expand snippet definition without defining snippet
  267. trigger.
  268. Note: You can use this function with |map-<expr>|.
  269. >
  270. inoremap <silent> ((
  271. \ <C-r>=neosnippet#anonymous('\left(${1}\right)${0}')<CR>
  272. " OR
  273. inoremap <expr><silent> ((
  274. \ neosnippet#anonymous('\left(${1}\right)${0}')
  275. <
  276. *neosnippet#expand()*
  277. neosnippet#expand({trigger})
  278. It expands the snippet trigger.
  279. {trigger} is snippet trigger.
  280. Note: You can use this function with |map-<expr>|.
  281. >
  282. inoremap <silent> test
  283. \ i<C-r>=neosnippet#expand('date_english')<CR>
  284. nnoremap <silent><expr> test
  285. \ neosnippet#expand('date_english')
  286. ------------------------------------------------------------------------------
  287. FUNCTIONS *neosnippet-functions*
  288. *neosnippet#get_snippets_directory()*
  289. neosnippet#get_snippets_directory()
  290. Gets snippet directories. These directories contain runtime
  291. snippets directories and |g:neosnippet#snippets_directory|
  292. directories.
  293. ==============================================================================
  294. EXAMPLES *neosnippet-examples*
  295. >
  296. " Plugin key-mappings.
  297. " Note: It must be "imap" and "smap". It uses <Plug> mappings.
  298. imap <C-k> <Plug>(neosnippet_expand_or_jump)
  299. smap <C-k> <Plug>(neosnippet_expand_or_jump)
  300. xmap <C-k> <Plug>(neosnippet_expand_target)
  301. " SuperTab like snippets' behavior.
  302. " Note: It must be "imap" and "smap". It uses <Plug> mappings.
  303. "imap <expr><TAB>
  304. " \ pumvisible() ? "\<C-n>" :
  305. " \ neosnippet#expandable_or_jumpable() ?
  306. " \ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
  307. "smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
  308. " \ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
  309. " For conceal markers.
  310. if has('conceal')
  311. set conceallevel=2 concealcursor=niv
  312. endif
  313. " Enable snipMate compatibility feature.
  314. " let g:neosnippet#enable_snipmate_compatibility = 1
  315. ==============================================================================
  316. SNIPPET SYNTAX *neosnippet-snippet-syntax*
  317. It is quite easy to create your own snippets. You can use the example below to
  318. get started.
  319. Note: The snippets file extension must be ".snip" or ".snippets".
  320. Example:
  321. >
  322. snippet [name]
  323. abbr [abbreviation]
  324. alias [aliases]
  325. regexp [pattern]
  326. options [options]
  327. if ${1:condition}
  328. ${2}
  329. endif
  330. The snippet syntax is close to the one of |snipMate|. Each snippet starts with
  331. some keywords that define the name and modify the expansion and treatment of
  332. the snippet.
  333. Snippet Keywords:
  334. - snippet [name] (Required)
  335. Each snippet starts with the keyword "snippet". This keyword is
  336. directly followed by the snippet name. The snippet name is used to
  337. expand the snippet.
  338. - abbr [name] (Optional)
  339. You can define an abbreviation for the snippet name. It will be
  340. displayed in the drop down selection menu.
  341. - alias [aliases] (Optional)
  342. Alias names can be use as additional keywords to expand the snippet.
  343. You can define multiple aliases using either spaces ' ' or commas ','
  344. as separator.
  345. Example
  346. >
  347. alias hoge hogera hogehoge
  348. <
  349. - regexp [pattern] (Optional)
  350. A pattern can be defined via a regular expression. The snippet expands
  351. only when the expression pattern is matched.
  352. Example
  353. >
  354. regexp '^% '
  355. <
  356. This snippet works same as "options head".
  357. >
  358. snippet if
  359. regexp '^\s*'
  360. if ${1:condition}
  361. ${2}
  362. endif
  363. <
  364. - options [options] (Optional)
  365. Options influence the snippet behavior. The possible values are:
  366. + word This snippet expands by a word boundary.
  367. Note: To complete the trigger with neosnippet, it must be a
  368. word character (digits, alphabetical characters or "_").
  369. >
  370. snippet date
  371. options word
  372. `strftime("%d %b %Y")`
  373. <
  374. + head This snippet expands at the beginning of a line only.
  375. Note: This is the same as "prev_word '^'" which is still
  376. there for backwards compatibility.
  377. >
  378. snippet if
  379. options head
  380. if ${1:condition}
  381. ${2}
  382. endif
  383. <
  384. + indent The horizontal position of the snippet will be adjusted
  385. to the indent of the line above the snippet after expansion.
  386. The snippet itself starts below the part that contains the options, snippet
  387. aliases and keywords, described above. It contains the snippet which gets
  388. expanded which can contain several placeholders. The placeholders are used as
  389. jump points while expanding the snippet. There are several placeholders
  390. available providing different functionality.
  391. The structure of a placeholder can be:
  392. - ${number:default placeholder text}
  393. The placeholder starts with a dollar sign "$". The number of a
  394. placeholder and the placeholder text are separated by a colon ":".
  395. They are surrounded by a pair of curly braces "{}". The placeholder
  396. text is displayed after the snippet expansion and will be replaced by
  397. your text. If you jump over the snippet and do not insert any text in
  398. that placeholder position the text remains there. This can be used as
  399. a default value for a certain position.
  400. Example
  401. >
  402. snippet if
  403. if ${1:condition}
  404. ${2}
  405. endif
  406. <
  407. - ${number:#:optional placeholder text}
  408. In this kind of placeholder the number is followed by the hash
  409. character "#". If you jump over this placeholder and do not insert
  410. any text, the placeholder text will be removed.
  411. Example
  412. >
  413. snippet if
  414. if ${1:#:condition}
  415. ${2}
  416. endif
  417. <
  418. - ${number:TARGET}
  419. This is the target placeholder which is replaced by text from a visual
  420. selection.
  421. Note: You need to make a visual selection and expand your
  422. snippet with the key mapping below for this to work.
  423. |<Plug>(neosnippet_expand_target)|.
  424. This is very useful if you edit text and decide to put something in an
  425. environment or some sort of brackets for folding.
  426. Example
  427. >
  428. snippet if
  429. if ${1:#:condition}
  430. ${2:TARGET}
  431. endif
  432. <
  433. - ${number}
  434. This is a placeholder which you can use as a simple jump position.
  435. This can be useful if you edit a placeholder inside of some sort of
  436. brackets or environment and want to go on behind it after that.
  437. Example
  438. >
  439. snippet if
  440. if ${1:#:condition}
  441. ${2:do}
  442. endif
  443. ${3}
  444. <
  445. - $number
  446. - ${0}
  447. This is a synchronized placeholder. Sometimes it is required to repeat
  448. a value in several positions inside a snippet. If you set the number
  449. of this placeholder to the same number as one of the other
  450. placeholders in the snippet, it will repeat its content. $1 is
  451. synchronized to ${1} and so on. ${0} will be the final jump
  452. placeholder.
  453. Example
  454. >
  455. snippet namespace
  456. namespace ${1:name} {
  457. ${0}
  458. } // namespace $1
  459. <
  460. Note: If you like to include characters in snippets that already have
  461. a special meaning to neosnippet you need to escape them with a
  462. backslash.
  463. >
  464. snippet code
  465. \`${1}\`${2}
  466. snippet test
  467. ${1:escape \} value}
  468. # Substitute "\$0" to "$0"
  469. snippet main
  470. options head
  471. if __FILE__ == \$0
  472. ${1:TARGET}
  473. end
  474. <
  475. A placeholder value can not contain new lines. The snippet below is
  476. not valid.
  477. >
  478. snippet invalid
  479. ${1:constructor: (${2:args\}) ->
  480. ${3:# do smth}}
  481. <
  482. Vim has a built-in expression evaluation. You can also use this feature inside
  483. of snippets if you use back ticks like in the example below. Here the "%:t"
  484. gets expanded to the name of the current active file and the current time gets
  485. inserted by expanding the output of the strftime command.
  486. >
  487. snippet header
  488. File: ${1:`expand('%:t')`}
  489. ${2:Created at: `strftime("%B %d, %Y")`}
  490. <
  491. You can also nest placeholders if you escape the special characters.
  492. >
  493. snippet div
  494. <div ${1:id="${2:someid\}"}>${3}</div>${4}
  495. <
  496. In some cases you need to escape the curly brace "}" twice as shown in the
  497. example below.
  498. >
  499. snippet catch
  500. options head
  501. catch ${1:/${2:pattern: empty, E484, Vim(cmdname):{errmsg\\}\}/}
  502. <
  503. This is because ${1:} substitutes the pattern to "/${2:pattern: empty, E484,
  504. Vim(cmdname):{errmsg\}}" and ${2:} substitutes the pattern to "pattern: empty,
  505. E484, Vim(cmdname):{errmsg}"
  506. If you create a snippet file and prepend the filename with a "_" neosnippet
  507. treats the snippets inside the file as global. This means that they will be
  508. available for all file types (e.g _.snip). You can include other snippet files
  509. from within a snippet file with.
  510. >
  511. include c.snip
  512. <
  513. Or if you want to include a whole directory with file type snippets.
  514. >
  515. include javascript/*
  516. <
  517. If you include snippet files it can happen that the same snippet name is used
  518. multiple times in snippet files. Neosnippet produces a warning if it detects
  519. this. If you want to overwrite a snippet explicitly, please use:
  520. >
  521. delete snippets_name
  522. <
  523. After that you can redefine the snippet. But this does not work if you include
  524. external snippet files. There will be no warning when snippets get overwritten.
  525. Multi snippet feature in snipMate is available. Neosnippet substitutes trigger
  526. and descriptions spaces to '_'.
  527. >
  528. snippet trigger description1
  529. hoge
  530. snippet trigger description2
  531. piyo
  532. <
  533. If you use hard-tab for indentation inside a snippet file, neosnippet will use
  534. 'shiftwidth' instead of Vim indent plugin. This feature is useful while some
  535. languages' indent files do not work very well (e.g.: PHP, Python).
  536. >
  537. snippet if
  538. if (${1:/* condition */}) {
  539. ${2:// code...}
  540. }
  541. <
  542. Note: "#{string}" is comment string. But it must be in head.
  543. >
  544. # It is comment string
  545. # It is not comment string!
  546. <
  547. Note: Neosnippet ignores empty or spaces lines in snippet end. If you want to
  548. insert empty line in snippet end, you must insert placeholder.
  549. >
  550. # This is valid.
  551. snippet #!
  552. abbr #!/usr/bin/env ruby
  553. alias shebang
  554. options head
  555. #!/usr/bin/env ruby
  556. ${0}
  557. # This is invalid(ignores spaces lines!).
  558. snippet #!
  559. abbr #!/usr/bin/env ruby
  560. alias shebang
  561. options head
  562. #!/usr/bin/env ruby
  563. You can load a Vim script file for snippets.
  564. >
  565. source go.vim
  566. <
  567. ==============================================================================
  568. UNITE SOURCES *neosnippet-unite-sources*
  569. *neosnippet-unite-source-neosnippet*
  570. neosnippet
  571. The candidates of the snippet source are neosnippet snippets.
  572. and their kind is "snippet". You can use the snippet source
  573. with the mapping |<Plug>(neosnippet_start_unite_snippet)|.
  574. But you can also execute it by ":Unite neosnippet". The
  575. snippet source offers an edit action you can use to edit the
  576. snippet files.
  577. Example:
  578. >
  579. imap <C-s> <Plug>(neosnippet_start_unite_snippet)
  580. <
  581. *neosnippet-unite-source-neosnippet/user*
  582. neosnippet/user
  583. The candidates of the user snippet files.
  584. *neosnippet-unite-source-neosnippet/runtime*
  585. neosnippet/runtime
  586. The candidates of the runtime snippet files.
  587. source actions
  588. neosnippet *neosnippet-unite-action-neosnippet*
  589. expand Expand snippet (default action)
  590. edit Edit snippet
  591. preview View snippet definition
  592. ==============================================================================
  593. FAQ *neosnippet-faq*
  594. Q: What if I want to expand a snippet trigger after (, [, " etc...:
  595. A: You should use "options word" in the snippet definition. This changes the
  596. expansion behavior to a word boundary or set
  597. |g:neosnippet#expand_word_boundary|.
  598. >
  599. snippet date
  600. options word
  601. `strftime("%d %b %Y")`
  602. <
  603. Q: Why does neosnippet not indent the expanded snippet?
  604. A: You should use "options indent" in the snippet definition. In default,
  605. neosnippet doesn't indent the expanded line.
  606. Q: What if Neosnippet conflicts with |LustyJuggler|.
  607. http://www.vim.org/scripts/script.php?script_id=2050
  608. A: Please try below settings:
  609. Note: But you must unmap the mappings in select mode manually.
  610. >
  611. let g:neosnippet#disable_select_mode_mappings = 0
  612. <
  613. Q: Error using snipmate-snippets
  614. Note: snipmate-snippets is currently vim-snippets.
  615. https://github.com/Shougo/neosnippet/issues/86
  616. A: Please try the setting below. It defines the snipMate function.
  617. >
  618. let g:neosnippet#enable_snipmate_compatibility = 1
  619. <
  620. Q: Cannot jump over placeholder
  621. https://github.com/Shougo/neosnippet/issues/120
  622. A: You must use smap in .vimrc.
  623. >
  624. imap <expr><TAB> neosnippet#expandable_or_jumpable() ?
  625. \ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
  626. smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
  627. \ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
  628. <
  629. Because neosnippet uses select-mode to jump over placeholder.
  630. Q: I want to disable preview window in neosnippet candidates.
  631. A:
  632. >
  633. set completeopt-=preview
  634. <
  635. Q: I want to add snippets dynamically.
  636. A: You can use |:NeoSnippetSource| for it.
  637. Q: I want to delete markers when InsertLeave event.
  638. A: You can use |:NeoSnippetClearMarkers| command. >
  639. autocmd InsertLeave * NeoSnippetClearMarkers
  640. Q: Why did you separate default snippets from neosnippet core?
  641. A: Because users should choose default snippet collection.
  642. neosnippet has many forks, but almost all forked users change default snippet
  643. files.
  644. https://github.com/Shougo/neosnippet.vim/network
  645. If splitted default snippets, users can fork and change it easily.
  646. Q: I want to complete function arguments using neosnippet like clang_complete.
  647. A: Yes, you can. You can just complete the candidate from completion window
  648. and expand the candidate as trigger.
  649. Note: It works in "func(arg1, arg2, ...)" prototypes only.
  650. Note: It is experiental feature.
  651. Note: |v:completed_item| feature is needed.
  652. ==============================================================================
  653. vim:tw=78:ts=8:ft=help:norl:noet:fen:noet: