mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated plugins. Added vim-golang as a mode
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
# Simple shortcuts
|
||||
|
||||
priority -50
|
||||
|
||||
snippet imp "import (imp)" b
|
||||
import ${1:std.stdio};
|
||||
endsnippet
|
||||
@ -42,22 +44,22 @@ endsnippet
|
||||
|
||||
snippet pub "public (pub)" b
|
||||
public:
|
||||
${1:/*members*/}
|
||||
${1:/*members*/}
|
||||
endsnippet
|
||||
|
||||
snippet priv "private (priv)" b
|
||||
private:
|
||||
${1:/*members*/}
|
||||
${1:/*members*/}
|
||||
endsnippet
|
||||
|
||||
snippet prot "protected (prot)" b
|
||||
protected:
|
||||
${1:/*members*/}
|
||||
${1:/*members*/}
|
||||
endsnippet
|
||||
|
||||
snippet pack "package (pack)" b
|
||||
package:
|
||||
${1:/*members*/}
|
||||
${1:/*members*/}
|
||||
endsnippet
|
||||
|
||||
snippet ret "return (ret)"
|
||||
@ -96,7 +98,7 @@ endsnippet
|
||||
|
||||
snippet enf "enforce (enf)" b
|
||||
enforce(${1:/*condition*/},
|
||||
new ${2}Exception(${3:/*args*/}));
|
||||
new ${2}Exception(${3:/*args*/}));
|
||||
endsnippet
|
||||
|
||||
# Branches
|
||||
@ -104,67 +106,67 @@ endsnippet
|
||||
snippet if "if .. (if)"
|
||||
if(${1:/*condition*/})
|
||||
{
|
||||
${VISUAL}${0:/*code*/}
|
||||
${VISUAL}${0:/*code*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet ife "if .. else (ife)" b
|
||||
if(${1:/*condition*/})
|
||||
{
|
||||
${2:/*code*/}
|
||||
${2:/*code*/}
|
||||
}
|
||||
else
|
||||
{
|
||||
${3:/*else*/}
|
||||
${3:/*else*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet el "else (el)" b
|
||||
else
|
||||
{
|
||||
${VISUAL}${1:/*code*/}
|
||||
${VISUAL}${1:/*code*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet eif "else if (elif)" b
|
||||
snippet elif "else if (elif)" b
|
||||
else if(${1:/*condition*/})
|
||||
{
|
||||
${VISUAL}${0:/*code*/}
|
||||
${VISUAL}${0:/*code*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet sw "switch (sw)"
|
||||
switch(${1:/*var*/})
|
||||
{
|
||||
case ${2:/*value*/}:
|
||||
${3:/*code*/}
|
||||
break;
|
||||
case ${4:/*value*/}:
|
||||
${5:/*code*/}
|
||||
break;
|
||||
${7:/*more cases*/}
|
||||
default:
|
||||
${6:assert(false);}
|
||||
case ${2:/*value*/}:
|
||||
${3:/*code*/}
|
||||
break;
|
||||
case ${4:/*value*/}:
|
||||
${5:/*code*/}
|
||||
break;
|
||||
${7:/*more cases*/}
|
||||
default:
|
||||
${6:assert(false);}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet fsw "final switch (fsw)"
|
||||
switch(${1:/*var*/})
|
||||
{
|
||||
case ${2:/*value*/}:
|
||||
${3:/*code*/}
|
||||
break;
|
||||
case ${4:/*value*/}:
|
||||
${5:/*code*/}
|
||||
break;
|
||||
${7:/*more cases*/}
|
||||
case ${2:/*value*/}:
|
||||
${3:/*code*/}
|
||||
break;
|
||||
case ${4:/*value*/}:
|
||||
${5:/*code*/}
|
||||
break;
|
||||
${7:/*more cases*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet case "case (case)" b
|
||||
case ${1:/*value*/}:
|
||||
${2:/*code*/}
|
||||
break;
|
||||
${2:/*code*/}
|
||||
break;
|
||||
endsnippet
|
||||
|
||||
snippet ?: "ternary operator (?:)"
|
||||
@ -176,42 +178,42 @@ endsnippet
|
||||
snippet do "do while (do)" b
|
||||
do
|
||||
{
|
||||
${VISUAL}${2:/*code*/}
|
||||
${VISUAL}${2:/*code*/}
|
||||
} while(${1:/*condition*/});
|
||||
endsnippet
|
||||
|
||||
snippet wh "while (wh)" b
|
||||
while(${1:/*condition*/})
|
||||
{
|
||||
${VISUAL}${2:/*code*/}
|
||||
${VISUAL}${2:/*code*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet for "for (for)" b
|
||||
for (${4:size_t} ${2:i} = 0; $2 < ${1:count}; ${3:++$2})
|
||||
{
|
||||
${VISUAL}${0:/*code*/}
|
||||
${VISUAL}${0:/*code*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet forever "forever (forever)" b
|
||||
for(;;)
|
||||
{
|
||||
${VISUAL}${0:/*code*/}
|
||||
${VISUAL}${0:/*code*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet fore "foreach (fore)"
|
||||
foreach(${1:/*elem*/}; ${2:/*range*/})
|
||||
{
|
||||
${VISUAL}${3:/*code*/}
|
||||
${VISUAL}${3:/*code*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet forif "foreach if (forif)" b
|
||||
foreach(${1:/*elem*/}; ${2:/*range*/}) if(${3:/*condition*/})
|
||||
{
|
||||
${VISUAL}${4:/*code*/}
|
||||
${VISUAL}${4:/*code*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -219,8 +221,8 @@ endsnippet
|
||||
snippet in "in contract (in)" b
|
||||
in
|
||||
{
|
||||
assert(${1:/*condition*/}, "${2:error message}");
|
||||
${3}
|
||||
assert(${1:/*condition*/}, "${2:error message}");
|
||||
${3}
|
||||
}
|
||||
body
|
||||
endsnippet
|
||||
@ -228,8 +230,8 @@ endsnippet
|
||||
snippet out "out contract (out)" b
|
||||
out${1:(result)}
|
||||
{
|
||||
assert(${2:/*condition*/}, "${3:error message}");
|
||||
${4}
|
||||
assert(${2:/*condition*/}, "${3:error message}");
|
||||
${4}
|
||||
}
|
||||
body
|
||||
endsnippet
|
||||
@ -237,8 +239,8 @@ endsnippet
|
||||
snippet inv "invariant (inv)" b
|
||||
invariant()
|
||||
{
|
||||
assert(${1:/*condition*/}, "${2:error message}");
|
||||
${3}
|
||||
assert(${1:/*condition*/}, "${2:error message}");
|
||||
${3}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -247,29 +249,29 @@ endsnippet
|
||||
snippet fun "function definition (fun)"
|
||||
${1:void} ${2:/*function name*/}(${3:/*args*/}) ${4:@safe pure nothrow}
|
||||
{
|
||||
${VISUAL}${5:/*code*/}
|
||||
${VISUAL}${5:/*code*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet void "void function definition (void)"
|
||||
void ${1:/*function name*/}(${2:/*args*/}) ${3:@safe pure nothrow}
|
||||
{
|
||||
${VISUAL}${4:/*code*/}
|
||||
${VISUAL}${4:/*code*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet this "ctor (this)" w
|
||||
this(${1:/*args*/})
|
||||
{
|
||||
${VISUAL}${2:/*code*/}
|
||||
${VISUAL}${2:/*code*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet get "getter property (get)" !
|
||||
snippet get "getter property (get)"
|
||||
@property ${1:/*type*/} ${2:/*member_name*/}() const pure nothrow {return ${3:$2_};}
|
||||
endsnippet
|
||||
|
||||
snippet set "setter property (set)" !
|
||||
snippet set "setter property (set)"
|
||||
@property void ${1:/*member_name*/}(${2:/*type*/} rhs) pure nothrow {${3:$1_} = rhs;}
|
||||
endsnippet
|
||||
|
||||
@ -278,7 +280,7 @@ endsnippet
|
||||
snippet main "Main" b
|
||||
void main(string[] args)
|
||||
{
|
||||
${VISUAL}${0: /*code*/}
|
||||
${VISUAL}${0: /*code*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -293,7 +295,7 @@ endsnippet
|
||||
snippet scope "scope (scope)" b
|
||||
scope(${1:exit})
|
||||
{
|
||||
${VISUAL}${2:/*code*/}
|
||||
${VISUAL}${2:/*code*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -302,7 +304,7 @@ endsnippet
|
||||
snippet with "with (with)"
|
||||
with(${1})
|
||||
{
|
||||
${VISUAL}${2:/*code*/}
|
||||
${VISUAL}${2:/*code*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -311,33 +313,33 @@ endsnippet
|
||||
snippet try "try/catch (try)" b
|
||||
try
|
||||
{
|
||||
${VISUAL}${1:/*code to try*/}
|
||||
${VISUAL}${1:/*code to try*/}
|
||||
}
|
||||
catch(${2}Exception e)
|
||||
{
|
||||
${3:/*handle exception*/}
|
||||
${3:/*handle exception*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet tryf "try/catch/finally (tryf)" b
|
||||
try
|
||||
{
|
||||
${VISUAL}${1:/*code to try*/}
|
||||
${VISUAL}${1:/*code to try*/}
|
||||
}
|
||||
catch(${2}Exception e)
|
||||
{
|
||||
${3:/*handle exception*/}
|
||||
${3:/*handle exception*/}
|
||||
}
|
||||
finally
|
||||
{
|
||||
${4:/*cleanup*/}
|
||||
${4:/*cleanup*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet catch "catch (catch)" b
|
||||
catch(${1}Exception e)
|
||||
{
|
||||
${2:/*handle exception*/}
|
||||
${2:/*handle exception*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -351,35 +353,35 @@ endsnippet
|
||||
snippet struct "struct (struct)"
|
||||
struct ${1:`!p snip.rv = (snip.basename or "name")`}
|
||||
{
|
||||
${2}
|
||||
${2}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet union "union (union)"
|
||||
union ${1:`!p snip.rv = (snip.basename or "name")`}
|
||||
{
|
||||
${2}
|
||||
${2}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet class "class (class)"
|
||||
class ${1:`!p snip.rv = (snip.basename or "name")`}
|
||||
{
|
||||
${2}
|
||||
${2}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet inter "interface (inter)"
|
||||
interface ${1:`!p snip.rv = (snip.basename or "name")`}
|
||||
{
|
||||
${2}
|
||||
${2}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet enum "enum (enum)"
|
||||
enum ${1:`!p snip.rv = (snip.basename or "name")`}
|
||||
{
|
||||
${2}
|
||||
${2}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -388,12 +390,12 @@ endsnippet
|
||||
|
||||
snippet exc "exception declaration (exc)" b
|
||||
/// ${3:/*documentation*/}
|
||||
class ${1}Exception : ${2}Exception
|
||||
class ${1}Exception : ${2}Exception
|
||||
{
|
||||
public this(string msg, string file = __FILE__, int line = __LINE__)
|
||||
{
|
||||
super(msg, file, line);
|
||||
}
|
||||
public this(string msg, string file = __FILE__, int line = __LINE__)
|
||||
{
|
||||
super(msg, file, line);
|
||||
}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -403,14 +405,14 @@ endsnippet
|
||||
snippet version "version (version)" b
|
||||
version(${1:/*version name*/})
|
||||
{
|
||||
${VISUAL}${2:/*code*/}
|
||||
${VISUAL}${2:/*code*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet debug "debug" b
|
||||
debug
|
||||
{
|
||||
${VISUAL}${1:/*code*/}
|
||||
${VISUAL}${1:/*code*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -420,7 +422,7 @@ endsnippet
|
||||
snippet temp "template (temp)" b
|
||||
template ${2:/*name*/}(${1:/*args*/})
|
||||
{
|
||||
${3:/*code*/}
|
||||
${3:/*code*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -438,7 +440,7 @@ endsnippet
|
||||
snippet unittest "unittest (unittest)" b
|
||||
unittest
|
||||
{
|
||||
${1:/*code*/}
|
||||
${1:/*code*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -448,41 +450,41 @@ endsnippet
|
||||
snippet opDis "opDispatch (opDis)" b
|
||||
${1:/*return type*/} opDispatch(string s)()
|
||||
{
|
||||
${2:/*code*/};
|
||||
${2:/*code*/};
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet op= "opAssign (op=)" b
|
||||
void opAssign(${1} rhs) ${2:@safe pure nothrow}
|
||||
{
|
||||
${2:/*code*/}
|
||||
${2:/*code*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet opCmp "opCmp (opCmp)" b
|
||||
int opCmp(${1} rhs) @safe const pure nothrow
|
||||
{
|
||||
${2:/*code*/}
|
||||
${2:/*code*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet opApply "opApply (opApply)" b
|
||||
int opApply(int delegate(ref ${1:/*iterated type/s*/}) dg)
|
||||
{
|
||||
int result = 0;
|
||||
${2:/*loop*/}
|
||||
{
|
||||
result = dg(${3:/*arg/s*/});
|
||||
if(result){break;}
|
||||
}
|
||||
return result;
|
||||
int result = 0;
|
||||
${2:/*loop*/}
|
||||
{
|
||||
result = dg(${3:/*arg/s*/});
|
||||
if(result){break;}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet toString "toString (toString)" b
|
||||
string toString() @safe const pure nothrow
|
||||
{
|
||||
${1:/*code*/}
|
||||
${1:/*code*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -490,12 +492,11 @@ endsnippet
|
||||
# Comments
|
||||
|
||||
|
||||
snippet todo "TODO (todo)" !
|
||||
snippet todo "TODO (todo)"
|
||||
// TODO: ${1}
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
# DDoc
|
||||
|
||||
snippet doc "generic ddoc block (doc)" b
|
||||
@ -508,7 +509,7 @@ snippet fdoc "function ddoc block (fdoc)" b
|
||||
/// ${1:description}
|
||||
///
|
||||
/// ${2:Params: ${3:param} = ${4:param description}
|
||||
/// ${5}}
|
||||
/// ${5}}
|
||||
///
|
||||
/// ${6:Returns: ${7:return value}}
|
||||
///
|
||||
@ -517,7 +518,7 @@ endsnippet
|
||||
|
||||
snippet Par "Params (Par)"
|
||||
Params: ${1:param} = ${2:param description}
|
||||
/// ${3}
|
||||
/// ${3}
|
||||
endsnippet
|
||||
|
||||
snippet Ret "Returns (Ret)"
|
||||
@ -543,16 +544,16 @@ snippet gpl "GPL (gpl)" b
|
||||
// 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, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
//
|
||||
// Copyright (C) ${1:Author}, `!v strftime("%Y")`
|
||||
|
||||
${2}
|
||||
|
Reference in New Issue
Block a user