1
0
mirror of https://github.com/amix/vimrc synced 2025-06-16 09:35:01 +08:00

Updated plugins

This commit is contained in:
Amir
2020-04-25 21:56:16 -04:00
parent d98c510eee
commit fef069af24
114 changed files with 4018 additions and 988 deletions

View File

@ -308,16 +308,29 @@ endsnippet
# methods #
#############
snippet equals "Equals method" b
public override bool Equals(object obj)
snippet equals "Equality for a type" b
public override bool Equals(object obj) => Equals(obj as ${1:TYPE});
public bool Equals($1 other) // IEquatable<$1>
{
if (obj == null || GetType() != obj.GetType())
{
if (object.ReferenceEquals(other, null))
return false;
if (object.ReferenceEquals(this, other))
return true;
if (this.GetType() != other.GetType())
return false;
}
$0
return base.Equals(obj);
return base.Equals(other);
}
public override int GetHashCode() => base.GetHashCode();
public static bool operator ==($1 x, $1 y) =>
(object.ReferenceEquals(x, null) && object.ReferenceEquals(y, null))
|| (!object.ReferenceEquals(x, null) && x.Equals(y));
public static bool operator !=($1 x, $1 y) => !(x == y);
endsnippet
snippet mth "Method" b

View File

@ -0,0 +1,10 @@
snippet for "ejs for loop" b
<% for (let ${1:i = 0}; ${2:i<arr.length}; ${3:i++}) { %>
${0:body}
<% } %>
endsnippet
snippet forE "ejs for Each loop" b
<% ${1:array}.forEach((${2:single var}) => { %>
${0:body}
<% }) %>
endsnippet

View File

@ -0,0 +1,42 @@
# Functional components
snippet rfc "react functional component" b
import React, {useState} from "react"
function ${1:`!p snip.rv = snip.basename`}(${2}){
return(
<div>
${3:<p>Body</p>}
</div>
)
}
export default $4`!p snip.rv = snip.basename`
endsnippet
# React Hooks
snippet useS "useState Hook" b
const [${1}, set$1`!p snip.rv=t[1].title()`] = useState(${3:"${4}"})
endsnippet
snippet useE "useEffect Hook" b
useEffect(() => {
${1:${0}}
}${2})
endsnippet
snippet useC "useContext Hook" b
const ${1:context} = useContext(${2})
endsnippet
snippet useRe "useReducer Hook" b
const [${3:state}, ${4:dispatch}] = useReducer(${5:reducer}, ${2:initial_value})
endsnippet
snippet useCB "useCallback(fn, inputs)" b
const ${1:callback} = useCallback((${2})) => ${3:{
${4}
}}, [${5}]
endsnippet
snippet useM "useMemo(fn, inputs)" b
const ${1:memorized} = useMemo(() => ${2:{
${3}
}}, [${4}])
endsnippet
snippet useR "useRef(defaultValue)" b
const ${1:ref} = useRef(${2:null})
endsnippet

View File

@ -96,6 +96,9 @@ snippet *** "bold italics"
***${1:${VISUAL}}***$0
endsnippet
snippet /* "Comment"
<!-- ${1:${VISUAL}} -->$0
endsnippet
################
# Common stuff #
@ -131,6 +134,12 @@ snippet fnt "Footnote"
[^$1]:${2:Text}
endsnippet
snippet detail "Disclosure"
<details${3: open=""}>
${1:summary>${2}</summary>}$0
</details>
endsnippet
post_jump "create_table(snip)"
snippet "tb([1-9][1-9])" "Fancy table" br
`!p snip.rv = match.group(1)`

View File

@ -4,7 +4,7 @@
priority -50
snippet fn "pub fn name(?) -> ? {}"
snippet fn "fn name(?) -> ? {}"
fn ${1:function_name}($2)${3/..*/ -> /}$3 {
${VISUAL}$0
}

View File

@ -0,0 +1 @@
extends html, javascript, css

View File

@ -44,7 +44,7 @@ def add_row(snip):
endglobal
snippet "b(egin)?" "begin{} / end{}" br
snippet "\\?b(egin)?" "begin{} / end{}" br
\begin{${1:something}}
${0:${VISUAL}}
\end{$1}