- Use head instead of prev_word.

This commit is contained in:
Shougo Matsushita 2012-10-21 21:13:26 +09:00
parent fdc6880600
commit f79f3df531
9 changed files with 35 additions and 30 deletions

View File

@ -64,7 +64,7 @@ snippet bfun
snippet cla
abbr cla
prev_word '^'
options head
class ${1:ClassName}${2: extends ${3:Ancestor\}}
constructor: (${4:args}) ->

View File

@ -43,7 +43,7 @@ abbr static_assert(,"")
delete namespace
snippet namespace
abbr namespace {}
prev_word '^'
options head
namespace ${1:name}
${0}
} // namespace $1

View File

@ -1,13 +1,13 @@
snippet class
abbr class Class(...): ...
prev_word '^'
options head
class ${1:name}(${2:object}):
def __init__(self, ${3}):
${0}
snippet classd
abbr class Class(...): "..."
prev_word '^'
options head
class ${1:name}(${2:object}):
"""${3:class documentation}"""
def __init__(self, ${4}):
@ -16,45 +16,45 @@ prev_word '^'
snippet def
abbr def function(...): ...
prev_word '^'
options head
def ${1:name}(${2}):
${0}
snippet defd
abbr def function(...): """..."""
prev_word '^'
options head
def ${1:name}(${2}):
"""${3:function documentation}"""
${0}
snippet defm
abbr def method(self, ...): ...
prev_word '^'
options head
def ${1:name}(self, ${2}):
${0}
snippet defmd
abbr def method(self, ...): "..."
prev_word '^'
options head
def ${1:name}(self, ${2}):
"""${3:method documentation}"""
${0}
snippet elif
abbr elif ...: ...
prev_word '^'
options head
elif ${1:condition}:
${0}
snippet else
abbr else: ...
prev_word '^'
options head
else:
${0}
snippet fileidiom
abbr f = None try: f = open(...) finally: ...
prev_word '^'
options head
${1:f} = None
try:
$1 = open(${2})
@ -65,25 +65,25 @@ prev_word '^'
snippet for
abbr for ... in ...: ...
prev_word '^'
options head
for ${1:value} in ${2:list}:
${0}
snippet if
abbr if ...: ...
prev_word '^'
options head
if ${1:condition}:
${0}
snippet ifmain
abbr if __name__ == '__main__': ...
prev_word '^'
options head
if __name__ == '__main__':
${0}
snippet tryexcept
abbr try: ... except ...: ...
prev_word '^'
options head
try:
${1}
except ${2:ExceptionClass}:
@ -91,7 +91,7 @@ prev_word '^'
snippet tryfinally
abbr try: ... finally: ...
prev_word '^'
options head
try:
${1}
finally:
@ -99,7 +99,7 @@ prev_word '^'
snippet while
abbr while ...: ...
prev_word '^'
options head
while ${1:condition}:
${0}

View File

@ -6,7 +6,7 @@ abbr match {\n case .. => ..
snippet try
abbr try {} catch { case ... }
prev_word '^'
options head
try {
${1}
} catch {
@ -23,14 +23,14 @@ abbr println('name, name)
snippet main
abbr def main(args: Array[String]) {
prev_word '^'
options head
def main(args: Array[String]) {
${0}
}
snippet hello
abbr object HelloWorld { def main(...) }
prev_word '^'
options head
object HelloWorld {
def main(args: Array[String]) {
println("Hello, world!")

View File

@ -1,8 +1,8 @@
snippet snippet
abbr snippet abbr prev_word <snippet code>
abbr snippet abbr options <snippet code>
alias snip
prev_word '^'
options head
snippet ${1:trigger}
abbr ${2:abbr}
prev_word '^'
options head
${3:snippet code}

View File

@ -12,7 +12,7 @@ abbr import
snippet vital_import
abbr let s:M = s:V.import('...')
prev_word '^'
options head
let ${1:s:M} = ${2:s:V}.import('${3:Module}')
snippet vital_load_without_call

View File

@ -1,7 +1,7 @@
"=============================================================================
" FILE: snippet.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 18 Oct 2012.
" Last Modified: 21 Oct 2012.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@ -136,8 +136,12 @@ function! s:action_table.unite__new_candidate.func(candidate)"{{{
call append('$', '')
endif
call append('$', ['snippet ' . trigger, 'abbr ' . trigger,
\ "prev_word '^'", ' '])
call append('$', [
\ 'snippet ' . trigger,
\ 'abbr ' . trigger,
\ 'options head',
\ ' '
\ ])
call cursor(line('$'), 0)
call cursor(0, col('$'))

View File

@ -458,6 +458,7 @@ CHANGELOG *neosnippet-changelog*
- Added options head.
- Added options word.
- Improved options word behavior.
- Use head instead of prev_word.
2012-10-20
- Improved scala snip.

View File

@ -1,7 +1,7 @@
"=============================================================================
" FILE: snippets.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 19 Sep 2011.
" Last Modified: 21 Oct 2012.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@ -45,8 +45,8 @@ function! SnippetsIndent()"{{{
if prev_line =~ '^\s*$'
return 0
elseif prev_line =~ '^\%(include\|snippet\|abbr\|prev_word\|rank\|delete\|alias\|condition\)'
\&& line !~ '^\s*\%(include\|snippet\|abbr\|prev_word\|rank\|delete\|alias\|condition\)'
elseif prev_line =~ '^\%(include\|snippet\|abbr\|prev_word\|delete\|alias\|options\)'
\&& line !~ '^\s*\%(include\|snippet\|abbr\|prev_word\|delete\|alias\|options\)'
return &shiftwidth
else
return match(line, '\S')