mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated plugins
This commit is contained in:
@ -16,17 +16,17 @@ snippet lorem
|
||||
snippet GPL2
|
||||
${1:One line to give the program's name and a brief description.}
|
||||
Copyright (C) `strftime("%Y")` ${2:copyright holder}
|
||||
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
@ -34,17 +34,17 @@ snippet GPL2
|
||||
snippet LGPL2
|
||||
${1:One line to give the program's name and a brief description.}
|
||||
Copyright (C) `strftime("%Y")` ${2:copyright holder}
|
||||
|
||||
|
||||
This library is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published
|
||||
by the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
@ -52,35 +52,35 @@ snippet LGPL2
|
||||
snippet GPL3
|
||||
${1:one line to give the program's name and a brief description.}
|
||||
Copyright (C) `strftime("%Y")` ${2:copyright holder}
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
${3}
|
||||
snippet LGPL3
|
||||
${1:One line to give the program's name and a brief description.}
|
||||
Copyright (C) `strftime("%Y")` ${2:copyright holder}
|
||||
|
||||
|
||||
This library is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published
|
||||
by the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
@ -89,7 +89,7 @@ snippet BSD2
|
||||
${1:one line to give the program's name and a brief description}
|
||||
Copyright (C) `strftime("%Y")` ${2:copyright holder}
|
||||
All rights reserved.
|
||||
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
@ -97,7 +97,7 @@ snippet BSD2
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY $2 ''AS IS'' AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
@ -108,9 +108,9 @@ snippet BSD2
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
The views and conclusions contained in the software and documentation
|
||||
|
||||
|
||||
The views and conclusions contained in the software and documentation
|
||||
are those of the authors and should not be interpreted as representing
|
||||
official policies, either expressedor implied, of $2.
|
||||
|
||||
@ -119,7 +119,7 @@ snippet BSD3
|
||||
${1:one line to give the program's name and a brief description}
|
||||
Copyright (C) `strftime("%Y")` ${2:copyright holder}
|
||||
All rights reserved.
|
||||
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
@ -130,7 +130,7 @@ snippet BSD3
|
||||
3. Neither the name of the ${3:organization} nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY $2 ''AS IS'' AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
@ -147,7 +147,7 @@ snippet BSD4
|
||||
${1:one line to give the program's name and a brief description}
|
||||
Copyright (C) `strftime("%Y")` ${2:copyright holder}
|
||||
All rights reserved.
|
||||
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
@ -161,7 +161,7 @@ snippet BSD4
|
||||
4. Neither the name of the $3 nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY $2 ''AS IS'' AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
@ -177,17 +177,17 @@ snippet BSD4
|
||||
snippet MIT
|
||||
${1:one line to give the program's name and a brief description}
|
||||
Copyright (C) `strftime("%Y")` ${2:copyright holder}
|
||||
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
@ -200,13 +200,13 @@ snippet MIT
|
||||
snippet APACHE
|
||||
${1:one line to give the program's name and a brief description}
|
||||
Copyright `strftime("%Y")` ${2:copyright holder}
|
||||
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@ -214,14 +214,14 @@ snippet APACHE
|
||||
limitations under the License.
|
||||
|
||||
${3}
|
||||
snippet BEERWARE
|
||||
snippet BEERWARE
|
||||
${2:one line to give the program's name and a brief description}
|
||||
Copyright `strftime("%Y")` ${3:copyright holder}
|
||||
|
||||
|
||||
Licensed under the "THE BEER-WARE LICENSE" (Revision 42):
|
||||
${1:`g:snips_author`} wrote this file. As long as you retain this notice you
|
||||
can do whatever you want with this stuff. If we meet some day, and you think
|
||||
this stuff is worth it, you can buy me a beer or coffee in return
|
||||
this stuff is worth it, you can buy me a beer or coffee in return
|
||||
|
||||
${4}
|
||||
|
||||
|
@ -2,22 +2,22 @@ snippet main
|
||||
package {
|
||||
import flash.display.*;
|
||||
import flash.Events.*;
|
||||
|
||||
|
||||
public class Main extends Sprite {
|
||||
public function Main ( ) {
|
||||
trace("start");
|
||||
stage.scaleMode = StageScaleMode.NO_SCALE;
|
||||
stage.addEventListener(Event.RESIZE, resizeListener);
|
||||
}
|
||||
|
||||
|
||||
private function resizeListener (e:Event):void {
|
||||
trace("The application window changed size!");
|
||||
trace("New width: " + stage.stageWidth);
|
||||
trace("New height: " + stage.stageHeight);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
snippet class
|
||||
${1:public|internal} class ${2:name} ${3:extends } {
|
||||
@ -109,17 +109,17 @@ snippet try
|
||||
# For Loop (same as c.snippet)
|
||||
snippet for for (..) {..}
|
||||
for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) {
|
||||
${4:/* code */}
|
||||
${4}
|
||||
}
|
||||
# Custom For Loop
|
||||
snippet forr
|
||||
for (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) {
|
||||
${5:/* code */}
|
||||
${5}
|
||||
}
|
||||
# If Condition
|
||||
snippet if
|
||||
if (${1:/* condition */}) {
|
||||
${2:/* code */}
|
||||
${2}
|
||||
}
|
||||
snippet el
|
||||
else {
|
||||
@ -131,7 +131,7 @@ snippet t
|
||||
snippet fun
|
||||
function ${1:function_name}(${2})${3}
|
||||
{
|
||||
${4:/* code */}
|
||||
${4}
|
||||
}
|
||||
# FlxSprite (usefull when using the flixel library)
|
||||
snippet FlxSprite
|
||||
@ -144,13 +144,13 @@ snippet FlxSprite
|
||||
public function $1(${3: X:Number, Y:Number}):void
|
||||
{
|
||||
super(X,Y);
|
||||
${4: //code...}
|
||||
${4}
|
||||
}
|
||||
|
||||
override public function update():void
|
||||
{
|
||||
super.update();
|
||||
${5: //code...}
|
||||
${5}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ snippet dir
|
||||
Order Deny,Allow
|
||||
Deny from All
|
||||
</Directory>
|
||||
# <FilesMatch>
|
||||
# <FilesMatch>
|
||||
snippet filesmatch
|
||||
<FilesMatch "${1:regex}">
|
||||
${2}
|
||||
|
@ -5,17 +5,17 @@ snippet if
|
||||
snippet el
|
||||
Else
|
||||
${1}
|
||||
snippet elif
|
||||
snippet eif
|
||||
ElseIf ${1:condition} Then
|
||||
${2:; True code}
|
||||
# If/Else block
|
||||
snippet ifel
|
||||
snippet ife
|
||||
If ${1:condition} Then
|
||||
${2:; True code}
|
||||
Else
|
||||
${3:; Else code}
|
||||
EndIf
|
||||
# If/ElseIf/Else block
|
||||
# If/ElseIf/Else block - because there is eif this is not really neccessary
|
||||
snippet ifelif
|
||||
If ${1:condition 1} Then
|
||||
${2:; True code}
|
||||
|
@ -14,13 +14,13 @@ snippet mainn
|
||||
return 0;
|
||||
}
|
||||
##
|
||||
## Preprocessor
|
||||
## Preprocessor
|
||||
# #include <...>
|
||||
snippet inc
|
||||
#include <${1:stdio}.h>${2}
|
||||
# #include "..."
|
||||
snippet Inc
|
||||
#include "${1:`Filename("$1.h")`}"${2}
|
||||
#include "${1:`vim_snippets#Filename("$1.h")`}"${2}
|
||||
# ifndef...define...endif
|
||||
snippet ndef
|
||||
#ifndef $1
|
||||
@ -41,7 +41,7 @@ snippet #if
|
||||
#endif
|
||||
# header include guard
|
||||
snippet once
|
||||
#ifndef ${1:`toupper(Filename('$1_H', 'UNTITLED_H'))`}
|
||||
#ifndef ${1:`toupper(vim_snippets#Filename('$1_H', 'UNTITLED_H'))`}
|
||||
|
||||
#define $1
|
||||
|
||||
@ -53,7 +53,7 @@ snippet once
|
||||
# if
|
||||
snippet if
|
||||
if (${1:/* condition */}) {
|
||||
${2:/* code */}
|
||||
${2}
|
||||
}${3}
|
||||
# else
|
||||
snippet el
|
||||
@ -63,8 +63,11 @@ snippet el
|
||||
# else if
|
||||
snippet elif
|
||||
else if (${1:/* condition */}) {
|
||||
${2:/* code */}
|
||||
${2}
|
||||
}${3}
|
||||
# ifi
|
||||
snippet ifi
|
||||
if (${1:/* condition */}) ${2};${3}
|
||||
# ternary
|
||||
snippet t
|
||||
${1:/* condition */} ? ${2:a} : ${3:b}
|
||||
@ -94,22 +97,22 @@ snippet case
|
||||
# for
|
||||
snippet for
|
||||
for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) {
|
||||
${4:/* code */}
|
||||
${4}
|
||||
}${5}
|
||||
# for (custom)
|
||||
snippet forr
|
||||
for (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) {
|
||||
${5:/* code */}
|
||||
${5}
|
||||
}${6}
|
||||
# while
|
||||
snippet wh
|
||||
while (${1:/* condition */}) {
|
||||
${2:/* code */}
|
||||
${2}
|
||||
}${3}
|
||||
# do... while
|
||||
snippet do
|
||||
do {
|
||||
${2:/* code */}
|
||||
${2}
|
||||
} while (${1:/* condition */});${3}
|
||||
##
|
||||
## Functions
|
||||
@ -117,7 +120,7 @@ snippet do
|
||||
snippet fun
|
||||
${1:void} ${2:function_name}(${3})
|
||||
{
|
||||
${4:/* code */}
|
||||
${4}
|
||||
}${5}
|
||||
# function declaration
|
||||
snippet fund
|
||||
@ -129,14 +132,14 @@ snippet td
|
||||
typedef ${1:int} ${2:MyCustomType};${3}
|
||||
# struct
|
||||
snippet st
|
||||
struct ${1:`Filename('$1_t', 'name')`} {
|
||||
struct ${1:`vim_snippets#Filename('$1_t', 'name')`} {
|
||||
${2:/* data */}
|
||||
}${3: /* optional variable list */};${4}
|
||||
# typedef struct
|
||||
snippet tds
|
||||
typedef struct ${2:_$1 }{
|
||||
${3:/* data */}
|
||||
} ${1:`Filename('$1_t', 'name')`};${4}
|
||||
} ${1:`vim_snippets#Filename('$1_t', 'name')`};${4}
|
||||
# typedef enum
|
||||
snippet tde
|
||||
typedef enum {
|
||||
@ -230,5 +233,5 @@ snippet gpl
|
||||
*
|
||||
* Copyright (C) ${1:Author}, `strftime("%Y")`
|
||||
*/
|
||||
|
||||
|
||||
${2}
|
||||
|
@ -141,7 +141,7 @@ snippet svn
|
||||
${12:#}svn_username ${13} # (Subversion only) Username for Subversion operations
|
||||
${14:#}svn_password ${15} # (Subversion only) Password for Subversion operations
|
||||
${16:#}svn_arguments ${17} # (Subversion only) Extra arguments passed to the subversion command
|
||||
|
||||
|
||||
${18:#}${19:action :sync} # Update the source to the specified revision, or get a new checkout (Default)
|
||||
${20:#}${21:action :checkout} # Checkout the source. Does nothing if a checkout is available
|
||||
${22:#}${23:action :export} # Export the source, excluding or removing any version control artifacts
|
||||
@ -159,7 +159,7 @@ snippet git
|
||||
${14:#}enable_submodules ${15:"false"} # (Git only) performs a submodule init and submodule update
|
||||
${16:#}remote ${17:"origin"} # (Git only) remote repository to use for syncing an existing clone
|
||||
${18:#}ssh_wrapper ${19} # (Git only) path to a wrapper script for running SSH with git. GIT_SSH environment variable is set to this.
|
||||
|
||||
|
||||
${20:#}${21:action :sync} # Update the source to the specified revision, or get a new clone (Default)
|
||||
${22:#}${23:action :checkout} # Clone the source. Does nothing if a checkout is available
|
||||
${24:#}${25:action :export} # Export the source, excluding or removing any version control artifacts
|
||||
@ -197,7 +197,7 @@ snippet deploy
|
||||
${54:#}before_symlink ${55:"deploy/before_symlink.rb"} # A block or path to a file containing chef code to run before symlinking
|
||||
${56:#}before_restart ${57:"deploy/before_restart.rb"} # A block or path to a file containing chef code to run before restarting
|
||||
${58:#}after_restart ${59:"deploy/after_restart.rb"} # A block or path to a file containing chef code to run after restarting
|
||||
|
||||
|
||||
${60:#}${61::deploy} # Deploy the application (Default)
|
||||
${62:#}${63::force_deploy} # For the revision deploy strategy, this removes any existing release of the same code version and re-deploys in its place
|
||||
${64:#}${65::rollback} # Rollback the application to the previous release
|
||||
|
@ -43,7 +43,7 @@ snippet if
|
||||
(if ${1:test-expr}
|
||||
${2:then-expr}
|
||||
${3:else-expr})
|
||||
snippet if-let
|
||||
snippet if-let
|
||||
(if-let [${1:result} ${2:test-expr}]
|
||||
(${3:then-expr} $1)
|
||||
(${4:else-expr}))
|
||||
|
@ -39,7 +39,7 @@ snippet link
|
||||
TARGET_LINK_LIBRARIES(${1:bin}
|
||||
${2:somelib}
|
||||
)
|
||||
|
||||
|
||||
snippet bin
|
||||
ADD_EXECUTABLE(${1:bin})
|
||||
|
||||
@ -52,7 +52,7 @@ snippet dep
|
||||
)
|
||||
|
||||
snippet props
|
||||
SET_TARGET_PROPERTIES(${1:target}
|
||||
${2:PROPERTIES} ${3:COMPILE_FLAGS}
|
||||
SET_TARGET_PROPERTIES(${1:target}
|
||||
${2:PROPERTIES} ${3:COMPILE_FLAGS}
|
||||
${4:"-O3 -Wall -pedantic"}
|
||||
)
|
||||
|
@ -35,19 +35,19 @@ snippet bfun
|
||||
${2:# body...}
|
||||
# Class
|
||||
snippet cla class ..
|
||||
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
||||
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
||||
${2}
|
||||
snippet cla class .. constructor: ..
|
||||
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
||||
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
||||
constructor: (${2:args}) ->
|
||||
${3}
|
||||
|
||||
${4}
|
||||
snippet cla class .. extends ..
|
||||
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass}
|
||||
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass}
|
||||
${3}
|
||||
snippet cla class .. extends .. constructor: ..
|
||||
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass}
|
||||
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass}
|
||||
constructor: (${3:args}) ->
|
||||
${4}
|
||||
|
||||
@ -63,7 +63,7 @@ snippet ife
|
||||
else
|
||||
${3:# body...}
|
||||
# Else if
|
||||
snippet elif
|
||||
snippet eif
|
||||
else if ${1:condition}
|
||||
${2:# body...}
|
||||
# Ternary If
|
||||
|
@ -64,11 +64,11 @@ snippet fr
|
||||
# mutable
|
||||
snippet mu
|
||||
mutable
|
||||
##
|
||||
##
|
||||
## Class
|
||||
# class
|
||||
snippet cl
|
||||
class ${1:`Filename('$1', 'name')`}
|
||||
class ${1:`vim_snippets#Filename('$1', 'name')`}
|
||||
{
|
||||
public:
|
||||
$1(${2});
|
||||
@ -79,12 +79,12 @@ snippet cl
|
||||
};
|
||||
# member function implementation
|
||||
snippet mfun
|
||||
${4:void} ${1:`Filename('$1', 'ClassName')`}::${2:memberFunction}(${3}) {
|
||||
${5:/* code */}
|
||||
${4:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}(${3}) {
|
||||
${5}
|
||||
}
|
||||
# namespace
|
||||
snippet ns
|
||||
namespace ${1:`Filename('', 'my')`} {
|
||||
namespace ${1:`vim_snippets#Filename('', 'my')`} {
|
||||
${2}
|
||||
} /* namespace $1 */
|
||||
##
|
||||
@ -97,16 +97,16 @@ snippet cin
|
||||
std::cin >> ${1};${2}
|
||||
##
|
||||
## Iteration
|
||||
# for i
|
||||
# for i
|
||||
snippet fori
|
||||
for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) {
|
||||
${4:/* code */}
|
||||
${4}
|
||||
}${5}
|
||||
|
||||
# foreach
|
||||
snippet fore
|
||||
for (${1:auto} ${2:i} : ${3:container}) {
|
||||
${4:/* code */}
|
||||
${4}
|
||||
}${5}
|
||||
# iterator
|
||||
snippet iter
|
||||
@ -123,9 +123,9 @@ snippet itera
|
||||
## Lambdas
|
||||
# lamda (one line)
|
||||
snippet ld
|
||||
[${1}](${2}){${3:/* code */}}${4}
|
||||
[${1}](${2}){${3}}${4}
|
||||
# lambda (multi-line)
|
||||
snippet lld
|
||||
[${1}](${2}){
|
||||
${3:/* code */}
|
||||
${3}
|
||||
}${4}
|
||||
|
@ -1,12 +1,12 @@
|
||||
# cs.snippets
|
||||
# ===========
|
||||
#
|
||||
#
|
||||
# Standard C-Sharp snippets for snipmate.
|
||||
#
|
||||
# Largely ported over from Visual Studio 2010 snippets plus
|
||||
# a few snippets from Resharper plus a few widely known snippets.
|
||||
#
|
||||
# Most snippets on elements (i.e. classes, properties)
|
||||
# Most snippets on elements (i.e. classes, properties)
|
||||
# follow suffix conventions. The order of suffixes to a snippet
|
||||
# is fixed.
|
||||
#
|
||||
@ -55,13 +55,13 @@
|
||||
# * Events
|
||||
#
|
||||
# Feedback is welcome!
|
||||
#
|
||||
#
|
||||
# entry point
|
||||
snippet sim
|
||||
public static int Main(string[] args) {
|
||||
${1}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
snippet simc
|
||||
public class Application {
|
||||
public static int Main(string[] args) {
|
||||
@ -73,13 +73,13 @@ snippet simc
|
||||
snippet if
|
||||
if (${1}) {
|
||||
${2}
|
||||
}
|
||||
}
|
||||
snippet el
|
||||
else {
|
||||
${1}
|
||||
}
|
||||
}
|
||||
snippet ifs
|
||||
if (${1})
|
||||
if (${1})
|
||||
${2}
|
||||
# ternary conditional
|
||||
snippet t
|
||||
@ -116,49 +116,49 @@ snippet each
|
||||
}
|
||||
# interfaces
|
||||
snippet interface
|
||||
public interface ${1:`Filename()`} {
|
||||
public interface ${1:`vim_snippets#Filename()`} {
|
||||
${2}
|
||||
}
|
||||
snippet if+
|
||||
public interface ${1:`Filename()`} {
|
||||
public interface ${1:`vim_snippets#Filename()`} {
|
||||
${2}
|
||||
}
|
||||
# class bodies
|
||||
snippet class
|
||||
public class ${1:`Filename()`} {
|
||||
public class ${1:`vim_snippets#Filename()`} {
|
||||
${2}
|
||||
}
|
||||
snippet cls
|
||||
${2:public} class ${1:`Filename()`} {
|
||||
${2:public} class ${1:`vim_snippets#Filename()`} {
|
||||
${3}
|
||||
}
|
||||
snippet cls+
|
||||
public class ${1:`Filename()`} {
|
||||
public class ${1:`vim_snippets#Filename()`} {
|
||||
${2}
|
||||
}
|
||||
snippet cls+^
|
||||
public static class ${1:`Filename()`} {
|
||||
public static class ${1:`vim_snippets#Filename()`} {
|
||||
${2}
|
||||
}
|
||||
snippet cls&
|
||||
internal class ${1:`Filename()`} {
|
||||
internal class ${1:`vim_snippets#Filename()`} {
|
||||
${2}
|
||||
}
|
||||
snippet cls&^
|
||||
internal static class ${1:`Filename()`} {
|
||||
internal static class ${1:`vim_snippets#Filename()`} {
|
||||
${2}
|
||||
}
|
||||
snippet cls|
|
||||
protected class ${1:`Filename()`} {
|
||||
protected class ${1:`vim_snippets#Filename()`} {
|
||||
${2}
|
||||
}
|
||||
snippet cls|%
|
||||
protected abstract class ${1:`Filename()`} {
|
||||
protected abstract class ${1:`vim_snippets#Filename()`} {
|
||||
${2}
|
||||
}
|
||||
# constructor
|
||||
snippet ctor
|
||||
public ${1:`Filename()`}() {
|
||||
public ${1:`vim_snippets#Filename()`}() {
|
||||
${2}
|
||||
}
|
||||
# properties - auto properties by default.
|
||||
@ -342,7 +342,7 @@ snippet ms-
|
||||
}
|
||||
# structure
|
||||
snippet struct
|
||||
public struct ${1:`Filename()`} {
|
||||
public struct ${1:`vim_snippets#Filename()`} {
|
||||
${2}
|
||||
}
|
||||
# enumeration
|
||||
|
@ -9,7 +9,7 @@ snippet so
|
||||
${2}
|
||||
snippet main
|
||||
static void main() {
|
||||
${1:/* code */}
|
||||
${1}
|
||||
}
|
||||
snippet st
|
||||
static ${1}
|
||||
@ -22,9 +22,9 @@ snippet br
|
||||
snippet th
|
||||
throw ${1}
|
||||
snippet cl
|
||||
class ${1:`Filename("", "untitled")`} ${2}
|
||||
class ${1:`vim_snippets#Filename("", "untitled")`} ${2}
|
||||
snippet in
|
||||
interface ${1:`Filename("", "untitled")`} ${2}
|
||||
interface ${1:`vim_snippets#Filename("", "untitled")`} ${2}
|
||||
snippet imp
|
||||
implements ${1}
|
||||
snippet ext
|
||||
@ -57,15 +57,15 @@ snippet for
|
||||
}
|
||||
snippet fore
|
||||
for (final ${2:item} in ${1:itemList}) {
|
||||
${3:/* code */}
|
||||
${3}
|
||||
}
|
||||
snippet wh
|
||||
while (${1:/* condition */}) {
|
||||
${2:/* code */}
|
||||
${2}
|
||||
}
|
||||
snippet dowh
|
||||
do {
|
||||
${2:/* code */}
|
||||
${2}
|
||||
} while (${1:/* condition */});
|
||||
snippet as
|
||||
assert(${1:/* condition */});
|
||||
|
@ -73,16 +73,16 @@ snippet model
|
||||
class ${1:ModelName}(models.Model):
|
||||
"""${2:docstring}"""
|
||||
${3}
|
||||
|
||||
|
||||
class Meta:
|
||||
${4}
|
||||
|
||||
|
||||
def __unicode__(self):
|
||||
${5}
|
||||
|
||||
|
||||
def save(self, force_insert=False, force_update=False):
|
||||
${6}
|
||||
|
||||
|
||||
@models.permalink
|
||||
def get_absolute_url(self):
|
||||
return ('${7:view_or_url_name}' ${8})
|
||||
@ -90,9 +90,9 @@ snippet model
|
||||
snippet modeladmin
|
||||
class ${1:ModelName}Admin(admin.ModelAdmin):
|
||||
${2}
|
||||
|
||||
|
||||
admin.site.register($1, $1Admin)
|
||||
|
||||
|
||||
snippet tabularinline
|
||||
class ${1:ModelName}Inline(admin.TabularInline):
|
||||
model = $1
|
||||
|
122
sources_non_forked/vim-snippets/snippets/elixir.snippets
Normal file
122
sources_non_forked/vim-snippets/snippets/elixir.snippets
Normal file
@ -0,0 +1,122 @@
|
||||
snippet do
|
||||
do
|
||||
${1}
|
||||
end
|
||||
snippet if if .. do .. end
|
||||
if ${1} do
|
||||
${2}
|
||||
end
|
||||
|
||||
snippet if if .. do: ..
|
||||
if ${1:condition}, do: ${2}
|
||||
|
||||
snippet ife if .. do .. else .. end
|
||||
if ${1:condition} do
|
||||
${2}
|
||||
else
|
||||
${3}
|
||||
end
|
||||
|
||||
snippet ife if .. do: .. else:
|
||||
if ${1:condition}, do: ${2}, else: ${3}
|
||||
|
||||
snippet unless unless .. do .. end
|
||||
unless ${1} do
|
||||
${2}
|
||||
end
|
||||
|
||||
snippet unless unless .. do: ..
|
||||
unless ${1:condition}, do: ${2}
|
||||
|
||||
snippet unlesse unless .. do .. else .. end
|
||||
unless ${1:condition} do
|
||||
${2}
|
||||
else
|
||||
${3}
|
||||
end
|
||||
|
||||
snippet unlesse unless .. do: .. else:
|
||||
unless ${1:condition}, do: ${2}, else: ${3}
|
||||
|
||||
snippet cond
|
||||
cond do
|
||||
${1} ->
|
||||
${2}
|
||||
end
|
||||
|
||||
snippet case
|
||||
case ${1} do
|
||||
${2} ->
|
||||
${3}
|
||||
end
|
||||
|
||||
snippet def
|
||||
def ${1:name} do
|
||||
${2}
|
||||
end
|
||||
|
||||
snippet defim
|
||||
defimpl ${1:protocol_name}, for: ${2:data_type} do
|
||||
${3}
|
||||
end
|
||||
|
||||
snippet defma
|
||||
defmacro ${1:name} do
|
||||
${2}
|
||||
end
|
||||
|
||||
snippet defmo
|
||||
defmodule ${1:module_name} do
|
||||
${2}
|
||||
end
|
||||
|
||||
snippet defp
|
||||
defp ${1:name} do
|
||||
${2}
|
||||
end
|
||||
|
||||
snippet defpr
|
||||
defprotocol ${1:name}, [${2:function}]
|
||||
|
||||
snippet defr
|
||||
defrecord ${1:record_name}, ${2:fields}
|
||||
|
||||
snippet doc
|
||||
@doc """
|
||||
${1}
|
||||
"""
|
||||
|
||||
snippet fn
|
||||
fn(${1:args}) -> ${2} end
|
||||
|
||||
snippet mdoc
|
||||
@moduledoc """
|
||||
${1}
|
||||
"""
|
||||
|
||||
snippet rec
|
||||
receive do
|
||||
${1} ->
|
||||
${2}
|
||||
end
|
||||
|
||||
snippet req
|
||||
require ${1:module_name}
|
||||
|
||||
snippet imp
|
||||
import ${1:module_name}
|
||||
|
||||
snippet ali
|
||||
alias ${1:module_name}
|
||||
|
||||
snippet test
|
||||
test "${1:test_name}" do
|
||||
${2}
|
||||
end
|
||||
|
||||
snippet try try .. rescue .. end
|
||||
try do
|
||||
${1}
|
||||
rescue
|
||||
${2} -> ${3}
|
||||
end
|
@ -1,12 +1,12 @@
|
||||
# module and export all
|
||||
snippet mod
|
||||
-module(${1:`Filename('', 'my')`}).
|
||||
|
||||
-module(${1:`vim_snippets#Filename('', 'my')`}).
|
||||
|
||||
-compile([export_all]).
|
||||
|
||||
|
||||
start() ->
|
||||
${2}
|
||||
|
||||
|
||||
stop() ->
|
||||
ok.
|
||||
# define directive
|
||||
@ -66,7 +66,7 @@ snippet %p
|
||||
%% @private
|
||||
# OTP application
|
||||
snippet application
|
||||
-module(${1:`Filename('', 'my')`}).
|
||||
-module(${1:`vim_snippets#Filename('', 'my')`}).
|
||||
|
||||
-behaviour(application).
|
||||
|
||||
@ -81,10 +81,10 @@ snippet application
|
||||
end.
|
||||
|
||||
stop(_State) ->
|
||||
ok.
|
||||
ok.
|
||||
# OTP supervisor
|
||||
snippet supervisor
|
||||
-module(${1:`Filename('', 'my')`}).
|
||||
-module(${1:`vim_snippets#Filename('', 'my')`}).
|
||||
|
||||
-behaviour(supervisor).
|
||||
|
||||
@ -107,7 +107,7 @@ snippet supervisor
|
||||
{ok, {RestartStrategy, Children}}.
|
||||
# OTP gen_server
|
||||
snippet gen_server
|
||||
-module(${1:`Filename('', 'my')`}).
|
||||
-module(${1:`vim_snippets#Filename('', 'my')`}).
|
||||
|
||||
-behaviour(gen_server).
|
||||
|
||||
@ -157,4 +157,194 @@ snippet gen_server
|
||||
%%%===================================================================
|
||||
%%% Internal functions
|
||||
%%%===================================================================
|
||||
# common_test test_SUITE
|
||||
snippet testsuite
|
||||
-module(${1:`vim_snippets#Filename('', 'my')`}).
|
||||
|
||||
-include_lib("common_test/include/ct.hrl").
|
||||
|
||||
%% Test server callbacks
|
||||
-export([suite/0, all/0, groups/0,
|
||||
init_per_suite/1, end_per_suite/1,
|
||||
init_per_group/2, end_per_group/2,
|
||||
init_per_testcase/2, end_per_testcase/2]).
|
||||
|
||||
%% Test cases
|
||||
-export([
|
||||
]).
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% COMMON TEST CALLBACK FUNCTIONS
|
||||
%%--------------------------------------------------------------------
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: suite() -> Info
|
||||
%%
|
||||
%% Info = [tuple()]
|
||||
%% List of key/value pairs.
|
||||
%%
|
||||
%% Description: Returns list of tuples to set default properties
|
||||
%% for the suite.
|
||||
%%
|
||||
%% Note: The suite/0 function is only meant to be used to return
|
||||
%% default data values, not perform any other operations.
|
||||
%%--------------------------------------------------------------------
|
||||
suite() ->
|
||||
[{timetrap,{minutes,10}}].
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: init_per_suite(Config0) ->
|
||||
%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
|
||||
%%
|
||||
%% Config0 = Config1 = [tuple()]
|
||||
%% A list of key/value pairs, holding the test case configuration.
|
||||
%% Reason = term()
|
||||
%% The reason for skipping the suite.
|
||||
%%
|
||||
%% Description: Initialization before the suite.
|
||||
%%
|
||||
%% Note: This function is free to add any key/value pairs to the Config
|
||||
%% variable, but should NOT alter/remove any existing entries.
|
||||
%%--------------------------------------------------------------------
|
||||
init_per_suite(Config) ->
|
||||
Config.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: end_per_suite(Config0) -> void() | {save_config,Config1}
|
||||
%%
|
||||
%% Config0 = Config1 = [tuple()]
|
||||
%% A list of key/value pairs, holding the test case configuration.
|
||||
%%
|
||||
%% Description: Cleanup after the suite.
|
||||
%%--------------------------------------------------------------------
|
||||
end_per_suite(_Config) ->
|
||||
ok.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: init_per_group(GroupName, Config0) ->
|
||||
%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
|
||||
%%
|
||||
%% GroupName = atom()
|
||||
%% Name of the test case group that is about to run.
|
||||
%% Config0 = Config1 = [tuple()]
|
||||
%% A list of key/value pairs, holding configuration data for the group.
|
||||
%% Reason = term()
|
||||
%% The reason for skipping all test cases and subgroups in the group.
|
||||
%%
|
||||
%% Description: Initialization before each test case group.
|
||||
%%--------------------------------------------------------------------
|
||||
init_per_group(_GroupName, Config) ->
|
||||
Config.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: end_per_group(GroupName, Config0) ->
|
||||
%% void() | {save_config,Config1}
|
||||
%%
|
||||
%% GroupName = atom()
|
||||
%% Name of the test case group that is finished.
|
||||
%% Config0 = Config1 = [tuple()]
|
||||
%% A list of key/value pairs, holding configuration data for the group.
|
||||
%%
|
||||
%% Description: Cleanup after each test case group.
|
||||
%%--------------------------------------------------------------------
|
||||
end_per_group(_GroupName, _Config) ->
|
||||
ok.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: init_per_testcase(TestCase, Config0) ->
|
||||
%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
|
||||
%%
|
||||
%% TestCase = atom()
|
||||
%% Name of the test case that is about to run.
|
||||
%% Config0 = Config1 = [tuple()]
|
||||
%% A list of key/value pairs, holding the test case configuration.
|
||||
%% Reason = term()
|
||||
%% The reason for skipping the test case.
|
||||
%%
|
||||
%% Description: Initialization before each test case.
|
||||
%%
|
||||
%% Note: This function is free to add any key/value pairs to the Config
|
||||
%% variable, but should NOT alter/remove any existing entries.
|
||||
%%--------------------------------------------------------------------
|
||||
init_per_testcase(_TestCase, Config) ->
|
||||
Config.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: end_per_testcase(TestCase, Config0) ->
|
||||
%% void() | {save_config,Config1} | {fail,Reason}
|
||||
%%
|
||||
%% TestCase = atom()
|
||||
%% Name of the test case that is finished.
|
||||
%% Config0 = Config1 = [tuple()]
|
||||
%% A list of key/value pairs, holding the test case configuration.
|
||||
%% Reason = term()
|
||||
%% The reason for failing the test case.
|
||||
%%
|
||||
%% Description: Cleanup after each test case.
|
||||
%%--------------------------------------------------------------------
|
||||
end_per_testcase(_TestCase, _Config) ->
|
||||
ok.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: groups() -> [Group]
|
||||
%%
|
||||
%% Group = {GroupName,Properties,GroupsAndTestCases}
|
||||
%% GroupName = atom()
|
||||
%% The name of the group.
|
||||
%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}]
|
||||
%% Group properties that may be combined.
|
||||
%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase]
|
||||
%% TestCase = atom()
|
||||
%% The name of a test case.
|
||||
%% Shuffle = shuffle | {shuffle,Seed}
|
||||
%% To get cases executed in random order.
|
||||
%% Seed = {integer(),integer(),integer()}
|
||||
%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail |
|
||||
%% repeat_until_any_ok | repeat_until_any_fail
|
||||
%% To get execution of cases repeated.
|
||||
%% N = integer() | forever
|
||||
%%
|
||||
%% Description: Returns a list of test case group definitions.
|
||||
%%--------------------------------------------------------------------
|
||||
groups() ->
|
||||
[].
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: all() -> GroupsAndTestCases | {skip,Reason}
|
||||
%%
|
||||
%% GroupsAndTestCases = [{group,GroupName} | TestCase]
|
||||
%% GroupName = atom()
|
||||
%% Name of a test case group.
|
||||
%% TestCase = atom()
|
||||
%% Name of a test case.
|
||||
%% Reason = term()
|
||||
%% The reason for skipping all groups and test cases.
|
||||
%%
|
||||
%% Description: Returns the list of groups and test cases that
|
||||
%% are to be executed.
|
||||
%%--------------------------------------------------------------------
|
||||
all() ->
|
||||
[].
|
||||
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% TEST CASES
|
||||
%%--------------------------------------------------------------------
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: TestCase(Config0) ->
|
||||
%% ok | exit() | {skip,Reason} | {comment,Comment} |
|
||||
%% {save_config,Config1} | {skip_and_save,Reason,Config1}
|
||||
%%
|
||||
%% Config0 = Config1 = [tuple()]
|
||||
%% A list of key/value pairs, holding the test case configuration.
|
||||
%% Reason = term()
|
||||
%% The reason for skipping the test case.
|
||||
%% Comment = term()
|
||||
%% A comment about the test case that will be printed in the html log.
|
||||
%%
|
||||
%% Description: Test case function. (The name of it must be specified in
|
||||
%% the all/0 list or in a test case group for the test case
|
||||
%% to be executed).
|
||||
%%--------------------------------------------------------------------
|
||||
|
||||
|
@ -53,6 +53,8 @@ snippet ff
|
||||
<%= form_for @${1:model} do |f| %>
|
||||
${2}
|
||||
<% end %>
|
||||
snippet ffi
|
||||
<%= ${1:f}.input :${2:attribute} %>
|
||||
snippet ffcb
|
||||
<%= ${1:f}.check_box :${2:attribute} %>
|
||||
snippet ffe
|
||||
@ -111,3 +113,13 @@ snippet slt
|
||||
<%= stylesheet_link_tag ${1::all}, :cache => ${2:true} %>
|
||||
snippet sslt
|
||||
<%= stylesheet_link_tag "${1}" %>
|
||||
snippet if
|
||||
<% if ${1} %>
|
||||
${2}
|
||||
<% end %>
|
||||
snippet ife
|
||||
<% if ${1} %>
|
||||
${2}
|
||||
<% else %>
|
||||
${3}
|
||||
<% end %>
|
||||
|
@ -1,15 +1,15 @@
|
||||
snippet #!
|
||||
#!/usr/bin/env falcon
|
||||
|
||||
# Import
|
||||
# Import
|
||||
snippet imp
|
||||
import ${1:module}
|
||||
|
||||
# Function
|
||||
snippet fun
|
||||
function ${2:function_name}(${3})
|
||||
${4:/* code */}
|
||||
end
|
||||
function ${2:function_name}(${3})
|
||||
${4}
|
||||
end
|
||||
|
||||
# Class
|
||||
snippet class
|
||||
@ -17,35 +17,35 @@ snippet class
|
||||
${3:/* members/methods */}
|
||||
end
|
||||
|
||||
# If
|
||||
# If
|
||||
snippet if
|
||||
if ${1:condition}
|
||||
${2:/* code */}
|
||||
${2}
|
||||
end
|
||||
|
||||
# If else
|
||||
snippet ife
|
||||
if ${1:condition}
|
||||
${2:/* code */}
|
||||
${2}
|
||||
else
|
||||
${1}
|
||||
${1}
|
||||
end
|
||||
|
||||
# If else if
|
||||
snippet elif
|
||||
# If else if
|
||||
snippet eif
|
||||
elif ${1:condition}
|
||||
${2:/* code */}
|
||||
${2}
|
||||
|
||||
# Switch case
|
||||
snippet switch
|
||||
switch ${1:expression}
|
||||
case ${2:item}
|
||||
case ${3:item}
|
||||
default
|
||||
default
|
||||
end
|
||||
|
||||
# Select
|
||||
snippet select
|
||||
snippet select
|
||||
select ${1:variable}
|
||||
case ${2:TypeSpec}
|
||||
case ${3:TypeSpec}
|
||||
@ -55,17 +55,17 @@ snippet select
|
||||
# For/in Loop
|
||||
snippet forin
|
||||
for ${1:element} in ${2:container}
|
||||
${3:/* code */}
|
||||
${3}
|
||||
end
|
||||
|
||||
# For/to Loop
|
||||
snippet forto
|
||||
for ${1:lowerbound} to ${2:upperbound}
|
||||
${3:/* code */}
|
||||
${3}
|
||||
end
|
||||
|
||||
# While Loop
|
||||
snippet while
|
||||
snippet while
|
||||
while ${1:conidition}
|
||||
${2:/* code */}
|
||||
${2}
|
||||
end
|
||||
|
@ -4,7 +4,7 @@ snippet ap
|
||||
# bool
|
||||
snippet bl
|
||||
bool
|
||||
# byte
|
||||
# byte
|
||||
snippet bt
|
||||
byte
|
||||
# break
|
||||
@ -16,7 +16,7 @@ snippet ch
|
||||
# case
|
||||
snippet cs
|
||||
case ${1:value}:
|
||||
${2:/* code */}
|
||||
${2}
|
||||
# const
|
||||
snippet c
|
||||
const ${1:NAME} = ${2:0}
|
||||
@ -29,14 +29,14 @@ snippet co
|
||||
# continue
|
||||
snippet cn
|
||||
continue
|
||||
# defer
|
||||
# defer
|
||||
snippet df
|
||||
defer ${1:func}()
|
||||
# defer recover
|
||||
snippet dfr
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
${1:/* code */}
|
||||
${1}
|
||||
}
|
||||
}()
|
||||
# gpl
|
||||
@ -57,20 +57,20 @@ snippet gpl
|
||||
*
|
||||
* Copyright (C) ${1:Author}, `strftime("%Y")`
|
||||
*/
|
||||
|
||||
|
||||
${2}
|
||||
# int
|
||||
snippet i
|
||||
int
|
||||
# import
|
||||
# import
|
||||
snippet im
|
||||
import (
|
||||
"${1:package}"
|
||||
"${1:package}"
|
||||
)${2}
|
||||
# interface
|
||||
# interface
|
||||
snippet in
|
||||
interface{}
|
||||
# full interface snippet
|
||||
# full interface snippet
|
||||
snippet inf
|
||||
interface ${1:name} {
|
||||
${2:/* methods */}
|
||||
@ -78,8 +78,8 @@ snippet inf
|
||||
# if condition
|
||||
snippet if
|
||||
if ${1:/* condition */} {
|
||||
${2:/* code */}
|
||||
}${2}
|
||||
${2}
|
||||
}${3}
|
||||
# else snippet
|
||||
snippet el
|
||||
else {
|
||||
@ -109,7 +109,7 @@ snippet f6
|
||||
# if else
|
||||
snippet ie
|
||||
if ${1:/* condition */} {
|
||||
${2:/* code */}
|
||||
${2}
|
||||
} else {
|
||||
${3}
|
||||
}
|
||||
@ -117,25 +117,25 @@ snippet ie
|
||||
# for loop
|
||||
snippet fo
|
||||
for ${2:i} := 0; $2 < ${1:count}; $2${3:++} {
|
||||
${4:/* code */}
|
||||
${4}
|
||||
}
|
||||
${5}
|
||||
# for range loop
|
||||
snippet fr
|
||||
for ${1:k}, ${2:v} := range ${3} {
|
||||
${4:/* code */}
|
||||
${4}
|
||||
}
|
||||
${5}
|
||||
# function simple
|
||||
# function simple
|
||||
snippet fun
|
||||
func ${1:funcName}(${2}) ${3:error} {
|
||||
${4:/* code */}
|
||||
${4}
|
||||
}
|
||||
${5}
|
||||
# function on receiver
|
||||
# function on receiver
|
||||
snippet fum
|
||||
func (self ${1:type}) ${2:funcName}(${3}) ${4:error} {
|
||||
${5:/* code */}
|
||||
${5}
|
||||
}
|
||||
${6}
|
||||
# log printf
|
||||
@ -147,42 +147,42 @@ snippet lp
|
||||
# make
|
||||
snippet mk
|
||||
make(${1:[]string}, ${2:0})
|
||||
# map
|
||||
# map
|
||||
snippet mp
|
||||
map[${1:string}]${2:int}
|
||||
# main()
|
||||
snippet main
|
||||
func main() {
|
||||
${1:/* code */}
|
||||
${1}
|
||||
}
|
||||
${2}
|
||||
# new
|
||||
snippet nw
|
||||
new(${1:type})
|
||||
# panic
|
||||
# panic
|
||||
snippet pn
|
||||
panic("${1:msg}")
|
||||
# print
|
||||
snippet pr
|
||||
fmt.Printf("%${1:s}\n", ${2:var})${3}
|
||||
# range
|
||||
# range
|
||||
snippet rn
|
||||
range ${1}
|
||||
# return
|
||||
# return
|
||||
snippet rt
|
||||
return ${1}
|
||||
# result
|
||||
# result
|
||||
snippet rs
|
||||
result
|
||||
# select
|
||||
snippet sl
|
||||
select {
|
||||
case ${1:v1} := <-${2:chan1}
|
||||
${3:/* code */}
|
||||
${3}
|
||||
case ${4:v2} := <-${5:chan2}
|
||||
${6:/* code */}
|
||||
${6}
|
||||
default:
|
||||
${7:/* code */}
|
||||
${7}
|
||||
}
|
||||
# string
|
||||
snippet sr
|
||||
@ -193,19 +193,19 @@ snippet st
|
||||
${2:/* data */}
|
||||
}
|
||||
${3}
|
||||
# switch
|
||||
# switch
|
||||
snippet sw
|
||||
switch ${1:var} {
|
||||
case ${2:value1}:
|
||||
${3:/* code */}
|
||||
${3}
|
||||
case ${4:value2}:
|
||||
${5:/* code */}
|
||||
${5}
|
||||
default:
|
||||
${6:/* code */}
|
||||
${6}
|
||||
}
|
||||
snippet sp
|
||||
fmt.Sprintf("%${1:s}", ${2:var})${3}
|
||||
# true
|
||||
# true
|
||||
snippet t
|
||||
true
|
||||
# variable declaration
|
||||
|
@ -11,10 +11,20 @@ snippet ul
|
||||
%li
|
||||
${1:item}
|
||||
%li
|
||||
snippet =rp
|
||||
= render :partial => '${1:partial}'
|
||||
snippet =rpl
|
||||
= render :partial => '${1:partial}', :locals => {}
|
||||
snippet =rpc
|
||||
= render :partial => '${1:partial}', :collection => @$1
|
||||
snippet rp
|
||||
= render :partial => "${1:item}"
|
||||
snippet rpc
|
||||
= render :partial => "${1:item}", :collection => ${2:@$1s}
|
||||
snippet rpl
|
||||
= render :partial => "${1:item}", :locals => { :${2:$1} => ${3:@$1}
|
||||
snippet rpo
|
||||
= render :partial => "${1:item}", :object => ${2:@$1}
|
||||
snippet ife
|
||||
- if ${1:condition}
|
||||
${2}
|
||||
- else
|
||||
${3}
|
||||
snippet ifp
|
||||
- if ${1:condition}.presence?
|
||||
${2}
|
||||
|
||||
|
@ -48,7 +48,7 @@ snippet ap
|
||||
${1:map} ${2:fn} ${3:list}
|
||||
snippet do
|
||||
do
|
||||
|
||||
|
||||
snippet λ
|
||||
\${1:x} -> ${2}
|
||||
snippet \
|
||||
|
@ -412,7 +412,7 @@ snippet head
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
|
||||
<title>${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
|
||||
<title>${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
|
||||
${2}
|
||||
</head>
|
||||
snippet header
|
||||
@ -450,7 +450,7 @@ snippet html5
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<title>${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
|
||||
<title>${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
|
||||
${2:meta}
|
||||
</head>
|
||||
<body>
|
||||
@ -730,6 +730,10 @@ snippet source
|
||||
<source src="${1}" type="${2}" media="${3}" />
|
||||
snippet span
|
||||
<span>${1}</span>
|
||||
snippet span.
|
||||
<span class="${1}">${2}</span>
|
||||
snippet span#
|
||||
<span id="${1}">${2}</span>
|
||||
snippet strong
|
||||
<strong>${1}</strong>
|
||||
snippet style
|
||||
@ -791,7 +795,7 @@ snippet thead
|
||||
snippet time
|
||||
<time datetime="${1}" pubdate="${2:$1}">${3:$1}</time>
|
||||
snippet title
|
||||
<title>${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
|
||||
<title>${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
|
||||
snippet tr
|
||||
<tr>
|
||||
${1}
|
||||
|
@ -0,0 +1,74 @@
|
||||
# file containing most useful mappings only
|
||||
# when editing this file please be aware that there is ZenCoding and sparkup
|
||||
|
||||
# html 5 is recommended from now on
|
||||
snippet html5
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>$2</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
$3
|
||||
</head>
|
||||
<body>
|
||||
$4
|
||||
</body>
|
||||
</html>
|
||||
|
||||
# ==== TAGS
|
||||
# you always need these:
|
||||
snippet .
|
||||
class="${1}"${2}
|
||||
snippet n
|
||||
name="${1}"${2}
|
||||
snippet r
|
||||
rel="${1}"${2}
|
||||
snippet t
|
||||
title="${1}"${2}
|
||||
|
||||
# not using # because id is faster to type
|
||||
snippet id
|
||||
id="${1}"${2}
|
||||
snippet idn
|
||||
id="${1}" name="${2:$1}"
|
||||
|
||||
snippet label_and_input
|
||||
<label for="${2:$1}">${1}</label>
|
||||
<input type="${3:text}" name="${4:$2}" id="${5:$2}" value="${6}" />${7}
|
||||
|
||||
|
||||
# FORMS
|
||||
# use idn . or n to add id
|
||||
snippet input
|
||||
<input type="${1:text}" value="${2}" ${3}/>${7}
|
||||
snippet submit
|
||||
<input type="submit" value="${2}" ${3}/>${7}
|
||||
snippet textarea
|
||||
<textarea $1>$2</textarea>
|
||||
|
||||
# if you need id or class use snippets above
|
||||
snippet form
|
||||
<form method="${1:post/get}" action="$2">
|
||||
$3
|
||||
</form>
|
||||
|
||||
# other tags
|
||||
snippet br
|
||||
<br/>
|
||||
snippet a
|
||||
<a href="#" $2>$3</a>
|
||||
snippet img
|
||||
<img src="$1" alt="$2"/>
|
||||
# JS/CSS
|
||||
snippet css_file
|
||||
<link rel="stylesheet" href="${1:style.css}" type="text/css" media="${2:all}" />${3}
|
||||
snippet css_block
|
||||
<link rel="stylesheet" href="${1:style.css}" type="text/css" media="${2:all}">
|
||||
</link>
|
||||
|
||||
snippet script_block
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
</script>
|
||||
snippet script_file
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
</script>
|
@ -47,10 +47,10 @@ snippet if
|
||||
{% if ${1} %}
|
||||
${2}
|
||||
{% endif %}
|
||||
snippet else
|
||||
snippet el
|
||||
{% else %}
|
||||
${1}
|
||||
snippet elif
|
||||
snippet eif
|
||||
{% elif ${1} %}
|
||||
${2}
|
||||
snippet ifchanged
|
||||
|
@ -27,9 +27,9 @@ snippet if
|
||||
{% if ${1:condition} %}
|
||||
${2}
|
||||
{% end %}
|
||||
snippet elif
|
||||
{% elif ${1:condition} %}
|
||||
snippet else
|
||||
snippet eif
|
||||
{% elif ${1:condition} %}
|
||||
snippet el
|
||||
{% else %}
|
||||
snippet import
|
||||
{% import ${1:module} %}
|
||||
|
@ -39,15 +39,15 @@ snippet j.u
|
||||
##
|
||||
## Class
|
||||
snippet cl
|
||||
class ${1:`Filename("", "untitled")`} ${2}
|
||||
class ${1:`vim_snippets#Filename("", "untitled")`} ${2}
|
||||
snippet in
|
||||
interface ${1:`Filename("", "untitled")`} ${2:extends Parent}${3}
|
||||
interface ${1:`vim_snippets#Filename("", "untitled")`} ${2:extends Parent}${3}
|
||||
snippet tc
|
||||
public class ${1:`Filename()`} extends ${2:TestCase}
|
||||
public class ${1:`vim_snippets#Filename()`} extends ${2:TestCase}
|
||||
##
|
||||
## Class Enhancements
|
||||
snippet ext
|
||||
extends
|
||||
extends
|
||||
snippet imp
|
||||
implements
|
||||
##
|
||||
@ -72,7 +72,7 @@ snippet def
|
||||
${2}
|
||||
snippet el
|
||||
else
|
||||
snippet elif
|
||||
snippet eif
|
||||
else if (${1}) ${2}
|
||||
snippet if
|
||||
if (${1}) ${2}
|
||||
@ -144,7 +144,7 @@ snippet @au
|
||||
snippet @br
|
||||
@brief ${1:Description}
|
||||
snippet @fi
|
||||
@file ${1:`Filename()`}.java
|
||||
@file ${1:`vim_snippets#Filename()`}.java
|
||||
snippet @pa
|
||||
@param ${1:param}
|
||||
snippet @re
|
||||
@ -171,7 +171,7 @@ snippet wh
|
||||
## Main method
|
||||
snippet main
|
||||
public static void main (String[] args) {
|
||||
${1:/* code */}
|
||||
${1}
|
||||
}
|
||||
##
|
||||
## Print Methods
|
||||
|
@ -260,7 +260,7 @@ snippet filter
|
||||
${1:obj}.filter('${2:selector expression}')${3}
|
||||
snippet filtert
|
||||
${1:obj}.filter(function (${2:index}) {
|
||||
${3:// test code}
|
||||
${3}
|
||||
})${4}
|
||||
snippet find
|
||||
${1:obj}.find('${2:selector expression}')${3}
|
||||
@ -291,7 +291,7 @@ snippet getscript
|
||||
});
|
||||
snippet grep
|
||||
$.grep(${1:array}, function (item, index) {
|
||||
${2:// test code}
|
||||
${2}
|
||||
}${3:, true});
|
||||
snippet hasc
|
||||
${1:obj}.hasClass('${2:className}')${3}
|
||||
|
@ -17,7 +17,7 @@ snippet f
|
||||
# Immediate function
|
||||
snippet (f
|
||||
(function (${1}) {
|
||||
${3:/* code */}
|
||||
${3}
|
||||
}(${2}));
|
||||
# if
|
||||
snippet if
|
||||
@ -38,16 +38,16 @@ snippet ter
|
||||
snippet switch
|
||||
switch (${1:expression}) {
|
||||
case '${3:case}':
|
||||
${4:// code}
|
||||
${4}
|
||||
break;
|
||||
${5}
|
||||
default:
|
||||
${2:// code}
|
||||
${2}
|
||||
}
|
||||
# case
|
||||
snippet case
|
||||
case '${1:case}':
|
||||
${2:// code}
|
||||
${2}
|
||||
break;
|
||||
${3}
|
||||
# for (...) {...}
|
||||
@ -63,19 +63,19 @@ snippet forr
|
||||
# while (...) {...}
|
||||
snippet wh
|
||||
while (${1:/* condition */}) {
|
||||
${2:/* code */}
|
||||
${2}
|
||||
}
|
||||
# try
|
||||
snippet try
|
||||
try {
|
||||
${1:/* code */}
|
||||
${1}
|
||||
} catch (${2:e}) {
|
||||
${3:/* handle error */}
|
||||
}
|
||||
# do...while
|
||||
snippet do
|
||||
do {
|
||||
${2:/* code */}
|
||||
${2}
|
||||
} while (${1:/* condition */});
|
||||
# Object Method
|
||||
snippet :f
|
||||
@ -124,10 +124,10 @@ snippet jsons
|
||||
# self-defining function
|
||||
snippet sdf
|
||||
var ${1:function_name} = function (${2:argument}) {
|
||||
${3:// initial code ...}
|
||||
${3}
|
||||
|
||||
$1 = function ($2) {
|
||||
${4:// main code}
|
||||
${4}
|
||||
};
|
||||
};
|
||||
# singleton
|
||||
@ -140,7 +140,7 @@ snippet sing
|
||||
$1 = function $1($2) {
|
||||
return instance;
|
||||
};
|
||||
|
||||
|
||||
// carry over the prototype properties
|
||||
$1.prototype = this;
|
||||
|
||||
@ -150,11 +150,11 @@ snippet sing
|
||||
// reset the constructor pointer
|
||||
instance.constructor = $1;
|
||||
|
||||
${3:// code ...}
|
||||
${3}
|
||||
|
||||
return instance;
|
||||
}
|
||||
# Crockford's object function
|
||||
# Crockford's object function
|
||||
snippet obj
|
||||
function object(o) {
|
||||
function F() {}
|
||||
@ -164,7 +164,7 @@ snippet obj
|
||||
# Define multiple properties
|
||||
snippet props
|
||||
var ${1:my_object} = Object.defineProperties(
|
||||
${2:new Object()},
|
||||
${2:new Object()},
|
||||
{
|
||||
${3:property} : {
|
||||
get : function $1_$3_getter() {
|
||||
@ -182,9 +182,9 @@ snippet props
|
||||
);
|
||||
# Define single property
|
||||
snippet prop
|
||||
Object.defineProperty(
|
||||
Object.defineProperty(
|
||||
${1:object},
|
||||
"${2:property}",
|
||||
"${2:property}",
|
||||
{
|
||||
get : function $1_$2_getter() {
|
||||
// getter code
|
||||
|
@ -1,4 +1,4 @@
|
||||
snippet ifeq
|
||||
ifeq (${1:cond0},${2:cond1})
|
||||
${3:code}
|
||||
${3}
|
||||
endif
|
||||
|
@ -22,7 +22,7 @@ snippet if if
|
||||
% if ${1:condition}:
|
||||
${2:}
|
||||
% endif
|
||||
snippet if if/else
|
||||
snippet ife if/else
|
||||
% if ${1:condition}:
|
||||
${2:}
|
||||
% else:
|
||||
|
@ -24,11 +24,11 @@ snippet ![:*
|
||||
|
||||
snippet ===
|
||||
`repeat('=', strlen(getline(line(".") - 1)))`
|
||||
|
||||
|
||||
${1}
|
||||
snippet ---
|
||||
`repeat('-', strlen(getline(line(".") - 1)))`
|
||||
|
||||
|
||||
${1}
|
||||
|
||||
snippet blockquote
|
||||
|
@ -3,7 +3,7 @@ snippet Imp
|
||||
#import <${1:Cocoa/Cocoa.h}>${2}
|
||||
# #import "..."
|
||||
snippet imp
|
||||
#import "${1:`Filename()`.h}"${2}
|
||||
#import "${1:`vim_snippets#Filename()`.h}"${2}
|
||||
# @selector(...)
|
||||
snippet sel
|
||||
@selector(${1:method}:)${3}
|
||||
@ -18,7 +18,7 @@ snippet log
|
||||
NSLog(@"${1:%@}"${2});${3}
|
||||
# Class
|
||||
snippet objc
|
||||
@interface ${1:`Filename('', 'someClass')`} : ${2:NSObject}
|
||||
@interface ${1:`vim_snippets#Filename('', 'someClass')`} : ${2:NSObject}
|
||||
{
|
||||
}
|
||||
@end
|
||||
@ -28,33 +28,33 @@ snippet objc
|
||||
@end
|
||||
# Class Interface
|
||||
snippet int
|
||||
@interface ${1:`Filename('', 'someClass')`} : ${2:NSObject}
|
||||
@interface ${1:`vim_snippets#Filename('', 'someClass')`} : ${2:NSObject}
|
||||
{${3}
|
||||
}
|
||||
${4}
|
||||
@end
|
||||
snippet @interface
|
||||
@interface ${1:`Filename('', 'someClass')`} : ${2:NSObject}
|
||||
@interface ${1:`vim_snippets#Filename('', 'someClass')`} : ${2:NSObject}
|
||||
{${3}
|
||||
}
|
||||
${4}
|
||||
@end
|
||||
# Class Implementation
|
||||
snippet impl
|
||||
@implementation ${1:`Filename('', 'someClass')`}
|
||||
@implementation ${1:`vim_snippets#Filename('', 'someClass')`}
|
||||
${2}
|
||||
@end
|
||||
snippet @implementation
|
||||
@implementation ${1:`Filename('', 'someClass')`}
|
||||
@implementation ${1:`vim_snippets#Filename('', 'someClass')`}
|
||||
${2}
|
||||
@end
|
||||
# Protocol
|
||||
snippet pro
|
||||
@protocol ${1:`Filename('$1Delegate', 'MyProtocol')`} ${2:<NSObject>}
|
||||
@protocol ${1:`vim_snippets#Filename('$1Delegate', 'MyProtocol')`} ${2:<NSObject>}
|
||||
${3}
|
||||
@end
|
||||
snippet @protocol
|
||||
@protocol ${1:`Filename('$1Delegate', 'MyProtocol')`} ${2:<NSObject>}
|
||||
@protocol ${1:`vim_snippets#Filename('$1Delegate', 'MyProtocol')`} ${2:<NSObject>}
|
||||
${3}
|
||||
@end
|
||||
# init Definition
|
||||
@ -87,7 +87,7 @@ snippet cat
|
||||
@end
|
||||
# Category Interface
|
||||
snippet cath
|
||||
@interface ${1:`Filename('$1', 'NSObject')`} (${2:MyCategory})
|
||||
@interface ${1:`vim_snippets#Filename('$1', 'NSObject')`} (${2:MyCategory})
|
||||
${3}
|
||||
@end
|
||||
# Method
|
||||
@ -207,7 +207,7 @@ snippet arel
|
||||
# autorelease pool
|
||||
snippet pool
|
||||
NSAutoreleasePool *${1:pool} = [[NSAutoreleasePool alloc] init];
|
||||
${2:/* code */}
|
||||
${2}
|
||||
[$1 drain];
|
||||
# Throw an exception
|
||||
snippet except
|
||||
|
@ -8,31 +8,35 @@ snippet .
|
||||
# Function
|
||||
snippet sub
|
||||
sub ${1:function_name} {
|
||||
${2:#body ...}
|
||||
${2}
|
||||
}
|
||||
# Conditional
|
||||
snippet if
|
||||
if (${1}) {
|
||||
${2:# body...}
|
||||
${2}
|
||||
}
|
||||
# Conditional if..else
|
||||
snippet ife
|
||||
if (${1}) {
|
||||
${2:# body...}
|
||||
${2}
|
||||
}
|
||||
else {
|
||||
${3:# else...}
|
||||
${3}
|
||||
}
|
||||
# Conditional if..elsif..else
|
||||
snippet ifee
|
||||
if (${1}) {
|
||||
${2:# body...}
|
||||
${2}
|
||||
}
|
||||
elsif (${3}) {
|
||||
${4:# elsif...}
|
||||
}
|
||||
else {
|
||||
${5:# else...}
|
||||
${5}
|
||||
}
|
||||
snippet eif
|
||||
elsif (${1}) {
|
||||
${2}
|
||||
}
|
||||
# Conditional One-line
|
||||
snippet xif
|
||||
@ -40,7 +44,7 @@ snippet xif
|
||||
# Unless conditional
|
||||
snippet unless
|
||||
unless (${1}) {
|
||||
${2:# body...}
|
||||
${2}
|
||||
}
|
||||
# Unless conditional One-line
|
||||
snippet xunless
|
||||
@ -57,7 +61,7 @@ snippet eval
|
||||
# While Loop
|
||||
snippet wh
|
||||
while (${1}) {
|
||||
${2:# body...}
|
||||
${2}
|
||||
}
|
||||
# While Loop One-line
|
||||
snippet xwh
|
||||
@ -65,7 +69,7 @@ snippet xwh
|
||||
# C-style For Loop
|
||||
snippet cfor
|
||||
for (my $${2:var} = 0; $$2 < ${1:count}; $$2${3:++}) {
|
||||
${4:# body...}
|
||||
${4}
|
||||
}
|
||||
# For loop one-line
|
||||
snippet xfor
|
||||
@ -73,14 +77,14 @@ snippet xfor
|
||||
# Foreach Loop
|
||||
snippet for
|
||||
foreach my $${1:x} (@${2:array}) {
|
||||
${3:# body...}
|
||||
${3}
|
||||
}
|
||||
# Foreach Loop One-line
|
||||
snippet fore
|
||||
${1:expression} foreach @${2:array};${3}
|
||||
# Package
|
||||
snippet package
|
||||
package ${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`};
|
||||
package ${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`};
|
||||
|
||||
${2}
|
||||
|
||||
@ -89,7 +93,7 @@ snippet package
|
||||
__END__
|
||||
# Package syntax perl >= 5.14
|
||||
snippet packagev514
|
||||
package ${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`} ${2:0.99};
|
||||
package ${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`} ${2:0.99};
|
||||
|
||||
${3}
|
||||
|
||||
@ -127,7 +131,7 @@ snippet switch
|
||||
# Anonymous subroutine
|
||||
snippet asub
|
||||
sub {
|
||||
${1:# body }
|
||||
${1}
|
||||
}
|
||||
|
||||
|
||||
@ -135,7 +139,7 @@ snippet asub
|
||||
# Begin block
|
||||
snippet begin
|
||||
BEGIN {
|
||||
${1:# begin body}
|
||||
${1}
|
||||
}
|
||||
|
||||
# call package function with some parameter
|
||||
@ -174,7 +178,7 @@ snippet given
|
||||
# switch-like case
|
||||
snippet when
|
||||
when (${1:case}) {
|
||||
${2:# body}
|
||||
${2}
|
||||
}
|
||||
|
||||
# hash slice
|
||||
@ -237,7 +241,7 @@ snippet subpod
|
||||
=cut
|
||||
|
||||
sub ${1:subroutine_name} {
|
||||
${2:# body...}
|
||||
${2}
|
||||
}
|
||||
# Subroutine signature
|
||||
snippet parg
|
||||
@ -318,7 +322,7 @@ snippet trunner
|
||||
snippet tsub
|
||||
sub t${1:number}_${2:test_case} :Test(${3:num_of_tests}) {
|
||||
my $self = shift;
|
||||
${4:# body}
|
||||
${4}
|
||||
|
||||
}
|
||||
|
||||
@ -326,14 +330,14 @@ snippet tsub
|
||||
snippet trsub
|
||||
test ${1:test_name} => { description => '${2:Description of test.}'} => sub {
|
||||
my ($self) = @_;
|
||||
${3:# test code}
|
||||
${3}
|
||||
};
|
||||
|
||||
#prep test method
|
||||
snippet tprep
|
||||
sub prep${1:number}_${2:test_case} :Test(startup) {
|
||||
my $self = shift;
|
||||
${4:# body}
|
||||
${4}
|
||||
}
|
||||
|
||||
# cause failures to print stack trace
|
||||
|
@ -28,12 +28,12 @@ snippet use
|
||||
use ${1:Foo\Bar\Baz};
|
||||
${2}
|
||||
snippet c
|
||||
class ${1:`Filename()`}
|
||||
class ${1:`vim_snippets#Filename()`}
|
||||
{
|
||||
${2}
|
||||
}
|
||||
snippet i
|
||||
interface ${1:`Filename()`}
|
||||
interface ${1:`vim_snippets#Filename()`}
|
||||
{
|
||||
${2}
|
||||
}
|
||||
@ -57,7 +57,7 @@ snippet sm
|
||||
*
|
||||
* @param ${2:$1} $$1 ${3:description}
|
||||
*
|
||||
* @return ${4:`Filename()`}
|
||||
* @return ${4:`vim_snippets#Filename()`}
|
||||
*/
|
||||
${5:public} function set${6:$2}(${7:$2 }$$1)
|
||||
{
|
||||
@ -214,7 +214,7 @@ snippet interface
|
||||
* @package ${3:default}
|
||||
* @author ${4:`g:snips_author`}
|
||||
*/
|
||||
interface ${1:`Filename()`}
|
||||
interface ${1:`vim_snippets#Filename()`}
|
||||
{
|
||||
${5}
|
||||
}
|
||||
@ -223,7 +223,7 @@ snippet class
|
||||
/**
|
||||
* ${1}
|
||||
*/
|
||||
class ${2:`Filename()`}
|
||||
class ${2:`vim_snippets#Filename()`}
|
||||
{
|
||||
${3}
|
||||
/**
|
||||
@ -231,13 +231,13 @@ snippet class
|
||||
*/
|
||||
${5:public} function ${6:__construct}(${7:argument})
|
||||
{
|
||||
${8:// code...}
|
||||
${8}
|
||||
}
|
||||
}
|
||||
snippet nc
|
||||
namespace ${1:`substitute(substitute(expand("%:h"), '\v^\w+\/(\u)', '\1', ''), '\/', '\\\', 'g')`};
|
||||
|
||||
${2:abstract }class ${3:`Filename()`}
|
||||
${2:abstract }class ${3:`vim_snippets#Filename()`}
|
||||
{
|
||||
${4}
|
||||
}
|
||||
@ -249,26 +249,26 @@ snippet def?
|
||||
${1}defined('${2}')${3}
|
||||
snippet wh
|
||||
while (${1:/* condition */}) {
|
||||
${2:// code...}
|
||||
${2}
|
||||
}
|
||||
# do ... while
|
||||
snippet do
|
||||
do {
|
||||
${2:// code... }
|
||||
${2}
|
||||
} while (${1:/* condition */});
|
||||
snippet if
|
||||
if (${1:/* condition */}) {
|
||||
${2:// code...}
|
||||
${2}
|
||||
}
|
||||
snippet ifil
|
||||
<?php if (${1:/* condition */}): ?>
|
||||
${2:<!-- code... -->}
|
||||
${2}
|
||||
<?php endif; ?>
|
||||
snippet ife
|
||||
if (${1:/* condition */}) {
|
||||
${2:// code...}
|
||||
${2}
|
||||
} else {
|
||||
${3:// code...}
|
||||
${3}
|
||||
}
|
||||
${4}
|
||||
snippet ifeil
|
||||
@ -278,35 +278,35 @@ snippet ifeil
|
||||
${3:<!-- html... -->}
|
||||
<?php endif; ?>
|
||||
${4}
|
||||
snippet else
|
||||
snippet el
|
||||
else {
|
||||
${1:// code...}
|
||||
${1}
|
||||
}
|
||||
snippet elseif
|
||||
snippet eif
|
||||
elseif (${1:/* condition */}) {
|
||||
${2:// code...}
|
||||
${2}
|
||||
}
|
||||
snippet switch
|
||||
switch ($${1:variable}) {
|
||||
case '${2:value}':
|
||||
${3:// code...}
|
||||
${3}
|
||||
break;
|
||||
${5}
|
||||
default:
|
||||
${4:// code...}
|
||||
${4}
|
||||
break;
|
||||
}
|
||||
snippet case
|
||||
case '${1:value}':
|
||||
${2:// code...}
|
||||
${2}
|
||||
break;${3}
|
||||
snippet for
|
||||
for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) {
|
||||
${4: // code...}
|
||||
${4}
|
||||
}
|
||||
snippet foreach
|
||||
foreach ($${1:variable} as $${2:value}) {
|
||||
${3:// code...}
|
||||
${3}
|
||||
}
|
||||
snippet foreachil
|
||||
<?php foreach ($${1:variable} as $${2:value}): ?>
|
||||
@ -314,7 +314,7 @@ snippet foreachil
|
||||
<?php endforeach; ?>
|
||||
snippet foreachk
|
||||
foreach ($${1:variable} as $${2:key} => $${3:value}) {
|
||||
${4:// code...}
|
||||
${4}
|
||||
}
|
||||
snippet foreachkil
|
||||
<?php foreach ($${1:variable} as $${2:key} => $${3:value}): ?>
|
||||
@ -343,6 +343,8 @@ snippet vd
|
||||
var_dump(${1});
|
||||
snippet vdd
|
||||
var_dump(${1}); die(${2:});
|
||||
snippet vdf
|
||||
error_log(print_r($${1:foo}, true), 3, '${2:/tmp/debug.log}');${3}
|
||||
snippet http_redirect
|
||||
header ("HTTP/1.1 301 Moved Permanently");
|
||||
header ("Location: ".URL);
|
||||
@ -364,7 +366,7 @@ snippet gs
|
||||
*
|
||||
* @param $2 $$1 ${5:description}
|
||||
*
|
||||
* @return ${6:`Filename()`}
|
||||
* @return ${6:`vim_snippets#Filename()`}
|
||||
*/
|
||||
public function set$3(${7:$2 }$$1)
|
||||
{
|
||||
|
@ -65,7 +65,7 @@ snippet for
|
||||
#loop while
|
||||
snippet while
|
||||
while (${1:/* condition */}) {
|
||||
${2:/* code */}
|
||||
${2}
|
||||
}
|
||||
#break
|
||||
snippet break
|
||||
@ -84,11 +84,11 @@ snippet default
|
||||
snippet switch
|
||||
switch(${1:expression}) {
|
||||
case '${3:case}':
|
||||
${4:// code}
|
||||
${4}
|
||||
break;
|
||||
${5}
|
||||
default:
|
||||
${2:// code}
|
||||
${2}
|
||||
}
|
||||
#try
|
||||
snippet try
|
||||
|
@ -55,4 +55,4 @@ snippet log
|
||||
snippet dec
|
||||
DECIMAL
|
||||
snippet sep
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
@ -1,15 +1,15 @@
|
||||
# Snippets for use with VIM and http://www.vim.org/scripts/script.php?script_id=2540
|
||||
#
|
||||
# Please contact R.I.Pienaar <rip@devco.net> for additions and feedback,
|
||||
# Please contact R.I.Pienaar <rip@devco.net> for additions and feedback,
|
||||
# see it in action @ http://www.devco.net/archives/2009/09/22/vim_and_puppet.php
|
||||
|
||||
# Language Constructs
|
||||
snippet class
|
||||
class ${1:`Filename('', 'name')`} {
|
||||
class ${1:`vim_snippets#Filename('', 'name')`} {
|
||||
${2}
|
||||
}
|
||||
snippet node
|
||||
node "${1:`Filename('', 'fqdn')`}" {
|
||||
node "${1:`vim_snippets#Filename('', 'fqdn')`}" {
|
||||
${2}
|
||||
}
|
||||
snippet case
|
||||
@ -25,8 +25,8 @@ snippet ife
|
||||
snippet if
|
||||
if $${1:variable} {
|
||||
${2}
|
||||
}
|
||||
snippet else
|
||||
}
|
||||
snippet el
|
||||
else {
|
||||
${1}
|
||||
}
|
||||
@ -34,7 +34,7 @@ snippet ?
|
||||
? {
|
||||
'${1}' => ${2}
|
||||
}
|
||||
#
|
||||
#
|
||||
# blocks etc and general syntax sugar
|
||||
snippet [
|
||||
[ ${1} ]${2}
|
||||
@ -54,7 +54,7 @@ snippet defined
|
||||
defined(${1:Resource}["${2:name}"])${3}
|
||||
snippet emerg
|
||||
emerg("${1:message}")${2}
|
||||
snippet extlookup Simple extlookup
|
||||
snippet extlookup Simple extlookup
|
||||
extlookup("${1:variable}")${2}
|
||||
snippet extlookup Extlookup with defaults
|
||||
extlookup("${1:variable}", "${2:default}")${3}
|
||||
|
@ -2,29 +2,33 @@ snippet #!
|
||||
#!/usr/bin/env python
|
||||
snippet imp
|
||||
import ${1:module}
|
||||
snippet uni
|
||||
def __unicode__(self):
|
||||
${1:representation}
|
||||
snippet from
|
||||
from ${1:package} import ${2:module}
|
||||
# Module Docstring
|
||||
snippet docs
|
||||
"""
|
||||
File: ${1:`Filename('$1.py', 'foo.py')`}
|
||||
File: ${1:`vim_snippets#Filename('$1.py', 'foo.py')`}
|
||||
Author: `g:snips_author`
|
||||
Email: `g:snips_email`
|
||||
Github: `g:snips_github`
|
||||
Description: ${2}
|
||||
"""
|
||||
|
||||
snippet wh
|
||||
while ${1:condition}:
|
||||
${2:# TODO: write code...}
|
||||
${2}
|
||||
# dowh - does the same as do...while in other languages
|
||||
snippet dowh
|
||||
while True:
|
||||
${1:# TODO: write code...}
|
||||
${1}
|
||||
if ${2:condition}:
|
||||
break
|
||||
snippet with
|
||||
with ${1:expr} as ${2:var}:
|
||||
${3:# TODO: write code...}
|
||||
${3}
|
||||
# New Class
|
||||
snippet cl
|
||||
class ${1:ClassName}(${2:object}):
|
||||
@ -37,14 +41,14 @@ snippet cl
|
||||
snippet def
|
||||
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
|
||||
"""${3:docstring for $1}"""
|
||||
${4:# TODO: write code...}
|
||||
${4}
|
||||
snippet deff
|
||||
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
|
||||
${3:# TODO: write code...}
|
||||
${3}
|
||||
# New Method
|
||||
snippet defs
|
||||
def ${1:mname}(self, ${2:arg}):
|
||||
${3:# TODO: write code...}
|
||||
${3}
|
||||
# New Property
|
||||
snippet property
|
||||
def ${1:foo}():
|
||||
@ -60,17 +64,17 @@ snippet property
|
||||
# Ifs
|
||||
snippet if
|
||||
if ${1:condition}:
|
||||
${2:# TODO: write code...}
|
||||
${2}
|
||||
snippet el
|
||||
else:
|
||||
${1:# TODO: write code...}
|
||||
${1}
|
||||
snippet ei
|
||||
elif ${1:condition}:
|
||||
${2:# TODO: write code...}
|
||||
${2}
|
||||
# For
|
||||
snippet for
|
||||
for ${1:item} in ${2:items}:
|
||||
${3:# TODO: write code...}
|
||||
${3}
|
||||
# Encodes
|
||||
snippet cutf8
|
||||
# -*- coding: utf-8 -*-
|
||||
@ -79,38 +83,38 @@ snippet clatin1
|
||||
snippet cascii
|
||||
# -*- coding: ascii -*-
|
||||
# Lambda
|
||||
snippet lda
|
||||
snippet ld
|
||||
${1:var} = lambda ${2:vars} : ${3:action}
|
||||
snippet .
|
||||
self.
|
||||
snippet try Try/Except
|
||||
try:
|
||||
${1:# TODO: write code...}
|
||||
${1}
|
||||
except ${2:Exception}, ${3:e}:
|
||||
${4:raise $3}
|
||||
snippet try Try/Except/Else
|
||||
try:
|
||||
${1:# TODO: write code...}
|
||||
${1}
|
||||
except ${2:Exception}, ${3:e}:
|
||||
${4:raise $3}
|
||||
else:
|
||||
${5:# TODO: write code...}
|
||||
${5}
|
||||
snippet try Try/Except/Finally
|
||||
try:
|
||||
${1:# TODO: write code...}
|
||||
${1}
|
||||
except ${2:Exception}, ${3:e}:
|
||||
${4:raise $3}
|
||||
finally:
|
||||
${5:# TODO: write code...}
|
||||
${5}
|
||||
snippet try Try/Except/Else/Finally
|
||||
try:
|
||||
${1:# TODO: write code...}
|
||||
${1}
|
||||
except ${2:Exception}, ${3:e}:
|
||||
${4:raise $3}
|
||||
else:
|
||||
${5:# TODO: write code...}
|
||||
${5}
|
||||
finally:
|
||||
${6:# TODO: write code...}
|
||||
${6}
|
||||
# if __name__ == '__main__':
|
||||
snippet ifmain
|
||||
if __name__ == '__main__':
|
||||
@ -127,6 +131,9 @@ snippet ipdb
|
||||
# ipython debugger (pdbbb)
|
||||
snippet pdbbb
|
||||
import pdbpp; pdbpp.set_trace()
|
||||
# python console debugger (pudb)
|
||||
snippet pudb
|
||||
import pudb; pudb.set_trace()
|
||||
snippet pprint
|
||||
import pprint; pprint.pprint(${1})${2}
|
||||
snippet "
|
||||
@ -136,13 +143,13 @@ snippet "
|
||||
# test function/method
|
||||
snippet test
|
||||
def test_${1:description}(${2:`indent('.') ? 'self' : ''`}):
|
||||
${3:# TODO: write code...}
|
||||
${3}
|
||||
# test case
|
||||
snippet testcase
|
||||
class ${1:ExampleCase}(unittest.TestCase):
|
||||
|
||||
|
||||
def test_${2:description}(self):
|
||||
${3:# TODO: write code...}
|
||||
${3}
|
||||
snippet fut
|
||||
from __future__ import ${1}
|
||||
#getopt
|
||||
@ -151,7 +158,7 @@ snippet getopt
|
||||
# Short option syntax: "hv:"
|
||||
# Long option syntax: "help" or "verbose="
|
||||
opts, args = getopt.getopt(sys.argv[1:], "${1:short_options}", [${2:long_options}])
|
||||
|
||||
|
||||
except getopt.GetoptError, err:
|
||||
# Print debug info
|
||||
print str(err)
|
||||
@ -169,7 +176,8 @@ snippet glog
|
||||
logger = logging.getLogger(${1:__name__})
|
||||
snippet le
|
||||
logger.error(${1:msg})
|
||||
snippet ld
|
||||
# conflict with lambda=ld, therefor we change into Logger.debuG
|
||||
snippet lg
|
||||
logger.debug(${1:msg})
|
||||
snippet lw
|
||||
logger.warning(${1:msg})
|
||||
|
@ -12,24 +12,24 @@ snippet source
|
||||
# conditionals
|
||||
snippet if
|
||||
if (${1:condition}) {
|
||||
${2:code}
|
||||
${2}
|
||||
}
|
||||
snippet el
|
||||
else {
|
||||
${1:code}
|
||||
${1}
|
||||
}
|
||||
snippet ei
|
||||
else if (${1:condition}) {
|
||||
${2:code}
|
||||
${2}
|
||||
}
|
||||
|
||||
# functions
|
||||
snippet fun
|
||||
${1:name} = function (${2:variables}) {
|
||||
${3:code}
|
||||
${3}
|
||||
}
|
||||
snippet ret
|
||||
return(${1:code})
|
||||
return(${1})
|
||||
|
||||
# dataframes, lists, etc
|
||||
snippet df
|
||||
@ -117,5 +117,5 @@ snippet cor
|
||||
cor.test(${1:x}, ${2:y})
|
||||
snippet fte
|
||||
var.test(${1:x}, ${2:y})
|
||||
snippet kvt
|
||||
snippet kvt
|
||||
kv.test(${1:x}, ${2:y})
|
||||
|
@ -3,9 +3,9 @@
|
||||
snippet :
|
||||
:${1:field name}: ${2:field body}
|
||||
snippet *
|
||||
*${1:Emphasis}*
|
||||
*${1:Emphasis}* ${2}
|
||||
snippet **
|
||||
**${1:Strong emphasis}**
|
||||
**${1:Strong emphasis}** ${2}
|
||||
snippet _
|
||||
\`${1:hyperlink-name}\`_
|
||||
.. _\`$1\`: ${2:link-block}
|
||||
@ -17,6 +17,53 @@ snippet -
|
||||
${1:Title}
|
||||
-----${2:-}
|
||||
${3}
|
||||
#some directive
|
||||
snippet img:
|
||||
.. |${2:alias}| image:: ${1:img}
|
||||
snippet fig:
|
||||
.. figure:: ${1:img}
|
||||
:alt: ${2:alter text}
|
||||
|
||||
$2
|
||||
snippet cont:
|
||||
.. contents::
|
||||
|
||||
${1:content}
|
||||
snippet code:
|
||||
.. code:: ${1:type}
|
||||
|
||||
${2:write some code}
|
||||
snippet tip:
|
||||
.. tip::
|
||||
${1:my tips}
|
||||
snippet not:
|
||||
.. note::
|
||||
${1:my notes}
|
||||
snippet war:
|
||||
.. warning::
|
||||
${1:attention!}
|
||||
snippet imp:
|
||||
.. important::
|
||||
${1:this is importatnt}
|
||||
snippet att:
|
||||
.. attention::
|
||||
${1:hey!}
|
||||
snippet dan:
|
||||
.. danger::
|
||||
${1:ah!}
|
||||
snippet err:
|
||||
.. error::
|
||||
${1:Error occur}
|
||||
snippet cau:
|
||||
.. caution::
|
||||
${1:Watch out!}
|
||||
#Spinx only
|
||||
snippet sid:
|
||||
.. sidebar:: ${1:Title}
|
||||
|
||||
${2}
|
||||
# CJK optimize, CJK has no space between charaters
|
||||
snippet *c
|
||||
\ *${1:Emphasis}*\ ${2}
|
||||
snippet **c
|
||||
\ **${1:Strong emphasis}**\ ${2}
|
||||
|
||||
|
@ -16,6 +16,14 @@ snippet =b
|
||||
=begin rdoc
|
||||
${1}
|
||||
=end
|
||||
snippet prot
|
||||
protected
|
||||
|
||||
${1}
|
||||
snippet priv
|
||||
private
|
||||
|
||||
${1}
|
||||
snippet y
|
||||
:yields: ${1:arguments}
|
||||
snippet rb
|
||||
@ -60,7 +68,7 @@ snippet ife
|
||||
else
|
||||
${3}
|
||||
end
|
||||
snippet elsif
|
||||
snippet eif
|
||||
elsif ${1:condition}
|
||||
${2}
|
||||
snippet unless
|
||||
@ -80,23 +88,23 @@ snippet until
|
||||
${2}
|
||||
end
|
||||
snippet cla class .. end
|
||||
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
||||
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
||||
${2}
|
||||
end
|
||||
snippet cla class .. initialize .. end
|
||||
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
||||
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
||||
def initialize(${2:args})
|
||||
${3}
|
||||
end
|
||||
end
|
||||
snippet cla class .. < ParentClass .. initialize .. end
|
||||
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} < ${2:ParentClass}
|
||||
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} < ${2:ParentClass}
|
||||
def initialize(${3:args})
|
||||
${4}
|
||||
end
|
||||
end
|
||||
snippet cla ClassName = Struct .. do .. end
|
||||
${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} = Struct.new(:${2:attr_names}) do
|
||||
${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} = Struct.new(:${2:attr_names}) do
|
||||
def ${3:method_name}
|
||||
${4}
|
||||
end
|
||||
@ -111,7 +119,7 @@ snippet cla class << self .. end
|
||||
end
|
||||
# class .. < DelegateClass .. initialize .. end
|
||||
snippet cla-
|
||||
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} < DelegateClass(${2:ParentClass})
|
||||
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} < DelegateClass(${2:ParentClass})
|
||||
def initialize(${3:args})
|
||||
super(${4:del_obj})
|
||||
|
||||
@ -119,17 +127,17 @@ snippet cla-
|
||||
end
|
||||
end
|
||||
snippet mod module .. end
|
||||
module ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
||||
module ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
||||
${2}
|
||||
end
|
||||
snippet mod module .. module_function .. end
|
||||
module ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
||||
module ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
||||
module_function
|
||||
|
||||
${2}
|
||||
end
|
||||
snippet mod module .. ClassMethods .. end
|
||||
module ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
||||
module ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
||||
module ClassMethods
|
||||
${2}
|
||||
end
|
||||
@ -156,6 +164,11 @@ snippet atp
|
||||
attr_protected :${1:attr_names}
|
||||
snippet ata
|
||||
attr_accessible :${1:attr_names}
|
||||
snippet ana
|
||||
accepts_nested_attributes_for :${1:association}
|
||||
# ivc == instance variable cache
|
||||
snippet ivc
|
||||
@${1:variable_name} ||= ${2:chached_value}
|
||||
# include Enumerable
|
||||
snippet Enum
|
||||
include Enumerable
|
||||
@ -178,6 +191,11 @@ snippet defs
|
||||
def self.${1:class_method_name}
|
||||
${2}
|
||||
end
|
||||
# def initialize
|
||||
snippet definit
|
||||
def initialize(${1:args})
|
||||
${2}
|
||||
end
|
||||
# def method_missing
|
||||
snippet defmm
|
||||
def method_missing(meth, *args, &blk)
|
||||
@ -309,6 +327,12 @@ snippet injd
|
||||
inject(${1:init}) do |${2:mem}, ${3:var}|
|
||||
${4}
|
||||
end
|
||||
snippet red
|
||||
reduce(${1:init}) { |${2:mem}, ${3:var}| ${4} }
|
||||
snippet redd
|
||||
reduce(${1:init}) do |${2:mem}, ${3:var}|
|
||||
${4}
|
||||
end
|
||||
snippet map
|
||||
map { |${1:e}| ${2} }
|
||||
snippet mapd
|
||||
@ -389,13 +413,17 @@ snippet seld
|
||||
end
|
||||
snippet lam
|
||||
lambda { |${1:args}| ${2} }
|
||||
snippet doo
|
||||
# I'm pretty sure that ruby users expect do to expand to do .. end
|
||||
snippet do
|
||||
do
|
||||
${1}
|
||||
end
|
||||
# this is for one or more variables. typing a ", " is that cheap that it may
|
||||
# not be worth adding another snippet. should 0/1 placeholders change order?
|
||||
# its a good idea to think about the var name, so use it first
|
||||
snippet dov
|
||||
do |${1:variable}|
|
||||
${2}
|
||||
do |${0:v}|
|
||||
${1}
|
||||
end
|
||||
snippet :
|
||||
:${1:key} => ${2:"value"}${3}
|
||||
@ -529,7 +557,7 @@ snippet clafn
|
||||
snippet sinc
|
||||
class << self; self end
|
||||
snippet nam
|
||||
namespace :${1:`Filename()`} do
|
||||
namespace :${1:`vim_snippets#Filename()`} do
|
||||
${2}
|
||||
end
|
||||
snippet tas
|
||||
@ -572,8 +600,8 @@ snippet artp
|
||||
snippet artpp
|
||||
assert_redirected_to ${1:model}s_path
|
||||
snippet asd
|
||||
assert_difference "${1:Model}.${2:count}", $1 do
|
||||
${3}
|
||||
assert_difference "${1:Model}.${2:count}", ${3:1} do
|
||||
${4}
|
||||
end
|
||||
snippet asnd
|
||||
assert_no_difference "${1:Model}.${2:count}" do
|
||||
@ -597,14 +625,14 @@ snippet defcreate
|
||||
def create
|
||||
@${1:model_class_name} = ${2:ModelClassName}.new(params[:$1])
|
||||
|
||||
respond_to do |wants|
|
||||
respond_to do |format|
|
||||
if @$1.save
|
||||
flash[:notice] = '$2 was successfully created.'
|
||||
wants.html { redirect_to(@$1) }
|
||||
wants.xml { render :xml => @$1, :status => :created, :location => @$1 }
|
||||
format.html { redirect_to(@$1) }
|
||||
format.xml { render :xml => @$1, :status => :created, :location => @$1 }
|
||||
else
|
||||
wants.html { render :action => "new" }
|
||||
wants.xml { render :xml => @$1.errors, :status => :unprocessable_entity }
|
||||
format.html { render :action => "new" }
|
||||
format.xml { render :xml => @$1.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end${3}
|
||||
@ -613,9 +641,9 @@ snippet defdestroy
|
||||
@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])
|
||||
@$1.destroy
|
||||
|
||||
respond_to do |wants|
|
||||
wants.html { redirect_to($1s_url) }
|
||||
wants.xml { head :ok }
|
||||
respond_to do |format|
|
||||
format.html { redirect_to($1s_url) }
|
||||
format.xml { head :ok }
|
||||
end
|
||||
end${3}
|
||||
snippet defedit
|
||||
@ -626,41 +654,41 @@ snippet defindex
|
||||
def index
|
||||
@${1:model_class_name} = ${2:ModelClassName}.all
|
||||
|
||||
respond_to do |wants|
|
||||
wants.html # index.html.erb
|
||||
wants.xml { render :xml => @$1s }
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.xml { render :xml => @$1s }
|
||||
end
|
||||
end${3}
|
||||
snippet defnew
|
||||
def new
|
||||
@${1:model_class_name} = ${2:ModelClassName}.new
|
||||
|
||||
respond_to do |wants|
|
||||
wants.html # new.html.erb
|
||||
wants.xml { render :xml => @$1 }
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.xml { render :xml => @$1 }
|
||||
end
|
||||
end${3}
|
||||
snippet defshow
|
||||
def show
|
||||
@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])
|
||||
|
||||
respond_to do |wants|
|
||||
wants.html # show.html.erb
|
||||
wants.xml { render :xml => @$1 }
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.xml { render :xml => @$1 }
|
||||
end
|
||||
end${3}
|
||||
snippet defupdate
|
||||
def update
|
||||
@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])
|
||||
|
||||
respond_to do |wants|
|
||||
respond_to do |format|
|
||||
if @$1.update_attributes(params[:$1])
|
||||
flash[:notice] = '$2 was successfully updated.'
|
||||
wants.html { redirect_to(@$1) }
|
||||
wants.xml { head :ok }
|
||||
format.html { redirect_to(@$1) }
|
||||
format.xml { head :ok }
|
||||
else
|
||||
wants.html { render :action => "edit" }
|
||||
wants.xml { render :xml => @$1.errors, :status => :unprocessable_entity }
|
||||
format.html { render :action => "edit" }
|
||||
format.xml { render :xml => @$1.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end${3}
|
||||
@ -733,8 +761,8 @@ snippet ra
|
||||
snippet ral
|
||||
render :action => "${1:action}", :layout => "${2:layoutname}"
|
||||
snippet rest
|
||||
respond_to do |wants|
|
||||
wants.${1:html} { ${2} }
|
||||
respond_to do |format|
|
||||
format.${1:html} { ${2} }
|
||||
end
|
||||
snippet rf
|
||||
render :file => "${1:filepath}"
|
||||
@ -779,7 +807,7 @@ snippet ru
|
||||
snippet rxml
|
||||
render :xml => ${1:text to render}
|
||||
snippet sc
|
||||
scope :${1:name}, :where(:@${2:field} => ${3:value})
|
||||
scope :${1:name}, -> { where(${2:field}: ${3:value}) }
|
||||
snippet sl
|
||||
scope :${1:name}, lambda do |${2:value}|
|
||||
where("${3:field = ?}", ${4:bind var})
|
||||
@ -802,6 +830,85 @@ snippet sweeper
|
||||
expire_page
|
||||
end
|
||||
end
|
||||
snippet va validates_associated
|
||||
validates_associated :${1:attribute}
|
||||
snippet va validates .., :acceptance => true
|
||||
validates :${1:terms}, :acceptance => true
|
||||
snippet vc
|
||||
validates :${1:attribute}, :confirmation => true
|
||||
snippet ve
|
||||
validates :${1:attribute}, :exclusion => { :in => ${2:%w( mov avi )} }
|
||||
snippet vf
|
||||
validates :${1:attribute}, :format => { :with => /${2:regex}/ }
|
||||
snippet vi
|
||||
validates :${1:attribute}, :inclusion => { :in => %w(${2: mov avi }) }
|
||||
snippet vl
|
||||
validates :${1:attribute}, :length => { :in => ${2:3}..${3:20} }
|
||||
snippet vn
|
||||
validates :${1:attribute}, :numericality => true
|
||||
snippet vp
|
||||
validates :${1:attribute}, :presence => true
|
||||
snippet vu
|
||||
validates :${1:attribute}, :uniqueness => true
|
||||
snippet format
|
||||
format.${1:js|xml|html} { ${2} }
|
||||
snippet wc
|
||||
where(${1:"conditions"}${2:, bind_var})
|
||||
snippet wh
|
||||
where(${1:field} => ${2:value})
|
||||
snippet xdelete
|
||||
xhr :delete, :${1:destroy}, :id => ${2:1}${3}
|
||||
snippet xget
|
||||
xhr :get, :${1:show}, :id => ${2:1}${3}
|
||||
snippet xpost
|
||||
xhr :post, :${1:create}, :${2:object} => { ${3} }
|
||||
snippet xput
|
||||
xhr :put, :${1:update}, :id => ${2:1}, :${3:object} => { ${4} }${5}
|
||||
snippet test
|
||||
test "should ${1:do something}" do
|
||||
${2}
|
||||
end
|
||||
###########################
|
||||
# migrations snippets #
|
||||
###########################
|
||||
snippet mac
|
||||
add_column :${1:table_name}, :${2:column_name}, :${3:data_type}
|
||||
snippet mai
|
||||
add_index :${1:table_name}, :${2:column_name}
|
||||
snippet mrc
|
||||
remove_column :${1:table_name}, :${2:column_name}
|
||||
snippet mrnc
|
||||
rename_column :${1:table_name}, :${2:old_column_name}, :${3:new_column_name}
|
||||
snippet mcc
|
||||
change_column :${1:table}, :${2:column}, :${3:type}
|
||||
snippet mnc
|
||||
t.${1:string} :${2:title}${3:, null: false}${4}
|
||||
snippet mct
|
||||
create_table :${1:table_name} do |t|
|
||||
${2}
|
||||
end
|
||||
snippet migration class .. < ActiveRecord::Migration .. def up .. def down .. end
|
||||
class ${1:class_name} < ActiveRecord::Migration
|
||||
def up
|
||||
${2}
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
||||
snippet migration class .. < ActiveRecord::Migration .. def change .. end
|
||||
class ${1:class_name} < ActiveRecord::Migration
|
||||
def change
|
||||
${2}
|
||||
end
|
||||
end
|
||||
snippet trc
|
||||
t.remove :${1:column}
|
||||
snippet tre
|
||||
t.rename :${1:old_column_name}, :${2:new_column_name}
|
||||
${3}
|
||||
snippet tref
|
||||
t.references :${1:model}
|
||||
snippet tcb
|
||||
t.boolean :${1:title}
|
||||
${2}
|
||||
@ -847,98 +954,17 @@ snippet tcts
|
||||
snippet tctss
|
||||
t.timestamps
|
||||
${1}
|
||||
snippet va
|
||||
validates_associated :${1:attribute}
|
||||
snippet vao
|
||||
validates_acceptance_of :${1:terms}
|
||||
snippet vc
|
||||
validates_confirmation_of :${1:attribute}
|
||||
snippet ve
|
||||
validates_exclusion_of :${1:attribute}, :in => ${2:%w( mov avi )}
|
||||
snippet vf
|
||||
validates_format_of :${1:attribute}, :with => /${2:regex}/
|
||||
snippet vi
|
||||
validates_inclusion_of :${1:attribute}, :in => %w(${2: mov avi })
|
||||
snippet vl
|
||||
validates_length_of :${1:attribute}, :within => ${2:3}..${3:20}
|
||||
snippet vn
|
||||
validates_numericality_of :${1:attribute}
|
||||
snippet vpo
|
||||
validates_presence_of :${1:attribute}
|
||||
snippet vu
|
||||
validates_uniqueness_of :${1:attribute}
|
||||
snippet wants
|
||||
wants.${1:js|xml|html} { ${2} }
|
||||
snippet wc
|
||||
where(${1:"conditions"}${2:, bind_var})
|
||||
snippet wh
|
||||
where(${1:field} => ${2:value})
|
||||
snippet xdelete
|
||||
xhr :delete, :${1:destroy}, :id => ${2:1}${3}
|
||||
snippet xget
|
||||
xhr :get, :${1:show}, :id => ${2:1}${3}
|
||||
snippet xpost
|
||||
xhr :post, :${1:create}, :${2:object} => { ${3} }
|
||||
snippet xput
|
||||
xhr :put, :${1:update}, :id => ${2:1}, :${3:object} => { ${4} }${5}
|
||||
snippet test
|
||||
test "should ${1:do something}" do
|
||||
${2}
|
||||
end
|
||||
#migrations
|
||||
snippet mac
|
||||
add_column :${1:table_name}, :${2:column_name}, :${3:data_type}
|
||||
snippet mrc
|
||||
remove_column :${1:table_name}, :${2:column_name}
|
||||
snippet mrnc
|
||||
rename_column :${1:table_name}, :${2:old_column_name}, :${3:new_column_name}
|
||||
snippet mcc
|
||||
change_column :${1:table}, :${2:column}, :${3:type}
|
||||
snippet mnc
|
||||
t.${1:string} :${2:title}${3:, null: false}${4}
|
||||
snippet mct
|
||||
create_table :${1:table_name} do |t|
|
||||
${2}
|
||||
end
|
||||
snippet migration class .. < ActiveRecord::Migration .. def up .. def down .. end
|
||||
class ${1:class_name} < ActiveRecord::Migration
|
||||
def up
|
||||
${2}
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
||||
snippet migration class .. < ActiveRecord::Migration .. def change .. end
|
||||
class ${1:class_name} < ActiveRecord::Migration
|
||||
def change
|
||||
${2}
|
||||
end
|
||||
end
|
||||
snippet trc
|
||||
t.remove :${1:column}
|
||||
snippet tre
|
||||
t.rename :${1:old_column_name}, :${2:new_column_name}
|
||||
${3}
|
||||
snippet tref
|
||||
t.references :${1:model}
|
||||
#rspec
|
||||
snippet it
|
||||
it "${1:spec_name}" do
|
||||
${2}
|
||||
end
|
||||
snippet itp
|
||||
it "${1:spec_name}"
|
||||
${2}
|
||||
snippet its
|
||||
its(:${1:method}) { should ${2} }
|
||||
snippet itsn
|
||||
its(:${1:method}) { should_not ${2} }
|
||||
|
||||
##########################
|
||||
# Rspec snippets #
|
||||
##########################
|
||||
snippet desc
|
||||
describe ${1:class_name} do
|
||||
${2}
|
||||
end
|
||||
snippet descm
|
||||
describe "${1:#method}" do
|
||||
${2:pending "Not implemented"}
|
||||
end
|
||||
snippet cont
|
||||
context "${1:message}" do
|
||||
${2}
|
||||
@ -952,22 +978,101 @@ snippet aft
|
||||
${2}
|
||||
end
|
||||
snippet let
|
||||
let(:${1:object}) ${2:block}
|
||||
let(:${1:object}) ${2}
|
||||
snippet let!
|
||||
let!(:${1:object}) ${2:block}
|
||||
let!(:${1:object}) ${2}
|
||||
snippet subj
|
||||
subject { ${1} }
|
||||
snippet s.
|
||||
subject.${1:method}
|
||||
snippet spec
|
||||
specify { subject.${1} }
|
||||
snippet exp
|
||||
expect(${1:object}).to ${2}
|
||||
snippet btr
|
||||
be_true
|
||||
snippet bfa
|
||||
be_false
|
||||
expect { ${1:object} }.to ${2}
|
||||
snippet raise
|
||||
expect { ${1:object} }.to raise_error ${2:StandardError}, /${3:message_regex}/
|
||||
snippet shared
|
||||
shared_examples "${1:shared examples name}" ${2}
|
||||
snippet itb
|
||||
it_behaves_like "${1:shared examples name}"${2}
|
||||
snippet ana
|
||||
accepts_nested_attributes_for :${1:association}
|
||||
shared_examples ${1:"shared examples name"}
|
||||
snippet ibl
|
||||
it_behaves_like ${1:"shared examples name"}
|
||||
snippet it
|
||||
it "${1:spec_name}" do
|
||||
${2}
|
||||
end
|
||||
snippet its
|
||||
its(:${1:method}) { should ${2} }
|
||||
snippet is
|
||||
it { should ${1} }
|
||||
snippet isn
|
||||
it { should_not ${1} }
|
||||
#ShouldaMatchers#ActionController
|
||||
snippet isfp
|
||||
it { should filter_param :${1:key} }
|
||||
snippet isrt
|
||||
it { should redirect_to ${1:url} }
|
||||
snippet isrtp
|
||||
it { should render_template ${1} }
|
||||
snippet isrwl
|
||||
it { should render_with_layout ${1} }
|
||||
snippet isrf
|
||||
it { should rescue_from ${1:exception} }
|
||||
snippet isrw
|
||||
it { should respond_with ${1:status} }
|
||||
snippet isr
|
||||
it { should route(:${1:method}, '${2:path}') }
|
||||
snippet isss
|
||||
it { should set_session :${1:key} }
|
||||
snippet issf
|
||||
it { should set_the_flash('${1}') }
|
||||
#ShouldaMatchers#ActiveModel
|
||||
snippet isama
|
||||
it { should allow_mass_assignment_of :${1} }
|
||||
snippet isav
|
||||
it { should allow_value(${1}).for :${2} }
|
||||
snippet isee
|
||||
it { should ensure_exclusion_of :${1} }
|
||||
snippet isei
|
||||
it { should ensure_inclusion_of :${1} }
|
||||
snippet isel
|
||||
it { should ensure_length_of :${1} }
|
||||
snippet isva
|
||||
it { should validate_acceptance_of :${1} }
|
||||
snippet isvc
|
||||
it { should validate_confirmation_of :${1} }
|
||||
snippet isvn
|
||||
it { should validate_numericality_of :${1} }
|
||||
snippet isvp
|
||||
it { should validate_presence_of :${1} }
|
||||
snippet isvu
|
||||
it { should validate_uniqueness_of :${1} }
|
||||
#ShouldaMatchers#ActiveRecord
|
||||
snippet isana
|
||||
it { should accept_nested_attributes_for :${1} }
|
||||
snippet isbt
|
||||
it { should belong_to :${1} }
|
||||
snippet isbtcc
|
||||
it { should belong_to(:${1}).counter_cache ${2:true} }
|
||||
snippet ishbtm
|
||||
it { should have_and_belong_to_many :${1} }
|
||||
snippet isbv
|
||||
it { should be_valid }${1}
|
||||
snippet ishc
|
||||
it { should have_db_column :${1} }
|
||||
snippet ishi
|
||||
it { should have_db_index :${1} }
|
||||
snippet ishm
|
||||
it { should have_many :${1} }
|
||||
snippet ishmt
|
||||
it { should have_many(:${1}).through :${2} }
|
||||
snippet isho
|
||||
it { should have_one :${1} }
|
||||
snippet ishro
|
||||
it { should have_readonly_attribute :${1} }
|
||||
snippet iss
|
||||
it { should serialize :${1} }
|
||||
snippet isres
|
||||
it { should respond_to :${1} }
|
||||
snippet isresw
|
||||
it { should respond_to(:${1}).with(${2}).arguments }
|
||||
snippet super_call
|
||||
${1:super_class}.instance_method(:${2:method}).bind(self).call
|
||||
|
@ -7,61 +7,65 @@
|
||||
#if
|
||||
snippet if
|
||||
if(${1:obj}) {
|
||||
${2:/* code */}
|
||||
${2}
|
||||
}
|
||||
#if not
|
||||
snippet ifn
|
||||
if(!${1:obj}) {
|
||||
${2:/* code */}
|
||||
${2}
|
||||
}
|
||||
#if-else
|
||||
snippet ifel
|
||||
snippet ife
|
||||
if(${1:obj}) {
|
||||
${2:/* code */}
|
||||
${2}
|
||||
} else {
|
||||
${3:/* code */}
|
||||
${3}
|
||||
}
|
||||
#if-else-if
|
||||
snippet ifelif
|
||||
if(${1:obj}) {
|
||||
${2:/* code */}
|
||||
${2}
|
||||
} else if(${3:obj}) {
|
||||
${4:/* code */}
|
||||
${4}
|
||||
}
|
||||
snippet eif
|
||||
else if(${3:obj}) {
|
||||
${4}
|
||||
}
|
||||
#while loop
|
||||
snippet while
|
||||
while (${1:obj}) {
|
||||
${2:/* code */}
|
||||
${2}
|
||||
}
|
||||
#for loop(classic)
|
||||
snippet for
|
||||
for (${1:item} <- ${2:obj}) {
|
||||
${3:/* code */}
|
||||
${3}
|
||||
}
|
||||
#for loop(indexed)
|
||||
snippet fori
|
||||
for (${1:i} <- ${2:0} to ${3:obj}.length) {
|
||||
${4:/* code */}
|
||||
${4}
|
||||
}
|
||||
#exceptions
|
||||
snippet try
|
||||
try {
|
||||
${1:/* code */}
|
||||
${1}
|
||||
} catch {
|
||||
case e: FileNotFoundException => ${2:/* code */}
|
||||
case e: IOException => ${3:/* code */}
|
||||
case e: FileNotFoundException => ${2}
|
||||
case e: IOException => ${3}
|
||||
} finally {
|
||||
${4:/* code */}
|
||||
${4}
|
||||
}
|
||||
#match
|
||||
snippet match
|
||||
${1: obj} match {
|
||||
case ${2:e} => ${3:/* code */}
|
||||
case _ => ${4:/* code */}
|
||||
case ${2:e} => ${3}
|
||||
case _ => ${4}
|
||||
}
|
||||
#case
|
||||
snippet case
|
||||
case ${1:value} => ${2:/* code */}
|
||||
case ${1:value} => ${2}
|
||||
############################
|
||||
# methods and arguments
|
||||
#
|
||||
@ -82,9 +86,9 @@ snippet ovdef
|
||||
override def ${1:name}(${2:arg}) = ${3:}
|
||||
#first class function(see scalabook p 188)
|
||||
snippet fcf
|
||||
(${1:a}: ${2:T}) => $1 ${3:/* code */}
|
||||
(${1:a}: ${2:T}) => $1 ${3}
|
||||
snippet =>
|
||||
${1:name} => ${2:/* code */}
|
||||
${1:name} => ${2}
|
||||
#recursion
|
||||
snippet rec
|
||||
def ${1:name}(${2:arg}) =
|
||||
@ -196,11 +200,11 @@ snippet as
|
||||
|
||||
#scope() with one arg
|
||||
snippet (a
|
||||
(${1:a} => ${2:/* code */})
|
||||
(${1:a} => ${2})
|
||||
#scope() with two args
|
||||
snippet {(
|
||||
{(${1:a},${2:b}) =>
|
||||
${3:/* code */}
|
||||
${3}
|
||||
}
|
||||
#filter
|
||||
snippet filter
|
||||
@ -220,10 +224,10 @@ snippet fldr
|
||||
#fold left operator(if u wanna reduce readability of ur code)
|
||||
#use wildcard symbols
|
||||
snippet /:
|
||||
(${1:first}/:${2:name})(${3:/* code */})
|
||||
(${1:first}/:${2:name})(${3})
|
||||
#fold right operator
|
||||
snippet :\
|
||||
(${1:first}:\${2:name})(${3:/* code */})
|
||||
(${1:first}:\${2:name})(${3})
|
||||
#reduce left
|
||||
snippet redl
|
||||
${1:name}.reduceLeft[${2:T}] {(
|
||||
@ -258,13 +262,13 @@ snippet athis
|
||||
snippet abstract
|
||||
abstract class ${1:name}${2:(arg)}${3: extends }${4: with} {
|
||||
${5:override def toString = "$1"}
|
||||
${6:/* code */}
|
||||
${6}
|
||||
}
|
||||
#class
|
||||
snippet class
|
||||
class ${1:name}${2:(arg)}${3: extends }${4: with} {
|
||||
${5:override def toString = "$1"}
|
||||
${6:/* code */}
|
||||
${6}
|
||||
}
|
||||
#object
|
||||
snippet object
|
||||
@ -279,7 +283,7 @@ snippet ordered
|
||||
class ${1:name}${2:(arg)} extends Ordered[$1] ${3: with} {
|
||||
${4:override def toString = "$1"}
|
||||
def compare(that: $1) = ${5:this - that}
|
||||
${6:/* code */}
|
||||
${6}
|
||||
}
|
||||
#case class
|
||||
snippet casecl
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Shebang. Executing bash via /usr/bin/env makes scripts more portable.
|
||||
snippet #!
|
||||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
snippet if
|
||||
if [[ ${1:condition} ]]; then
|
||||
${2:#statements}
|
||||
@ -30,9 +30,9 @@ snippet case
|
||||
${2:pattern})
|
||||
${3};;
|
||||
esac
|
||||
snippet go
|
||||
while getopts '${1:o}' ${2:opts}
|
||||
do
|
||||
snippet go
|
||||
while getopts '${1:o}' ${2:opts}
|
||||
do
|
||||
case $$2 in
|
||||
${3:o0})
|
||||
${4:#staments};;
|
||||
@ -53,9 +53,9 @@ snippet getopt
|
||||
{
|
||||
cat <<- EOT
|
||||
|
||||
Usage : $${0:0} [options] [--]
|
||||
Usage : $${0:0} [options] [--]
|
||||
|
||||
Options:
|
||||
Options:
|
||||
-h|help Display this message
|
||||
-v|version Display script version
|
||||
|
||||
@ -80,7 +80,5 @@ snippet getopt
|
||||
esac # --- end of case ---
|
||||
done
|
||||
shift $(($OPTIND-1))
|
||||
|
||||
|
||||
snippet root
|
||||
if [ $(id -u) -ne 0 ]; then exec sudo $0; fi
|
||||
|
@ -1,11 +1,11 @@
|
||||
# #!/usr/bin/env tclsh
|
||||
snippet #!
|
||||
#!/usr/bin/env tclsh
|
||||
|
||||
|
||||
# Process
|
||||
snippet pro
|
||||
proc ${1:function_name} {${2:args}} {
|
||||
${3:#body ...}
|
||||
${3}
|
||||
}
|
||||
#xif
|
||||
snippet xif
|
||||
@ -13,19 +13,23 @@ snippet xif
|
||||
# Conditional
|
||||
snippet if
|
||||
if {${1}} {
|
||||
${2:# body...}
|
||||
${2}
|
||||
}
|
||||
# Conditional if..else
|
||||
snippet ife
|
||||
if {${1}} {
|
||||
${2:# body...}
|
||||
${2}
|
||||
} else {
|
||||
${3:# else...}
|
||||
}
|
||||
snippet eif
|
||||
elseif {${1}} {
|
||||
${2}
|
||||
}
|
||||
# Conditional if..elsif..else
|
||||
snippet ifee
|
||||
if {${1}} {
|
||||
${2:# body...}
|
||||
${2}
|
||||
} elseif {${3}} {
|
||||
${4:# elsif...}
|
||||
} else {
|
||||
@ -42,17 +46,17 @@ snippet catch
|
||||
# While Loop
|
||||
snippet wh
|
||||
while {${1}} {
|
||||
${2:# body...}
|
||||
${2}
|
||||
}
|
||||
# For Loop
|
||||
snippet for
|
||||
for {set ${2:var} 0} {$$2 < ${1:count}} {${3:incr} $2} {
|
||||
${4:# body...}
|
||||
${4}
|
||||
}
|
||||
# Foreach Loop
|
||||
snippet fore
|
||||
foreach ${1:x} {${2:#list}} {
|
||||
${3:# body...}
|
||||
${3}
|
||||
}
|
||||
# after ms script...
|
||||
snippet af
|
||||
|
@ -1,16 +1,16 @@
|
||||
#PREAMBLE
|
||||
#newcommand
|
||||
snippet nc
|
||||
\newcommand{\${1:cmd}}[${2:opt}]{${3:realcmd}}${4}
|
||||
\newcommand{\${1:cmd}}[${2:opt}]{${3:realcmd}} ${4}
|
||||
#usepackage
|
||||
snippet up
|
||||
\usepackage[${1:[options}]{${2:package}}
|
||||
\usepackage[${1:options}]{${2:package}} ${3}
|
||||
#newunicodechar
|
||||
snippet nuc
|
||||
\newunicodechar{${1}}{${2:\ensuremath}${3:tex-substitute}}}
|
||||
\newunicodechar{${1}}{${2:\ensuremath}${3:tex-substitute}}} ${4}
|
||||
#DeclareMathOperator
|
||||
snippet dmo
|
||||
\DeclareMathOperator{${1}}{${2}}
|
||||
\DeclareMathOperator{${1}}{${2}} ${3}
|
||||
|
||||
#DOCUMENT
|
||||
# \begin{}...\end{}
|
||||
@ -26,7 +26,7 @@ snippet tab
|
||||
snippet thm
|
||||
\begin[${1:author}]{${2:thm}}
|
||||
${3}
|
||||
\end{$1}
|
||||
\end{$2}
|
||||
snippet center
|
||||
\begin{center}
|
||||
${1}
|
||||
@ -56,6 +56,11 @@ snippet \
|
||||
\[
|
||||
${1}
|
||||
\]
|
||||
# Equation array
|
||||
snippet eqnarray
|
||||
\begin{eqnarray}
|
||||
${1}
|
||||
\end{eqnarray}
|
||||
# Enumerate
|
||||
snippet enum
|
||||
\begin{enumerate}
|
||||
@ -66,11 +71,17 @@ snippet itemize
|
||||
\begin{itemize}
|
||||
\item ${1}
|
||||
\end{itemize}
|
||||
snippet item
|
||||
\item ${1}
|
||||
# Description
|
||||
snippet desc
|
||||
\begin{description}
|
||||
\item[${1}] ${2}
|
||||
\end{description}
|
||||
# Endless new item
|
||||
snippet ]i
|
||||
\item ${1}
|
||||
${2:]i}
|
||||
# Matrix
|
||||
snippet mat
|
||||
\begin{${1:p/b/v/V/B/small}matrix}
|
||||
@ -103,16 +114,31 @@ snippet sec
|
||||
\section{${1:section name}}
|
||||
\label{sec:${2:$1}}
|
||||
${3}
|
||||
# Section without number
|
||||
snippet sec*
|
||||
\section*{${1:section name}}
|
||||
\label{sec:${2:$1}}
|
||||
${3}
|
||||
# Sub Section
|
||||
snippet sub
|
||||
\subsection{${1:subsection name}}
|
||||
\label{sub:${2:$1}}
|
||||
${3}
|
||||
# Sub Section without number
|
||||
snippet sub*
|
||||
\subsection*{${1:subsection name}}
|
||||
\label{sub:${2:$1}}
|
||||
${3}
|
||||
# Sub Sub Section
|
||||
snippet subs
|
||||
\subsubsection{${1:subsubsection name}}
|
||||
\label{ssub:${2:$1}}
|
||||
${3}
|
||||
# Sub Sub Section without number
|
||||
snippet subs*
|
||||
\subsubsection*{${1:subsubsection name}}
|
||||
\label{ssub:${2:$1}}
|
||||
${3}
|
||||
# Paragraph
|
||||
snippet par
|
||||
\paragraph{${1:paragraph name}}
|
||||
@ -123,6 +149,9 @@ snippet subp
|
||||
\subparagraph{${1:subparagraph name}}
|
||||
\label{subp:${2:$1}}
|
||||
${3}
|
||||
snippet ni
|
||||
\noindent
|
||||
${1}
|
||||
#References
|
||||
snippet itd
|
||||
\item[${1:description}] ${2:item}
|
||||
@ -133,14 +162,21 @@ snippet table
|
||||
snippet listing
|
||||
${1:Listing}~\ref{${2:list}}${3}
|
||||
snippet section
|
||||
${1:Section}~\ref{${2:sec:}}${3}
|
||||
${1:Section}~\ref{sec:${2}} ${3}
|
||||
snippet page
|
||||
${1:page}~\pageref{${2}}${3}
|
||||
${1:page}~\pageref{${2}} ${3}
|
||||
snippet index
|
||||
\index{${1:index}}${2}
|
||||
\index{${1:index}} ${2}
|
||||
#Citations
|
||||
snippet citen
|
||||
\cite{$1} ${2}
|
||||
# bibtex commands
|
||||
snippet citep
|
||||
\citep{$1} ${2}
|
||||
snippet citet
|
||||
\citet{$1} ${2}
|
||||
snippet cite
|
||||
\cite[${1}]{${2}}${3}
|
||||
\cite[${1}]{${2}} ${3}
|
||||
snippet fcite
|
||||
\footcite[${1}]{${2}}${3}
|
||||
#Formating text: italic, bold, underline, small capital, emphase ..
|
||||
@ -172,6 +208,7 @@ snippet fig
|
||||
\caption{${3}}
|
||||
\label{fig:${4}}
|
||||
\end{figure}
|
||||
${5}
|
||||
snippet tikz
|
||||
\begin{figure}
|
||||
\begin{center}
|
||||
@ -182,10 +219,40 @@ snippet tikz
|
||||
\caption{${3}}
|
||||
\label{fig:${4}}
|
||||
\end{figure}
|
||||
${5}
|
||||
#math
|
||||
snippet stackrel
|
||||
\stackrel{${1:above}}{${2:below}} ${3}
|
||||
snippet frac
|
||||
\frac{${1:num}}{${2:denom}}
|
||||
\frac{${1:num}}{${2:denom}} ${3}
|
||||
snippet sum
|
||||
\sum^{${1:n}}_{${2:i=1}}{${3}}
|
||||
\sum^{${1:n}}_{${2:i=1}} ${3}
|
||||
snippet lim
|
||||
\lim_{${1:x \to +\infty}} ${2}
|
||||
snippet frame
|
||||
\begin{frame}[<+->]
|
||||
\frametitle{${1:title}}
|
||||
|
||||
${2}
|
||||
\end{frame}
|
||||
snippet block
|
||||
\begin{block}{${1:title}}
|
||||
${2}
|
||||
\end{block}
|
||||
snippet alert
|
||||
\begin{alertblock}{${1:title}}
|
||||
${2}
|
||||
\end{alertblock}
|
||||
snippet example
|
||||
\begin{exampleblock}{${1:title}}
|
||||
${2}
|
||||
\end{exampleblock}
|
||||
snippet col2
|
||||
\begin{columns}
|
||||
\begin{column}{0.5\textwidth}
|
||||
${1}
|
||||
\end{column}
|
||||
\begin{column}{0.5\textwidth}
|
||||
${2}
|
||||
\end{column}
|
||||
\end{columns}
|
||||
|
@ -27,4 +27,4 @@ snippet fn
|
||||
[${1:ref number}] ${3}
|
||||
|
||||
fn$1. ${2:footnote}
|
||||
|
||||
|
||||
|
@ -4,13 +4,13 @@ snippet header
|
||||
" Description: ${3}
|
||||
${4:" Last Modified: `strftime("%B %d, %Y")`}
|
||||
snippet guard
|
||||
if exists('${1:did_`Filename()`}') || &cp${2: || version < 700}
|
||||
if exists('${1:did_`vim_snippets#Filename()`}') || &cp${2: || version < 700}
|
||||
finish
|
||||
endif
|
||||
let $1 = 1${3}
|
||||
snippet f
|
||||
fun! ${1:`expand('%') =~ 'autoload' ? substitute(matchstr(expand('%:p'),'autoload/\zs.*\ze.vim'),'[/\\]','#','g').'#' : ''`}${2:function_name}(${3})
|
||||
${4:" code}
|
||||
${4}
|
||||
endf
|
||||
snippet t
|
||||
try
|
||||
@ -19,19 +19,25 @@ snippet t
|
||||
${3}
|
||||
endtry
|
||||
snippet for
|
||||
for ${1:needle} in ${2:haystack}
|
||||
${3:" code}
|
||||
for ${1} in ${2}
|
||||
${3}
|
||||
endfor
|
||||
snippet forkv
|
||||
for [${1},${2}] in items(${3})
|
||||
${4}
|
||||
unlet $1 $2
|
||||
endfor
|
||||
|
||||
snippet wh
|
||||
while ${1:condition}
|
||||
${2:" code}
|
||||
while ${1}
|
||||
${2}
|
||||
endw
|
||||
snippet if
|
||||
if ${1:condition}
|
||||
${2:" code}
|
||||
if ${1}
|
||||
${2}
|
||||
endif
|
||||
snippet ife
|
||||
if ${1:condition}
|
||||
if ${1}
|
||||
${2}
|
||||
else
|
||||
${3}
|
||||
|
@ -50,7 +50,7 @@ snippet import
|
||||
|
||||
snippet include
|
||||
<xsl:include href="${1:stylesheet}" />${2}
|
||||
|
||||
|
||||
snippet otherwise
|
||||
<xsl:otherwise>${1}
|
||||
</xsl:otherwise>
|
||||
@ -64,7 +64,7 @@ snippet stylesheet
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">${1}
|
||||
</xsl:stylesheet>
|
||||
|
||||
snippet template
|
||||
snippet template
|
||||
<xsl:template match="${1:*}">${3}
|
||||
</xsl:template>
|
||||
|
||||
@ -91,7 +91,7 @@ snippet when
|
||||
|
||||
snippet with-param
|
||||
<xsl:with-param name="${1:name}">${2}</xsl:with-param>
|
||||
|
||||
|
||||
snippet with-param select
|
||||
<xsl:with-param name="${1:name}" select="${2:*}" />
|
||||
|
||||
|
||||
|
@ -1,59 +1,59 @@
|
||||
#--------------------Yii CHtml---------------------------------
|
||||
#Yii CHtml::radioButton
|
||||
snippet yhrb
|
||||
echo CHtml::radioButton('${1:name}', ${2:false},array(${3:optionName}=>${4:optionValue} );
|
||||
echo CHtml::radioButton('${1:name}', ${2:false},array(${3:optionName}=>${4:optionValue} );
|
||||
|
||||
#Yii CHtml::asset
|
||||
snippet yhass
|
||||
echo CHtml::asset('${1:path}');
|
||||
echo CHtml::asset('${1:path}');
|
||||
|
||||
#Yii CHtml::activeLabelEx
|
||||
snippet yhale
|
||||
echo CHtml::activeLabelEx(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue}));
|
||||
echo CHtml::activeLabelEx(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue}));
|
||||
|
||||
#Yii CHtml::encodeArray
|
||||
snippet yheca
|
||||
echo CHtml::encodeArray(array(${1}));
|
||||
echo CHtml::encodeArray(array(${1}));
|
||||
|
||||
#Yii CHtml::normalizeUrl
|
||||
snippet yhnurl
|
||||
echo CHtml::normalizeUrl(array('${1}'));
|
||||
echo CHtml::normalizeUrl(array('${1}'));
|
||||
|
||||
#Yii CHtml::resetButton
|
||||
snippet yhsb
|
||||
echo CHtml::submitButton('${1:label}',array('${2:optionName}'=>${3:optionValue}));
|
||||
echo CHtml::submitButton('${1:label}',array('${2:optionName}'=>${3:optionValue}));
|
||||
|
||||
#Yii CHtml::linkButton
|
||||
snippet yhlinkb
|
||||
echo CHtml::linkButton('${1:lable}',array('${2:optionName}'=>${3:optionValue}));
|
||||
echo CHtml::linkButton('${1:lable}',array('${2:optionName}'=>${3:optionValue}));
|
||||
|
||||
#Yii CHtml::activeTextArea
|
||||
snippet yhata
|
||||
echo CHtml::activeTextArea(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue}));
|
||||
echo CHtml::activeTextArea(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue}));
|
||||
|
||||
#Yii CHtml::ajaxButton
|
||||
snippet yhajb
|
||||
echo CHtml::ajaxButton('${1:label}', '${2:url}',array('${3:ajaxOptionName}'=>${4:ajaxOptionValue}),array('${5:optionName}'=>${6:optionValue}));
|
||||
echo CHtml::ajaxButton('${1:label}', '${2:url}',array('${3:ajaxOptionName}'=>${4:ajaxOptionValue}),array('${5:optionName}'=>${6:optionValue}));
|
||||
|
||||
#Yii CHtml::activeId
|
||||
snippet yhai
|
||||
echo CHtml::activeId(${1:model}, '${2:attribute}');
|
||||
echo CHtml::activeId(${1:model}, '${2:attribute}');
|
||||
|
||||
#Yii CHtml::activeCheckBox
|
||||
snippet yhacb
|
||||
echo CHtml::activeCheckBox(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue}));
|
||||
echo CHtml::activeCheckBox(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue}));
|
||||
|
||||
#Yii CHtml::activeHiddenField
|
||||
snippet yhahf
|
||||
echo CHtml::activeHiddenField(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue}));
|
||||
echo CHtml::activeHiddenField(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue}));
|
||||
|
||||
#Yii CHtml::encode
|
||||
snippet yhec
|
||||
echo CHtml::encode(${1:text});
|
||||
echo CHtml::encode(${1:text});
|
||||
|
||||
#Yii CHtml::metaTag
|
||||
snippet yhmtag
|
||||
echo CHtml::metaTag('${1:content}', '${2:name}', '${3:httpEquiv}',array('${4:optionName}'=>${5:optionValue}));
|
||||
echo CHtml::metaTag('${1:content}', '${2:name}', '${3:httpEquiv}',array('${4:optionName}'=>${5:optionValue}));
|
||||
|
||||
#Yii CHtml::dropDownList
|
||||
snippet yhddl
|
||||
@ -61,167 +61,167 @@ snippet yhddl
|
||||
|
||||
#Yii CHtml::listBox
|
||||
snippet yhlb
|
||||
echo CHtml::listBox('${1:name}', '${2:select}',array(${3}),array('${4:optionName}'=>${5:optionValue}));
|
||||
echo CHtml::listBox('${1:name}', '${2:select}',array(${3}),array('${4:optionName}'=>${5:optionValue}));
|
||||
|
||||
#Yii CHtml::script
|
||||
snippet yhjs
|
||||
echo CHtml::script('${1:test}');
|
||||
echo CHtml::script('${1:test}');
|
||||
|
||||
#Yii CHtml::ajax
|
||||
snippet yhaj
|
||||
echo CHtml::ajax(array(${1}));
|
||||
echo CHtml::ajax(array(${1}));
|
||||
|
||||
#Yii CHtml::textField
|
||||
snippet yhtf
|
||||
echo CHtml::textField('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue}));
|
||||
echo CHtml::textField('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue}));
|
||||
|
||||
#Yii CHtml::activePasswordField
|
||||
snippet yhapf
|
||||
echo CHtml::activePasswordField(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue}));
|
||||
echo CHtml::activePasswordField(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue}));
|
||||
|
||||
#Yii CHtml::listData
|
||||
snippet yhld
|
||||
echo CHtml::listData(array(${1}),'${2:valueField}', '${3:textField}','${4:groupField}');
|
||||
echo CHtml::listData(array(${1}),'${2:valueField}', '${3:textField}','${4:groupField}');
|
||||
|
||||
#Yii CHtml::mailto
|
||||
snippet yhmt
|
||||
echo CHtml::mailto('${1:text}', '${2:email}',array('${3:optionName}'=>${4:optionValue}));
|
||||
echo CHtml::mailto('${1:text}', '${2:email}',array('${3:optionName}'=>${4:optionValue}));
|
||||
|
||||
#Yii CHtml::image
|
||||
snippet yhimg
|
||||
echo CHtml::image('${1:src}', '${2:alt}',array('${3:optionName}'=>${4:optionValue}));
|
||||
echo CHtml::image('${1:src}', '${2:alt}',array('${3:optionName}'=>${4:optionValue}));
|
||||
|
||||
#Yii CHtml::activeListBox
|
||||
snippet yhalb
|
||||
echo CHtml::activeListBox(${1:model}, '${2:attribute}', array(${3}),array('${4:optionName}'=>${5:optionValue}));
|
||||
echo CHtml::activeListBox(${1:model}, '${2:attribute}', array(${3}),array('${4:optionName}'=>${5:optionValue}));
|
||||
|
||||
#Yii CHtml::activeFileField
|
||||
snippet yhaff
|
||||
echo CHtml::activeFileField(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue}));
|
||||
echo CHtml::activeFileField(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue}));
|
||||
|
||||
#Yii CHtml::closeTag
|
||||
snippet yhct
|
||||
echo CHtml::closeTag('${1:tag}');
|
||||
echo CHtml::closeTag('${1:tag}');
|
||||
|
||||
#Yii CHtml::activeInputField
|
||||
snippet yhaif
|
||||
echo CHtml::activeInputField('${1:type}', ${2:model}, '${3:attribute}',array('${4:optionName}'=>${5:optionValue}));
|
||||
echo CHtml::activeInputField('${1:type}', ${2:model}, '${3:attribute}',array('${4:optionName}'=>${5:optionValue}));
|
||||
|
||||
#Yii CHtml::scriptFile
|
||||
snippet yhjsf
|
||||
echo CHtml::scriptFile('${1:url}');
|
||||
echo CHtml::scriptFile('${1:url}');
|
||||
|
||||
#Yii CHtml::radioButtonList
|
||||
snippet yhrbl
|
||||
echo CHtml::radioButtonList('${1:name}', ${2:select}, array(${3}),array('${4:optionName}'=>${5:optionValue}));
|
||||
echo CHtml::radioButtonList('${1:name}', ${2:select}, array(${3}),array('${4:optionName}'=>${5:optionValue}));
|
||||
|
||||
#Yii CHtml::cssFile
|
||||
snippet yhcssf
|
||||
echo CHtml::cssFile('${1:url}','${2:media}');
|
||||
echo CHtml::cssFile('${1:url}','${2:media}');
|
||||
|
||||
#Yii CHtml::error
|
||||
snippet yherr
|
||||
echo CHtml::error(${1:model}, '${2:attribute}');
|
||||
echo CHtml::error(${1:model}, '${2:attribute}');
|
||||
|
||||
#Yii CHtml::passwordField
|
||||
snippet yhpf
|
||||
echo CHtml::passwordField('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue}));
|
||||
echo CHtml::passwordField('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue}));
|
||||
|
||||
#Yii CHtml::hiddenField
|
||||
snippet yhhf
|
||||
echo CHtml::hiddenField('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue}));
|
||||
echo CHtml::hiddenField('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue}));
|
||||
|
||||
#Yii CHtml::cdata
|
||||
snippet yhc
|
||||
echo CHtml::cdata(${1:text});
|
||||
echo CHtml::cdata(${1:text});
|
||||
|
||||
#Yii CHtml::link
|
||||
snippet yhlink
|
||||
echo CHtml::link('${1:text}',array(${2}),array('${3:optionName}'=>${4:optionValue}));
|
||||
echo CHtml::link('${1:text}',array(${2}),array('${3:optionName}'=>${4:optionValue}));
|
||||
|
||||
#Yii CHtml::errorSummary
|
||||
snippet yherrs
|
||||
echo CHtml::errorSummary(${1:model},'${2:headerHtml}','${3:footerHtml}');
|
||||
echo CHtml::errorSummary(${1:model},'${2:headerHtml}','${3:footerHtml}');
|
||||
|
||||
#Yii CHtml::tag
|
||||
snippet yht
|
||||
echo CHtml::tag('${1:tag}',array('${2:optionName}'=>${3:optionValue}),${4:false},${5:true});
|
||||
echo CHtml::tag('${1:tag}',array('${2:optionName}'=>${3:optionValue}),${4:false},${5:true});
|
||||
|
||||
#Yii CHtml::ajaxLink
|
||||
snippet yhajl
|
||||
echo CHtml::ajaxLink('${1:label}', '${2:url}',array('${3:ajaxOptionName}'=>${4:ajaxOptionValue}),array('${5:optionName}'=>${6:optionValue}));
|
||||
echo CHtml::ajaxLink('${1:label}', '${2:url}',array('${3:ajaxOptionName}'=>${4:ajaxOptionValue}),array('${5:optionName}'=>${6:optionValue}));
|
||||
|
||||
#Yii CHtml::label
|
||||
snippet yhlabel
|
||||
echo CHtml::label('${1:label}', '${2:for}',array('${3:optionName}'=>${4:optionValue}));
|
||||
echo CHtml::label('${1:label}', '${2:for}',array('${3:optionName}'=>${4:optionValue}));
|
||||
|
||||
#Yii CHtml::activeName
|
||||
snippet yhan
|
||||
echo CHtml::activeName(${1:model}, '${2:attribute}');
|
||||
echo CHtml::activeName(${1:model}, '${2:attribute}');
|
||||
|
||||
#Yii CHtml::statefulForm
|
||||
snippet yhsform
|
||||
echo CHtml::statefulForm(array('${1}'), '${2:post}',array('${3:optionName}'=>${4:optionValue}));
|
||||
echo CHtml::statefulForm(array('${1}'), '${2:post}',array('${3:optionName}'=>${4:optionValue}));
|
||||
|
||||
#Yii CHtml::fileField
|
||||
snippet yhff
|
||||
echo CHtml::fileField('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue}));
|
||||
echo CHtml::fileField('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue}));
|
||||
|
||||
#Yii CHtml::activeTextField
|
||||
snippet yhatf
|
||||
echo CHtml::activeTextField(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue}));
|
||||
echo CHtml::activeTextField(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue}));
|
||||
|
||||
#Yii CHtml::css
|
||||
snippet yhcss
|
||||
echo CHtml::css('${1:test}','${2:media}');
|
||||
echo CHtml::css('${1:test}','${2:media}');
|
||||
|
||||
#Yii CHtml::imageButton
|
||||
snippet yhimgb
|
||||
echo CHtml::imageButton('${1:src}',array('${2:optionName}'=>${3:optionValue}));
|
||||
echo CHtml::imageButton('${1:src}',array('${2:optionName}'=>${3:optionValue}));
|
||||
|
||||
#Yii CHtml::ajaxSubmitButton
|
||||
snippet yhajsb
|
||||
echo CHtml::ajaxSubmitButton('${1:label}', '${2:url}',array('${3:ajaxOptionName}'=>${4:ajaxOptionValue}),array('${5:optionName}'=>${6:optionValue}));
|
||||
echo CHtml::ajaxSubmitButton('${1:label}', '${2:url}',array('${3:ajaxOptionName}'=>${4:ajaxOptionValue}),array('${5:optionName}'=>${6:optionValue}));
|
||||
|
||||
#Yii CHtml::button
|
||||
snippet yhb
|
||||
echo CHtml::button('${1:label}',array('${2:optionName}'=>${3:optionValue}));
|
||||
echo CHtml::button('${1:label}',array('${2:optionName}'=>${3:optionValue}));
|
||||
|
||||
#Yii CHtml::listOptions
|
||||
snippet yhlo
|
||||
echo CHtml::listOptions('${1:selection}', array(${2}), array('${3:optionName}'=>${4:optionValue}));
|
||||
echo CHtml::listOptions('${1:selection}', array(${2}), array('${3:optionName}'=>${4:optionValue}));
|
||||
|
||||
#Yii CHtml::activeCheckBoxList
|
||||
snippet yhacbl
|
||||
echo CHtml::activeCheckBoxList(${1:model}, '${2:attribute}', array(${3}),array('${4:optionName}'=>${5:optionValue}));
|
||||
echo CHtml::activeCheckBoxList(${1:model}, '${2:attribute}', array(${3}),array('${4:optionName}'=>${5:optionValue}));
|
||||
|
||||
#Yii CHtml::openTag
|
||||
snippet yhot
|
||||
echo CHtml::openTag('${1:tag}', array('${2:optionName}'=>${3:optionValue}));
|
||||
echo CHtml::openTag('${1:tag}', array('${2:optionName}'=>${3:optionValue}));
|
||||
|
||||
#Yii CHtml::checkBox
|
||||
snippet yhcb
|
||||
echo CHtml::checkBox('${1:name}', ${2:false}, array('${3:optionName}'=>${4:optionValue}));
|
||||
echo CHtml::checkBox('${1:name}', ${2:false}, array('${3:optionName}'=>${4:optionValue}));
|
||||
|
||||
#Yii CHtml::textArea
|
||||
snippet yhta
|
||||
echo CHtml::textArea('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue}));
|
||||
echo CHtml::textArea('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue}));
|
||||
|
||||
#Yii CHtml::linkTag
|
||||
snippet yhlinkt
|
||||
echo CHtml::linkTag('${1:relation}', '${2:type}', '${3:href}', '${4:media}',array('${5:optionName}'=>${6:optionValue}));
|
||||
echo CHtml::linkTag('${1:relation}', '${2:type}', '${3:href}', '${4:media}',array('${5:optionName}'=>${6:optionValue}));
|
||||
|
||||
#Yii CHtml::resetButton
|
||||
snippet yhrsb
|
||||
echo CHtml::resetButton('${1:label}',array('${2:optionName}'=>${3:optionValue}));
|
||||
echo CHtml::resetButton('${1:label}',array('${2:optionName}'=>${3:optionValue}));
|
||||
|
||||
#Yii CHtml::activeRadioButtonList
|
||||
snippet yharbl
|
||||
echo CHtml::activeRadioButtonList(${1:model}, '${2:attribute}', array(${3}),array('${4:optionName}'=>${5:optionValue}));
|
||||
echo CHtml::activeRadioButtonList(${1:model}, '${2:attribute}', array(${3}),array('${4:optionName}'=>${5:optionValue}));
|
||||
|
||||
#Yii CHtml::checkBoxList
|
||||
snippet yhcbl
|
||||
echo CHtml::checkBoxList('${1:name}', ${2:select}, array(${3}),array('${4:optionName}'=>${5:optionValue}));
|
||||
echo CHtml::checkBoxList('${1:name}', ${2:select}, array(${3}),array('${4:optionName}'=>${5:optionValue}));
|
||||
|
||||
#Yii CHtml::form
|
||||
snippet yhform
|
||||
@ -231,18 +231,18 @@ snippet yhform
|
||||
snippet yhbeform
|
||||
echo CHtml::beginForm(array('${1}'), '${2:post}',array('${3:optionName}'=>${4:optionValue}));
|
||||
${5}
|
||||
echo CHtml::endForm();
|
||||
echo CHtml::endForm();
|
||||
|
||||
#Yii CHtml::activeDropDownList
|
||||
snippet yhaddl
|
||||
echo CHtml::activeDropDownList(${1:model}, '${2:attribute}', array(${3}),array('${4:optionName}'=>${5:optionValue}));
|
||||
echo CHtml::activeDropDownList(${1:model}, '${2:attribute}', array(${3}),array('${4:optionName}'=>${5:optionValue}));
|
||||
|
||||
#Yii CHtml::activeRadioButton
|
||||
snippet yharb
|
||||
echo CHtml::activeRadioButton(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue}));
|
||||
echo CHtml::activeRadioButton(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue}));
|
||||
|
||||
#Yii CHtml::activeLabel
|
||||
snippet yhal
|
||||
echo CHtml::activeLabel(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue}));
|
||||
echo CHtml::activeLabel(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue}));
|
||||
|
||||
|
||||
|
@ -1,58 +1,58 @@
|
||||
#Yii session offset
|
||||
snippet yse
|
||||
Yii::app()->session['${1}'];
|
||||
Yii::app()->session['${1}'];
|
||||
|
||||
#Yii renderDynamic
|
||||
snippet yrd
|
||||
$this->renderDynamic('${1:callback}');
|
||||
$this->renderDynamic('${1:callback}');
|
||||
|
||||
#Yii set cache
|
||||
snippet ycas
|
||||
Yii::app()->cache->set('${1:key}', ${2:value}, ${3:expire}, new C${4:}CacheDependency(${5}));
|
||||
Yii::app()->cache->set('${1:key}', ${2:value}, ${3:expire}, new C${4:}CacheDependency(${5}));
|
||||
|
||||
#Yii Add cache
|
||||
snippet ycad
|
||||
Yii::app()->cache->add('${1:key}', ${2:value}, ${3:expire}, new C${4}CacheDependency(${5}));
|
||||
Yii::app()->cache->add('${1:key}', ${2:value}, ${3:expire}, new C${4}CacheDependency(${5}));
|
||||
|
||||
#Yii register CSS file
|
||||
snippet yregcf
|
||||
Yii::app()->clientScript->registerCssFile('${1:file}');
|
||||
Yii::app()->clientScript->registerCssFile('${1:file}');
|
||||
|
||||
#Yii requestType
|
||||
snippet yreqtype
|
||||
Yii::app()->request->requestType
|
||||
Yii::app()->request->requestType
|
||||
|
||||
#Yii isAjaxRequest
|
||||
snippet yisajax
|
||||
Yii::app()->request->isAjaxRequest
|
||||
Yii::app()->request->isAjaxRequest
|
||||
|
||||
#Yii translate
|
||||
snippet yt
|
||||
Yii::t('${1:category}', '${2:message}',array(${3}));
|
||||
Yii::t('${1:category}', '${2:message}',array(${3}));
|
||||
|
||||
#Yii register CSS
|
||||
snippet yregc
|
||||
Yii::app()->clientScript->registerCss('${1:id}', '${2}');
|
||||
Yii::app()->clientScript->registerCss('${1:id}', '${2}');
|
||||
|
||||
#Yii log
|
||||
snippet ylog
|
||||
Yii::log('${1:msg}', '${2:info}');
|
||||
Yii::log('${1:msg}', '${2:info}');
|
||||
|
||||
#Yii userHostAddress
|
||||
snippet yuserip
|
||||
YYii::app()->request->userHostAddress
|
||||
YYii::app()->request->userHostAddress
|
||||
|
||||
#Yii register script file
|
||||
snippet yregsf
|
||||
Yii::app()->clientScript->registerScriptFile('${1:scriptUrl}', CClientScript::POS_${2:END});
|
||||
Yii::app()->clientScript->registerScriptFile('${1:scriptUrl}', CClientScript::POS_${2:END});
|
||||
|
||||
#Yii CLinkPager
|
||||
snippet ylinkpager
|
||||
$this->widget('CLinkPager', array('pages'=>$pages,'header'=>'${1}'}))
|
||||
$this->widget('CLinkPager', array('pages'=>$pages,'header'=>'${1}'}))
|
||||
|
||||
#Yii CJSON::encode
|
||||
snippet yjec
|
||||
CJSON::encode(${1:text});
|
||||
CJSON::encode(${1:text});
|
||||
|
||||
#CActiveDataProvider
|
||||
snippet yadp
|
||||
@ -68,23 +68,23 @@ snippet yadp
|
||||
),
|
||||
));
|
||||
${6}
|
||||
// $dataProvider->getData() will return a list of Post objects
|
||||
// $dataProvider->getData() will return a list of Post objects
|
||||
|
||||
#Yii renderDynamic internal
|
||||
snippet yrdi
|
||||
$this->renderDynamic('${1:callback}', array('${2:key}'=>${3:value}));
|
||||
$this->renderDynamic('${1:callback}', array('${2:key}'=>${3:value}));
|
||||
|
||||
#Yii register script
|
||||
snippet yregs
|
||||
Yii::app()->clientScript->registerScript('${1:id}', '${2}', CClientScript::POS_${3:READY});
|
||||
Yii::app()->clientScript->registerScript('${1:id}', '${2}', CClientScript::POS_${3:READY});
|
||||
|
||||
#Yii Flush cache
|
||||
snippet ycaf
|
||||
Yii::app()->cache->flush();
|
||||
Yii::app()->cache->flush();
|
||||
|
||||
#Yii Yii::app()->request->cookies
|
||||
snippet yco
|
||||
Yii::app()->request->cookies['${1}']
|
||||
Yii::app()->request->cookies['${1}']
|
||||
|
||||
#Yii user->
|
||||
snippet yuser
|
||||
@ -92,54 +92,54 @@ snippet yuser
|
||||
|
||||
#Yii refresh
|
||||
snippet yrf
|
||||
$this->refresh();
|
||||
$this->refresh();
|
||||
|
||||
#Yii import
|
||||
snippet yimp
|
||||
Yii::import('${1}');
|
||||
Yii::import('${1}');
|
||||
|
||||
#Yii trace
|
||||
snippet ytrace
|
||||
Yii::trace('${1:msg}');
|
||||
Yii::trace('${1:msg}');
|
||||
|
||||
#Yii params
|
||||
snippet ypar
|
||||
Yii::app()->params['${1}']
|
||||
Yii::app()->params['${1}']
|
||||
|
||||
#Yii isPostRequest
|
||||
snippet yispost
|
||||
Yii::app()->request->isPostRequest
|
||||
Yii::app()->request->isPostRequest
|
||||
|
||||
#Yii IF isAjaxRequest
|
||||
snippet yifisajax
|
||||
if(Yii::app()->request->isAjaxRequest == TRUE)
|
||||
{
|
||||
${1}
|
||||
}
|
||||
}
|
||||
|
||||
#Yii Yii::app()->cache->delete
|
||||
snippet ydelcache
|
||||
Yii::app()->cache->delete('${1:key}');
|
||||
Yii::app()->cache->delete('${1:key}');
|
||||
|
||||
#Yii render view
|
||||
snippet yr
|
||||
$this->render('${1:view}',array('${2:key}'=>${3:value}));
|
||||
$this->render('${1:view}',array('${2:key}'=>${3:value}));
|
||||
|
||||
#Yii redirect
|
||||
snippet yre
|
||||
$this->redirect(array('${1:controller}/${2:action}'));
|
||||
$this->redirect(array('${1:controller}/${2:action}'));
|
||||
|
||||
#Yii Get cache
|
||||
snippet ycag
|
||||
Yii::app()->cache->get('${1:key}');
|
||||
Yii::app()->cache->get('${1:key}');
|
||||
|
||||
#Yii render text
|
||||
snippet yrt
|
||||
$this->renderText('${1}');
|
||||
$this->renderText('${1}');
|
||||
|
||||
#Yii render partial
|
||||
snippet yrp
|
||||
$this->renderPartial('${1:view}',array('${2:key}'=>${3:value}));
|
||||
$this->renderPartial('${1:view}',array('${2:key}'=>${3:value}));
|
||||
|
||||
#----------------Yii Model-----------------------------
|
||||
#Yii Model count
|
||||
@ -152,7 +152,7 @@ snippet ycountbs
|
||||
|
||||
#Yii Model updateAll
|
||||
snippet yupdatea
|
||||
${1:ModelName}::model()->updateAll(${2:array('attributes')}, ${3:condition},array('${4:key}'=>${5:value}));
|
||||
${1:ModelName}::model()->updateAll(${2:array('attributes')}, ${3:condition},array('${4:key}'=>${5:value}));
|
||||
|
||||
#Yii Model updateByPk
|
||||
snippet yupdatebp
|
||||
@ -164,35 +164,35 @@ snippet ydela
|
||||
|
||||
#Yii Model deleteByPk
|
||||
snippet ydelbp
|
||||
${1:ModelName}::model()->deleteByPk(${2:pk}, ${3:condition}, array('${4:key}'=>${5:value}));
|
||||
${1:ModelName}::model()->deleteByPk(${2:pk}, ${3:condition}, array('${4:key}'=>${5:value}));
|
||||
|
||||
#Yii Model find
|
||||
snippet yfind
|
||||
${1:ModelName}::model()->find(${2:condition},array('${3:key}'=>${4:value}));
|
||||
${1:ModelName}::model()->find(${2:condition},array('${3:key}'=>${4:value}));
|
||||
|
||||
#Yii Model findAll
|
||||
snippet yfinda
|
||||
${1:ModelName}::model()->findAll(${2:condition},array('${3:key}'=>${4:value}));
|
||||
${1:ModelName}::model()->findAll(${2:condition},array('${3:key}'=>${4:value}));
|
||||
|
||||
#Yii Model findByPk
|
||||
snippet yfindbp
|
||||
${1:ModelName}::model()->findByPk(${2:pk}, ${3:condition}, array('${4:key}'=>${5:value}));
|
||||
${1:ModelName}::model()->findByPk(${2:pk}, ${3:condition}, array('${4:key}'=>${5:value}));
|
||||
|
||||
#Yii Model findAllByPk
|
||||
snippet yfindabp
|
||||
${1:ModelName}::model()->findAllByPk(${2:pk}, ${3:condition},array('${4:key}'=>${5:value}));
|
||||
${1:ModelName}::model()->findAllByPk(${2:pk}, ${3:condition},array('${4:key}'=>${5:value}));
|
||||
|
||||
#Yii Model findBySql
|
||||
snippet yfindbs
|
||||
${1:ModelName}::model()->findBySql(${2:sql}, array('${3:key}'=>${4:value}));
|
||||
${1:ModelName}::model()->findBySql(${2:sql}, array('${3:key}'=>${4:value}));
|
||||
|
||||
#Yii Model findAllByAttributes
|
||||
snippet yfindaba
|
||||
${1:ModelName}::model()->findAllByAttributes(array('${2:attributeName}'=>${3:attributeValue}), ${4:condition}, array('${5:key}'=>${6:value}));
|
||||
${1:ModelName}::model()->findAllByAttributes(array('${2:attributeName}'=>${3:attributeValue}), ${4:condition}, array('${5:key}'=>${6:value}));
|
||||
|
||||
#Yii Model exists
|
||||
snippet yexists
|
||||
${1:ModelName}::model()->exists(${2:condition}, array('${3:key}'=>${4:value}));
|
||||
${1:ModelName}::model()->exists(${2:condition}, array('${3:key}'=>${4:value}));
|
||||
|
||||
#Yii Create model class
|
||||
snippet ymodel
|
||||
@ -245,7 +245,7 @@ snippet ymodel
|
||||
}
|
||||
}
|
||||
|
||||
#------------Yii Controller------------------------------------
|
||||
#------------Yii Controller------------------------------------
|
||||
|
||||
#Yii Create controller class
|
||||
snippet ycontroller
|
||||
|
@ -12,7 +12,7 @@ snippet ife
|
||||
else
|
||||
${3:# statements}
|
||||
fi
|
||||
snippet elif
|
||||
snippet eif
|
||||
elif ${1:condition} ; then
|
||||
${2:# statements}
|
||||
snippet for
|
||||
|
Reference in New Issue
Block a user