adding new stuff
This commit is contained in:
parent
f84d7183aa
commit
9ef8a96f9a
1580 changed files with 0 additions and 0 deletions
39
plugins/bundle/xptemplate/ftplugin/_loops/c.for.like.xpt.vim
Normal file
39
plugins/bundle/xptemplate/ftplugin/_loops/c.for.like.xpt.vim
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
XPTemplate priority=like
|
||||
|
||||
XPTvar $BRloop ' '
|
||||
|
||||
" int fun( ** arg ** )
|
||||
" if ( ** condition ** )
|
||||
" for ( ** statement ** )
|
||||
" [ ** a, b ** ]
|
||||
" { ** 'k' : 'v' ** }
|
||||
XPTvar $SParg ''
|
||||
|
||||
" if ** (
|
||||
" while ** (
|
||||
" for ** (
|
||||
XPTvar $SPcmd ' '
|
||||
|
||||
" a ** = ** a ** + ** 1
|
||||
" (a, ** b, ** )
|
||||
XPTvar $SPop ' '
|
||||
|
||||
fun! s:f.c_strip_type()
|
||||
let v = self.ItemValue()
|
||||
echom v
|
||||
echom substitute(v, '\V\^\_.*\s', 'g')
|
||||
return substitute(v, '\V\^\_.*\s', 'g')
|
||||
endfunction
|
||||
|
||||
XPT for wrap " for (..;..;++)
|
||||
for`$SPcmd^(`$SParg^`i^`$SPop^=`$SPop^`0^; `i^c_strip_type()^`$SPop^<`$SPop^`len^; `i^c_strip_type()^++`$SParg^)`$BRloop^{
|
||||
`cursor^
|
||||
}
|
||||
|
||||
XPT forr wrap " for (..;..;--)
|
||||
for`$SPcmd^(`$SParg^`i^`$SPop^=`$SPop^`n^; `i^`$SPop^>`=$SPop`0^; `i^--`$SParg^)`$BRloop^{
|
||||
`cursor^
|
||||
}
|
||||
|
||||
XPT forever " for (;;) ..
|
||||
for`$SPcmd^(;;) `cursor^
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
XPTemplate priority=like
|
||||
|
||||
|
||||
XPTvar $TRUE 1
|
||||
XPTvar $FALSE 0
|
||||
XPTvar $NULL NULL
|
||||
|
||||
XPTvar $BRloop ' '
|
||||
|
||||
XPTvar $SParg ' '
|
||||
XPTvar $SPcmd ' '
|
||||
XPTvar $SPop ' '
|
||||
|
||||
|
||||
|
||||
|
||||
XPT while wrap " while ( .. )
|
||||
while`$SPcmd^(`$SParg^`condition^`$SParg^)`$BRloop^{
|
||||
`cursor^
|
||||
}
|
||||
|
||||
XPT do wrap " do { .. } while ( .. )
|
||||
do`$BRloop^{
|
||||
`cursor^
|
||||
}`$BRloop^while`$SPcmd^(`$SParg^`condition^`$SParg^);
|
||||
|
||||
|
||||
XPT while0 alias=do " do { .. } while ( $FALSE )
|
||||
XSET condition=Embed( $FALSE )
|
||||
|
||||
|
||||
XPT while1 alias=while " while ( $TRUE ) { .. }
|
||||
XSET condition=Embed( $TRUE )
|
||||
|
||||
|
||||
XPT whilenn alias=while " while ( $NULL != .. ) { .. }
|
||||
XSET condition=Embed( $NULL . $SPop . '!=' . $SPop . '`x^' )
|
||||
68
plugins/bundle/xptemplate/ftplugin/_loops/for.xpt.vim
Normal file
68
plugins/bundle/xptemplate/ftplugin/_loops/for.xpt.vim
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
"
|
||||
" standard for( i = 0; i < 10; i++ ) snippets
|
||||
"
|
||||
XPTemplate priority=all-
|
||||
|
||||
let s:f = g:XPTfuncs()
|
||||
|
||||
XPTvar $NULL NULL
|
||||
XPTvar $BRloop ' '
|
||||
|
||||
|
||||
XPTvar $SParg ''
|
||||
XPTvar $SPcmd ' '
|
||||
XPTvar $SPop ' '
|
||||
|
||||
XPTvar $VAR_PRE ''
|
||||
XPTvar $FOR_SCOPE ''
|
||||
|
||||
XPTinclude
|
||||
\ _common/common
|
||||
|
||||
fun! s:f.c_strip_type()
|
||||
let v = self.ItemValue()
|
||||
return substitute(v, '\V\^\_.\*\s', '', 'g')
|
||||
endfunction
|
||||
|
||||
XPT for wrap " for (..;..;++)
|
||||
for`$SPcmd^(`$SParg^`$FOR_SCOPE^`$VAR_PRE`i^`$SPop^=`$SPop^`0^; `i^c_strip_type()^`$SPop^<`$SPop^`len^; `i^c_strip_type()^++`$SParg^)`$BRloop^{
|
||||
`cursor^
|
||||
}
|
||||
|
||||
|
||||
XPT forr wrap " for (..;..;--)
|
||||
for`$SPcmd^(`$SParg^`$FOR_SCOPE^`$VAR_PRE`i^`$SPop^=`$SPop^`0^; `i^c_strip_type()^`$SPop^>`=$SPop`end^; `i^c_strip_type()^--`$SParg^)`$BRloop^{
|
||||
`cursor^
|
||||
}
|
||||
|
||||
|
||||
XPT fornn wrap " for (..; $NULL != var; .. )
|
||||
for`$SPcmd^(`$SParg^`$FOR_SCOPE^`$VAR_PRE`ptr^`$SPop^=`$SPop^`init^; `$NULL^`$SPop^!=`$SPop^`ptr^; `^R('ptr')^`$SParg^)`$BRloop^{
|
||||
`cursor^
|
||||
}
|
||||
|
||||
|
||||
XPT forever " for (;;) ..
|
||||
for`$SPcmd^(;;) `cursor^
|
||||
..XPT
|
||||
|
||||
" Simplify
|
||||
" XSET i|edgeLeft=$VAR_PRE
|
||||
" XSET i|edgeRight=$VAR_PRE
|
||||
" XSET $(= ($SParg
|
||||
" XSET $)= $SParg)
|
||||
" XSET $== $SPop=$SPop
|
||||
" XSET $>= $SPop>
|
||||
" XSET $e= =$SPop
|
||||
|
||||
" for`$SPcmd`$(`$FOR_SCOPE``i`$=`0; `i`$>`$e`end; `i++`$)`$BRloop{
|
||||
" ^
|
||||
" ..XPT
|
||||
"
|
||||
" for`SP(`SP`FOR_SCOPE`i`SP=`SP`0;`SP`i`SP>`SP`end;`SP`i++`SP)`SP{
|
||||
"
|
||||
" for$ ($ $FOR_SCOPE$i$ =$ $0;$ $i$ >$ $end;$ $i++$ )$ {
|
||||
"
|
||||
" for$ ($ $FOR_SCOPE${$VAR_PRE `i`}$ =$ $0;$ $i$ >$ $end;$ $i++$ )$ {
|
||||
"
|
||||
" for` (` `FOR_SCOPE`{$VAR_PRE `i`}` =` `0;` `{i/\v(\S+)$/\1/}` >` `{end:0::post=::focus=::live=};` `i++` )` {
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
XPTemplate priority=like-
|
||||
|
||||
" containers
|
||||
let s:f = g:XPTfuncs()
|
||||
|
||||
XPTvar $TRUE true
|
||||
XPTvar $FALSE false
|
||||
XPTvar $NULL null
|
||||
XPTvar $BRif
|
||||
XPTvar $VOID_LINE /* void */;
|
||||
|
||||
" ================================= Snippets ===================================
|
||||
|
||||
XPT for " for i++
|
||||
for`$SPcmd^(`$SParg^`int^ `i^`$SPop^=`$SPop^`0^; `i^`$SPop^<`$SPop^`len^; ++`i^`$SParg^)`$BRloop^{
|
||||
`cursor^
|
||||
}
|
||||
|
||||
XPT forr "for i--
|
||||
for`$SPcmd^(`$SParg^`int^ `i^`$SPop^=`$SPop^`n^; `i^`$SPop^>`=^`$SPop^`end^; --`i^`$SParg^)`$BRloop^{
|
||||
`cursor^
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue