1
0
mirror of https://github.com/amix/vimrc synced 2025-07-18 17:44:59 +08:00
This commit is contained in:
huangqundl
2017-03-17 23:12:53 +08:00
parent 47b213d974
commit cba39b7326
855 changed files with 59981 additions and 35298 deletions

View File

@ -7,6 +7,8 @@ snippet date
`strftime("%Y-%m-%d")`
snippet ddate
`strftime("%B %d, %Y")`
snippet diso
`strftime("%Y-%m-%dT%H:%M:%S")`
snippet time
`strftime("%H:%M")`
snippet datetime
@ -15,7 +17,7 @@ snippet lorem
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
snippet GPL2
${1:One line to give the program's name and a brief description.}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
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
@ -29,11 +31,10 @@ snippet GPL2
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
${0}
snippet LGPL2
${1:One line to give the program's name and a brief description.}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
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
@ -47,11 +48,10 @@ snippet LGPL2
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/>.
${0}
snippet GPL3
${1:one line to give the program's name and a brief description.}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
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
@ -65,11 +65,10 @@ snippet GPL3
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
${0}
snippet LGPL3
${1:One line to give the program's name and a brief description.}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
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
@ -83,11 +82,10 @@ snippet LGPL3
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/>.
${0}
snippet AGPL3
${1:one line to give the program's name and a brief description.}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
@ -101,11 +99,19 @@ snippet AGPL3
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
${0}
snippet GMGPL linking exception
As a special exception, if other files instantiate generics from
this unit, or you link this unit with other files to produce an
executable, this unit does not by itself cause the resulting
executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU Public License.
${0}
snippet BSD2
${1:one line to give the program's name and a brief description}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -131,11 +137,10 @@ snippet BSD2
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.
${0}
snippet BSD3
${1:one line to give the program's name and a brief description}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -159,11 +164,10 @@ snippet BSD3
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.
${0}
snippet BSD4
${1:one line to give the program's name and a brief description}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -190,11 +194,10 @@ snippet BSD4
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.
${0}
snippet MIT
${1:one line to give the program's name and a brief description}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the "Software"),
@ -213,11 +216,10 @@ snippet MIT
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
${0}
snippet APACHE
${1:one line to give the program's name and a brief description}
Copyright `strftime("%Y")` ${2:copyright holder}
Copyright `strftime("%Y")` ${2:`g:snips_author`}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -230,24 +232,21 @@ snippet APACHE
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
${0}
snippet BEERWARE
${2:one line to give the program's name and a brief description}
Copyright `strftime("%Y")` ${3:copyright holder}
${1:one line to give the program's name and a brief description}
Copyright `strftime("%Y")` ${2:`g:snips_author`}
Licensed under the "THE BEER-WARE LICENSE" (Revision 42):
${1:`g:snips_author`} wrote this file. As long as you retain this notice you
$2 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
${0}
snippet WTFPL
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright `strftime("%Y")` ${0:copyright holder}
Copyright `strftime("%Y")` ${0:`g:snips_author`}
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
@ -257,3 +256,34 @@ snippet WTFPL
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
${0}
snippet MPL2
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
${0}
snippet AGPL
${1:One line to give the program's name and a brief description.}
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
snippet ISC
${1:one line to give the program's name and a brief description}
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")`, ${2:`g:snips_author`}
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
${0}

View File

@ -75,10 +75,6 @@ snippet do
do {
${0}
} while (${1:cond})
snippet wh
while ${1:cond}{
${0}
}
snippet for enumerate names
for (${1:var} in ${2:object}){
${0}
@ -100,7 +96,7 @@ snippet interface
}
snippet try
try {
${1}
${1:${VISUAL}}
} catch (error:ErrorType) {
${2}
} finally {
@ -119,11 +115,11 @@ snippet forr
# If Condition
snippet if
if (${1:/* condition */}) {
${0}
${0:${VISUAL}}
}
snippet el
else {
${0}
${0:${VISUAL}}
}
# Ternary conditional
snippet t

View File

@ -90,19 +90,19 @@ snippet fors for some
snippet if if
if ${1} then
${0}
${0:${VISUAL}}
end if;
snippet ife if ... else
if ${1} then
${2}
${2:${VISUAL}}
else
${0}
end if;
snippet el else
else
${0}
${0:${VISUAL}}
snippet eif elsif
elsif ${1} then
@ -110,13 +110,13 @@ snippet eif elsif
snippet wh while
while ${1} loop
${0}
${0:${VISUAL}}
end loop;
snippet nwh named while
${1}:
while ${2} loop
${0}
${0:${VISUAL}}
end loop $1;
snippet for for
@ -215,41 +215,3 @@ snippet getl Ada.Text_IO.Get_Line
snippet newline Ada.Text_IO.New_Line
Ada.Text_IO.New_Line(${1:1});${0}
snippet gpl GPL license header
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU ${1}General Public License as published by
-- the Free Software Foundation; either version ${2: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 $1General Public License for more details.
--
-- You should have received a copy of the GNU $1General Public License
-- along with this program; if not, see <http://www.gnu.org/licenses/>.
--
-- Copyright (C) ${3:Author}, ${4:`strftime("%Y")`}
${0}
snippet gplf GPL file license header
-- This file is part of ${1:Program-Name}.
--
-- $1 is free software: you can redistribute it and/or modify
-- it under the terms of the GNU ${2}General Public License as published by
-- the Free Software Foundation, either version ${3:3} of the License, or
-- (at your option) any later version.
--
-- $1 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 $2General Public License for more details.
--
-- You should have received a copy of the GNU $2General Public License
-- along with $1. If not, see <http://www.gnu.org/licenses/>.
--
-- Copyright (C) ${4:Author}, ${5:`strftime("%Y")`}
${0}

View File

@ -9,22 +9,22 @@ snippet dir
# <FilesMatch>
snippet filesmatch
<FilesMatch "${1:regex}">
${0}
${0:${VISUAL}}
</FilesMatch>
# <IfModule>
snippet ifmodule
<IfModule ${1:mod_example.c}>
${0}
${0:${VISUAL}}
</IfModule>
# <LimitExcept>
snippet limitexcept
<LimitExcept ${1:POST GET}>
${0}
${0:${VISUAL}}
</LimitExcept>
# <Proxy>
snippet proxy
<Proxy ${1:*}>
${0}
${0:${VISUAL}}
</Proxy>
# <VirtualHost>
snippet virtualhost

View File

@ -0,0 +1,124 @@
snippet setup
void setup()
{
Serial.begin(${1:9600});
${2}
}
snippet loop
void loop()
{
${0}
}
snippet inc
#include <${1}.h>
snippet def
#define ${1}
# if
snippet if
if (${1:/* condition */}) {
${0:${VISUAL}}
}
# else
snippet el
else {
${1}
}
# else if
snippet elif
else if (${1:/* condition */}) {
${2}
}
# ifi
snippet ifi
if (${1:/* condition */}) ${2};
# switch
snippet switch
switch (${1:/* variable */}) {
case ${2:/* variable case */}:
${3}
${4:break;}${5}
default:
${6}
}
snippet case
case ${1:/* variable case */}:
${2}
${3:break;}
# for
snippet for
for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) {
${4}
}
# for (custom)
snippet forr
for (int ${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) {
${5}
}
# while
snippet wh
while (${1:/* condition */}) {
${2}
}
# do... while
snippet do
do {
${2}
} while (${1:/* condition */});
##
## Functions
# function definition
snippet fun
${1:void} ${2:function_name}(${3})
{
${4}
}
## IO
# pinMode OUTPUT
snippet pinout
pinMode(${1}, OUTPUT);
# pinMode INPUT
snippet pinin
pinMode(${1}, INPUT);
# digitalWrite HIGH
snippet dwHigh
digitalWrite(${1}, HIGH);
# digitalWrite LOW
snippet dwLow
digitalWrite(${1}, LOW);
# digitalRead
snippet dr
digitalRead(${1});
# analogRead
snippet ar
analogRead(${1});
# analogWrite
snippet aw
analogWrite(${1});
# serialRead
snippet sr
Serial.read();
# serialWrite
snippet sw
Serial.write();
# serial.print
snippet sp
Serial.print(${1});
# serial.println
snippet sl
Serial.println(${1});
# delay
snippet dl
delay(${1});
# millis
snippet ml
millis();

View File

@ -0,0 +1,102 @@
# cannot use /usr/bin/env because it does not support parameters (as -f)
snippet #! #!/usr/bin/awk -f
#!/usr/bin/awk -f
# @include is a gawk extension
snippet inc @include
@include "${1}"${0}
# @load is a gawk extension
snippet loa @load
@load "${1}"${0}
snippet beg BEGIN { ... }
BEGIN {
${0}
}
# BEGINFILE is a gawk extension
snippet begf BEGINFILE { ... }
BEGINFILE {
${0}
}
snippet end END { ... }
END {
${0}
}
# ENDFILE is a gawk extension
snippet endf ENDFILE { ... }
ENDFILE {
${0}
}
snippet pri print
print ${1:"${2}"}${0}
snippet printf printf
printf("${1:%s}\n", ${2})${0}
snippet ign IGNORECASE
IGNORECASE = ${1:1}
snippet if if {...}
if (${1}) {
${0:${VISUAL}}
}
snippet ife if ... else ...
if (${1}) {
${2:${VISUAL}}
} else {
${0}
}
snippet eif else if ...
else if (${1}) {
${0}
}
snippet el else {...}
else {
${0}
}
snippet wh while
while (${1}) {
${2}
}
snippet do do ... while
do {
${0}
} while (${1})
snippet for for
for (${2:i} = 0; i < ${1:n}; ${3:++i}) {
${0}
}
snippet fore for each
for (${1:i} in ${2:array}) {
${0}
}
# the switch is a gawk extension
snippet sw switch
switch (${1}) {
case ${2}:
${3}
break
default:
${0}
break
}
# the switch is a gawk extension
snippet case case
case ${1}:
${0}
break

View File

@ -25,7 +25,7 @@ snippet Inc
snippet ndef
#ifndef $1
#define ${1:SYMBOL} ${2:value}
#endif
#endif /* ifndef $1 */
# define
snippet def
#define
@ -37,7 +37,7 @@ snippet ifdef
# if
snippet #if
#if ${1:FOO}
${0}
${0:${VISUAL}}
#endif
# header include guard
snippet once
@ -52,22 +52,28 @@ snippet once
## Control Statements
# if
snippet if
if (${1:/* condition */}) {
${2}
if (${1:true}) {
${0:${VISUAL}}
}
snippet ife
if (${1:true}) {
${2:${VISUAL}}
} else {
${0}
}
# else
snippet el
else {
${1}
${0:${VISUAL}}
}
# else if
snippet elif
else if (${1:/* condition */}) {
${2}
else if (${1:true}) {
${0:${VISUAL}}
}
# ifi
snippet ifi
if (${1:/* condition */}) ${2};
if (${1:true}) ${0};
# ternary
snippet t
${1:/* condition */} ? ${2:a} : ${3:b}
@ -92,27 +98,29 @@ snippet case
case ${1:/* variable case */}:
${2}
${3:break;}
snippet ret
return ${0};
##
## Loops
# for
snippet for
for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) {
for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) {
${4}
}
# for (custom)
snippet forr
for (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) {
for (int ${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) {
${5}
}
# while
snippet wh
while (${1:/* condition */}) {
${2}
${0:${VISUAL}}
}
# do... while
snippet do
do {
${2}
${0:${VISUAL}}
} while (${1:/* condition */});
##
## Functions
@ -122,6 +130,84 @@ snippet fun
{
${4}
}
# function definition with zero parameters
snippet fun0
${1:void} ${2:function_name}()
{
${3}
}
# function definition with Doxygen documentation
snippet dfun0
/*! \brief ${1:Brief function description here}
*
* ${2:Detailed description of the function}
*
* \return ${3:Return parameter description}
*/
${4:void} ${5:function_name}()
{
${6}
}
# function definition with one parameter
snippet fun1
${1:void} ${2:function_name}(${3:Type} ${4:Parameter})
{
${5}
}
# function definition with one parameter with Doxygen documentation
snippet dfun1
/*! \brief ${1:Brief function description here}
*
* ${2:Detailed description of the function}
*
* \param $3 ${4:Parameter description}
* \return ${5:Return parameter description}
*/
${6:void} ${7:function_name}(${8:Type} ${3:Parameter})
{
${9}
}
# function definition with two parameters
snippet fun2
${1:void} ${2:function_name}(${3:Type} ${4:Parameter}, ${5:Type} ${6:Parameter})
{
${7}
}
# function definition with two parameters with Doxygen documentation
snippet dfun2
/*! \brief ${1:Brief function description here}
*
* ${2:Detailed description of the function}
*
* \param $3 ${4:Parameter description}
* \param $5 ${6:Parameter description}
* \return ${7:Return parameter description}
*/
${8:void} ${9:function_name}(${10:Type} ${3:Parameter}, ${11:Type} ${5:Parameter})
{
${12}
}
# function definition with two parameters
snippet fun3
${1:void} ${2:function_name}(${3:Type} ${4:Parameter}, ${5:Type} ${6:Parameter}, ${7:Type} ${8:Parameter})
{
${9}
}
# function definition with two parameters with Doxygen documentation
snippet dfun3
/*! \brief ${1:Brief function description here}
*
* ${2:Detailed description of the function}
*
* \param $3 ${4:Parameter description}
* \param $5 ${6:Parameter description}
* \param $7 ${8:Parameter description}
* \return ${9:Return parameter description}
*/
${10:void} ${11:function_name}(${12:Type} ${3:Parameter}, ${13:Type} ${5:Parameter}, ${14:Type} ${7:Parameter})
{
${15}
}
# function declaration
snippet fund
${1:void} ${2:function_name}(${3});
@ -132,18 +218,39 @@ snippet td
typedef ${1:int} ${2:MyCustomType};
# struct
snippet st
/*! \struct $1
* \brief ${3:Brief struct description}
*
* ${4:Detailed description}
*/
struct ${1:`vim_snippets#Filename('$1_t', 'name')`} {
${2:/* data */}
}${3: /* optional variable list */};
${2:Data} /*!< ${4:Description} */
}${5: /* optional variable list */};
# typedef struct
snippet tds
/*! \struct $2
* \brief ${5:Brief struct description}
*
* ${6:Detailed description}
*/
typedef struct ${2:_$1 }{
${3:/* data */}
m_${3:Data} /*!< ${4:Description} */
} ${1:`vim_snippets#Filename('$1_t', 'name')`};
snippet enum
/*! \enum $1
*
* ${2:Detailed description}
*/
enum ${1:name} { ${0} };
# typedef enum
snippet tde
/*! \enum $2
*
* ${4:Detailed description}
*/
typedef enum {
${1:/* data */}
${1:Data} /*!< ${3:Description} */
} ${2:foo};
##
## Input/Output
@ -153,6 +260,12 @@ snippet pr
# fprintf (again, this isn't as nice as TextMate's version, but it works)
snippet fpr
fprintf(${1:stderr}, "${2:%s}\n"${3});
snippet prd
printf("${1:} = %d\n", $1);
snippet prf
printf("${1:} = %f\n", $1);
snippet prx
printf("${1:} = %${2}\n", $1);
# getopt
snippet getopt
int choice;
@ -211,27 +324,12 @@ snippet getopt
}
}
##
# TODO section
snippet todo
/*! TODO: ${1:Todo description here}
* \todo $1
*/
## Miscellaneous
# This is kind of convenient
snippet .
[${1}]
# GPL
snippet gpl
/*
* 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/>.
*
* Copyright (C) ${1:Author}, `strftime("%Y")`
*/
${0}

View File

@ -1,76 +1,73 @@
snippet comm
(comment
${0}
)
${0})
snippet condp
(condp ${1:pred} ${2:expr}
${0})
${0})
snippet def
(def ${0})
snippet defm
(defmethod ${1:multifn} "${2:doc-string}" ${3:dispatch-val} [${4:args}]
${0})
${0})
snippet defmm
(defmulti ${1:name} "${2:doc-string}" ${0:dispatch-fn})
snippet defma
(defmacro ${1:name} "${2:doc-string}" ${0:dispatch-fn})
snippet defn
(defn ${1:name} "${2:doc-string}" [${3:arg-list}]
${0})
${0})
snippet defp
(defprotocol ${1:name}
${0})
${0})
snippet defr
(defrecord ${1:name} [${2:fields}]
${3:protocol}
${0})
${3:protocol}
${0})
snippet deft
(deftest ${1:name}
(is (= ${2:assertion})))
${0})
(is (= ${0:assertion})))
snippet is
(is (= ${1} ${0}))
snippet defty
(deftype ${1:Name} [${2:fields}]
${3:Protocol}
${0})
${3:Protocol}
${0})
snippet doseq
(doseq [${1:elem} ${2:coll}]
${0})
${0})
snippet fn
(fn [${1:arg-list}] ${0})
snippet if
(if ${1:test-expr}
${2:then-expr}
${0:else-expr})
${2:then-expr}
${0:else-expr})
snippet if-let
(if-let [${1:result} ${2:test-expr}]
(${3:then-expr} $1)
(${0:else-expr}))
snippet imp
(:import [${1:package}])
& {:keys [${1:keys}] :or {${0:defaults}}}
& {:keys [${1:keys}] :or {${0:defaults}}}
snippet let
(let [${1:name} ${2:expr}]
${0})
snippet letfn
(letfn [(${1:name) [${2:args}]
${0})])
(letfn [(${1:name}) [${2:args}]
${0})])
snippet map
(map ${1:func} ${0:coll})
snippet mapl
(map #(${1:lambda}) ${0:coll})
snippet met
(${1:name} [${2:this} ${3:args}]
${0})
${0})
snippet ns
(ns ${1:name}
${0})
(ns ${0:name})
snippet dotimes
(dotimes [_ 10]
(time
(dotimes [_ ${1:times}]
${0})))
(time
(dotimes [_ ${1:times}]
${0})))
snippet pmethod
(${1:name} [${2:this} ${0:args}])
snippet refer

View File

@ -1,58 +1,83 @@
snippet cmake
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(${1:ProjectName})
snippet init
cmake_minimum_required(version ${1:2.8.2})
project(${2:ProjectName})
FIND_PACKAGE(${2:LIBRARY})
find_package(${3:library})
INCLUDE_DIRECTORIES(
${$2_INCLUDE_DIR}
)
include_directories(${$3_INCLUDE_DIRS})
ADD_SUBDIRECTORY(${0:src})
add_subdirectory(${0:src})
ADD_EXECUTABLE($1)
add_executable($2)
TARGET_LINK_LIBRARIES($1
${$2_LIBRARIES}
)
target_link_libraries($2 ${$3_LIBRARIES})
snippet proj
project(${0:Name})
snippet min
cmake_minimum_required(version ${0:2.8.2})
snippet include
INCLUDE_DIRECTORIES(
${${0:INCLUDE_DIR}}
)
include_directories(${${0:include_dir}})
snippet find
FIND_PACKAGE(${0:LIBRARY})
find_package(${1:library} ${0:REQUIRED})
snippet glob
FILE(GLOB ${1:SRCS} *.${0:cpp})
file(glob ${1:srcs} *.${0:cpp})
snippet subdir
ADD_SUBDIRECTORY(${0:src})
add_subdirectory(${0:src})
snippet lib
ADD_LIBRARY(${1:lib} ${2:STATIC}
${${0:SRCS}}
)
add_library(${1:lib} ${${0:srcs}})
snippet link
TARGET_LINK_LIBRARIES(${1:bin}
${0:somelib}
)
target_link_libraries(${1:bin} ${0:somelib})
snippet bin
ADD_EXECUTABLE(${1:bin})
add_executable(${1:bin})
snippet set
SET(${1:var} ${0:val})
set(${1:var} ${0:val})
snippet dep
ADD_DEPENDENCIES(${1:target}
add_dependencies(${1:target}
${0:dep}
)
snippet Ext_url
include(ExternalProject)
ExternalProject_Add(${1:googletest}
URL ${2:http://googletest.googlecode.com/files/gtest-1.7.0.zip}
URL_HASH SHA1=${3:f85f6d2481e2c6c4a18539e391aa4ea8ab0394af}
SOURCE_DIR "${4:${CMAKE_BINARY_DIR}/gtest-src}"
BINARY_DIR "${0:${CMAKE_BINARY_DIR}/gtest-build}"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
snippet Ext_git
include(ExternalProject)
ExternalProject_Add(${1:googletest}
GIT_REPOSITORY ${2:https://github.com/google/googletest.git}
GIT_TAG ${3:master}
SOURCE_DIR "${4:${CMAKE_BINARY_DIR}/googletest-src}"
BINARY_DIR "${0:${CMAKE_BINARY_DIR}/googletest-build}"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
snippet props
SET_TARGET_PROPERTIES(${1:target}
${2:PROPERTIES} ${3:COMPILE_FLAGS}
set_target_properties(${1:target}
${2:properties} ${3:compile_flags}
${0:"-O3 -Wall -pedantic"}
)
snippet test
add_test(${1:ATestName} ${0:testCommand --options})

View File

@ -0,0 +1,171 @@
# Based on nebjak/snipmate.vim/snippets/php.snippets
# Controller
snippet ci_controller
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class ${1:ClassName} extends CI_Controller
{
function __construct()
{
parent::__construct();
${2:// code...}
}
function ${3:index}()
{
${4:// code...}
}
}
# Model
snippet ci_model
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class ${1:ClassName_model} extends CI_Model
{
function __construct()
{
parent::__construct();
${2:// code...}
}
}
snippet ci_model_crudl
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class ${1:ClassName_model} extends CI_Model
{
private $table = '${2:table_name}';
function __construct()
{
parent::__construct();
${3:// code...}
}
public function create($data)
{
if($this->db->insert($this->table, $data))
return true;
else
return false;
}
public function read($id)
{
return $this->db->get_where($this->table, array('id', $id))->result();
}
public function update($id, $data)
{
if($this->db->update($this->table, $data, array('id' => $id)))
return true;
else
return false;
}
public function delete($id)
{
if(is_array($id))
{
$this->db->trans_start();
foreach($id as $elem)
$this->db->delete($this->table, array('id' => $elem));
$this->db->trans_complete();
}
else
{
if($this->db->delete($this->table, array('id' => $id)))
return true;
else
return false;
}
}
public function listRows($limit = null, $offset = 0)
{
if(!is_null($limit))
$this->db->limit($limit, $offset);
return $this->db->get($this->table)->result();
}
}
# Load view
snippet ci_load-view
$this->load->view("${1:view_name}", $${2:data});${3}
# DB Class snippets
snippet ci_db-insert
$this->db->insert("${1:table}", $${2:data});${3}
snippet ci_db-select
$this->db->select("${1:id, ...}");${2}
snippet ci_db-from
$this->db->from("${1:table}");${2}
snippet ci_db-join
$this->db->join("${1:table}", "${2:condition}", "${3:type}");${4}
snippet ci_db-where
$this->db->where("${1:key}", "${2:value}");${3}
snippet ci_db-or_where
$this->db->or_where("${1:key}", "${2:value}");${3}
snippet ci_db-get
$this->db->get("${1:table}", ${2:limit}, ${3:offset});${4}
snippet ci_db-delete
$this->db->delete("${1:table}", "${2:where}");${3}
snippet ci_db-update
$this->db->update("${1:table}", $${2:set}, $${3:where});${4}
# Input Class snippets
snippet ci_input-post
$this->input->post("${1:index}");${2}
snippet ci_input-get
$this->input->get("${1:index}");${2}
snippet ci_input-cookie
$this->input->cookie("${1:index}");${2}
snippet ci_input-server
$this->input->server("${1:index}");${2}
snippet ci_input-user_agent
$this->input->user_agent();${1}
snippet ci_input-is_ajax_request
$this->input->is_ajax_request();${1}
snippet ci_input-is_cli_request
$this->input->is_cli_request();${1}
# Form Validation Class and Form Helper snippets
snippet ci_form_validation-set_rules
$this->form_validation->set_rules("${1:field}", "${2:label}", "${3:trim|required}");${4}
snippet ci_form_open
form_open("${1:action}");${2}
snippet ci_form_open_multipart
form_open_multipart("${1:action}");${2}
snippet ci_form_hidden
form_hidden("${1:name}", "${2:value}");${3}
snippet ci_form_input
form_input("${1:name}", "${2:value}");${3}
snippet ci_form_password
form_password("${1:name}", "${2:value}");${3}
snippet ci_form_upload
form_upload("${1:name}", "${2:value}");${3}
snippet ci_form_textarea
form_textarea("${1:name}", "${2:value}");${3}
snippet ci_form_dropdown
form_dropdown("${1:name}", $${2:options}, $${3:selected);${4}
snippet ci_form_checkbox
form_checkbox("${1:name}", "${2:value}");${3}
snippet ci_form_radio
form_radio("${1:name}", "${2:value}");${3}
snippet ci_form_submit
form_submit("${1:name}", "${2:value}");${3}
snippet ci_form_reset
form_reset("${1:name}", "${2:value}");${3}
snippet ci_form_button
form_button("${1:name}", "${2:value}");${3}
snippet ci_form_label
form_label("${1:label text}", "${2:id}");${3}
snippet ci_form_close
form_close();${1}
snippet ci_validation_errors
validation_errors();${1}
# Session Class snippets
snippet ci_session_userdata
$this->session->userdata("${1:item}");${2}
snippet ci_session_set_userdata
$this->session->set_userdata($${1:array});${2}
snippet ci_session_flashdata
$this->session->flashdata("${1:item}");${2}
snippet ci_session_set_flashdata
$this->session->set_flashdata("${1:item}", "${2:value}");${3}

View File

@ -55,17 +55,17 @@ snippet cla class .. extends .. constructor: ..
# If
snippet if
if ${1:condition}
${0:# body...}
${0:${VISUAL}}
# If __ Else
snippet ife
if ${1:condition}
${2:# body...}
${2:${VISUAL}}
else
${0:# body...}
# Else if
snippet eif
else if ${1:condition}
${0:# body...}
${0:${VISUAL}}
# Ternary If
snippet ifte
if ${1:condition} then ${2:value} else ${0:other}
@ -84,7 +84,7 @@ snippet log
# Try __ Catch
snippet try
try
${1}
${1:${VISUAL}}
catch ${2:error}
${0}
# Require

View File

@ -1,3 +1,13 @@
extends c
##
## Preprocessor
# #include <...>
snippet incc
#include <${1:iostream}>
snippet binc
#include <boost/${1:shared_ptr}.hpp>
##
## STL Collections
# std::array
snippet array
@ -68,20 +78,61 @@ snippet mu
## Class
# class
snippet cl
/*! \class $1
* \brief ${3:Brief class description}
*
* ${4:Detailed description}
*/
class ${1:`vim_snippets#Filename('$1', 'name')`}
{
public:
$1(${2});
~$1();
virtual ~$1();
private:
${0:/* data */}
protected:
m_${5}; /*!< ${6:Member description} */
};
# member function implementation
snippet mfun
${4:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}(${3}) {
${0}
}
# member function implementation without parameters
snippet dmfun0
/*! \brief ${4:Brief function description here}
*
* ${5:Detailed description}
*
* \return ${6:Return parameter description}
*/
${3:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}() {
${0}
}
# member function implementation with one parameter
snippet dmfun1
/*! \brief ${6:Brief function description here}
*
* ${7:Detailed description}
*
* \param $4 ${8:Parameter description}
* \return ${9:Return parameter description}
*/
${5:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}(${3:Type} ${4:Parameter}) {
${0}
}
# member function implementation with two parameter
snippet dmfun2
/*! \brief ${8:Brief function description here}
*
* ${9:Detailed description}
*
* \param $4 ${10:Parameter description}
* \param $6 ${11:Parameter description}
* \return ${12:Return parameter description}
*/
${7:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}(${3:Type} ${4:Parameter},${5:Type} ${6:Parameter}) {
${0}
}
# namespace
snippet ns
namespace ${1:`vim_snippets#Filename('', 'my')`} {
@ -96,6 +147,19 @@ snippet cout
snippet cin
std::cin >> ${1};
##
## Casts
# static
snippet sca
static_cast<${1:unsigned}>(${2:expr})${3}
# dynamic
snippet dca
dynamic_cast<${1:unsigned}>(${2:expr})${3}
# reinterpret
snippet rca
reinterpret_cast<${1:unsigned}>(${2:expr})${3}
# const
snippet cca
const_cast<${1:unsigned}>(${2:expr})${3}
## Iteration
# for i
snippet fori
@ -123,9 +187,19 @@ snippet itera
## Lambdas
# lamda (one line)
snippet ld
[${1}](${2}){${3}}
[${1}](${2}){${3}};
# lambda (multi-line)
snippet lld
[${1}](${2}){
${3}
};
# snippets exception
snippet try
try {
}catch(${1}) {
}

View File

@ -0,0 +1,82 @@
snippet req require
require "${1}"
snippet case
case ${1:object}
when ${2:condition}
${0}
end
snippet when
when ${1:condition}
${0}
snippet def
def ${1:method_name}
${0}
end
snippet pdef
private def ${1:method_name}
${0}
end
snippet if
if ${1:condition}
${0:${VISUAL}}
end
snippet ife
if ${1:condition}
${2:${VISUAL}}
else
${0}
end
snippet wh
while ${1:condition}
${0:${VISUAL}}
end
snippet cla class .. end
class ${1:`substitute(vim_snippets#Filename(), "\(_\|^\)\(.\)", "\u\2", "g")`}
${0}
end
snippet mod class .. end
module ${1:`substitute(vim_snippets#Filename(), "\(_\|^\)\(.\)", "\u\2", "g")`}
${0}
end
snippet r
getter ${0:name}
snippet r!
getter! ${0:name}
snippet r?
getter? ${0:name}
snippet w
setter ${0:name}
snippet w!
setter! ${0:name}
snippet w?
setter? ${0:name}
snippet rw
property ${0:name}
snippet rw!
property! ${0:name}
snippet rw?
property? ${0:name}
snippet defs
def self.${1:class_method_name}
${0}
end
snippet defi
def initialize(${1})
${0}
end
snippet do
do
${0:${VISUAL}}
end
snippet dov
do |${1:v}|
${2}
end
snippet desc
describe ${1:`substitute(substitute(vim_snippets#Filename(), "_spec$", "", ""), "\(_\|^\)\(.\)", "\u\2", "g")`} do
${0}
end
snippet it
it "${1}" do
${0}
end

View File

@ -56,31 +56,35 @@
#
# Feedback is welcome!
#
# entry point
# Main
snippet sim
public static int Main(string[] args) {
${1:public }static int Main(string[] args) {
${0}
return 0;
}
snippet simc
public class Application {
public static int Main(string[] args) {
${1:public }static int Main(string[] args) {
${0}
return 0;
}
}
snippet svm
${1:public }static void Main(string[] args) {
${0}
}
# if condition
snippet if
if (${1}) {
${0}
if (${1:true}) {
${0:${VISUAL}}
}
snippet el
else {
${0}
${0:${VISUAL}}
}
snippet ifs
if (${1})
${0}
${0:${VISUAL}}
# ternary conditional
snippet t
${1} ? ${2} : ${0}
@ -89,29 +93,33 @@ snippet ?
# do while loop
snippet do
do {
${0}
} while (${1});
${0:${VISUAL}}
} while (${1:true});
# while loop
snippet wh
while (${1}) {
${0}
while (${1:true}) {
${0:${VISUAL}}
}
# for loop
snippet for
for (int ${1:i} = 0; $1 < ${2:count}; $1${3:++}) {
${0}
}
snippet forr
for (int ${1:i} = ${2:length}; $1 >= 0; $1--) {
${0}
}
# foreach
snippet fore
foreach (var ${1:entry} in ${2}) {
foreach (${1:var} ${2:entry} in ${3}) {
${0}
}
snippet foreach
foreach (var ${1:entry} in ${2}) {
foreach (${1:var} ${2:entry} in ${3}) {
${0}
}
snippet each
foreach (var ${1:entry} in ${2}) {
foreach (${1:var} ${2:entry} in ${3}) {
${0}
}
# interfaces
@ -164,32 +172,32 @@ snippet ctor
# properties - auto properties by default.
# default type is int with layout get / set.
snippet prop
${1:public} ${2:int} ${3:} { get; set; }
${1:public} ${2:int} ${3} { get; set; }
snippet p
${1:public} ${2:int} ${3:} { get; set; }
${1:public} ${2:int} ${3} { get; set; }
snippet p+
public ${1:int} ${2:} { get; set; }
public ${1:int} ${2} { get; set; }
snippet p+&
public ${1:int} ${2:} { get; internal set; }
public ${1:int} ${2} { get; internal set; }
snippet p+|
public ${1:int} ${2:} { get; protected set; }
public ${1:int} ${2} { get; protected set; }
snippet p+-
public ${1:int} ${2:} { get; private set; }
public ${1:int} ${2} { get; private set; }
snippet p&
internal ${1:int} ${2:} { get; set; }
internal ${1:int} ${2} { get; set; }
snippet p&|
internal ${1:int} ${2:} { get; protected set; }
internal ${1:int} ${2} { get; protected set; }
snippet p&-
internal ${1:int} ${2:} { get; private set; }
internal ${1:int} ${2} { get; private set; }
snippet p|
protected ${1:int} ${2:} { get; set; }
protected ${1:int} ${2} { get; set; }
snippet p|-
protected ${1:int} ${2:} { get; private set; }
protected ${1:int} ${2} { get; private set; }
snippet p-
private ${1:int} ${2:} { get; set; }
private ${1:int} ${2} { get; set; }
# property - bool
snippet pi
${1:public} int ${2:} { get; set; }
${1:public} int ${2} { get; set; }
snippet pi+
public int ${1} { get; set; }
snippet pi+&
@ -212,7 +220,7 @@ snippet pi-
private int ${1} { get; set; }
# property - bool
snippet pb
${1:public} bool ${2:} { get; set; }
${1:public} bool ${2} { get; set; }
snippet pb+
public bool ${1} { get; set; }
snippet pb+&
@ -235,7 +243,7 @@ snippet pb-
private bool ${1} { get; set; }
# property - string
snippet ps
${1:public} string ${2:} { get; set; }
${1:public} string ${2} { get; set; }
snippet ps+
public string ${1} { get; set; }
snippet ps+&
@ -258,87 +266,87 @@ snippet ps-
private string ${1} { get; set; }
# members - void
snippet m
${1:public} ${2:void} ${3:}(${4:}) {
${5:}
${1:public} ${2:void} ${3}(${4}) {
${0}
}
snippet m+
public ${1:void} ${2:}(${3:}) {
${4:}
public ${1:void} ${2}(${3}) {
${0}
}
snippet m&
internal ${1:void} ${2:}(${3:}) {
${4:}
internal ${1:void} ${2}(${3}) {
${0}
}
snippet m|
protected ${1:void} ${2:}(${3:}) {
${4:}
protected ${1:void} ${2}(${3}) {
${0}
}
snippet m-
private ${1:void} ${2:}(${3:}) {
${4:}
private ${1:void} ${2}(${3}) {
${0}
}
# members - int
snippet mi
${1:public} int ${2:}(${3:}) {
${4:return 0;}
${1:public} int ${2}(${3}) {
${0:return 0;}
}
snippet mi+
public int ${1:}(${2:}) {
${3:return 0;}
public int ${1}(${2}) {
${0:return 0;}
}
snippet mi&
internal int ${1:}(${2:}) {
${3:return 0;}
internal int ${1}(${2}) {
${0:return 0;}
}
snippet mi|
protected int ${1:}(${2:}) {
${3:return 0;}
protected int ${1}(${2}) {
${0:return 0;}
}
snippet mi-
private int ${1:}(${2:}) {
${3:return 0;}
private int ${1}(${2}) {
${0:return 0;}
}
# members - bool
snippet mb
${1:public} bool ${2:}(${3:}) {
${4:return false;}
${1:public} bool ${2}(${3}) {
${0:return false;}
}
snippet mb+
public bool ${1:}(${2:}) {
${3:return false;}
public bool ${1}(${2}) {
${0:return false;}
}
snippet mb&
internal bool ${1:}(${2:}) {
${3:return false;}
internal bool ${1}(${2}) {
${0:return false;}
}
snippet mb|
protected bool ${1:}(${2:}) {
${3:return false;}
protected bool ${1}(${2}) {
${0:return false;}
}
snippet mb-
private bool ${1:}(${2:}) {
${3:return false;}
private bool ${1}(${2}) {
${0:return false;}
}
# members - string
snippet ms
${1:public} string ${2:}(${3:}) {
${4:return "";}
${1:public} string ${2}(${3}) {
${0:return "";}
}
snippet ms+
public string ${1:}(${2:}) {
${3:return "";}
public string ${1}(${2}) {
${0:return "";}
}
snippet ms&
internal string ${1:}(${2:}) {
${3:return "";}
internal string ${1}(${2}) {
${0:return "";}
}
snippet ms|
protected string ${1:}(${2:}) {
${3:return "";}
${0:return "";}
}
snippet ms-
private string ${1:}(${2:}) {
${3:return "";}
private string ${1}(${2}) {
${0:return "";}
}
# structure
snippet struct
@ -347,6 +355,11 @@ snippet struct
}
# enumeration
snippet enum
enum ${1} {
${0}
}
snippet enum+
public enum ${1} {
${0}
}
@ -365,10 +378,93 @@ snippet <p
snippet <ex
<exception cref="${1:System.Exception}">${2}</exception>
snippet <r
<returns>${1}</returns>{
<returns>${1}</returns>
snippet <s
<see cref="${1}"/>
snippet <rem
<remarks>${1}</remarks>
snippet <c
<code>${1}</code>
snippet cw
Console.WriteLine(${1});
# equals override
snippet eq
public override bool Equals(object obj) {
if (obj == null || GetType() != obj.GetType()) {
return false;
}
${0:throw new NotImplementedException();}
return base.Equals(obj);
}
# exception
snippet exc
public class ${1:MyException} : ${2:Exception} {
public $1() { }
public $1(string message) : base(message) { }
public $1(string message, Exception inner) : base(message, inner) { }
protected $1(
System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context)
: base(info, context) { }
}
# indexer
snippet index
public ${1:object} this[${2:int} index] {
get { ${0} }
set { ${0} }
}
# eventhandler
snippet inv
EventHandler temp = ${1:MyEvent};
if (${2:temp} != null) {
$2();
}
# lock
snippet lock
lock (${1:this}) {
${0}
}
# namespace
snippet namespace
namespace ${1:MyNamespace} {
${0}
}
# property
snippet prop
public ${1:int} ${2:MyProperty} { get; set; }
snippet propf
private ${1:int} ${2:myVar};
public $1 ${3:MyProperty} {
get { return $2; }
set { $2 = value; }
}
snippet propg
public ${1:int} ${2:MyProperty} { get; private set; }
# switch
snippet switch
switch (${1:switch_on}) {
${0}
default:
}
# try
snippet try
try {
${0:${VISUAL}}
}
catch (${1:System.Exception}) {
throw;
}
snippet tryf
try {
${0:${VISUAL}}
}
finally {
${1}
}
# using
snippet usi
using(${1:resource}) {
${0}
}

View File

@ -1,8 +1,8 @@
snippet .
snippet . "selector { }"
${1} {
${0}
${0:${VISUAL}}
}
snippet !
snippet ! "!important"
!important
snippet bdi:m+
-moz-border-image: url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${0:stretch};
@ -31,9 +31,9 @@ snippet @f
}
snippet @i
@import url(${0});
snippet @m
snippet @m "@media mediatype { }"
@media ${1:print} {
${0}
${0:${VISUAL}}
}
snippet bg+
background: #${1:FFF} url(${2}) ${3:0} ${4:0} ${0:no-repeat};

View File

@ -0,0 +1 @@
extends cpp

View File

@ -88,13 +88,13 @@ snippet fsw
}
snippet try
try {
${1}
${1:${VISUAL}}
} catch(${2:Exception} ${3:e}) {
${4}
}
snippet tcf
try {
${0}
${0:${VISUAL}}
} catch(${1:Exception} ${2:e}) {
${3}
} finally {
@ -102,7 +102,7 @@ snippet tcf
}
snippet wh
while(${1:cond}) {
${0}
${0:${VISUAL}}
}
snippet dowh
do {

View File

@ -71,12 +71,12 @@ snippet as
assert(${0:/* condition */});
snippet try
try {
${0}
${0:${VISUAL}}
} catch (${1:Exception e}) {
}
snippet tryf
try {
${0}
${0:${VISUAL}}
} catch (${1:Exception e}) {
} finally {
}

View File

@ -0,0 +1,34 @@
extends html
snippet %
<% ${0} %>
snippet =
<%= ${0} %>
snippet end
<% end %>
snippet for
<%= for ${1:item} <- ${2:items} ${3:@conn} do %>
${0}
<% end %>
snippet if
<%= if ${1} do %>
${0:${VISUAL}}
<% end %>
snippet ife
<%= if ${1} do %>
${2:${VISUAL}}
<%= else %>
${0}
<% end %>
snippet ft
<%= form_tag(${1:"/users"}, method: ${2::post}) %>
${0}
</form>
snippet lin
<%= link "${1:Submit}", to: ${2:"/users"}, method: ${3::delete} %>
snippet ff
<%= form_for @changeset, ${1:"/users"}, fn f -> %>
${0}
<%= submit "Submit" %>
<% end %>

View File

@ -1,51 +1,81 @@
snippet do
do
${0}
${0:${VISUAL}}
end
snippet if if .. do .. end
if ${1} do
${0}
${0:${VISUAL}}
end
snippet if if .. do: ..
snippet if: if .. do: ..
if ${1:condition}, do: ${0}
snippet ife if .. do .. else .. end
if ${1:condition} do
${2}
${2:${VISUAL}}
else
${0}
end
snippet ife if .. do: .. else:
snippet ife: if .. do: .. else:
if ${1:condition}, do: ${2}, else: ${0}
snippet unless unless .. do .. end
unless ${1} do
${0}
${0:${VISUAL}}
end
snippet unless unless .. do: ..
snippet unless: unless .. do: ..
unless ${1:condition}, do: ${0}
snippet unlesse unless .. do .. else .. end
unless ${1:condition} do
${2}
${2:${VISUAL}}
else
${0}
end
snippet unlesse unless .. do: .. else:
snippet unlesse: unless .. do: .. else:
unless ${1:condition}, do: ${2}, else: ${0}
snippet cond
cond do
${1} ->
${0}
${1} ->
${0:${VISUAL}}
end
snippet case
case ${1} do
${2} ->
${2} ->
${0}
end
snippet for
for ${1:item} <- ${2:items} do
${0}
end
snippet fori
for ${1:item} <- ${2:items}, into: ${3} do
${0}
end
snippet wi
with(
${1:item} <- ${2:items}
) do
${0}
end
snippet wie
with(
${1:item} <- ${2:items}
) do
${3}
else
${4} ->
${0}
end
snippet df
def ${1:name}, do: ${2}
snippet def
def ${1:name} do
${0}
end
snippet defd
@doc """
${1:doc string}
"""
def ${2:name} do
${0}
end
snippet defim
defimpl ${1:protocol_name}, for: ${2:data_type} do
${0}
@ -55,9 +85,11 @@ snippet defma
${0}
end
snippet defmo
defmodule ${1:module_name} do
defmodule ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} do
${0}
end
snippet dfp
defp ${1:name}, do: ${2}
snippet defp
defp ${1:name} do
${0}
@ -70,20 +102,20 @@ snippet doc
@doc """
${0}
"""
snippet docf
@doc false
snippet fn
fn(${1:args}) -> ${0} end
snippet fun
function do
${0}
end
fn ${1:args} -> ${0} end
snippet mdoc
@moduledoc """
${0}
"""
snippet mdocf
@moduledoc false
snippet rec
receive do
${1} ->
${0}
${1} ->
${0}
end
snippet req
require ${0:module_name}
@ -92,12 +124,36 @@ snippet imp
snippet ali
alias ${0:module_name}
snippet test
test "${1:test_name}" do
test "${1:test name}" do
${0}
end
snippet testa
test "${1:test_name}", %{${2:arg: arg}} do
${0}
end
snippet des
describe "${1:test group subject}" do
${0}
end
snippet exunit
defmodule ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} do
use ExUnit.Case, async: true
${0}
end
snippet try try .. rescue .. end
try do
${1}
${1:${VISUAL}}
rescue
${2} -> ${0}
end
snippet pry
require IEx; IEx.pry
${0}
snippet qu
quote do
${1}
end
snippet beh
@behaviour ${1:Mix.Task}
${0}

View File

@ -0,0 +1,50 @@
snippet mod
module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` exposing (${1})
${0}
snippet imp
import ${0:List}
snippet impe
import ${1:List} exposing (${0:map})
snippet fn
${1:fn} : ${2:a} -> ${3:a}
$1 ${4} =
${0}
snippet fn1
${1:fn} : ${2:a} -> ${3:a}
$1 ${4} =
${0}
snippet fn2
${1:fn} : ${2:a} -> ${3:a} -> ${4:a}
$1 ${5} =
${0}
snippet fn3
${1:fn} : ${2:a} -> ${3:a} -> ${4:a} -> ${5:a}
$1 ${6} =
${0}
snippet fn0
${1:fn} : ${2:a}
$1 =
${0}
snippet case
case ${1} of
${2} ->
${0}
snippet -
${1} ->
${0}
snippet let
let
${1} = ${2}
in
${0}
snippet if
if ${1} then
${2:${VISUAL}}
else
${0}
snippet ty
type ${1:Msg}
= ${0}
snippet tya
type alias ${1:Model} =
${0}

View File

@ -24,6 +24,10 @@ snippet incl
# behavior directive
snippet beh
-behaviour(${1:behaviour}).
snippet ifd
-ifdef(${1:TEST}).
${0}
-endif.
# if expression
snippet if
if
@ -42,7 +46,7 @@ snippet fun
# try...catch
snippet try
try
${1}
${1:${VISUAL}}
catch
${2:_:_} -> ${0:got_some_exception}
end
@ -103,8 +107,8 @@ snippet supervisor
supervisor:start_link({local, ?SERVER}, ?MODULE, []).
init([]) ->
Server = {${0:my_server}, {$2, start_link, []},
permanent, 2000, worker, [$2]},
Server = {${0:my_server}, {${2}, start_link, []},
permanent, 2000, worker, [${2}]},
Children = [Server],
RestartStrategy = {one_for_one, 0, 1},
{ok, {RestartStrategy, Children}}.
@ -478,26 +482,57 @@ snippet gen_event
%%%===================================================================
%%% Internal functions
%%%===================================================================
# EUnit snippets
snippet eunit
-module(${1:`vim_snippets#Filename('', 'my')`}).
-include_lib("eunit/include/eunit.hrl").
${0}
snippet ieunit
-ifdef(TEST).
-include_lib("eunit/include/eunit.hrl").
${0}
-endif.
snippet as
?assert(${0})
snippet asn
?assertNot(${0})
snippet aseq
?assertEqual(${1}, ${0})
snippet asneq
?assertNotEqual(${1}, ${0})
snippet asmat
?assertMatch(${1:Pattern}, ${0:Expression})
snippet asnmat
?assertNotMatch(${1:Pattern}, ${0:Expression})
snippet aserr
?assertError(${1:Pattern}, ${0:Expression})
snippet asex
?assertExit(${1:Pattern}, ${0:Expression})
snippet asexc
?assertException(${1:Class}, ${2:Pattern}, ${0:Expression})
# common_test test_SUITE
snippet testsuite
-module(${0:`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
%%
@ -512,7 +547,7 @@ snippet testsuite
%%--------------------------------------------------------------------
suite() ->
[{timetrap,{minutes,10}}].
%%--------------------------------------------------------------------
%% Function: init_per_suite(Config0) ->
%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
@ -529,7 +564,7 @@ snippet testsuite
%%--------------------------------------------------------------------
init_per_suite(Config) ->
Config.
%%--------------------------------------------------------------------
%% Function: end_per_suite(Config0) -> void() | {save_config,Config1}
%%
@ -540,7 +575,7 @@ snippet testsuite
%%--------------------------------------------------------------------
end_per_suite(_Config) ->
ok.
%%--------------------------------------------------------------------
%% Function: init_per_group(GroupName, Config0) ->
%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
@ -556,7 +591,7 @@ snippet testsuite
%%--------------------------------------------------------------------
init_per_group(_GroupName, Config) ->
Config.
%%--------------------------------------------------------------------
%% Function: end_per_group(GroupName, Config0) ->
%% void() | {save_config,Config1}
@ -570,7 +605,7 @@ snippet testsuite
%%--------------------------------------------------------------------
end_per_group(_GroupName, _Config) ->
ok.
%%--------------------------------------------------------------------
%% Function: init_per_testcase(TestCase, Config0) ->
%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
@ -589,7 +624,7 @@ snippet testsuite
%%--------------------------------------------------------------------
init_per_testcase(_TestCase, Config) ->
Config.
%%--------------------------------------------------------------------
%% Function: end_per_testcase(TestCase, Config0) ->
%% void() | {save_config,Config1} | {fail,Reason}
@ -605,7 +640,7 @@ snippet testsuite
%%--------------------------------------------------------------------
end_per_testcase(_TestCase, _Config) ->
ok.
%%--------------------------------------------------------------------
%% Function: groups() -> [Group]
%%
@ -629,7 +664,7 @@ snippet testsuite
%%--------------------------------------------------------------------
groups() ->
[].
%%--------------------------------------------------------------------
%% Function: all() -> GroupsAndTestCases | {skip,Reason}
%%
@ -644,14 +679,14 @@ snippet testsuite
%% Description: Returns the list of groups and test cases that
%% are to be executed.
%%--------------------------------------------------------------------
all() ->
all() ->
[].
%%--------------------------------------------------------------------
%% TEST CASES
%%--------------------------------------------------------------------
%%--------------------------------------------------------------------
%% Function: TestCase(Config0) ->
%% ok | exit() | {skip,Reason} | {comment,Comment} |

View File

@ -1,6 +1,7 @@
# .erb and .rhmtl files
# Includes html.snippets
extends html
# Rails *****************************
snippet rc
@ -22,23 +23,23 @@ snippet for
${0}
<% end %>
snippet rp
<%= render :partial => '${0:item}' %>
<%= render partial: '${0:item}' %>
snippet rpl
<%= render :partial => '${1:item}', :locals => { :${2:name} => '${3:value}'${0} } %>
<%= render partial: '${1:item}', locals: { :${2:name} => '${3:value}'${0} } %>
snippet rps
<%= render :partial => '${1:item}', :status => ${0:500} %>
<%= render partial: '${1:item}', status: ${0:500} %>
snippet rpc
<%= render :partial => '${1:item}', :collection => ${0:items} %>
<%= render partial: '${1:item}', collection: ${0:items} %>
snippet lia
<%= link_to '${1:link text...}', :action => '${0:index}' %>
<%= link_to '${1:link text...}', action: '${0:index}' %>
snippet liai
<%= link_to '${1:link text...}', :action => '${2:edit}', :id => ${0:@item} %>
<%= link_to '${1:link text...}', action: '${2:edit}', id: ${0:@item} %>
snippet lic
<%= link_to '${1:link text...}', :controller => '${0:items}' %>
<%= link_to '${1:link text...}', controller: '${0:items}' %>
snippet lica
<%= link_to '${1:link text...}', :controller => '${2:items}', :action => '${0:index}' %>
<%= link_to '${1:link text...}', controller: '${2:items}', action: '${0:index}' %>
snippet licai
<%= link_to '${1:link text...}', :controller => '${2:items}', :action => '${3:edit}', :id => ${0:@item} %>
<%= link_to '${1:link text...}', controller: '${2:items}', action: '${3:edit}', id: ${0:@item} %>
snippet yield
<%= yield ${1::content_symbol} %>
snippet conf
@ -110,16 +111,16 @@ snippet ofcfs
snippet ofs
<%= options_for_select ${1:collection}, ${2:value_method} %>
snippet rf
<%= render :file => "${1:file}"${0} %>
<%= render file: "${1:file}"${0} %>
snippet rt
<%= render :template => "${1:file}"${0} %>
<%= render template: "${1:file}"${0} %>
snippet slt
<%= stylesheet_link_tag ${1::all}, :cache => ${0:true} %>
<%= stylesheet_link_tag ${1::all}, cache: ${0:true} %>
snippet sslt
<%= stylesheet_link_tag "${0}" %>
snippet if
<% if ${1} %>
${0}
${0:${VISUAL}}
<% end %>
snippet ife
<% if ${1} %>

View File

@ -0,0 +1,101 @@
snippet impl
implicit none
$0
snippet prog
program ${1:main}
$0
end program $1
snippet mod
module ${1:modulename}
$0
end module $1
snippet proc
procedure ${1:name}
${0}
end procedure $1
snippet iface
interface ${1:name}
${0}
end interface $1
snippet doc
! """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
! File: ${2:`vim_snippets#Filename('$1')`}
! Author: `g:snips_author`
! Email: `g:snips_email`
! Github: `g:snips_github`
! Description: $1
! """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
$0
snippet dox
!> @brief ${1}
!!
!> ${2}
!> @author `g:snips_author`
${0}
snippet doxp
!> @param[${1}]${0}
# Variables definitions
# Boolean
snippet bool
logical :: $0
# Integer
snippet int
integer :: $0
snippet real
real :: $0
# Double Precision
snippet double
double precision :: $0
# Char
snippet str
character(len=${1:*}) :: ${0:}
# Types
snippet type
type(${1:name})
$0
end type
snippet const
${1:type}, parameter :: $2 = $0
snippet arr
${1:type}, ${2:allocatable, }dimension(${3::}) :: $0
snippet intent
${1:type}, intent(inout) :: $0
# Array
snippet /
(/ $1 /) ${2:,&} $0
snippet if
if (${1:condition}) then
$0
end if
snippet case
select case (${1:expr})
case ($2)
case default
$3
end select $0
snippet do
do ${1:i} = ${2:start}, ${3:end}, ${4:incr}
$0
end do
snippet dow
do while (${1:condition})
$2
end do
snippet sub
subroutine ${1:name}($2)
$0
end subroutine $1
snippet func
function ${1:name}($2) result($3)
$0
end function $1
snippet pr
write(*,*) $0
snippet read
read(unit = ${1:fp}, file = ${2:filename}, iostat = ${3:ierr}) $0
snippet write
write(unit = ${1:fp}, file = ${2:filename}, iostat = ${3:ierr}) $0
snippet open
open(unit = ${1:fp}, file = ${2:filename}, status = ${3:unknown}, iostat = ${4:ierr}) $0
snippet close
close(unit = ${1:fp}) $0

View File

@ -30,7 +30,7 @@ snippet ch
# case
snippet cs
case ${1:value}:
${0}
${0:${VISUAL}}
# const
snippet c
const ${1:NAME} = ${0:0}
@ -50,29 +50,9 @@ snippet df
snippet dfr
defer func() {
if err := recover(); err != nil {
${0}
${0:${VISUAL}}
}
}()
# gpl
snippet gpl
/*
* 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/>.
*
* Copyright (C) ${1:Author}, `strftime("%Y")`
*/
${0}
# int
snippet i
int
@ -92,12 +72,18 @@ snippet inf
# if condition
snippet if
if ${1:/* condition */} {
${2}
${2:${VISUAL}}
}
snippet ife
if ${1:/* condition */} {
${2:${VISUAL}}
} else {
${0}
}
# else snippet
snippet el
else {
${1}
${0:${VISUAL}}
}
# error snippet
snippet ir
@ -120,26 +106,21 @@ snippet f3
# float64
snippet f6
float64
# if else
snippet ie
if ${1:/* condition */} {
${2}
} else {
${3}
# for int loop
snippet for
for ${1}{
${0:${VISUAL}}
}
${0}
# for loop
snippet fo
# for int loop
snippet fori
for ${2:i} := 0; $2 < ${1:count}; $2${3:++} {
${4}
${0:${VISUAL}}
}
${0}
# for range loop
snippet fr
for ${1:k}, ${2:v} := range ${3} {
${4}
snippet forr
for ${1:e} := range ${2:collection} {
${0:${VISUAL}}
}
${0}
# function simple
snippet fun
func ${1:funcName}(${2}) ${3:error} {
@ -148,8 +129,8 @@ snippet fun
${0}
# function on receiver
snippet fum
func (self ${1:type}) ${2:funcName}(${3}) ${4:error} {
${5}
func (${1:receiver} ${2:type}) ${3:funcName}(${4}) ${5:error} {
${6}
}
${0}
# log printf
@ -173,12 +154,18 @@ snippet main
# new
snippet nw
new(${0:type})
# package
snippet pa
package ${1:main}
# panic
snippet pn
panic("${0:msg}")
# print
snippet pr
fmt.Printf("%${1:s}\n", ${2:var})
# println
snippet pl
fmt.Println("${1:s}")
# range
snippet rn
range ${0}
@ -193,8 +180,6 @@ snippet sl
select {
case ${1:v1} := <-${2:chan1}
${3}
case ${4:v2} := <-${5:chan2}
${6}
default:
${0}
}
@ -225,16 +210,15 @@ snippet t
# goroutine named function
snippet g
go ${1:funcName}(${0})
# goroutine anonymous function
# goroutine anonymous function
snippet ga
go func(${1} ${2:type}) {
${3:/* code */}
}(${0})
snippet test test function
func Test${1:name}(t *testing.T) {
${2}
${0:${VISUAL}}
}
${0}
snippet bench benchmark function
func Benchmark${1:name}(b *testing.B) {
for i := 0; i < b.N; i++ {

View File

@ -27,11 +27,11 @@ snippet mts
= mail_to ${1:email_address}, ${2:name}, :subject => ${3}, :body => ${4}
snippet ife
- if ${1:condition}
${2}
${2:${VISUAL}}
- else
${0}
snippet ifp
- if ${1:condition}.presence?
${0}
${0:${VISUAL}}
snippet ntc
= number_to_currency(${1})

View File

@ -0,0 +1,14 @@
snippet if # {{#if value}} ... {{/if}}
{{#if ${1:value}}}
${0:${VISUAL}}
{{/if}}
snippet ifn # {{#unless value}} ... {{/unless}}
{{#unless ${1:value}}}
${0:${VISUAL}}
{{/unless}}
snippet ife # {{#if value}} ... {{else}} .. {{/if}}
{{#if ${1:value}}}
${2:${VISUAL}}
{{else}}
${3}
{{/if}}

View File

@ -2,9 +2,13 @@ snippet lang
{-# LANGUAGE ${0:OverloadedStrings} #-}
snippet haddock
{-# OPTIONS_HADDOCK ${0:hide} #-}
snippet ghc
{-# OPTIONS_GHC ${0:-fno-warn-unused-imports} #-}
snippet inline
{-# INLINE ${0:name} #-}
snippet info
-- |
-- Module : ${1:Module.Namespace}
-- Module : ${1:`substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')`}
-- Copyright : ${2:Author} ${3:2011-2012}
-- License : ${4:BSD3}
--
@ -38,9 +42,12 @@ snippet class
${0}
snippet module
module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` (
) where
`expand('%') =~ 'Main' ? "\n\nmain = do\n print \"hello world\"" : ""`
) where
`expand('%') =~ 'Main' ? "\nmain :: IO ()\nmain = undefined" : ""`
snippet main
main :: IO ()
main = ${0:undefined}
snippet const
${1:name} :: ${2:a}
$1 = ${0:undefined}
@ -50,25 +57,21 @@ snippet fn
snippet fn2
${1:fn} :: ${2:a} -> ${3:a} -> ${4:a}
$1 ${5} = ${0:undefined}
snippet fn3
${1:fn} :: ${2:a} -> ${3:a} -> ${4:a} -> ${5:a}
$1 ${6} = ${0:undefined}
snippet => "Type constraint"
(${1:Class} ${2:a}) => $2
snippet ap
${1:map} ${2:fn} ${0:list}
snippet do
do
snippet λ
\\${1:x} -> ${0:expression}
snippet \
\\${1:x} -> ${0:expression}
snippet (\
(\\${1:x} -> ${0:expression})
snippet <-
${1:a} <- ${0:m a}
snippet ←
${1:a} <- ${0:m a}
snippet ->
${1:m a} -> ${0:a}
snippet →
${1:m a} -> ${0:a}
snippet tup
(${1:a}, ${0:b})
snippet tup2
@ -88,3 +91,25 @@ snippet let
snippet where
where
${1:fn} = ${0:undefined}
snippet spec
module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` (main, spec) where
import Test.Hspec
import Test.QuickCheck
main :: IO ()
main = hspec spec
spec :: Spec
spec =
describe "${1}" $ do
$0
snippet desc
describe "${1}" $ do
$0
snippet it
it "${1}" $
$0
snippet itp
it "${1}" $ property $
$0

View File

@ -254,11 +254,11 @@ snippet colgroup+
col+${0}
</colgroup>
snippet command
<command type="command" label="${1}" icon="${0}" />
<command type="command" label="${1}" icon="${0}">
snippet command:c
<command type="checkbox" label="${1}" icon="${0}" />
<command type="checkbox" label="${1}" icon="${0}">
snippet command:r
<command type="radio" radiogroup="${1}" label="${2}" icon="${0}" />
<command type="radio" radiogroup="${1}" label="${2}" icon="${0}">
snippet datagrid
<datagrid>
${0}
@ -550,8 +550,6 @@ snippet ins
<ins>${0}</ins>
snippet kbd
<kbd>${0}</kbd>
snippet keygen
<keygen>${0}</keygen>
snippet label
<label for="${0:$1}">${1}</label>
snippet label:i
@ -592,6 +590,10 @@ snippet link:rss
<link rel="alternate" href="${1:rss.xml}" title="RSS" type="application/atom+xml" />
snippet link:touch
<link rel="apple-touch-icon" href="${1:favicon.png}" />
snippet main
<main role="main">
${0}
</main>
snippet map
<map name="${1}">
${0}
@ -702,6 +704,10 @@ snippet output
<output>${0}</output>
snippet p
<p>${0}</p>
snippet p.
<p class="${1}">${0}</p>
snippet p#
<p id="${1}">${0}</p>
snippet param
<param name="${1}" value="${2}" />
snippet pre
@ -727,7 +733,7 @@ snippet samp
${0}
</samp>
snippet script
<script type="text/javascript" charset="utf-8">
<script charset="utf-8">
${0}
</script>
snippet scripts
@ -737,7 +743,7 @@ snippet scriptt
${0}
</script>
snippet scriptsrc
<script src="${0}.js" type="text/javascript" charset="utf-8"></script>
<script src="${0}.js" charset="utf-8"></script>
snippet section
<section>
${0}
@ -845,7 +851,7 @@ snippet tr+
td+${0}
</tr>
snippet track
<track src="${1}" srclang="${2}" label="${3}" default="${4:default}>${5}</track>
<track src="${1}" srclang="${2}" label="${3}" default="${4:default} />${5}
snippet ul
<ul>
${0}
@ -869,3 +875,5 @@ snippet video
<video src="${1} height="${2}" width="${3}" preload="${5:none}" autoplay="${6:autoplay}>${7}</video>
snippet wbr
<wbr />
snippet viewport
<meta name="viewport" content="width=device-width, initial-scale=1">

View File

@ -1,5 +1,7 @@
# Generic tags
extends html
snippet %
{% ${1} %}
snippet %%
@ -138,4 +140,3 @@ snippet urlizetrunc
urlizetrunc:${0}
snippet wordwrap
wordwrap:${0}

View File

@ -43,7 +43,7 @@ snippet set
{% set ${1:x} = ${0:y} %}
snippet try
{% try %}
${1}
${1:${VISUAL}}
{% except %}
${2}
{% finallly %}

View File

@ -163,12 +163,12 @@ snippet ths
throws ${0}
snippet try
try {
${0}
${0:${VISUAL}}
} catch(${1:Exception} ${2:e}) {
}
snippet tryf
try {
${0}
${0:${VISUAL}}
} catch(${1:Exception} ${2:e}) {
} finally {
}
@ -214,18 +214,28 @@ snippet wh
while (${1}) ${0}
##
## Main method
snippet psvm
public static void main (String[] args) {
${0}
}
snippet main
public static void main (String[] args) {
${0}
}
##
## Print Methods
snippet sout
System.out.println(${0});
snippet serr
System.err.println(${0});
snippet print
System.out.print("${0:Message}");
snippet printf
System.out.printf("${1:Message}", ${0:args});
snippet println
System.out.println(${0});
snippet printlna
System.out.println(Arrays.toString(${0}));
##
## Render Methods
snippet ren

View File

@ -0,0 +1,52 @@
# Snippet for bemjson. https://en.bem.info/platform/bemjson/
# Blocks
snippet b
{
block : '${1:name}',
content : [
'${2:content}'
]
}
# btc - BEM block with text content
snippet btc
{
block : '${1:name}',
content: '${2:content}'
}
# bwm - BEM block with modifier.
snippet bwm
{
block : '${1:name}',
mods: { ${2:modName}: '${3:modVal}' },
content : [
'${4:content}'
]
}
# Elems
# e - BEM elem
snippet e
{
elem : '${1:name}',
content : [
'${2:content}'
]
}
# mo - Mods
snippet mo
mods : { ${1:modName} : '${2:modVal}' },
# mi - BEM mix mod
snippet mi
mix : [ { ${1:block} : '${2:block}' } ],
# a - BEM attrs mod
snippet a
attrs : { ${1:attr} : '${2:val}' },

View File

@ -16,8 +16,8 @@ snippet marginconvention
var ${8:height} = ${9:500} - $1.top - $1.bottom;
var ${10:svg} = d3.select("${11}").append("svg")
.attr("width", $6)
.attr("height", $8)
.attr("width", $6 + $1.left + $1.right)
.attr("height", $8 + $1.top + $1.bottom)
.append("g")
.attr("transform", "translate(" + $1.left + "," + $1.top + ")")
snippet nest

View File

@ -0,0 +1,34 @@
snippet des "describe('thing', () => { ... })" b
describe('${1:}', () => {
${0:${VISUAL}}
});
snippet it "it('should do', () => { ... })" b
it('${1:}', () => {
${0:${VISUAL}}
});
snippet xit "xit('should do', () => { ... })" b
xit('${1:}', () => {
${0:${VISUAL}}
});
snippet bef "before(() => { ... })" b
before(() => {
${0:${VISUAL}}
});
snippet befe "beforeEach(() => { ... })" b
beforeEach(() => {
${0:${VISUAL}}
});
snippet aft "after(() => { ... })" b
after(() => {
${0:${VISUAL}}
});
snippet afte "afterEach(() => { ... })" b
afterEach(() => {
${0:${VISUAL}}
});
snippet exp "expect(...)" b
expect(${1:})${0};
snippet expe "expect(...).to.equal(...)" b
expect(${1:}).to.equal(${0});
snippet expd "expect(...).to.deep.equal(...)" b
expect(${1:}).to.deep.equal(${0});

View File

@ -0,0 +1,81 @@
# Import only React
snippet ri1
import React from 'react'
# Import both React and Component
snippet ri2
import React, { Component, PropTypes } from 'react'
# React class
snippet rcla
class ${1:MyComponent} extends Component {
render() {
return (
${0:<div></div>}
)
}
}
# React constructor
snippet rcon
constructor(props) {
super(props)
this.state = {
${1}: ${0},
}
}
# Proptypes for React Class
snippet rcpt
static propTypes = {
${1}: PropTypes.${0},
}
# Default props for React Class
snippet rcdp
static defaultProps = {
${1}: ${0},
}
# Presentational component
snippet rcom
(props) => {
return (
${0:<div></div>}
)
}
# Proptypes for Presentational component
snippet rpt
${1}.propTypes = {
${2}: PropTypes.${0},
}
# Default props for Presentational component
snippet rdp
${1}.defaultProps = {
${2}: ${0},
}
# Lifecycle Methods
snippet rcdm
componentDidMount() {
${0:${VISUAL}}
}
# State
snippet rsst
this.setState({
${1}: ${0},
})
snippet rtst
this.state.${0}
# Props
snippet rp
props.${0}
snippet rtp
this.props.${0}

View File

@ -0,0 +1,83 @@
snippet ir
import React from 'react';
snippet ird
import ReactDOM from 'react-dom';
snippet cdm
componentDidMount() {
${1}
}
snippet cdup
componentDidUpdate(prevProps, prevState) {
${1}
}
snippet cwm
componentWillMount() {
${1}
}
snippet cwr
componentWillReceiveProps(nextProps) {
${1}
}
snippet cwun
componentWillUnmount() {
${1}
}
snippet cwu
componentWillUpdate(nextProps, nextState) {
${1}
}
snippet fup
forceUpdate(${1:callback});
snippet dp
static defaultProps = {
${1}: ${2},
}
snippet st
state = {
${1}: ${2},
}
snippet pt
static propTypes = {
${1}: React.PropTypes.${2:type},
}
snippet rcc
class ${1:ClassName} extends React.Component {
render() {
return (
${0:<div />}
);
}
}
snippet rdr
ReactDOM.render(${1}, ${2})
snippet ercc
export default class ${1:ClassName} extends React.Component {
render() {
return (
${0:<div />}
);
}
}
snippet ctor
constructor() {
super();
${1}
}
snippet ren
render() {
return (
${1:<div />}
);
}
snippet sst
this.setState({
${1}: ${2}
});
snippet scu
shouldComponentUpdate(nextProps, nextState) {
${1}
}
snippet prp i
this.props.${1}
snippet ste i
this.state.${1}

View File

@ -0,0 +1,55 @@
snippet const
const ${1} = ${0};
snippet let
let ${1} = ${0};
snippet im "import xyz from 'xyz'"
import ${1} from '${2:$1}';
snippet imas "import * as xyz from 'xyz'"
import * as ${1} from '${2:$1}';
snippet imm "import { member } from 'xyz'"
import { ${1} } from '${2}';
snippet cla
class ${1} {
${0:${VISUAL}}
}
snippet clax
class ${1} extends ${2} {
${0:${VISUAL}}
}
snippet clac
class ${1} {
constructor(${2}) {
${0:${VISUAL}}
}
}
snippet foro "for (const prop of object}) { ... }"
for (const ${1:prop} of ${2:object}) {
${0:$1}
}
# Generator
snippet fun*
function* ${1:function_name}(${2}) {
${0:${VISUAL}}
}
snippet c=>
const ${1:function_name} = (${2}) => {
${0:${VISUAL}}
}
snippet caf
const ${1:function_name} = (${2}) => {
${0:${VISUAL}}
}
snippet =>
(${1}) => {
${0:${VISUAL}}
}
snippet af
(${1}) => {
${0:${VISUAL}}
}
snippet sym
const ${1} = Symbol('${0}');
snippet ed
export default ${0}
snippet ${
${${1}}${0}

View File

@ -1,9 +1,11 @@
snippet #!
#!/usr/bin/env node
# module exports
snippet ex
module.exports = ${1};
# require
snippet re
var ${1} = require('${2:module_name}');
${1:const} ${2} = require('${3:module_name}');
# EventEmitter
snippet on
on('${1:event_name}', function(${2:stream}) {

View File

@ -1,53 +1,60 @@
# Functions
# prototype
snippet proto
${1:class_name}.prototype.${2:method_name} = function(${3}) {
${0}
${0:${VISUAL}}
};
# Function
snippet fun
function ${1:function_name}(${2}) {
${0}
${0:${VISUAL}}
}
# Anonymous Function
snippet f
snippet f "" w
function(${1}) {
${0}
${0:${VISUAL}}
}
# Anonymous Function assigned to variable
snippet vaf
var ${1:function_name} = function(${2}) {
${0:${VISUAL}}
};
# Function assigned to variable
snippet vf
var ${1:function_name} = function $1(${2}) {
${0}
${0:${VISUAL}}
};
# Immediate function
snippet (f
(function(${1}) {
${0}
${0:${VISUAL}}
}(${2}));
# Minify safe iife
snippet ;fe
;(function(${1}) {
${0:${VISUAL}}
}(${2}))
# self-defining function
snippet sdf
var ${1:function_name} = function (${2:argument}) {
${3}
$1 = function ($2) {
${0}
${0:${VISUAL}}
};
};
# Flow control
# if
snippet if
snippet if "if (condition) { ... }"
if (${1:true}) {
${0}
${0:${VISUAL}}
}
# if ... else
snippet ife
snippet ife "if (condition) { ... } else { ... }"
if (${1:true}) {
${2}
${0:${VISUAL}}
} else {
${0}
${2}
}
# tertiary conditional
snippet ter
@ -62,58 +69,57 @@ snippet switch
default:
${2}
}
# case
snippet case
snippet case "case 'xyz': ... break"
case '${1:case}':
${2}
${0:${VISUAL}}
break;
${0}
# try
snippet try
snippet try "try { ... } catch(e) { ... }"
try {
${1}
} catch (${2:e}) {
${0:/* handle error */}
${0:${VISUAL}}
} catch (${1:e}) {
${2:/* handle error */}
}
snippet tryf "try { ... } catch(e) { ... } finally { ... }"
try {
${0:${VISUAL}}
} catch (${1:e}) {
${2:/* handle error */}
} finally {
${3:/* be executed regardless of the try / catch result*/}
}
# throw Error
snippet terr
throw new Error('${1:error message}')
# return
snippet ret
return ${0:result};
# Loops
# for loop
snippet for
for (var ${2:i} = 0, l = ${1:arr}.length; $2 < l; $2 ++) {
var ${3:v} = $1[$2];${0:}
snippet for "for (...) {...}"
for (var ${1:i} = 0, ${2:len} = ${3:Things.length}; $1 < $2; $1++) {
${0:${VISUAL}}
}
# Reversed for loop
snippet forr
for (var ${2:i} = ${1:arr}.length - 1; $2 >= 0; $2 --) {
var ${3:v} = $1[$2];${0:}
snippet forr "reversed for (...) {...}"
for (var ${2:i} = ${1:Things.length} - 1; $2 >= 0; $2--) {
${0:${VISUAL}}
}
# While loop
snippet wh
snippet wh "(condition) { ... }"
while (${1:/* condition */}) {
${0}
${0:${VISUAL}}
}
# Do while loop
snippet do
snippet do "do { ... } while (condition)"
do {
${0}
${0:${VISUAL}}
} while (${1:/* condition */});
# For in loop
snippet fori
for (var ${1:prop} in ${2:object}) {
${0:$2[$1]}
}
# Objects
# Object Method
snippet :f
${1:method_name}: function (${2:attribute}) {
${0}
}${3:,}
${0:${VISUAL}}
},
# hasOwnProperty
snippet has
hasOwnProperty(${0})
@ -185,9 +191,7 @@ snippet prop
configurable : ${0:boolean}
}
);
# Documentation
# docstring
snippet /**
/**
@ -198,7 +202,6 @@ snippet @par
@param {${1:type}} ${2:name} ${0:description}
snippet @ret
@return {${1:type}} ${0:description}
# JSON
# JSON.parse
@ -207,9 +210,7 @@ snippet jsonp
# JSON.stringify
snippet jsons
JSON.stringify(${0:object});
# DOM selectors
# Get elements
snippet get
getElementsBy${1:TagName}('${0}')
@ -228,30 +229,53 @@ snippet qs
# Query selector all
snippet qsa
${1:document}.querySelectorAll('${0:CSS selector}')
# Debugging
# console.log
snippet cl
snippet de
debugger;
snippet cl "console.log"
console.log(${0});
# console.debug
snippet cd
snippet cd "console.debug"
console.debug(${0});
# console.trace
snippet ct
snippet ce "console.error"
console.error(${0});
snippet cw "console.warn"
console.warn(${0});
snippet ci "console.info"
console.info(${0});
snippet ct "console.trace"
console.trace(${0:label});
# console.time
snippet ctime
console.time(${0:label});
# console.assert
snippet ca
snippet ctime "console.time ... console.timeEnd"
console.time("${1:label}");
${0:${VISUAL}}
console.timeEnd("$1");
snippet ctimestamp "console.timeStamp"
console.timeStamp("${1:label}");
snippet ca "console.assert"
console.assert(${1:expression}, ${0:obj});
# console.dir
snippet cdir
snippet cclear "console.clear"
console.clear();
snippet cdir "console.dir"
console.dir(${0:obj});
snippet cdirx "console.dirxml"
console.dirxml(${1:object});
snippet cgroup "console.group"
console.group("${1:label}");
${0:${VISUAL}}
console.groupEnd();
snippet cgroupc "console.groupCollapsed"
console.groupCollapsed("${1:label}");
${0:${VISUAL}}
console.groupEnd();
snippet cprof "console.profile"
console.profile("${1:label}");
${0:${VISUAL}}
console.profileEnd();
snippet ctable "console.table"
console.table(${1:"${2:value}"});
# Misc
# 'use strict';
snippet us
'use strict';
# setTimeout function
snippet timeout
setTimeout(function () {${0}}${2}, ${1:10});

View File

@ -0,0 +1,142 @@
# Generic tags
extends html
snippet %
{% ${1} %}
snippet %%
{% ${1:tag_name} %}
${0}
{% end$1 %}
snippet {
{{ ${1} }}
# Template Tags
snippet autoescape
{% autoescape ${1:off} %}
${0}
{% endautoescape %}
snippet block
{% block ${1} %}
${0}
{% endblock %}
snippet #
{# ${0:comment} #}
snippet comment
{% comment %}
${0}
{% endcomment %}
snippet cycle
{% cycle ${1:val1} ${2:val2} ${3:as ${4}} %}
snippet debug
{% debug %}
snippet extends
{% extends "${0:base.html}" %}
snippet filter
{% filter ${1} %}
${0}
{% endfilter %}
snippet firstof
{% firstof ${1} %}
snippet for
{% for ${1} in ${2} %}
${0}
{% endfor %}
snippet empty
{% empty %}
${0}
snippet if
{% if ${1} %}
${0}
{% endif %}
snippet el
{% else %}
${1}
snippet eif
{% elif ${1} %}
${0}
snippet ifchanged
{% ifchanged %}${1}{% endifchanged %}
snippet ifequal
{% ifequal ${1} ${2} %}
${0}
{% endifequal %}
snippet ifnotequal
{% ifnotequal ${1} ${2} %}
${0}
{% endifnotequal %}
snippet include
{% include "${0}" %}
snippet load
{% load ${0} %}
snippet now
{% now "${0:jS F Y H:i}" %}
snippet regroup
{% regroup ${1} by ${2} as ${0} %}
snippet spaceless
{% spaceless %}${0}{% endspaceless %}
snippet ssi
{% ssi ${0} %}
snippet trans
{% trans %}${0}{% endtrans %}
snippet url
{% url ${1} as ${0} %}
snippet widthratio
{% widthratio ${1:this_value} ${2:max_value} ${0:100} %}
snippet with
{% with ${1} as ${2} %}
${0}
{% endwith %}
# Template Filters
# Note: Since SnipMate can't determine which template filter you are
# expanding without the "|" character, these do not add the "|"
# character. These save a few keystrokes still.
# Note: Template tags that take no arguments are not implemented.
snippet add
add:"${0}"
snippet center
center:"${0}"
snippet cut
cut:"${0}"
snippet date
date:"${0}"
snippet default
default:"${0}"
snippet defaultifnone
default_if_none:"${0}"
snippet dictsort
dictsort:"${0}"
snippet dictsortrev
dictsortreversed:"${0}"
snippet divisibleby
divisibleby:"${0}"
snippet floatformat
floatformat:"${0}"
snippet getdigit
get_digit:"${0}"
snippet join
join:"${0}"
snippet lengthis
length_is:"${0}"
snippet pluralize
pluralize:"${0}"
snippet removetags
removetags:"${0}"
snippet slice
slice:"${0}"
snippet stringformat
stringformat:"${0}"
snippet time
time:"${0}"
snippet truncatewords
truncatewords:${0}
snippet truncatewordshtml
truncatewords_html:${0}
snippet urlizetrunc
urlizetrunc:${0}
snippet wordwrap
wordwrap:${0}

View File

@ -75,7 +75,7 @@ snippet tern ternary operator
# Exceptions
snippet try try catch
try
${1}
${1:${VISUAL}}
catch ${2}
${0}
end

View File

@ -0,0 +1,242 @@
#resource controller
snippet l_rsc
/*!
* \class $1
*
* \author ${3:`!v g:snips_author`}
* \date `!v strftime('%d-%m-%y')`
*/
class ${1:`!v expand('%:t:r')`} extends ${2:BaseController} {
function __construct() {
}
public function index() {
}
public function create() {
}
public function store() {
}
public function show($id) {
}
public function edit($id) {
}
public function update($id) {
}
public function destroy($id) {
}
}
#service service provider
snippet l_ssp
/*!
* \namespace $1
* \class $2
*
* \author ${3:`!v g:snips_author`}
* \date `!v strftime('%d-%m-%y')`
*/
namespace ${1:Services};
use Illuminate\Support\ServiceProvider;
class ${2:`!v expand('%:t:r')`} extends ServiceProvider {
public function register() {
$this->app->bind('${4}Service', function ($app) {
return new ${5}(
$app->make('Repositories\\${6}Interface')
);
});
}
}
#repository service provider
snippet l_rsp
/*!
* \namespace $2
* \class $3
*
* \author ${4:`!v g:snips_author`}
* \date `!v strftime('%d-%m-%y')`
*/
namespace ${2:Repositories\\${1:}};
use Entities\\$1;
use $2\\$1Repository;
use Illuminate\Support\ServiceProvider;
class ${3:`!v expand('%:t:r')`} extends ServiceProvider {
/*!
* \var defer
* \brief Defer service
*/
protected $defer = ${5:true};
public function register() {
$this->app->bind('$2\\$1Interface', function($app) {
return new $1Repository(new $1());
});
}
/*!
* \brief If $defer == true need this fn
*/
public function provides() {
return ['$2\\$1Interface'];
}
}
#model
snippet l_md
/*!
* \namespace $1
* \class $2
*
* \author ${3:`!v g:snips_author`}
* \date `!v strftime('%d-%m-%y')`
*/
namespace ${1:Entities};
class ${2:`!v expand('%:t:r')`} extends \Eloquent {
protected $table = '${4:`!p snip.rv = t[2].lower()`}';
public $timestamps = ${5:false};
protected $hidden = array(${6});
protected $guarded = array(${7:'id'});
}
#abstract repository
snippet l_ar
/*!
* \namespace $1
* \class $2
* \implements $3
*
* \author ${4:`!v g:snips_author`}
* \date `!v strftime('%d-%m-%y')`
*/
namespace ${1:Repositories};
use Illuminate\Database\Eloquent\Model;
abstract class ${2:`!v expand('%:t:r')`} implements ${3:BaseRepositoryInterface} {
protected $model;
/*!
* \fn __construct
*
* \brief Take the model
*/
public function __construct(Model $model) {
$this->model = $model;
}
/*!
* \fn all
*
* \return Illuminate\Database\Eloquent\Collection
*/
public function all($columns = array('*')) {
return $this->model->all()->toArray();
}
/*!
* \fn create
*
* \return Illuminate\Database\Eloquent\Model
*/
public function create(array $attributes) {
return $this->model->create($attributes);
}
/*!
* \fn destroy
*
* \return int
*/
public function destroy($ids) {
return $this->model->destroy($ids);
}
/*!
* \fn find
*
* \return mixed
*/
public function find($id, $columns = array('*')) {
return $this->model->find($id, $columns);
}
}
#repository
snippet l_r
/*!
* \namespace $1
* \class $3
* \implements $4
*
* \author ${5:`!v g:snips_author`}
* \date `!v strftime('%d-%m-%y')`
*/
namespace ${1:Repositories\\${2}};
class ${3:`!v expand('%:t:r')`} extends \\${6} implements ${4:$3RepositoryInterface} {
${7}
}
#service
snippet l_s
/*!
* \namespace $1
* \class $2
*
* \author ${6:`!v g:snips_author`}
* \date `!v strftime('%d-%m-%y')`
*/
namespace Services\\${1};
use ${3:Repositories\\${4:Interface}};
class ${2:`!v expand('%:t:r')`} {
protected $${5:repo};
/*!
* \fn __construct
*/
public function __construct($4 $repo) {
$this->$5 = $repo;
}
}
#facade
snippet l_f
/*!
* \namespace $1
* \class $2
*
* \author ${5:`!v g:snips_author`}
* \date `!v strftime('%d-%m-%y')`
*/
namespace ${1:Services};
use \Illuminate\Support\Facades\Facade;
class ${2:`!v expand('%:t:r')`} extends Facade {
/*!
* \fn getFacadeAccessor
*
* \return string
*/
protected static function getFacadeAccessor() { return '${4:${3}Service}'; }
}

View File

@ -0,0 +1,18 @@
snippet defmo
(defmodule ${1:`vim_snippets#Filename()`}
(export ${2:all}))
$0
snippet def
(defun $1 ($2)
$0)
snippet ltest
(defmodule ${1:`vim_snippets#Filename()`}
(behaviour ltest-unit)
(export all))
(include-lib "ltest/include/ltest-macros.lfe")
$0
snippet test
(deftest $1
$0)

View File

@ -93,7 +93,7 @@ snippet str
# Try __ Catch
snippet try
try
${1}
${1:${VISUAL}}
catch ${2:error}
${3}
# Require

View File

@ -1,4 +1,50 @@
snippet ifeq
ifeq (${1:cond0},${2:cond1})
# base
snippet base
.PHONY: clean, mrproper
CC = gcc
CFLAGS = -g -Wall
all: $1
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
${1:out}: $1.o
$(CC) $(CFLAGS) -o $@ $+
clean:
rm -f *.o core.*
mrproper: clean
rm -f $1
# add
snippet add
${1:out}: $1.o
$(CC) $(CFLAGS) -o $@ $+
# print
snippet print
print-%: ; @echo $*=$($*)
# ifeq
snippet if
ifeq (${1:cond0}, ${2:cond1})
${0:${VISUAL}}
endif
# ifeq ... else ... endif
snippet ife
ifeq (${1:cond0}, ${2:cond1})
${3:${VISUAL}}
else
${0}
endif
# else ...
snippet el
else
${0:${VISUAL}}
# .DEFAULT_GOAL := target
snippet default
.DEFAULT_GOAL := ${1}
# help target for self-documented Makefile
snippet help
help: ## Prints help for targets with comments
@cat $(MAKEFILE_LIST) | grep -E '^[a-zA-Z_-]+:.*?## .*$$' | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $\$1, $\$2}'
${0}

View File

@ -30,7 +30,7 @@ snippet ife if/else
% endif
snippet try
% try:
${1:}
${1:${VISUAL}}
% except${2:}:
${0:pass}
% endtry

View File

@ -2,30 +2,81 @@
# Includes octopress (http://octopress.org/) snippets
snippet [
[${1:text}](http://${2:address} "${0:title}")
snippet [*
[${1:link}](${2:`@*`} "${3:title}")
# The suffix `c` stands for "Clipboard".
snippet [
[${1:text}](http://${2:address})
snippet [*
[${1:link}](${2:`@*`})
snippet [c
[${1:link}](${2:`@+`})
snippet ["
[${1:text}](http://${2:address} "${3:title}")
snippet ["*
[${1:link}](${2:`@*`} "${3:title}")
snippet ["c
[${1:link}](${2:`@+`} "${3:title}")
snippet [:
[${1:id}]: http://${2:url} "${0:title}"
[${1:id}]: http://${2:url}
snippet [:*
[${1:id}]: ${2:`@*`} "${0:title}"
[${1:id}]: ${2:`@*`}
snippet [:c
[${1:id}]: ${2:`@+`}
snippet [:"
[${1:id}]: http://${2:url} "${3:title}"
snippet [:"*
[${1:id}]: ${2:`@*`} "${3:title}"
snippet [:"c
[${1:id}]: ${2:`@+`} "${3:title}"
snippet ![
![${1:alttext}](${2:/images/image.jpg} "${0:title}")
![${1:alttext}](${2:/images/image.jpg})
snippet ![*
![${1:alt}](${2:`@*`})
snippet ![c
![${1:alt}](${2:`@+`})
snippet !["
![${1:alttext}](${2:/images/image.jpg} "${3:title}")
snippet !["*
![${1:alt}](${2:`@*`} "${3:title}")
snippet !["c
![${1:alt}](${2:`@+`} "${3:title}")
snippet ![:
![${1:id}]: ${2:url} "${0:title}"
snippet ![:*
![${1:id}]: ${2:`@*`} "${0:title}"
![${1:id}]: ${2:url}
snippet ![:*
![${1:id}]: ${2:`@*`}
snippet ![:"
![${1:id}]: ${2:url} "${3:title}"
snippet ![:"*
![${1:id}]: ${2:`@*`} "${3:title}"
snippet ![:"c
![${1:id}]: ${2:`@+`} "${3:title}"
snippet <
<http://${1:url}>
snippet <*
<`@*`>
snippet <c
<`@+`>
snippet **
**${1:bold}**
snippet __
__${1:bold}__
snippet ===
`repeat('=', strlen(getline(line(".") - 1)) - strlen(getline('.')))`
${0}
snippet -
- ${0}
snippet ---
`repeat('-', strlen(getline(line(".") - 1)) - strlen(getline('.')))`
@ -46,15 +97,16 @@ snippet blockquote-link
${0:quote}
{% endblockquote %}
snippet bt-codeblock-short
```
${0:code_snippet}
```
snippet ```
\`\`\`
${1:code}
\`\`\`
snippet bt-codeblock-full
``` ${1:language} ${2:title} ${3:URL} ${4:link_text}
${0:code_snippet}
```
# Language.
snippet ```l
\`\`\`${1:language}
${2:code}
\`\`\`
snippet codeblock-short
{% codeblock %}

View File

@ -0,0 +1,64 @@
snippet if if
if ${1}
${0}
end
snippet ife if ... else
if ${1}
${2}
else
${0}
end
snippet el else
else
${0}
snippet eif elsif
elseif ${1}
${0}
snippet wh while
while ${1}
${0}
end
snippet for for
for ${1:i} = ${2:1:n}
${0}
end
snippet parfor parfor
parfor ${1:i} = ${2:1:n}
${0}
end
snippet fun function
function [${3:out}] = ${1:`vim_snippets#Filename("$1", "fun_name")`}(${2})
${0}
snippet try try ... catch
try
${1}
catch ${2:err}
${0}
end
snippet switch switch
switch ${1:n}
case ${2:0}
${0}
end
snippet @ anonymous function
@(${1:x}) ${0:x*x}
snippet cl class
classdef ${1:`vim_snippets#Filename("$1", "class_name")`}
properties
${2}
end
methods
${0}
end
end

View File

@ -0,0 +1,15 @@
snippet if # {{#value}} ... {{/value}}
{{#${1:value}}}
${0:${VISUAL}}
{{/$1}}
snippet ifn # {{^value}} ... {{/value}}
{{^${1:value}}}
${0:${VISUAL}}
{{/$1}}
snippet ife # {{#value}} ... {{/value}} {{^value}} ... {{/value}}
{{#${1:value}}}
${2:${VISUAL}}
{{/$1}}
{{^$1}}
${3}
{{/$1}}

View File

@ -84,7 +84,9 @@ snippet fore
${1:expression} foreach @${2:array};
# Package
snippet package
package ${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`};
package ${1:`expand('%:p:s?.*lib/??:r:gs?/?::?')`};
use strict;
use warnings;
${0}
@ -93,7 +95,9 @@ snippet package
__END__
# Package syntax perl >= 5.14
snippet packagev514
package ${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`} ${2:0.99};
package ${1:`expand('%:p:s?.*lib/??:r:gs?/?::?')`} ${2:0.99};
use v5.14;
use warnings;
${0}

View File

@ -0,0 +1,116 @@
# shebang
snippet #!
#!/usr/bin/env perl6
# Hash Pointer
snippet .
=>
# Function
snippet sub
sub ${1:function_name}(${2:Str $var}) {
${3}
}
snippet mul
multi ${1:function_name}(${2:Str $var}) {
${3}
}
# Conditional
snippet if
if ${1} {
${2}
}
# Conditional if..else
snippet ife
if ${1} {
${2}
}
else {
${3}
}
snippet eif
elsif ${1) {
${2}
}
# Conditional One-line
snippet xif
${1:expression} if ${2:condition};
# Unless conditional
snippet unless
unless ${1} {
${2}
}
# Unless conditional One-line
snippet xunless
${1:expression} unless ${2:condition};
# Ternary conditional
snippet tc
${1:condition} ?? ${2:value-if-true} !! ${3:value-if-false};
# given - when (perl6 switch)
snippet switch
given ${1:$var} {
when ${2:condition} {
${3:# code block ...}
}
${4}
default {
${5}
}
}
# 'loop' - C's for.
snippet loop
loop (my ${1:$i} = 0; $$1 < ${2:count}; $$1++) {
${3}
}
# for loop
snippet for
for ${1:@array} -> ${2:$variable} {
${3}
}
# While Loop
snippet wh
while ${1} {
${2}
}
# Repeat while and repean until
snippet rp
repeat {
${1}
} ${2:while|until} ${3};
# classes ..
snippet cl
${1:my} class ${2:ClassName} ${3:is|does Parent|Role}{
${4}
}
snippet has
has ${1:Type} ${2:$!identifier};
snippet mth
method ${1:method_name}(${2:$attr}) {
${3}
}
snippet pmth
method ${1:!}${2:method_name}(${3:$attr}) {
${4}
}
snippet smth
submethod ${1:submethod_name}(${2:$attr}) {
${3}
}
# Tests
snippet test
use v6;
use Test;
${1:use lib 'lib';}
plan ${2:$num-tests};
# IO
snippet slurp
my ${1:$var} = "${2:filename}".IO.slurp;
snippet rfile
for "${1:filename}".IO.lines -> $line {
${2}
}
snippet open
my $fh = open "${1:filename}", ${2::r|:w|:a};
${3:# actions};
$fh.close;

View File

@ -1,7 +1,9 @@
snippet <?
<?php
${0}
${0:${VISUAL}}
snippet dst "declare(strict_types=1)"
declare(strict_types=${1:1});
snippet ec
echo ${0};
snippet <?e
@ -15,63 +17,60 @@ snippet ?
<?php ${0} ?>
snippet ?f
<?php foreach ($${1:vars} as $${2:$var}): ?>
${0}
${0:${VISUAL}}
<?php endforeach ?>
snippet ?i
<?php if ($${1:var}): ?>
${0}
${0:${VISUAL}}
<?php endif ?>
snippet ns
namespace ${1:Foo\Bar\Baz};
${0}
snippet use
use ${1:Foo\Bar\Baz};
${0}
snippet c
${0:${VISUAL}}
snippet c
class ${1:`vim_snippets#Filename()`}
{
${0}
${0:${VISUAL}}
}
snippet i
interface ${1:`vim_snippets#Filename()`}
{
${0}
${0:${VISUAL}}
}
snippet t.
$this->
snippet f
function ${1}(${3})
{
${0}
${0:${VISUAL}}
}
# method
snippet m
${1:protected} function ${2:foo}()
{
${0}
${0:${VISUAL}}
}
# setter method
snippet sm
snippet sm "PHP Class Setter"
/**
* Sets the value of ${1:foo}
*
* @param ${2:$1} $$1 ${3:description}
* @param ${2:string} $$1 ${3:description}
*
* @return ${4:`vim_snippets#Filename()`}
*/
${5:public} function set${6:$2}(${7:$2 }$$1)
${5:public} function set${6:$1}(${7:$2 }$$1)
{
$this->${8:$1} = $$1;
return $this;
}
# getter method
snippet gm
snippet gm "PHP Class Getter Setter"
/**
* Gets the value of ${1:foo}
*
* @return ${2:$1}
* @return ${2:string}
*/
${3:public} function get${4:$2}()
${3:public} function get${4:$1}()
{
return $this->${5:$1};
}
@ -81,22 +80,23 @@ snippet $s
#getter
snippet $g
${1:$foo}->get${0:Bar}();
# Tertiary conditional
snippet =?:
$${1:foo} = ${2:true} ? ${3:a} : ${0};
snippet ?:
${1:true} ? ${2:a} : ${0}
snippet t "$retVal = (condition) ? a : b"
$${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b};
# Predefined variables
snippet C
$_COOKIE['${1:variable}']
snippet E
$_ENV['${1:variable}']
snippet F
$_FILES['${1:variable}']
snippet G
snippet G "_GET array"
$_GET['${1:variable}']
snippet P
snippet P "_POST array"
$_POST['${1:variable}']
snippet R
$_REQUEST['${1:variable}']
@ -104,7 +104,12 @@ snippet S
$_SERVER['${1:variable}']
snippet SS
$_SESSION['${1:variable}']
snippet get "get"
$_GET['${1}']
snippet post "post"
$_POST['${1}']
snippet session "session"
$_SESSION['${1}']
# the following are old ones
snippet inc
include '${1:file}';
@ -154,7 +159,7 @@ snippet doc_c
*/
${1:}class ${2:}
{
${0}
${0:${VISUAL}}
} // END $1class $2
# Constant Definition - post doc
snippet doc_dp
@ -205,7 +210,19 @@ snippet doc_h
* @copyright ${4:$2}, `strftime('%d %B, %Y')`
* @package ${0:default}
*/
snippet doc_i "interface someClass {}"
/**
* $1
* @package ${2:default}
* @author ${3:`!v g:snips_author`}
**/
interface ${1:someClass}
{${4}
}
snippet inheritdoc "@inheritdoc docblock"
/**
* {@inheritdoc}
*/
# Interface
snippet interface
/**
@ -216,7 +233,19 @@ snippet interface
*/
interface ${1:`vim_snippets#Filename()`}
{
${0}
${0:${VISUAL}}
}
# Trait
snippet trait
/**
* ${2:undocumented class}
*
* @package ${3:default}
* @author ${4:`g:snips_author`}
*/
trait ${1:`vim_snippets#Filename()`}
{
${0:${VISUAL}}
}
# class ...
snippet class
@ -239,58 +268,55 @@ snippet nc
${2:abstract }class ${3:`vim_snippets#Filename()`}
{
${0}
${0:${VISUAL}}
}
# define(...)
snippet def
define('${1}'${2});
snippet def "define('VARIABLE_NAME', 'definition')"
define('${1:VARIABLE_NAME}', ${2:'definition'});
# defined(...)
snippet def?
${1}defined('${2}')
snippet wh
snippet wh "while (condition) { ... }"
while (${1:/* condition */}) {
${0}
${0:${VISUAL}}
}
# do ... while
snippet do
snippet do "do { ... } while (condition)"
do {
${0}
} while (${1:/* condition */});
snippet if
if (${1:/* condition */}) {
${0}
${0:${VISUAL}}
} while (${1});
snippet if "if (condition) { ... }"
if (${1}) {
${0:${VISUAL}}
}
snippet ifn
if (!${1:/* condition */}) {
${2}
snippet ifn "if (!condition) { ... }"
if (!${1}) {
${0:${VISUAL}}
}
snippet ifil
<?php if (${1:/* condition */}): ?>
${0}
snippet ifil "<?php if (condition): ?> ... <?php endif; ?>"
<?php if (${1}): ?>
${0:${VISUAL}}
<?php endif; ?>
snippet ife
if (${1:/* condition */}) {
${2}
snippet ife "if (cond) { ... } else { ... }"
if (${1}) {
${0:${VISUAL}}
} else {
${3}
${2}
}
${0}
snippet ifeil
<?php if (${1:/* condition */}): ?>
${2:<!-- html... -->}
snippet ifeil "<?php if (condition): ?> ... <?php else: ?> ... <?php endif; ?>"
<?php if (${1}): ?>
${0:${VISUAL}}
<?php else: ?>
${3:<!-- html... -->}
${2}
<?php endif; ?>
${0}
snippet el
snippet el "else { ... }"
else {
${0}
${0:${VISUAL}}
}
snippet eif
elseif (${1:/* condition */}) {
${0}
snippet eif "elseif(condition) { ... }"
elseif (${1}) {
${0:${VISUAL}}
}
snippet switch
snippet switch "switch($var) { case 'xyz': ... default: .... }"
switch ($${1:variable}) {
case '${2:value}':
${3}
@ -300,36 +326,35 @@ snippet switch
${4}
break;
}
snippet case
snippet case "case 'value': ... break"
case '${1:value}':
${2}
${0:${VISUAL}}
break;
snippet for
snippet for "for ($i = 0; $i < $count; $i++) { ... }"
for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) {
${0}
${0:${VISUAL}}
}
snippet foreach
snippet foreach "foreach ($var as $value) { .. }"
foreach ($${1:variable} as $${2:value}) {
${0}
${0:${VISUAL}}
}
snippet foreachil
snippet foreachil "<?php foreach ($var as $value): ?> ... <?php endforeach; ?>"
<?php foreach ($${1:variable} as $${2:value}): ?>
${0:<!-- html... -->}
${0:${VISUAL}}
<?php endforeach; ?>
snippet foreachk
snippet foreachk "foreach ($var as $key => $value) { .. }"
foreach ($${1:variable} as $${2:key} => $${3:value}) {
${0}
${0:${VISUAL}}
}
snippet foreachkil
snippet foreachkil "<?php foreach ($var as $key => $value): ?> ... <?php endforeach; ?>"
<?php foreach ($${1:variable} as $${2:key} => $${3:value}): ?>
${0:<!-- html... -->}
<?php endforeach; ?>
# $... = array (...)
snippet array
$${1:arrayName} = array('${2}' => ${3});
snippet try
snippet array "$... = ['' => ]"
$${1:arrayName} = ['${2}' => ${3}];
snippet try "try { ... } catch (Exception $e) { ... }"
try {
${0}
${0:${VISUAL}}
} catch (${1:Exception} $e) {
}
# lambda with closure
@ -357,14 +382,22 @@ snippet http_redirect
header ("HTTP/1.1 301 Moved Permanently");
header ("Location: ".URL);
exit();
snippet log "error_log(var_export($var, true));"
error_log(var_export(${1}, true));
snippet var "var_export($var)"
var_export(${1});
snippet ve "Dumb debug helper in HTML"
echo '<pre>' . var_export(${1}, 1) . '</pre>';
snippet pc "Dumb debug helper in cli"
var_export($1);$0
# Getters & Setters
snippet gs
snippet gs "PHP Class Getter Setter"
/**
* Gets the value of ${1:foo}
*
* @return ${2:$1}
* @return ${2:string}
*/
public function get${3:$2}()
public function get${3:$1}()
{
return $this->${4:$1};
}
@ -413,14 +446,12 @@ snippet aw
array_walk($${1:foo}, function(&$${2:v}, $${3:k}) {
$$2 = ${0};
});
# static var assign once
snippet static_var
static $${1} = null;
if (is_null($$1)){
$$1 = ${2};
}
snippet CSVWriter
<?php
@ -434,7 +465,7 @@ snippet CSVWriter
? fopen($file_or_handle, $mode)
: $file_or_handle;
$this->fputcsv_args = array($this->f, null, $sep, $quot);
$this->fputcsv_args = [$this->f, null, $sep, $quot];
if (!$this->f) throw new Exception('bad file descriptor');
}
@ -455,7 +486,6 @@ snippet CSVWriter
}
}
snippet CSVIterator
// http://snipplr.com/view.php?codeview&id=1986 // modified
@ -471,7 +501,7 @@ snippet CSVIterator
* enclosure
* delimiter
*/
public function __construct( $file_or_handle, $opts = array(4096, ',') )
public function __construct( $file_or_handle, $opts = [4096, ','] )
{
$d = function($n) use(&$opts){ return isset($opts[$n]) ? $opts[$n] : false; };
@ -484,13 +514,13 @@ snippet CSVIterator
? fopen( $file_or_handle, 'r' )
: $file_or_handle;
if (!$this->f) throw new Exception('bad file descriptor');
$this->fgetcsv_args = array(
$this->fgetcsv_args = [
$this->f,
isset($opts['row_size']) ? $opts['row_size'] : 4096,
isset($opts['delimiter']) ? $opts['delimiter'] : ',',
isset($opts['enclosure']) ? $opts['enclosure'] : '"',
isset($opts['escape']) ? $opts['escape'] : '\\',
);
];
$this->start();
}
@ -558,47 +588,97 @@ snippet CSVIterator
}
} // end class
snippet is
isset($1{VISUAL})
# phpunit
snippet ase
$this->assertEquals(${1:expected}, ${2:actual});
snippet asne
$this->assertNotEquals(${1:expected}, ${2:actual});
snippet asf
$this->assertFalse(${1:Something});
snippet ast
$this->assertTrue(${1:Something});
snippet asfex
$this->assertFileExists(${1:path/to/file});
snippet asfnex
$this->assertFileNotExists(${1:path/to/file});
snippet ascon
$this->assertContains(${1:Search Value}, ${2:Array or Iterator});
snippet ashk
$this->assertArrayHasKey(${1:key}, ${2:array});
snippet asnhk
this->assertArrayNotHasKey(${1:value}, ${2:array});
snippet ascha
$this->assertClassHasAttribute('${1:Attribute Name}', '${2:ClassName}');
snippet asi
$this->assertInstanceOf(${1:expected}, ${2:actual});
snippet tc
public function test${1:name_of_the_test}()
# phpunit
snippet ase "$this->assertEquals($a, $b)"
$this->assertEquals(${1:$expected}, ${2:$actual});
snippet asne "$this->assertNotEquals($a, $b)"
$this->assertNotEquals(${1:$expected}, ${2:$actual});
snippet asf "$this->assertFalse($a)"
$this->assertFalse(${1});
snippet ast "$this->assertTrue($a)"
$this->assertTrue(${1});
snippet asfex "$this->assertFileExists('path/to/file')"
$this->assertFileExists(${1:'path/to/file'});
snippet asfnex "$this->assertFileNotExists('path/to/file')"
$this->assertFileNotExists(${1:'path/to/file'});
snippet ascon "$this->assertContains($needle, $haystack)"
$this->assertContains(${1:$needle}, ${2:$haystack});
snippet asncon "$this->assertNotContains($needle, $haystack)"
$this->assertNotContains(${1:$needle}, ${2:$haystack});
snippet ascono "$this->assertContainsOnly($needle, $haystack)"
$this->assertContainsOnly(${1:$needle}, ${2:$haystack});
snippet asconoi "$this->assertContainsOnlyInstancesOf(Example::class, $haystack)"
$this->assertContainsOnlyInstancesOf(${1:Example}::class, ${2:$haystack});
snippet ashk "$this->assertArrayHasKey($key, $array)"
$this->assertArrayHasKey(${1:$key}, ${2:$array});
snippet asnhk "$this->assertArrayNotHasKey($key, $array)"
this->assertArrayNotHasKey(${1:$key}, ${2:$array});
snippet ascha "$this->assertClassHasAttribute($name, Example::class)"
$this->assertClassHasAttribute(${1:$attributeName}, ${2:Example}::class);
snippet asi "$this->assertInstanceOf(Example::class, $actual)"
$this->assertInstanceOf(${1:Example}::class, ${2:$actual});
snippet ast "$this->assertInternalType('string', $actual)"
$this->assertInternalType(${1:'string'}, ${2:actual});
snippet asco "$this->assertCount($count, $haystack)"
$this->assertCount(${1:$expectedCount}, ${2:$haystack});
snippet asnco "$this->assertNotCount($count, $haystack)"
$this->assertNotCount(${1:$count}, ${2:$haystack});
snippet assub "$this->assertArraySubset($subset, $array)"
$this->assertArraySubset(${1:$subset}, ${2:$array});
snippet asnu "$this->assertNull($a)"
$this->assertNull(${1});
snippet asnnu "$this->assertNotNull($a)"
$this->assertNotNull(${1});
snippet test "public function testXYZ() { ... }"
public function test${1}()
{
${0:code}
${0:${VISUAL}}
}
snippet setup "protected function setUp() { ... }"
protected function setUp()
{
${0:${VISUAL}}
}
snippet teardown "protected function tearDown() { ... }"
protected function tearDown()
{
${0:${VISUAL}}
}
snippet proph "$observer = $this->prophesize(SomeClass::class);"
$${1:observer} = $this->prophesize(${2:SomeClass}::class);
snippet mock "$mock = $this->createMock(SomeClass::class);"
$${1:mock} = $this->createMock(${2:SomeClass}::class);
snippet exp "phpunit expects"
expects($this->${1:once}())
->method('${2}')
->with(${3})
->willReturn(${4});
snippet testcmt "phpunit comment with group"
/**
* @group ${1}
*/
snippet fail "$this->fail()"
$this->fail(${1});
snippet marki "$this->markTestIncomplete()"
$this->markTestIncomplete(${1});
snippet marks "$this->markTestSkipped()"
$this->markTestSkipped(${1});
# end of phpunit snippets
snippet te "throw new Exception()"
throw new ${1:Exception}("${2:Error Processing Request}");
snippet fpc "file_put_contents" b
file_put_contents(${1:file}, ${2:content}${3:, FILE_APPEND});$0
snippet sr "str_replace"
str_replace(${1:search}, ${2:replace}, ${3:subject})$0
snippet ia "in_array"
in_array(${1:needle}, ${2:haystack})$0
snippet is "isset"
isset(${1:var})$0
snippet isa "isset array"
isset($${1:array}[${2:key}])$0
snippet in "is_null"
is_null($${1:var})$0
snippet fe "file_exists"
file_exists(${1:file})$0
snippet id "is_dir"
is_dir(${1:path})$0

View File

@ -93,13 +93,13 @@ snippet switch
#try
snippet try
try {
${0}
${0:${VISUAL}}
} catch(${1:Exception} ${2:e}) {
}
#try catch finally
snippet tryf
try {
${0}
${0:${VISUAL}}
} catch(${1:Exception} ${2:e}) {
} finally {
}

View File

@ -0,0 +1,58 @@
# Snippets for
# Authored by Trevor Sullivan <trevor@trevorsullivan.net>
# PowerShell Class
snippet class
class {
[string] ${0:FirstName}
}
# PowerShell Advanced Function
snippet function
function {0:name} {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string] $Param1
)
begin {
}
process {
}
end {
}
}
# PowerShell Splatting
snippet splatting
$Params = @{
${0:Param1} = 'Value1'
${1:Param2} = 'Value2'
}
${3:CommandName}
# PowerShell Enumeration
snippet enum
enum ${0:name} {
${1:item1}
${2:item2}
}
# PowerShell if..then
snippet if
if (${0:condition}) {
${1:statement}
}
# PowerShell While Loop
snippet while
while (${0:condition}) {
${1:statement}
}
# PowerShell Filter..Sort
snippet filtersort
${0:command} | Where-Object -FilterScript { $PSItem.${1:property} -${2:operator} '${3:expression}' } | Sort-Object -Property ${4:sortproperty}

View File

@ -90,7 +90,7 @@ snippet class
${0}
}
snippet node
node '${1:`vim_snippets#Filename('', 'fqdn')`}' {
node "${1:`vim_snippets#Filename('', 'fqdn')`}" {
${0}
}
snippet case
@ -107,13 +107,21 @@ snippet if
if $${1:variable} {
${0}
}
snippet ifd
if defined(${1:Resource}["${2:name}"]) {
${0}
}
snippet ifnd
if !defined(${1:Resource}["${2:name}"]) {
${0}
}
snippet el
else {
${0}
}
snippet ?
? {
'${1}' => ${0}
"${1}" => ${0}
}
#
# blocks etc and general syntax sugar
@ -122,98 +130,98 @@ snippet [
snippet >
${1} => ${0}
snippet p:
'puppet://puppet/${1:module name}/${0:file name}'
"puppet://puppet/${1:module name}/${0:file name}"
#
# Functions
snippet alert
alert('${1:message}')
alert("${1:message}")
snippet crit
crit('${1:message}')
crit("${1:message}")
snippet debug
debug('${1:message}')
debug("${1:message}")
snippet defined
defined(${1:Resource}['${2:name}'])
defined(${1:Resource}["${2:name}"])
snippet emerg
emerg('${1:message}')
emerg("${1:message}")
snippet extlookup Simple extlookup
extlookup('${1:variable}')
extlookup("${1:variable}")
snippet extlookup Extlookup with defaults
extlookup('${1:variable}', '${2:default}')
extlookup("${1:variable}", "${2:default}")
snippet extlookup Extlookup with defaults and custom data file
extlookup('${1:variable}', '${2:default}', '${3:data source}')
extlookup("${1:variable}", "${2:default}", "${3:data source}")
snippet fail
fail('${1:message}')
fail("${1:message}")
snippet info
info('${1:message}')
info("${1:message}")
snippet inline_template
inline_template('<%= ${1} %>')
inline_template("<%= ${1} %>")
snippet notice
notice('${1:message}')
notice("${1:message}")
snippet realize
realize(${1:Resource}[${2:name}])
snippet regsubst
regsubst(${1:hay stack}, ${2:needle}, '${3:replacement}')
regsubst(${1:hay stack}, ${2:needle}, "${3:replacement}")
snippet inc
include ${1:classname}
snippet split
split(${1:hay stack}, '${2:patten}')
split(${1:hay stack}, "${2:patten}")
snippet versioncmp
versioncmp('${1:version}', '${2:version}')
versioncmp("${1:version}", "${2:version}")
snippet warning
warning('${1:message}')
warning("${1:message}")
#
# Types
snippet cron
cron { '${1:name}':
command => '${2}',
user => '${3:root}',
cron { "${1:name}":
command => "${2}",
user => "${3:root}",
${4} => ${0},
}
snippet exec
exec { '${1:name}':
command => '${2:$1}',
user => '${3:root}',
exec { "${1:name}":
command => "${2:$1}",
user => "${3:root}",
${4} => ${0},
}
snippet user
user { '${1:user}':
user { "${1:user}":
ensure => present,
comment => '${2:$1}',
comment => "${2:$1}",
managehome => true,
home => '${0:/home/$1}',
home => "${0:/home/$1}",
}
snippet group
group { '${1:group}':
group { "${1:group}":
ensure => ${0:present},
}
snippet host
host { '${1:hostname}':
host { "${1:hostname}":
ip => ${0:127.0.0.1},
}
snippet mailalias
mailalias { '${1:localpart}':
recipient => '${0:recipient}',
mailalias { "${1:localpart}":
recipient => "${0:recipient}",
}
snippet mount
mount { '${1:destination path}':
mount { "${1:destination path}":
ensure => ${2:mounted},
device => '${0:device name or path}',
device => "${0:device name or path}",
}
snippet package
package { '${1:package name}':
package { "${1:package name}":
ensure => ${0:present},
}
snippet yumrepo
yumrepo { '${1:repo name}':
Descr => '${2:$1}',
yumrepo { "${1:repo name}":
descr => "${2:$1}",
enabled => ${0:1},
}
@ -223,22 +231,39 @@ snippet define
}
snippet service
service { '${1:service}' :
service { "${1:service}" :
ensure => running,
enable => true,
require => [ Package['${2:package}'], File['${3:file}'], ],
subscribe => [ File['${4:configfile1}'], File['${5:configfile2}'], Package['${6:package}'], ],
require => [ Package["${2:package}"], File["${3:file}"], ],
subscribe => [ File["${4:configfile1}"], File["${5:configfile2}"], Package["${6:package}"], ],
}
snippet file
file { '${1:filename}' :
file { "${1:filename}" :
ensure => ${2:present},
owner => '${3:root}',
group => '${4:root}',
mode => '${5:0644}',
source => 'puppet:///modules/${6:module}/${7:source}',
content => template('/etc/puppet/templates/${8:template}'),
alias => '${9:alias}',
require => [ Package['${10:package}'], File['${11:file}'], ],
owner => "${3:root}",
group => "${4:root}",
mode => "${5:0644}",
source => "puppet:///modules/${6:module}/${7:source}",
content => template("${8:module}/${9:template}"),
alias => "${10:alias}",
require => [ Package["${11:package}"], File["${12:file}"], ],
}
snippet archive
archive { "${1:filename}" :
ensure => ${2:present},
url => "http://${3:url}",
extension => "${4:tgz}",
target => "${5:target}",
checksum => ${6:false},
src_target => "${7:/tmp}",
}
snippet firewall
firewall { "${1:comment}" :
proto => ${2:tcp},
action => ${3:accept},
port => ${4},
}

View File

@ -0,0 +1,52 @@
snippet mod
module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')`
(
) where
import Prelude
${0}
snippet imp
import ${0:Data.List}
snippet impq
import ${1:Data.List} as ${0:List}
snippet fn0
${1:name} :: ${2:a}
$1 = ${0:undefined}
snippet fn
${1:fn} :: ${2:a} -> ${3:a}
$1 ${4}= ${0}
snippet fn1
${1:fn} :: ${2:a} -> ${3:a}
$1 ${4}= ${0}
snippet fn2
${1:fn} :: ${2:a} -> ${3:a} -> ${4:a}
$1 ${5}= ${0}
snippet fn3
${1:fn} :: ${2:a} -> ${3:a} -> ${4:a} -> ${5:a}
$1 ${6}= ${0}
snippet case
case ${1} of
${2} -> ${0}
snippet let
let
${1} = ${2}
in
${3}
snippet where
where
${1} = ${0}
snippet testunit
module Test.Main where
import Prelude
import Test.Unit (suite, test)
import Test.Unit.Main (runTest)
import Test.Unit.Assert as Assert
main = runTest do
suite "${1}" do
test "${2:the tests run}" do
Assert.equal
"Hello, world!"
"Hello, sailor!"

View File

@ -1,6 +1,9 @@
snippet #!
#!/usr/bin/env python
# -*- coding: utf-8 -*-
snippet #!3
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
snippet imp
import ${0:module}
snippet uni
@ -20,7 +23,7 @@ snippet docs
snippet wh
while ${1:condition}:
${0}
${0:${VISUAL}}
# dowh - does the same as do...while in other languages
snippet dowh
while True:
@ -29,7 +32,7 @@ snippet dowh
break
snippet with
with ${1:expr} as ${2:var}:
${0}
${0:${VISUAL}}
# New Class
snippet cl
class ${1:ClassName}(${2:object}):
@ -47,7 +50,7 @@ snippet deff
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
${0}
# New Method
snippet defs
snippet defm
def ${1:mname}(self, ${2:arg}):
${0}
# New Property
@ -65,13 +68,13 @@ snippet property
# Ifs
snippet if
if ${1:condition}:
${0}
${0:${VISUAL}}
snippet el
else:
${0}
${0:${VISUAL}}
snippet ei
elif ${1:condition}:
${0}
${0:${VISUAL}}
# For
snippet for
for ${1:item} in ${2:items}:
@ -90,27 +93,27 @@ snippet .
self.
snippet try Try/Except
try:
${1}
except ${2:Exception}, ${3:e}:
${1:${VISUAL}}
except ${2:Exception} as ${3:e}:
${0:raise $3}
snippet try Try/Except/Else
try:
${1}
except ${2:Exception}, ${3:e}:
${1:${VISUAL}}
except ${2:Exception} as ${3:e}:
${4:raise $3}
else:
${0}
snippet try Try/Except/Finally
try:
${1}
except ${2:Exception}, ${3:e}:
${1:${VISUAL}}
except ${2:Exception} as ${3:e}:
${4:raise $3}
finally:
${0}
snippet try Try/Except/Else/Finally
try:
${1}
except ${2:Exception}, ${3:e}:
${1:${VISUAL}}
except ${2:Exception} as ${3:e}:
${4:raise $3}
else:
${5}
@ -125,21 +128,45 @@ snippet _
__${1:init}__
# python debugger (pdb)
snippet pdb
import pdb; pdb.set_trace()
import pdb
pdb.set_trace()
# bpython debugger (bpdb)
snippet bpdb
import bpdb
bpdb.set_trace()
# ipython debugger (ipdb)
snippet ipdb
import ipdb; ipdb.set_trace()
import ipdb
ipdb.set_trace()
# embed ipython itself
snippet iem
import IPython
IPython.embed()
# ipython debugger (pdbbb)
snippet pdbbb
import pdbpp; pdbpp.set_trace()
import pdbpp
pdbpp.set_trace()
# remote python debugger (rpdb)
snippet rpdb
import rpdb
rpdb.set_trace()
# ptpython
snippet ptpython
from ptpython.repl import embed
embed(globals(), locals(), vi_mode=${1:False}, history_filename=${2:None})
# python console debugger (pudb)
snippet pudb
import pudb; pudb.set_trace()
import pudb
pudb.set_trace()
# pdb in nosetests
snippet nosetrace
from nose.tools import set_trace
set_trace()
snippet pprint
import pprint; pprint.pprint(${1})
import pprint
pprint.pprint(${1})
snippet "
"""
${0:doc}
"""${0:doc}
"""
# assertions
snippet a=
@ -190,8 +217,7 @@ snippet lc
snippet li
logger.info(${0:msg})
snippet epydoc
"""
${1:Description}
"""${1:Description}
@param ${2:param}: ${3: Description}
@type $2: ${4: Type}
@ -208,3 +234,9 @@ snippet kwg
self.${1:var_name} = kwargs.get('$1', ${2:None})
snippet lkwg
${1:var_name} = kwargs.get('$1', ${2:None})
snippet args
*args${1:,}${0}
snippet kwargs
**kwargs${1:,}${0}
snippet akw
*args, **kwargs${1:,}${0}

View File

@ -36,7 +36,7 @@ snippet crw
cattr_accessor :${0:attr_names}
snippet defcreate
def create
@${1:model_class_name} = ${2:ModelClassName}.new(params[:$1])
@${1:model_class_name} = ${2:ModelClassName}.new($1_params)
respond_to do |format|
if @$1.save
@ -95,7 +95,7 @@ snippet defupdate
@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])
respond_to do |format|
if @$1.update_attributes(params[:$1])
if @$1.update($1_params)
flash[:notice] = '$2 was successfully updated.'
format.html { redirect_to(@$1) }
format.xml { head :ok }
@ -105,6 +105,10 @@ snippet defupdate
end
end
end
snippet defparams
def ${1:model_class_name}_params
params.require(:$1).permit()
end
snippet dele delegate .. to
delegate :${1:methods}, to: :${0:object}
snippet dele delegate .. to .. prefix .. allow_nil
@ -321,7 +325,7 @@ snippet xpost
snippet xput
xhr :put, :${1:update}, id: ${2:1}, ${3:object}: ${4:object}
snippet test
test 'should ${1:do something}' do
test '${1:should do something}' do
${0}
end
###########################
@ -344,7 +348,7 @@ snippet mct
${0}
end
snippet migration class .. < ActiveRecord::Migration .. def up .. def down .. end
class ${1:class_name} < ActiveRecord::Migration
class `substitute( substitute(vim_snippets#Filename(), '^\d\+_', '',''), '\(_\|^\)\(.\)', '\u\2', 'g')` < ActiveRecord::Migration
def up
${0}
end
@ -353,7 +357,7 @@ snippet migration class .. < ActiveRecord::Migration .. def up .. def down .. en
end
end
snippet migration class .. < ActiveRecord::Migration .. def change .. end
class ${1:class_name} < ActiveRecord::Migration
class `substitute( substitute(vim_snippets#Filename(), '^\d\+_', '',''), '\(_\|^\)\(.\)', '\u\2', 'g')` < ActiveRecord::Migration
def change
${0}
end

View File

@ -56,11 +56,40 @@ snippet err:
snippet cau:
.. caution::
${0:Watch out!}
#Spinx only
#Sphinx only
snippet sid:
.. sidebar:: ${1:Title}
${0}
snippet tod:
.. todo::
${0}
snippet lis:
.. list-table:: ${0:Title}
:header-rows: 1
:stub-columns: 1
* - x1,y1
- x2,y1
- x3,y1
* - x1,y2
- x2,y2
- x3,y2
* - x1,y3
- x2,y3
- x3,y3
snippet toc:
.. toctree::
:maxdepth: 2
${0}
snippet dow:
:download:\`${0:text} <${1:path}>\`
snippet ref:
:ref:\`${0:text} <${1:path}>\`
snippet doc:
:doc:`${0:text} <${1:path}>`
# CJK optimize, CJK has no space between charaters
snippet *c
\ *${1:Emphasis}*\ ${0}

View File

@ -1,12 +1,9 @@
# encoding for Ruby 1.9
snippet enc
# encoding: utf-8
# #!/usr/bin/env ruby
snippet frozen
# frozen_string_literal: true
snippet #!
#!/usr/bin/env ruby
# encoding: utf-8
# New Block
snippet =b
=begin rdoc
@ -29,15 +26,12 @@ snippet beg
${0}
rescue ${1:Exception} => ${2:e}
end
snippet req require
require '${1}'
snippet reqr
require_relative '${1}'
snippet #
# =>
snippet end
__END__
snippet case
case ${1:object}
when ${2:condition}
@ -45,7 +39,7 @@ snippet case
end
snippet when
when ${1:condition}
${0}
${0:${VISUAL}}
snippet def
def ${1:method_name}
${0}
@ -62,24 +56,46 @@ snippet descendants
end
snippet if
if ${1:condition}
${0}
${0:${VISUAL}}
end
snippet ife
if ${1:condition}
${2}
${2:${VISUAL}}
else
${0}
end
snippet eif
elsif ${1:condition}
${0}
${0:${VISUAL}}
snippet ifee
if ${1:condition}
$2
elsif ${3:condition}
$4
else
$0
end
snippet unless
unless ${1:condition}
${0}
${0:${VISUAL}}
end
snippet unlesse
unless ${1:condition}
$2
else
$0
end
snippet unlesee
unless ${1:condition}
$2
elsif ${3:condition}
$4
else
$0
end
snippet wh
while ${1:condition}
${0}
${0:${VISUAL}}
end
snippet for
for ${1:e} in ${2:c}
@ -87,35 +103,29 @@ snippet for
end
snippet until
until ${1:condition}
${0}
${0:${VISUAL}}
end
snippet cla class .. end
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
${0}
end
snippet cla class .. initialize .. end
snippet clai class .. initialize .. end
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
def initialize(${2:args})
${0}
end
end
snippet cla class .. < ParentClass .. initialize .. end
snippet cla< class .. < ParentClass .. initialize .. end
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} < ${2:ParentClass}
def initialize(${3:args})
${0}
end
end
snippet cla ClassName = Struct .. do .. end
${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} = Struct.new(:${2:attr_names}) do
def ${3:method_name}
${0}
end
end
snippet cla class BlankSlate .. initialize .. end
snippet blankslate class BlankSlate .. initialize .. end
class ${0:BlankSlate}
instance_methods.each { |meth| undef_method(meth) unless meth =~ /\A__/ }
end
snippet cla class << self .. end
snippet claself class << self .. end
class << ${1:self}
${0}
end
@ -132,27 +142,6 @@ snippet mod module .. end
module ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
${0}
end
snippet mod module .. module_function .. end
module ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
module_function
${0}
end
snippet mod module .. ClassMethods .. end
module ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
module ClassMethods
${0}
end
module InstanceMethods
end
def self.included(receiver)
receiver.extend ClassMethods
receiver.send :include, InstanceMethods
end
end
# attr_reader
snippet r
attr_reader :${0:attr_names}
@ -713,3 +702,15 @@ snippet is
it { should ${0} }
snippet isn
it { should_not ${0} }
snippet iexp
it { expect(${1:object}).${1} ${0} }
snippet iexpb
it { expect { ${1:object} }.${1} ${0} }
snippet iiexp
it { is_expected.to ${0} }
snippet iiexpn
it { is_expected.not_to ${0} }
snippet agg
aggregate_failures '${1:message}' do
${0}
end

View File

@ -3,43 +3,75 @@
#################
# Functions
snippet fn
fn ${1:function_name}(${2}) {
snippet fn "Function definition"
fn ${1:function_name}(${2})${3} {
${0}
}
snippet fn-
fn ${1:function_name}(${2}) -> ${3} {
snippet pfn "Function definition"
pub fn ${1:function_name}(${2})${3} {
${0}
}
snippet test
snippet test "Unit test function"
#[test]
fn ${1:test_function_name}() {
${0}
}
snippet new
pub fn new(${2}) -> ${1:Name} {
${0}return $1 { ${3} };
snippet bench "Bench function" b
#[bench]
fn ${1:bench_function_name}(b: &mut test::Bencher) {
b.iter(|| {
${0}
})
}
snippet main
snippet new "Constructor function"
pub fn new(${2}) -> ${1:Name} {
$1 { ${3} }
}
snippet main "Main function"
pub fn main() {
${0}
}
snippet let
let ${1:name}${3} = ${2};
snippet pln
snippet let "let variable declaration with type inference"
let ${1} = ${2};
snippet lett "let variable declaration with explicit type annotation"
let ${1}: ${2} = ${3};
snippet letm "let mut variable declaration with type inference"
let mut ${1} = ${2};
snippet lettm "let mut variable declaration with explicit type annotation"
let mut ${1}: ${2} = ${3};
snippet pln "println!"
println!("${1}");
snippet pln,
snippet pln, "println! with format param"
println!("${1}", ${2});
snippet ec
# Modules
snippet ec "extern crate"
extern crate ${1:sync};
snippet ecl
#![feature(phase)]
#[phase(plugin, link)] extern crate log;
snippet ecl "extern crate log"
#[macro_use]
extern crate log;
snippet mod
mod ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} {
${0}
} /* $1 */
snippet crate
snippet testmod "Test module" b
#[cfg(test)]
mod tests {
use super::${1:*};
test${0}
}
# Attributes
snippet allow "allow lint attribute" b
#[allow(${1:unused_variable})]
snippet cfg "cfg attribute" b
#[cfg(${1:target_os = "linux"})]
snippet feat "feature attribute" b
#![feature(${1:plugin})]
snippet der "#[derive(..)]" b
#[derive(${1:Debug})]
snippet attr "#[..]" b
#[${1:inline}]
snippet crate "Define create meta attributes"
// Crate name
#![crate_name = "${1:crate_name}"]
// Additional metadata attributes
@ -48,78 +80,107 @@ snippet crate
#![comment = "${4:Comment.}"]
// Specify the output type
#![crate_type = "${5:lib}"]
snippet allow
#[allow(${1:unused_variable})]
snippet feat
#![feature(${1:macro_rules})]
# Common types
snippet opt
Option<${1:int}>
snippet res
snippet opt "Option<T>"
Option<${1:i32}>
snippet res "Result<T, E>"
Result<${1:~str}, ${2:()}>
# Control structures
snippet if
if ${1:/* condition */} {
if ${1} {
${0:${VISUAL}}
}
snippet ife "if / else"
if ${1} {
${2:${VISUAL}}
} else {
${0}
}
snippet mat
snippet el "else"
else {
${0:${VISUAL}}
}
snippet eli "else if"
else if ${1} {
${0:${VISUAL}}
}
snippet mat "match pattern"
match ${1} {
${2} => ${3},
${2} => ${3}
}
snippet while
snippet case "Case clause of pattern match"
${1:_} => ${2:expression}
snippet loop "loop {}" b
loop {
${0:${VISUAL}}
}
snippet wh "while loop"
while ${1:condition} {
${0:${VISUAL}}
}
snippet for "for ... in ... loop"
for ${1:i} in ${2} {
${0}
}
snippet for
for ${1:i} in ${2:range(0u, 10)} {
${0}
}
snippet spawn
spawn(proc() {
${0}
});
snippet chan
let (${1:tx}, ${2:rx}): (Sender<${3:int}>, Receiver<${4:int}>) = channel();
snippet duplex
let (${1:from_child}, ${2:to_child}) = sync::duplex();
# TODO commenting
snippet todo
// [TODO]: ${1:Description}
snippet todo "TODO comment"
// [TODO]: ${0:Description}
snippet fixme "FIXME comment"
// FIXME: $0
# Struct
snippet st
snippet st "Struct definition"
struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} {
${0}
}
snippet impl "Struct/Trait implementation"
impl ${1:Type/Trait}${2: for ${3:Type}} {
${0}
}
snippet stn "Struct with new constructor"
pub struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} {
${0}
}
impl $1 {
pub fn new(${2}) -> $1 {
${4}return $1 {
${5}
};
pub fn new(${2}) -> Self {
$1 { ${3} }
}
}
# Enum
snippet enum
enum ${1:enum_name} {
${0},
snippet type "Type alias"
type ${1:NewName} = $2;
snippet enum "enum definition"
enum ${1:Name} {
${2},
}
# Impl
snippet imp
impl ${1:Name} {
# Traits
snippet trait "Trait definition"
trait ${1:Name} {
${0}
}
snippet drop
snippet drop "Drop trait implementation (destructor)"
impl Drop for ${1:Name} {
fn drop(&mut self) {
${0}
}
}
# Traits
snippet trait
trait ${1:Name} {
${0}
}
# Statics
snippet ss
snippet ss "static string declaration"
static ${1}: &'static str = "${0}";
snippet stat
static ${1}: ${2:uint} = ${0};
snippet stat "static item declaration"
static ${1}: ${2:usize} = ${0};
# Concurrency
snippet scoped "spawn a scoped thread"
thread::scoped(${1:move }|| {
${0}
});
snippet spawn "spawn a thread"
thread::spawn(${1:move }|| {
${0}
});
snippet chan "Declare (Sender, Receiver) pair of asynchronous channel()"
let (${1:tx}, ${2:rx}): (Sender<${3:i32}>, Receiver<${4:i32}>) = channel();
# Testing
snippet as "assert!"
assert!(${1:predicate})
snippet ase "assert_eq!"
assert_eq!(${1:expected}, ${2:actual})

File diff suppressed because it is too large Load Diff

View File

@ -7,30 +7,30 @@
#if
snippet if
if (${1})
${0}
${0:${VISUAL}}
#if not
snippet ifn
if (!${1})
${0}
${0:${VISUAL}}
#if-else
snippet ife
if (${1})
${2}
${2:${VISUAL}}
else
${0}
#if-else-if
snippet ifelif
if (${1})
${2}
${2:${VISUAL}}
else if (${3})
${0}
${0:${VISUAL}}
snippet eif
else if (${3})
${0}
${0:${VISUAL}}
#while loop
snippet wh
while (${1:obj}) {
${0}
${0:${VISUAL}}
}
#for loop(classic)
snippet for
@ -50,7 +50,7 @@ snippet fory
#exceptions
snippet try
try {
${1}
${1:${VISUAL}}
} catch {
case e: FileNotFoundException => ${2}
case e: IOException => ${3}
@ -298,19 +298,25 @@ snippet scalatest
${0:import org.scalatest.FunSuite}
#assert
snippet assert
assert(${1:a}==${0:b})
assert(${1:a} === ${0:b})
#ensuring(p 296)
snippet ensuring
ifel ensuring(${1:a}==${0:b})
#expect
snippet expect
expect(${0:what}) {
expect(${1:what}) {
${0}
}
#intercept
snippet intercept
intercept[${0:IllegalArgumentException}] {
intercept[${1:IllegalArgumentException}] {
${0}
}
#test
snippet test
test("${0:description}") {
test("${1:description}") {
${0}
}
#suite
snippet suite
class ${0:name} extends Suite {

View File

@ -1,3 +1,5 @@
extends css
snippet $
$${1:variable}: ${0:value};
snippet imp
@ -8,7 +10,7 @@ snippet mix
}
snippet inc
@include ${1:mixin}(${2});
snippet ex
snippet ext
@extend ${0};
snippet fun
@function ${1:name}(${2:args}) {
@ -18,8 +20,14 @@ snippet if
@if ${1:condition} {
${0}
}
snippet else
@else ${1:condition} {
snippet ife
@if ${1:condition} {
${2}
} @else {
${0}
}
snippet eif
@else if ${1:condition} {
${0}
}
snippet for

View File

@ -1,29 +1,37 @@
# Shebang. Executing bash via /usr/bin/env makes scripts more portable.
snippet #!
#!/usr/bin/env sh
snippet bash
#!/usr/bin/env bash
snippet sbash
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
snippet if
if [[ ${1:condition} ]]; then
${0:#statements}
${0:${VISUAL}}
fi
snippet elif
elif [[ ${1:condition} ]]; then
${0:#statements}
${0:${VISUAL}}
snippet for
for (( ${2:i} = 0; $2 < ${1:count}; $2++ )); do
${0:#statements}
${0:${VISUAL}}
done
snippet fori
for ${1:needle} in ${2:haystack} ; do
${0:#statements}
${0:${VISUAL}}
done
snippet wh
while [[ ${1:condition} ]]; do
${0:#statements}
${0:${VISUAL}}
done
snippet until
until [[ ${1:condition} ]]; do
${0:#statements}
${0:${VISUAL}}
done
snippet case
case ${1:word} in
@ -51,15 +59,12 @@ snippet getopt
#===============================================================================
function usage ()
{
cat <<- EOT
echo "Usage : $${0:0} [options] [--]
Usage : $${0:0} [options] [--]
Options:
-h|help Display this message
-v|version Display script version"
Options:
-h|help Display this message
-v|version Display script version
EOT
} # ---------- end of function usage ----------
#-----------------------------------------------------------------------
@ -74,7 +79,7 @@ snippet getopt
v|version ) echo "$${0:0} -- Version $__ScriptVersion"; exit 0 ;;
\? ) echo -e "\n Option does not exist : $OPTARG\n"
* ) echo -e "\n Option does not exist : $OPTARG\n"
usage; exit 1 ;;
esac # --- end of case ---
@ -82,11 +87,13 @@ snippet getopt
shift $(($OPTIND-1))
snippet root
if [ \$(id -u) -ne 0 ]; then exec sudo \$0; fi
snippet fun
snippet fun-sh
${1:function_name}() {
${0:#function_body}
}
snippet ffun
snippet fun
function ${1:function_name}() {
${0:#function_body}
}

View File

@ -0,0 +1,122 @@
snippet sm_controller
<?php
namespace Controllers;
use Core\View;
use Core\Controller;
class ${1:class_name} extends Controller
{
public function __construct()
{
parent::__construct();
}
public function index()
{
${2:}
}
}
snippet sm_model
<?php
namespace Models;
use Core\Model;
class ${1:class_name} extends Model
{
function __construct()
{
parent::__construct();
}
}
snippet sm_model_crud
<?php
namespace Models;
use Core\Model;
class ${1:class_name} extends Model
{
private $${2:table};
function __construct()
{
parent::__construct();
}
public function getRow($where)
{
return $this->db->select('SELECT * FROM '.$table.' WHERE ${3:where}', $data);
}
public function getRows($where)
{
return $this->db->select('SELECT * FROM '.$table.');
}
public function insert($data)
{
$this->db->insert($table, $data);
}
public function update($data, $where)
{
$this->db->update($table ,$data, $where);
}
public function delete($where)
{
$this->db->delete($table, $where);
}
}
snippet sm_render
View::render('${1:view}', $${2:array});
snippet sm_render_template
View::renderTemplate('${1:part}', $${2:array});
# database
snippet sm_db_select
$this->db->select(${1:sql}, ${2:where});
snippet sm_db_insert
$this->db->insert(${1:table}, ${2:data});
snippet sm_db_update
$this->db->update(${1:table}, ${2:data}, ${3:where});
snippet sm_db_delete
$this->db->delete(${1:table}, ${2:where});
snippet sm_db_truncate
$this->db->delete(${1:table});
#session
snippet sm_session_set
Session::set(${1:key}, ${2:value});
snippet sm_session_get
Session::get(${1:key});
snippet sm_session_pull
Session::pull(${1:key});
snippet sm_session_id
Session::id();
snippet sm_session_destroy
Session::set(${1:key});
snippet sm_session_display
Session::display();
#url
snippet sm_url_redirect
Url:redirect('${1:path}');
snippet sm_url_previous
Url:previous();
snippet sm_url_templatepath
Url:templatePath();
snippet sm_url_autolink
Url:autolink('${1:string}');

View File

@ -1,3 +1,16 @@
snippet pry
- binding.pry
snippet renp
= render partial: '${0}'
# Forms
# =====
snippet fieldset
fieldset
legend ${1}
snippet css
link rel="stylesheet" href="${1:style.css}" type="text/css" media="${2:all}"
snippet script
script src="${1:script.js}" type="text/javascript"
# Some useful Unicode entities
# ============================
# Non-Breaking Space
@ -48,17 +61,3 @@ snippet backspace
# ⎋
snippet esc
&#x238B;
# Forms
# =====
snippet fieldset
fieldset
legend ${1}
# Assets
# ======
snippet css
link rel="stylesheet" href="${1:style.css}" type="text/css" media="${2:all}"
snippet script
script src="${1:script.js}" type="text/javascript"

View File

@ -1,10 +1,7 @@
# snippets for making snippets :)
snippet snip
snippet ${1:trigger}
${0}
snippet msnip
snippet ${1:trigger} ${2:description}
${0}
snippet ${1:trigger} "${2:description}"
${0:${VISUAL}}
snippet v
{VISUAL}
snippet $

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,22 @@
snippet b
(
${0}
)
snippet if
if (${1}) {
${0}
}
snippet ife
if (${1}) {
${2}
} {
${0}
}
snippet for
for (${1:1}, ${2:10}) { |i|
${0}
}
snippet sdef
SynthDef(\\${1:synthName}, {${2}
${0}
}).add;

View File

@ -0,0 +1,73 @@
extends verilog
# Foreach Loop
snippet fe
foreach (${1}) begin
${0}
end
# Do-while statement
snippet dowh
do begin
${0}
end while (${1});
# Combinational always block
snippet alc
always_comb begin ${1:: statement_label}
${0}
end $1
# Sequential logic
snippet alff
always_ff @(posedge ${1:clk}) begin ${2:: statement_label}
${0}
end $2
# Latched logic
snippet all
always_latch begin ${1:: statement_label}
${0}
end $1
# Class
snippet cl
class ${1:class_name};
// data or class properties
${0}
// initialization
function new();
endfunction : new
endclass : $1
# Typedef structure
snippet types
typedef struct {
${0}
} ${1:name_t};
# Program block
snippet prog
program ${1:program_name} ();
${0}
endprogram : $1
# Interface block
snippet intf
interface ${1:program_name} ();
// nets
${0}
// clocking
// modports
endinterface : $1
# Clocking Block
snippet clock
clocking ${1:clocking_name} @(${2:posedge} ${3:clk});
${0}
endclocking : $1
# Covergroup construct
snippet cg
covergroup ${1:group_name} @(${2:posedge} ${3:clk});
${0}
endgroup : $1
# Package declaration
snippet pkg
package ${1:package_name};
${0}
endpackage : $1

View File

@ -1,282 +1,334 @@
#version 1
#PREAMBLE
#newcommand
snippet nc \newcommand
\newcommand{\\${1:cmd}}[${2:opt}]{${3:realcmd}} ${0}
\\newcommand{\\${1:cmd}}[${2:opt}]{${3:realcmd}} ${0}
#usepackage
snippet up \usepackage
\usepackage[${1:options}]{${2:package}} ${0}
\\usepackage[${1:options}]{${2:package}} ${0}
#newunicodechar
snippet nuc \newunicodechar
\newunicodechar{${1}}{${2:\ensuremath}${3:tex-substitute}}} ${0}
\\newunicodechar{${1}}{${2:\\ensuremath}${3:tex-substitute}}} ${0}
#DeclareMathOperator
snippet dmo \DeclareMathOperator
\DeclareMathOperator{${1}}{${2}} ${0}
\\DeclareMathOperator{${1}}{${2}} ${0}
#DOCUMENT
# \begin{}...\end{}
snippet begin \begin{} ... \end{} block
\begin{${1:env}}
${0}
\end{$1}
\\begin{${1:env}}
${0:${VISUAL}}
\\end{$1}
# Tabular
snippet tab tabular (or arbitrary) environment
\begin{${1:tabular}}{${2:c}}
${0}
\end{$1}
\\begin{${1:tabular}}{${2:c}}
${0:${VISUAL}}
\\end{$1}
snippet thm thm (or arbitrary) environment with optional argument
\begin[${1:author}]{${2:thm}}
${0}
\end{$2}
\\begin[${1:author}]{${2:thm}}
${0:${VISUAL}}
\\end{$2}
snippet center center environment
\begin{center}
${0}
\end{center}
\\begin{center}
${0:${VISUAL}}
\\end{center}
# Align(ed)
snippet ali align(ed) environment
\begin{align${1:ed}}
\label{eq:${2}}
${0}
\end{align$1}
\\begin{align${1:ed}}
\\label{eq:${2}}
${0:${VISUAL}}
\\end{align$1}
# Gather(ed)
snippet gat gather(ed) environment
\begin{gather${1:ed}}
${0}
\end{gather$1}
\\begin{gather${1:ed}}
${0:${VISUAL}}
\\end{gather$1}
# Equation
snippet eq equation environment
\begin{equation}
\label{eq:${2}}
${0}
\end{equation}
\\begin{equation}
${0:${VISUAL}}
\\end{equation}
# Equation
snippet eql Labeled equation environment
\\begin{equation}
\\label{eq:${2}}
${0:${VISUAL}}
\\end{equation}
# Equation
snippet eq* unnumbered equation environment
\begin{equation*}
${0}
\end{equation*}
\\begin{equation*}
${0:${VISUAL}}
\\end{equation*}
# Unnumbered Equation
snippet \ unnumbered equation: \[ ... \]
\[
${0}
\]
\\[
${0:${VISUAL}}
\\]
# Equation array
snippet eqnarray eqnarray environment
\begin{eqnarray}
${0}
\end{eqnarray}
\\begin{eqnarray}
${0:${VISUAL}}
\\end{eqnarray}
# Label
snippet lab \label
\label{${1:eq:}${2:fig:}${3:tab:}${0}}
\\label{${1:eq:}${2:fig:}${3:tab:}${0}}
# Enumerate
snippet enum enumerate environment
\begin{enumerate}
\item ${0}
\end{enumerate}
\\begin{enumerate}
\\item ${0}
\\end{enumerate}
snippet enuma enumerate environment
\\begin{enumerate}[(a)]
\\item ${0}
\\end{enumerate}
snippet enumi enumerate environment
\\begin{enumerate}[(i)]
\\item ${0}
\\end{enumerate}
# Itemize
snippet itemize itemize environment
\begin{itemize}
\item ${0}
\end{itemize}
snippet item \item
\item ${1}
snippet item itemize environment
\\begin{itemize}
\\item ${0}
\\end{itemize}
snippet it \item
\\item ${1:${VISUAL}}
# Description
snippet desc description environment
\begin{description}
\item[${1}] ${0}
\end{description}
\\begin{description}
\\item[${1}] ${0}
\\end{description}
# Endless new item
snippet ]i \item (recursive)
\item ${1}
\\item ${1}
${0:]i}
# Matrix
snippet mat smart matrix environment
\begin{${1:p/b/v/V/B/small}matrix}
${0}
\end{$1matrix}
\\begin{${1:p/b/v/V/B/small}matrix}
${0:${VISUAL}}
\\end{$1matrix}
# Cases
snippet cas cases environment
\begin{cases}
${1:equation}, &\text{ if }${2:case}\\
${0}
\end{cases}
\\begin{cases}
${1:equation}, &\\text{ if }${2:case}\\
${0:${VISUAL}}
\\end{cases}
# Split
snippet spl split environment
\begin{split}
${0}
\end{split}
\\begin{split}
${0:${VISUAL}}
\\end{split}
# Part
snippet part document \part
\part{${1:part name}} % (fold)
\label{prt:${2:$1}}
\\part{${1:part name}} % (fold)
\\label{prt:${2:$1}}
${0}
% part $2 (end)
# Chapter
snippet cha \chapter
\chapter{${1:chapter name}}
\label{cha:${2:$1}}
\\chapter{${1:chapter name}}
\\label{cha:${2:$1}}
${0}
# Section
snippet sec \section
\section{${1:section name}}
\label{sec:${2:$1}}
\\section{${1:section name}}
\\label{sec:${2:$1}}
${0}
# Section without number
snippet sec* \section*
\section*{${1:section name}}
\label{sec:${2:$1}}
\\section*{${1:section name}}
\\label{sec:${2:$1}}
${0}
# Sub Section
snippet sub \subsection
\subsection{${1:subsection name}}
\label{sub:${2:$1}}
\\subsection{${1:subsection name}}
\\label{sub:${2:$1}}
${0}
# Sub Section without number
snippet sub* \subsection*
\subsection*{${1:subsection name}}
\label{sub:${2:$1}}
\\subsection*{${1:subsection name}}
\\label{sub:${2:$1}}
${0}
# Sub Sub Section
snippet subs \subsubsection
\subsubsection{${1:subsubsection name}}
\label{ssub:${2:$1}}
\\subsubsection{${1:subsubsection name}}
\\label{ssub:${2:$1}}
${0}
# Sub Sub Section without number
snippet subs* \subsubsection*
\subsubsection*{${1:subsubsection name}}
\label{ssub:${2:$1}}
\\subsubsection*{${1:subsubsection name}}
\\label{ssub:${2:$1}}
${0}
# Paragraph
snippet par \paragraph
\paragraph{${1:paragraph name}}
\label{par:${2:$1}}
\\paragraph{${1:paragraph name}}
\\label{par:${2:$1}}
${0}
# Sub Paragraph
snippet subp \subparagraph
\subparagraph{${1:subparagraph name}}
\label{subp:${2:$1}}
\\subparagraph{${1:subparagraph name}}
\\label{subp:${2:$1}}
${0}
snippet ni \noindent
\noindent
\\noindent
${0}
#References
snippet itd description \item
\item[${1:description}] ${0:item}
\\item[${1:description}] ${0:item}
snippet figure reference to a figure
${1:Figure}~\ref{${2:fig:}}
${1:Figure}~\\ref{${2:fig:}}
snippet table reference to a table
${1:Table}~\ref{${2:tab:}}
${1:Table}~\\ref{${2:tab:}}
snippet listing reference to a listing
${1:Listing}~\ref{${2:list}}
${1:Listing}~\\ref{${2:list}}
snippet section reference to a section
${1:Section}~\ref{sec:${2}} ${0}
${1:Section}~\\ref{sec:${2}} ${0}
snippet page reference to a page
${1:page}~\pageref{${2}} ${0}
${1:page}~\\pageref{${2}} ${0}
snippet index \index
\index{${1:index}} ${0}
\\index{${1:index}} ${0}
#Citations
snippet citen \citen
\citen{${1}} ${0}
\\citen{${1}} ${0}
# natbib citations
snippet citep \citep
\citep{${1}} ${0}
\\citep{${1}} ${0}
snippet citet \citet
\citet{${1}} ${0}
\\citet{${1}} ${0}
snippet cite \cite[]{}
\cite[${1}]{${2}} ${0}
\\cite[${1}]{${2}} ${0}
snippet citea \citeauthor
\citeauthor{${1}} ${0}
\\citeauthor{${1}} ${0}
snippet citey \citeyear
\citeyear{${1}} ${0}
\\citeyear{${1}} ${0}
snippet fcite \footcite[]{}
\footcite[${1}]{${2}}${0}
\\footcite[${1}]{${2}}${0}
#Formating text: italic, bold, underline, small capital, emphase ..
snippet it italic text
\textit{${0:text}}
\\textit{${0:${VISUAL:text}}}
snippet bf bold face text
\textbf{${0:text}}
\\textbf{${0:${VISUAL:text}}}
snippet under underline text
\underline{${0:text}}
\\underline{${0:${VISUAL:text}}}
snippet emp emphasize text
\emph{${0:text}}
\\emph{${0:${VISUAL:text}}}
snippet sc small caps text
\textsc{${0:text}}
\\textsc{${0:${VISUAL:text}}}
#Choosing font
snippet sf sans serife text
\textsf{${0:text}}
\\textsf{${0:${VISUAL:text}}}
snippet rm roman font text
\textrm{${0:text}}
\\textrm{${0:${VISUAL:text}}}
snippet tt typewriter (monospace) text
\texttt{${0:text}}
\\texttt{${0:${VISUAL:text}}}
#Math font
snippet mf mathfrak
\\mathfrak{${0:${VISUAL:text}}}
snippet mc mathcal
\\mathcal{${0:${VISUAL:text}}}
snippet ms mathscr
\\mathscr{${0:${VISUAL:text}}}
#misc
snippet ft \footnote
\footnote{${0:text}}
\\footnote{${0:${VISUAL:text}}}
snippet fig figure environment (includegraphics)
\begin{figure}
\begin{center}
\includegraphics[scale=${1}]{Figures/${2}}
\end{center}
\caption{${3}}
\label{fig:${4}}
\end{figure}
\\begin{figure}
\\begin{center}
\\includegraphics[scale=${1}]{Figures/${2}}
\\end{center}
\\caption{${3}}
\\label{fig:${4}}
\\end{figure}
${0}
snippet tikz figure environment (tikzpicture)
\begin{figure}
\begin{center}
\begin{tikzpicture}[scale=${1:1}]
\\begin{figure}[htpb]
\\begin{center}
\\begin{tikzpicture}[scale=${1:1}, transform shape]
${2}
\end{tikzpicture}
\end{center}
\caption{${3}}
\label{fig:${4}}
\end{figure}
\\end{tikzpicture}
\\end{center}
\\caption{${3}}
\\label{fig:${4}}
\\end{figure}
${0}
snippet subfig subfigure environment
\\begin{subfigure}[${1}]{${2:\\textwidth}}
\\begin{center}
${3}
\\end{center}
\\caption{${4}}
\\label{fig:${5}}
\\end{subfigure}
${0}
snippet tikzcd tikzcd environment
\begin{equation}
\begin{tikzcd}
${1}
\end{tikzcd}
\end{equation}
${0}
#math
snippet stackrel \stackrel{}{}
\stackrel{${1:above}}{${2:below}} ${0}
\\stackrel{${1:above}}{${2:below}} ${0}
snippet frac \frac{}{}
\frac{${1:num}}{${2:denom}} ${0}
\\frac{${1:num}}{${2:denom}} ${0}
snippet sum \sum^{}_{}
\sum^{${1:n}}_{${2:i=1}} ${0}
\\sum^{${1:n}}_{${2:i=1}} ${0}
snippet lim \lim_{}
\lim_{${1:x \to +\infty}} ${0}
\\lim_{${1:n \\to \\infty}} ${0}
snippet frame frame environment
\begin{frame}[${1:t}]{${2:title}}
${0}
\end{frame}
\\begin{frame}[${1:t}]{${2:title}}
${0:${VISUAL}}
\\end{frame}
snippet block block environment
\begin{block}{${1:title}}
${0}
\end{block}
\\begin{block}{${1:title}}
${0:${VISUAL}}
\\end{block}
snippet alert alertblock environment
\begin{alertblock}{${1:title}}
${0}
\end{alertblock}
\\begin{alertblock}{${1:title}}
${0:${VISUAL}}
\\end{alertblock}
snippet example exampleblock environment
\begin{exampleblock}{${1:title}}
${0}
\end{exampleblock}
\\begin{exampleblock}{${1:title}}
${0:${VISUAL}}
\\end{exampleblock}
snippet col2 two-column environment
\begin{columns}
\begin{column}{0.5\textwidth}
\\begin{columns}
\\begin{column}{0.5\\textwidth}
${1}
\end{column}
\begin{column}{0.5\textwidth}
\\end{column}
\\begin{column}{0.5\\textwidth}
${0}
\end{column}
\end{columns}
\\end{column}
\\end{columns}
snippet \{ \{ \}
\\{ ${0} \\}
#delimiter
snippet lr left right
\\left${1} ${0} \\right$1
snippet lr( left( right)
\\left( ${0} \\right)
snippet lr| left| right|
\\left| ${0} \\right|
snippet lr{ left\{ right\}
\\left\\{ ${0} \\right\\}
snippet lr[ left[ right]
\\left[ ${0} \\right]
snippet lra langle rangle
\\langle ${0} \\rangle
# Code listings
snippet lst
\begin{listing}[language=${1:language}]
${0}
\end{listing}
\\begin{listing}[language=${1:language}]
${0:${VISUAL}}
\\end{listing}
snippet lsi
\lstinline|${1}| ${0}
\\lstinline|${1}| ${0}
# Hyperlinks
snippet url
\url{${1}} ${0}
\\url{${1}} ${0}
snippet href
\href{${1}}{${2}} ${0}
\\href{${1}}{${2}} ${0}
# URL from Clipboard.
snippet urlc
\url{`@+`} ${0}
\\url{`@+`} ${0}
snippet hrefc
\href{`@+`}{${1}} ${0}
\\href{`@+`}{${1}} ${0}

View File

@ -0,0 +1,34 @@
snippet bl "{% block xyz %} .. {% endblock xyz %}"
{% block ${1} %}
${2:${VISUAL}}
{% endblock $1 %}
snippet js "{% javascripts 'xyz' %} .. {% endjavascripts %}"
{% javascripts '${1}' %}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}
snippet css "{% stylesheets 'xyz' %} .. {% endstylesheets %}"
{% stylesheets '${1}' %}
<link rel="stylesheet" href="{{ asset_url }}">
{% endstylesheets %}
snippet if "{% if %} .. {% endif %}"
{% if ${1} %}
${2:${VISUAL}}
{% endif %}
snippet ife "{% if %} .. {% else %} .. {% endif %}"
{% if ${1} %}
${2:${VISUAL}}
{% else %}
${0}
{% endif %}
snippet el "{% else %}"
{% else %}
${0:${VISUAL}}
snippet eif "{% elseif %}"
{% elseif ${1} %}
${0}
snippet for "{% for x in y %} .. {% endfor %}"
{% for ${1} in ${2} %}
${3}
{% endfor %}
snippet ext "{% extends xyz %}"
{% extends ${1} %}

View File

@ -0,0 +1,63 @@
# if statement
snippet if
if (${1}) begin
${0}
end
# If/else statements
snippet ife
if (${1}) begin
${2}
end
else begin
${1}
end
# Else if statement
snippet eif
else if (${1}) begin
${0}
end
#Else statement
snippet el
else begin
${0}
end
# While statement
snippet wh
while (${1}) begin
${0}
end
# Repeat Loop
snippet rep
repeat (${1}) begin
${0}
end
# Case statement
snippet case
case (${1:/* variable */})
${2:/* value */}: begin
${3}
end
default: begin
${4}
end
endcase
# CaseZ statement
snippet casez
casez (${1:/* variable */})
${2:/* value */}: begin
${3}
end
default: begin
${4}
end
endcase
# Always block
snippet al
always @(${1:/* sensitive list */}) begin
${0}
end
# Module block
snippet mod
module ${1:module_name} (${2});
${0}
endmodule

View File

@ -0,0 +1,127 @@
#
## Libraries
snippet lib
library ${1}
use ${1}.${2}
# Standard Libraries
snippet libs
library IEEE;
use IEEE.std_logic_1164.ALL;
use IEEE.numeric_std.ALL;
# Xilinx Library
snippet libx
library UNISIM;
use UNISIM.VCOMPONENTS.ALL;
## Entity Declaration
snippet ent
entity ${1:`vim_snippets#Filename()`} is
generic (
${2}
);
port (
${3}
);
end entity $1;
## Architecture
snippet arc
architecture ${1:behav} of ${2:`vim_snippets#Filename()`} is
${3}
begin
end $1;
## Declarations
# std_logic
snippet st
signal ${1} : std_logic;
# std_logic_vector
snippet sv
signal ${1} : std_logic_vector (${2} downto 0);
# std_logic in
snippet ist
${1} : in std_logic;
# std_logic_vector in
snippet isv
${1} : in std_logic_vector (${2} downto 0);
# std_logic out
snippet ost
${1} : out std_logic;
# std_logic_vector out
snippet osv
${1} : out std_logic_vector (${2} downto 0);
# unsigned
snippet un
signal ${1} : unsigned (${2} downto 0);
## Process Statements
# process
snippet pr
process (${1})
begin
${2}
end process;
# process with clock
snippet prc
process (${1:clk})
begin
if rising_edge ($1) then
${2}
end if;
end process;
# process all
snippet pra
process (${1:all})
begin
${2}
end process;
## Control Statements
# if
snippet if
if ${1} then
${2}
end if;
# if
snippet ife
if ${1} then
${2}
else
${3}
end if;
# else
snippet el
else
${1}
# if
snippet eif
elsif ${1} then
${2}
# case
snippet ca
case ${1} is
${2}
end case;
# when
snippet wh
when ${1} =>
${2}
# for
snippet for
for ${1:i} in ${2} ${3:to} ${4} loop
${5}
end loop;
# while
snippet wh
while ${1} loop
${2}
end loop;
## Misc
# others
snippet oth
(others => '${1:0}');

View File

@ -14,13 +14,13 @@ snippet f function
endf
snippet t try ... catch statement
try
${1}
${1:${VISUAL}}
catch ${2}
${0}
endtry
snippet for for ... in loop
for ${1} in ${2}
${0}
${0:${VISUAL}}
endfor
snippet forkv for [key, value] in loop
for [${1},${2}] in items(${3})
@ -29,15 +29,15 @@ snippet forkv for [key, value] in loop
endfor
snippet wh while loop
while ${1}
${0}
${0:${VISUAL}}
endw
snippet if if statement
if ${1}
${0}
${0:${VISUAL}}
endif
snippet ife if ... else statement
if ${1}
${2}
${2:${VISUAL}}
else
${0}
endif

View File

@ -0,0 +1,12 @@
# xml declaration
snippet xml
<?xml version="1.0" encoding="UTF-8"?>
# tag
snippet t
<${1:}>
${2}
</$1>
# inline tag
snippet ti
<${1:}>${2}</$1>

View File

@ -4,40 +4,40 @@ snippet #!
snippet if
if ${1:condition}; then
${0:# statements}
${0:${VISUAL}}
fi
snippet ife
if ${1:condition}; then
${2:# statements}
${2:${VISUAL}}
else
${0:# statements}
fi
snippet eif
elif ${1:condition}; then
${0:# statements}
${0:${VISUAL}}
snippet for
for (( ${2:i} = 0; $2 < ${1:count}; $2++ )); do
${0:# statements}
${0:${VISUAL}}
done
snippet fori
for ${1:needle} in ${2:haystack}; do
${0:#statements}
${0:${VISUAL}}
done
snippet fore
for ${1:item} in ${2:list}; do
${0:# statements}
${0:${VISUAL}}
done
snippet wh
while ${1:condition}; do
${0:# statements}
${0:${VISUAL}}
done
snippet until
until ${1:condition}; do
${0:# statements}
${0:${VISUAL}}
done
snippet repeat
repeat ${1:integer}; do
${0:# statements}
${0:${VISUAL}}
done
snippet case
case ${1:word} in
@ -46,7 +46,7 @@ snippet case
esac
snippet select
select ${1:answer} in ${2:choices}; do
${0:# statements}
${0:${VISUAL}}
done
snippet (
( ${0:#statements} )