- Added indent option.
This commit is contained in:
parent
d93a1a1e92
commit
c8a337b6aa
@ -344,7 +344,7 @@ function! s:parse_snippets_file(snippets, snippets_file)"{{{
|
|||||||
|
|
||||||
" Initialize snippet dict.
|
" Initialize snippet dict.
|
||||||
let snippet_dict = { 'word' : '', 'linenr' : linenr,
|
let snippet_dict = { 'word' : '', 'linenr' : linenr,
|
||||||
\ 'options' : { 'head' : 0, 'word' : 0 } }
|
\ 'options' : { 'head' : 0, 'word' : 0, 'indent' : 0 } }
|
||||||
|
|
||||||
" Try using the name without the description (abbr).
|
" Try using the name without the description (abbr).
|
||||||
let snippet_dict.name = matchstr(line, '^snippet\s\+\zs\S\+')
|
let snippet_dict.name = matchstr(line, '^snippet\s\+\zs\S\+')
|
||||||
@ -583,8 +583,8 @@ function! neosnippet#expand(cur_text, col, trigger_name)"{{{
|
|||||||
let neosnippet = neosnippet#get_current_neosnippet()
|
let neosnippet = neosnippet#get_current_neosnippet()
|
||||||
|
|
||||||
call s:indent_snippet(
|
call s:indent_snippet(
|
||||||
\ (neosnippet.target == '' ? begin_line : begin_line + 1),
|
\ ((neosnippet.target == '' && snippet.options.indent) ?
|
||||||
\ end_line)
|
\ begin_line : begin_line + 1), end_line)
|
||||||
|
|
||||||
let begin_patterns = (begin_line > 1) ?
|
let begin_patterns = (begin_line > 1) ?
|
||||||
\ [getline(begin_line - 1)] : []
|
\ [getline(begin_line - 1)] : []
|
||||||
|
@ -322,9 +322,6 @@ snippet {snippet_name} syntax is the snippet name.
|
|||||||
abbr {abbr_name} is the completion abbrevation (same to completion "abbr"
|
abbr {abbr_name} is the completion abbrevation (same to completion "abbr"
|
||||||
key).
|
key).
|
||||||
|
|
||||||
"options head" means this snippet is enabled only in line head.
|
|
||||||
Note: prev_word '^' is duplicated keyword.
|
|
||||||
|
|
||||||
By the way, it is warned that the snippet name was already defined by other
|
By the way, it is warned that the snippet name was already defined by other
|
||||||
snippet file. If you want to overwrite it explicitly, please use:
|
snippet file. If you want to overwrite it explicitly, please use:
|
||||||
>
|
>
|
||||||
@ -456,6 +453,11 @@ languages' indent files can not work very well (e.g.: PHP, Python).
|
|||||||
${2:// code...}
|
${2:// code...}
|
||||||
}
|
}
|
||||||
<
|
<
|
||||||
|
SNIPPET SYNTAX OPTIONS *neosnippet-snippet-syntax-options*
|
||||||
|
|
||||||
|
"options head" means this snippet is enabled only in line head.
|
||||||
|
Note: prev_word '^' is duplicated keyword.
|
||||||
|
|
||||||
"options word" means this snippet is expanded by word boundary.
|
"options word" means this snippet is expanded by word boundary.
|
||||||
Note: To complete the trigger in snippets_complete, it must be word(digits or
|
Note: To complete the trigger in snippets_complete, it must be word(digits or
|
||||||
alphabet characters or "_") characters.
|
alphabet characters or "_") characters.
|
||||||
@ -464,6 +466,7 @@ alphabet characters or "_") characters.
|
|||||||
options word
|
options word
|
||||||
`strftime("%d %b %Y")`
|
`strftime("%d %b %Y")`
|
||||||
<
|
<
|
||||||
|
"options indent" means neosnippet indents in expanded line.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
UNITE SOURCES *neosnippet-unite-sources*
|
UNITE SOURCES *neosnippet-unite-sources*
|
||||||
@ -499,6 +502,11 @@ this snippet is expanded by word boundary.
|
|||||||
`strftime("%d %b %Y")`
|
`strftime("%d %b %Y")`
|
||||||
<
|
<
|
||||||
|
|
||||||
|
Q: Doesn't indent in expanded line:
|
||||||
|
|
||||||
|
A: You should use "options indent" in snippet definition. In default,
|
||||||
|
neosnippet doesn't indent in expanded line.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
CHANGELOG *neosnippet-changelog*
|
CHANGELOG *neosnippet-changelog*
|
||||||
|
|
||||||
@ -509,6 +517,7 @@ CHANGELOG *neosnippet-changelog*
|
|||||||
- Implemented targetted placeholder.
|
- Implemented targetted placeholder.
|
||||||
- Improved documentation.
|
- Improved documentation.
|
||||||
- Added FAQ section.
|
- Added FAQ section.
|
||||||
|
- Added indent option.
|
||||||
|
|
||||||
2012-10-29
|
2012-10-29
|
||||||
- Improved parse of snippets file.
|
- Improved parse of snippets file.
|
||||||
|
Loading…
Reference in New Issue
Block a user