mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated vimrc
This commit is contained in:
@ -15,7 +15,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:`g:snips_author`}
|
||||
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
|
||||
@ -32,7 +32,7 @@ snippet GPL2
|
||||
${0}
|
||||
snippet LGPL2
|
||||
${1:One line to give the program's name and a brief description.}
|
||||
Copyright (C) `strftime("%Y")` ${2:`g:snips_author`}
|
||||
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
|
||||
@ -49,7 +49,7 @@ snippet LGPL2
|
||||
${0}
|
||||
snippet GPL3
|
||||
${1:one line to give the program's name and a brief description.}
|
||||
Copyright (C) `strftime("%Y")` ${2:`g:snips_author`}
|
||||
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
|
||||
@ -66,7 +66,7 @@ snippet GPL3
|
||||
${0}
|
||||
snippet LGPL3
|
||||
${1:One line to give the program's name and a brief description.}
|
||||
Copyright (C) `strftime("%Y")` ${2:`g:snips_author`}
|
||||
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,7 +83,7 @@ snippet LGPL3
|
||||
${0}
|
||||
snippet AGPL3
|
||||
${1:one line to give the program's name and a brief description.}
|
||||
Copyright (C) `strftime("%Y")` ${2:`g:snips_author`}
|
||||
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
|
||||
@ -109,7 +109,7 @@ snippet GMGPL linking exception
|
||||
${0}
|
||||
snippet BSD2
|
||||
${1:one line to give the program's name and a brief description}
|
||||
Copyright (C) `strftime("%Y")` ${2:`g:snips_author`}
|
||||
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
|
||||
@ -138,7 +138,7 @@ snippet BSD2
|
||||
${0}
|
||||
snippet BSD3
|
||||
${1:one line to give the program's name and a brief description}
|
||||
Copyright (C) `strftime("%Y")` ${2:`g:snips_author`}
|
||||
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
|
||||
@ -165,7 +165,7 @@ snippet BSD3
|
||||
${0}
|
||||
snippet BSD4
|
||||
${1:one line to give the program's name and a brief description}
|
||||
Copyright (C) `strftime("%Y")` ${2:`g:snips_author`}
|
||||
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
|
||||
@ -195,7 +195,7 @@ snippet BSD4
|
||||
${0}
|
||||
snippet MIT
|
||||
${1:one line to give the program's name and a brief description}
|
||||
Copyright (C) `strftime("%Y")` ${2:`g:snips_author`}
|
||||
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"),
|
||||
@ -261,3 +261,19 @@ snippet MPL2
|
||||
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/>.
|
||||
|
106
sources_non_forked/vim-snippets/snippets/arduino.snippets
Normal file
106
sources_non_forked/vim-snippets/snippets/arduino.snippets
Normal file
@ -0,0 +1,106 @@
|
||||
snippet setup
|
||||
void setup()
|
||||
{
|
||||
${0}
|
||||
Serial.begin(9600);
|
||||
}
|
||||
|
||||
snippet loop
|
||||
void loop()
|
||||
{
|
||||
${0}
|
||||
}
|
||||
|
||||
snippet inc
|
||||
#include <${1}.h>
|
||||
|
||||
# if
|
||||
snippet if
|
||||
if (${1:/* condition */}) {
|
||||
${2}
|
||||
}
|
||||
# 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 (${2:i} = 0; $2 < ${1:count}; $2${3:++}) {
|
||||
${4}
|
||||
}
|
||||
# for (custom)
|
||||
snippet forr
|
||||
for (${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});
|
||||
# serialRead
|
||||
snippet sr
|
||||
serialRead();
|
||||
# serial.println
|
||||
snippet sp
|
||||
serial.println(${1});
|
||||
|
||||
|
||||
# delay
|
||||
snippet dl
|
||||
delay(${1});
|
@ -52,22 +52,28 @@ snippet once
|
||||
## Control Statements
|
||||
# if
|
||||
snippet if
|
||||
if (${1:/* condition */}) {
|
||||
if (${1:true}) {
|
||||
${0}
|
||||
}
|
||||
snippet ife
|
||||
if (${1:true}) {
|
||||
${2}
|
||||
} else {
|
||||
${0}
|
||||
}
|
||||
# else
|
||||
snippet el
|
||||
else {
|
||||
${1}
|
||||
${0}
|
||||
}
|
||||
# else if
|
||||
snippet elif
|
||||
else if (${1:/* condition */}) {
|
||||
${2}
|
||||
else if (${1:true}) {
|
||||
${0}
|
||||
}
|
||||
# ifi
|
||||
snippet ifi
|
||||
if (${1:/* condition */}) ${2};
|
||||
if (${1:true}) ${0};
|
||||
# ternary
|
||||
snippet t
|
||||
${1:/* condition */} ? ${2:a} : ${3:b}
|
||||
|
@ -42,98 +42,51 @@ snippet ci_model_crudl
|
||||
${3:// code...}
|
||||
}
|
||||
|
||||
// public create(data) {{{
|
||||
/**
|
||||
* create
|
||||
*
|
||||
* @param mixed $data
|
||||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
public function create($data)
|
||||
{
|
||||
if($this->db->insert($table, $data))
|
||||
if($this->db->insert($this->table, $data))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// public read(id) {{{
|
||||
/**
|
||||
* read
|
||||
*
|
||||
* @param int $id
|
||||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
public function read($id)
|
||||
{
|
||||
return $this->db->get_where($table, array('id', $id))->result();
|
||||
return $this->db->get_where($this->table, array('id', $id))->result();
|
||||
}
|
||||
// }}}
|
||||
|
||||
// public update(id,data) {{{
|
||||
/**
|
||||
* update
|
||||
*
|
||||
* @param int $id
|
||||
* @param mixed $data
|
||||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
public function update($id, $data)
|
||||
{
|
||||
if($this->db->update($table, $data, array('id' => $id)))
|
||||
if($this->db->update($this->table, $data, array('id' => $id)))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// public delete(id) {{{
|
||||
/**
|
||||
* delete
|
||||
*
|
||||
* @param mixed $id (int o array of int)
|
||||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
if(is_array($id))
|
||||
{
|
||||
$this->db->trans_start();
|
||||
foreach($id as $elem)
|
||||
$this->db->delete($table, array('id' => $elem));
|
||||
$this->db->delete($this->table, array('id' => $elem));
|
||||
$this->db->trans_complete();
|
||||
}
|
||||
else
|
||||
{
|
||||
if($this->db->delete($table, array('id' => $id)))
|
||||
if($this->db->delete($this->table, array('id' => $id)))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// }}}
|
||||
|
||||
// public listRows(limit=null,offset=0) {{{
|
||||
/**
|
||||
* listRows
|
||||
*
|
||||
* @param int $limit
|
||||
* @param int $offset
|
||||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
public function listRows($limit = null, $offset = 0)
|
||||
{
|
||||
if(!is_null($limit))
|
||||
$this->db->limit($limit, $offset);
|
||||
return $this->db->get($table)->result();
|
||||
return $this->db->get($this->table)->result();
|
||||
}
|
||||
// }}}
|
||||
}
|
||||
# Load view
|
||||
snippet ci_load-view
|
||||
|
@ -1,3 +1,5 @@
|
||||
extends c
|
||||
|
||||
## STL Collections
|
||||
# std::array
|
||||
snippet array
|
||||
|
@ -56,22 +56,26 @@
|
||||
#
|
||||
# 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}) {
|
||||
if (${1:true}) {
|
||||
${0}
|
||||
}
|
||||
snippet el
|
||||
@ -90,10 +94,10 @@ snippet ?
|
||||
snippet do
|
||||
do {
|
||||
${0}
|
||||
} while (${1});
|
||||
} while (${1:true});
|
||||
# while loop
|
||||
snippet wh
|
||||
while (${1}) {
|
||||
while (${1:true}) {
|
||||
${0}
|
||||
}
|
||||
# for loop
|
||||
@ -101,17 +105,21 @@ 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}
|
||||
}
|
||||
@ -372,3 +385,86 @@ 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}
|
||||
}
|
||||
catch (${1:System.Exception}) {
|
||||
throw;
|
||||
}
|
||||
snippet tryf
|
||||
try {
|
||||
${0}
|
||||
}
|
||||
finally {
|
||||
${1}
|
||||
}
|
||||
# using
|
||||
snippet usi
|
||||
using(${1:resource}) {
|
||||
${0}
|
||||
}
|
||||
|
@ -1,6 +1,40 @@
|
||||
snippet %
|
||||
<% ${0} %>
|
||||
|
||||
snippet =
|
||||
<%= ${1} %>
|
||||
<%= ${0} %>
|
||||
|
||||
snippet end
|
||||
<% end %>
|
||||
|
||||
snippet for
|
||||
<%= for ${1:item} <- ${2:items} ${3:@conn} do %>
|
||||
${0}
|
||||
<% end %>
|
||||
|
||||
snippet if
|
||||
<%= if ${1} do %>
|
||||
${0}
|
||||
<% end %>
|
||||
|
||||
snippet ife
|
||||
<%= if ${1} do %>
|
||||
${2}
|
||||
<%= 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 %>
|
||||
|
@ -40,6 +40,14 @@ snippet case
|
||||
${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 df
|
||||
def ${1:name}, do: ${2}
|
||||
snippet def
|
||||
@ -89,8 +97,8 @@ snippet mdoc
|
||||
"""
|
||||
snippet rec
|
||||
receive do
|
||||
${1} ->
|
||||
${0}
|
||||
${1} ->
|
||||
${0}
|
||||
end
|
||||
snippet req
|
||||
require ${0:module_name}
|
||||
|
@ -103,8 +103,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}}.
|
||||
|
@ -226,6 +226,8 @@ 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
|
||||
|
@ -1,3 +1,5 @@
|
||||
snippet #!
|
||||
#!/usr/bin/env node
|
||||
# module exports
|
||||
snippet ex
|
||||
module.exports = ${1};
|
||||
|
@ -235,7 +235,8 @@ snippet qsa
|
||||
${1:document}.querySelectorAll('${0:CSS selector}')
|
||||
|
||||
# Debugging
|
||||
|
||||
snippet de
|
||||
debugger;
|
||||
# console.log
|
||||
snippet cl
|
||||
console.log(${0});
|
||||
|
242
sources_non_forked/vim-snippets/snippets/laravel.snippets
Normal file
242
sources_non_forked/vim-snippets/snippets/laravel.snippets
Normal 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}'; }
|
||||
}
|
@ -1,4 +1,31 @@
|
||||
# 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 ifeq
|
||||
ifeq (${1:cond0},${2:cond1})
|
||||
ifeq (${1:cond0}, ${2:cond1})
|
||||
${0}
|
||||
endif
|
||||
|
@ -47,7 +47,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
|
||||
@ -138,18 +138,17 @@ snippet pdbbb
|
||||
# remote python debugger (rpdb)
|
||||
snippet rpdb
|
||||
import rpdb; rpdb.set_trace()
|
||||
# python_prompt_toolkit
|
||||
snippet ppt
|
||||
from prompt_toolkit.contrib.repl import embed
|
||||
embed(globals(), locals(), vi_mode=${1:default=False}, history_filename=${2:default=None})
|
||||
# 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()
|
||||
snippet pprint
|
||||
import pprint; pprint.pprint(${1})
|
||||
snippet "
|
||||
"""
|
||||
${0:doc}
|
||||
"""${0:doc}
|
||||
"""
|
||||
# assertions
|
||||
snippet a=
|
||||
@ -200,8 +199,7 @@ snippet lc
|
||||
snippet li
|
||||
logger.info(${0:msg})
|
||||
snippet epydoc
|
||||
"""
|
||||
${1:Description}
|
||||
"""${1:Description}
|
||||
|
||||
@param ${2:param}: ${3: Description}
|
||||
@type $2: ${4: Type}
|
||||
|
@ -121,23 +121,17 @@ snippet cla class .. initialize .. end
|
||||
${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
|
||||
@ -152,12 +146,6 @@ snippet cla-
|
||||
end
|
||||
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
|
||||
@ -735,3 +723,11 @@ 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} }
|
||||
|
@ -111,7 +111,7 @@ snippet while "while loop"
|
||||
${0}
|
||||
}
|
||||
snippet for "for ... in ... loop"
|
||||
for ${1:i} in ${2:0u..10} {
|
||||
for ${1:i} in ${2} {
|
||||
${0}
|
||||
}
|
||||
# TODO commenting
|
||||
|
127
sources_non_forked/vim-snippets/snippets/systemverilog.snippets
Normal file
127
sources_non_forked/vim-snippets/snippets/systemverilog.snippets
Normal file
@ -0,0 +1,127 @@
|
||||
# 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
|
||||
# Foreach Loopo
|
||||
snippet fe
|
||||
foreach (${1}) begin
|
||||
${0}
|
||||
end
|
||||
# Do-while statement
|
||||
snippet dowh
|
||||
do begin
|
||||
${0}
|
||||
end while (${1});
|
||||
# Case statement
|
||||
snippet case
|
||||
case (${1})
|
||||
{$2}: begin
|
||||
${0}
|
||||
end
|
||||
default: begin
|
||||
end
|
||||
endcase
|
||||
# CaseZ statement
|
||||
snippet casez
|
||||
casez (${1})
|
||||
{$2}: begin
|
||||
${0}
|
||||
end
|
||||
default: begin
|
||||
end
|
||||
endcase
|
||||
# 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
|
||||
# Module block
|
||||
snippet mod
|
||||
module ${1:module_name} (${2});
|
||||
${0}
|
||||
endmodule : $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
|
@ -45,10 +45,15 @@ snippet gat gather(ed) environment
|
||||
# Equation
|
||||
snippet eq equation environment
|
||||
\begin{equation}
|
||||
\label{eq:${2}}
|
||||
${0}
|
||||
\end{equation}
|
||||
# Equation
|
||||
snippet eql Labeled equation environment
|
||||
\begin{equation}
|
||||
\label{eq:${2}}
|
||||
${0}
|
||||
\end{equation}
|
||||
# Equation
|
||||
snippet eq* unnumbered equation environment
|
||||
\begin{equation*}
|
||||
${0}
|
||||
@ -206,6 +211,13 @@ snippet rm roman font text
|
||||
\textrm{${0:text}}
|
||||
snippet tt typewriter (monospace) text
|
||||
\texttt{${0:text}}
|
||||
#Math font
|
||||
snippet mf mathfrak
|
||||
\mathfrak{${0:text}}
|
||||
snippet mc mathcal
|
||||
\mathcal{${0:text}}
|
||||
snippet ms mathscr
|
||||
\mathscr{${0:text}}
|
||||
#misc
|
||||
snippet ft \footnote
|
||||
\footnote{${0:text}}
|
||||
@ -263,6 +275,18 @@ snippet col2 two-column environment
|
||||
${0}
|
||||
\end{column}
|
||||
\end{columns}
|
||||
#delimiter
|
||||
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}]
|
||||
|
Reference in New Issue
Block a user