mirror of
https://github.com/amix/vimrc
synced 2025-06-17 02:15:01 +08:00
Updated plugins
This commit is contained in:
@ -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
|
||||
|
10
sources_non_forked/vim-snippets/UltiSnips/ejs.snippets
Normal file
10
sources_non_forked/vim-snippets/UltiSnips/ejs.snippets
Normal 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
|
@ -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
|
@ -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)`
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
priority -50
|
||||
|
||||
snippet fn "pub fn name(?) -> ? {}"
|
||||
snippet fn "fn name(?) -> ? {}"
|
||||
fn ${1:function_name}($2)${3/..*/ -> /}$3 {
|
||||
${VISUAL}$0
|
||||
}
|
||||
|
@ -0,0 +1 @@
|
||||
extends html, javascript, css
|
@ -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}
|
||||
|
@ -1,88 +1,70 @@
|
||||
# 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}) {
|
||||
@ -93,10 +75,8 @@ snippet sw switch
|
||||
${0}
|
||||
break
|
||||
}
|
||||
|
||||
# the switch is a gawk extension
|
||||
snippet case case
|
||||
case ${1}:
|
||||
${0}
|
||||
break
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
## Main
|
||||
# main
|
||||
snippet main
|
||||
int main(int argc, const char *argv[])
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
${0}
|
||||
return 0;
|
||||
|
@ -0,0 +1,59 @@
|
||||
# Snippets for dart in flutter project, to use add the following to your .vimrc
|
||||
# `autocmd BufRead,BufNewFile,BufEnter *.dart UltiSnipsAddFiletypes dart-flutter`
|
||||
# Flutter stateless widget
|
||||
snippet stless
|
||||
class $1 extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
$2
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
# Flutter stateful widget
|
||||
snippet stful
|
||||
class $1 extends StatefulWidget {
|
||||
@override
|
||||
_$1State createState() => _$1State();
|
||||
}
|
||||
|
||||
class _$1State extends State<$1> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
$2
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
# Flutter widget with AnimationController
|
||||
snippet stanim
|
||||
class $1 extends StatefulWidget {
|
||||
@override
|
||||
_$1State createState() => _$1State();
|
||||
}
|
||||
|
||||
class _$1State extends State<$1>
|
||||
with SingleTickerProviderStateMixin {
|
||||
AnimationController _controller;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_controller = AnimationController(vsync: this);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
_controller.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
$2
|
||||
);
|
||||
}
|
||||
}
|
@ -21,9 +21,9 @@ snippet info
|
||||
snippet imp
|
||||
import ${0:Data.Text}
|
||||
snippet import
|
||||
import ${0:Data.Text}
|
||||
import ${0:Data.Text}
|
||||
snippet import2
|
||||
import ${1:Data.Text} (${0:head})
|
||||
import ${1:Data.Text} (${0:head})
|
||||
snippet impq
|
||||
import qualified ${1:Data.Text} as ${0:T}
|
||||
snippet importq
|
||||
|
@ -327,7 +327,9 @@ snippet =>
|
||||
(${1}) => {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet af
|
||||
snippet af "() =>"
|
||||
(${1}) => ${0:${VISUAL}}
|
||||
snippet afb "() => {}"
|
||||
(${1}) => {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
|
@ -89,14 +89,26 @@ snippet thr throw
|
||||
${0}
|
||||
|
||||
# Messages
|
||||
snippet in
|
||||
info("${1}")
|
||||
${0}
|
||||
snippet @i
|
||||
@info "${1}" ${0}
|
||||
|
||||
snippet wa
|
||||
warn("${1}")
|
||||
${0}
|
||||
snippet @w
|
||||
@warn "${1}" ${0}
|
||||
|
||||
snippet err
|
||||
error("${1}")
|
||||
${0}
|
||||
snippet @e
|
||||
@error "${1}" ${0}
|
||||
|
||||
snippet @d
|
||||
@debug "${1}" ${0}
|
||||
|
||||
snippet @t @testset with @test
|
||||
@testset "${1}" begin
|
||||
${2}
|
||||
@test ${0}
|
||||
end
|
||||
|
||||
snippet @tt @testset with @test_throws
|
||||
@testset "${1}" begin
|
||||
${2}
|
||||
@test_throws ${0}
|
||||
end
|
||||
|
@ -63,6 +63,10 @@ snippet include
|
||||
{% include '${0:snippet}' %}
|
||||
snippet includewith
|
||||
{% include '${1:snippet}', ${2:variable}: ${0:value} %}
|
||||
snippet render
|
||||
{% render '${0:snippet}' %}
|
||||
snippet renderwith
|
||||
{% render '${1:snippet}', ${2:variable}: ${0:value} %}
|
||||
snippet section
|
||||
{% section '${1:snippet}' %}
|
||||
snippet raw
|
||||
|
@ -129,6 +129,12 @@ snippet img
|
||||
snippet youtube
|
||||
{% youtube ${0:video_id} %}
|
||||
|
||||
snippet tb
|
||||
| ${0:factors} | ${1:a} | ${2:b} |
|
||||
| ------------- |------------- | ------- |
|
||||
| ${3:f1} | Y | N |
|
||||
| ${4:f2} | Y | N |
|
||||
|
||||
# The quote should appear only once in the text. It is inherently part of it.
|
||||
# See http://octopress.org/docs/plugins/pullquote/ for more info.
|
||||
|
||||
|
@ -357,6 +357,10 @@ snippet dump
|
||||
use Data::Dump qw(dump);
|
||||
warn dump ${1:variable}
|
||||
|
||||
snippet ddp
|
||||
use DDP;
|
||||
p ${1:variable}
|
||||
|
||||
snippet subtest
|
||||
subtest '${1: test_name}' => sub {
|
||||
${2}
|
||||
|
@ -123,6 +123,8 @@ snippet ret
|
||||
return ${0}
|
||||
snippet .
|
||||
self.
|
||||
snippet sa self.attribute = attribute
|
||||
self.${1:attribute} = $1
|
||||
snippet try Try/Except
|
||||
try:
|
||||
${1:${VISUAL}}
|
||||
@ -182,6 +184,10 @@ snippet ptpython
|
||||
# python console debugger (pudb)
|
||||
snippet pudb
|
||||
__import__('pudb').set_trace()
|
||||
# python console debugger remote (pudb)
|
||||
snippet pudbr
|
||||
from pudb.remote import set_trace
|
||||
set_trace()
|
||||
# pdb in nosetests
|
||||
snippet nosetrace
|
||||
__import__('nose').tools.set_trace()
|
||||
|
@ -32,6 +32,10 @@ snippet for
|
||||
for (${1:item} in ${2:list}) {
|
||||
${3}
|
||||
}
|
||||
snippet foreach
|
||||
foreach (${1:item} = ${2:list}) {
|
||||
${3}
|
||||
}
|
||||
|
||||
# functions
|
||||
snippet fun
|
||||
|
205
sources_non_forked/vim-snippets/snippets/rmd.snippets
Normal file
205
sources_non_forked/vim-snippets/snippets/rmd.snippets
Normal file
@ -0,0 +1,205 @@
|
||||
#
|
||||
# Snipmate Snippets for Pandoc Markdown
|
||||
#
|
||||
# Many snippets have starred versions, i.e., versions
|
||||
# that end with an asterisk (`*`). These snippets use
|
||||
# vim's `"*` register---i.e., the contents of the
|
||||
# system clipboard---to insert text.
|
||||
|
||||
# Insert Title Block
|
||||
snippet %%
|
||||
% ${1:`Filename('', 'title')`}
|
||||
% ${2:`g:snips_author`}
|
||||
% ${3:`strftime("%d %B %Y")`}
|
||||
|
||||
${4}
|
||||
snippet %%*
|
||||
% ${1:`Filename('', @*)`}
|
||||
% ${2:`g:snips_author`}
|
||||
% ${3:`strftime("%d %b %Y")`}
|
||||
|
||||
${4}
|
||||
|
||||
# Insert Definition List
|
||||
snippet ::
|
||||
${1:term}
|
||||
~ ${2:definition}
|
||||
|
||||
# Underline with `=`s or `-`s
|
||||
snippet ===
|
||||
`repeat('=', strlen(getline(line(".") - 1)))`
|
||||
|
||||
${1}
|
||||
snippet ---
|
||||
`repeat('-', strlen(getline(line(".") - 1)))`
|
||||
|
||||
${1}
|
||||
|
||||
# Links and their kin
|
||||
# -------------------
|
||||
#
|
||||
# (These don't play very well with delimitMate)
|
||||
#
|
||||
|
||||
snippet [
|
||||
[${1:link}](http://${2:url} "${3:title}")${4}
|
||||
snippet [*
|
||||
[${1:link}](${2:`@*`} "${3:title}")${4}
|
||||
|
||||
snippet [:
|
||||
[${1:id}]: http://${2:url} "${3:title}"
|
||||
snippet [:*
|
||||
[${1:id}]: ${2:`@*`} "${3:title}"
|
||||
|
||||
snippet [@
|
||||
[${1:link}](mailto:${2:email})${3}
|
||||
snippet [@*
|
||||
[${1:link}](mailto:${2:`@*`})${3}
|
||||
|
||||
snippet [:@
|
||||
[${1:id}]: mailto:${2:email} "${3:title}"
|
||||
snippet [:@*
|
||||
[${1:id}]: mailto:${2:`@*`} "${3:title}"
|
||||
|
||||
snippet ${4}
|
||||
snippet ${4}
|
||||
|
||||
snippet ![:
|
||||
![${1:id}]: ${2:url} "${3:title}"
|
||||
snippet ![:*
|
||||
![${1:id}]: ${2:`@*`} "${3:title}"
|
||||
|
||||
snippet [^:
|
||||
[^${1:id}]: ${2:note}
|
||||
snippet [^:*
|
||||
[^${1:id}]: ${2:`@*`}
|
||||
|
||||
#
|
||||
|
||||
# library()
|
||||
snippet req
|
||||
require(${1:}, quietly = TRUE)
|
||||
# If Condition
|
||||
snippet if
|
||||
if ( ${1:condition} )
|
||||
{
|
||||
${2:}
|
||||
}
|
||||
snippet el
|
||||
else
|
||||
{
|
||||
${1:}
|
||||
}
|
||||
|
||||
# Function
|
||||
snippet fun
|
||||
${1:funname} <- # ${2:}
|
||||
function
|
||||
(
|
||||
${3:}
|
||||
)
|
||||
{
|
||||
${4:}
|
||||
}
|
||||
# repeat
|
||||
snippet re
|
||||
repeat{
|
||||
${2:}
|
||||
if(${1:condition}) break
|
||||
}
|
||||
|
||||
# matrix
|
||||
snippet ma
|
||||
matrix(NA, nrow = ${1:}, ncol = ${2:})
|
||||
|
||||
# data frame
|
||||
snippet df
|
||||
data.frame(${1:}, header = TRUE)
|
||||
|
||||
snippet cmdarg
|
||||
args <- commandArgs(TRUE)
|
||||
if (length(args) == 0)
|
||||
stop("Please give ${1:}!")
|
||||
if (!all(file.exists(args)))
|
||||
stop("Couln't find input files!")
|
||||
|
||||
snippet getopt
|
||||
require('getopt', quietly = TRUE)
|
||||
opt_spec <- matrix(c(
|
||||
'help', 'h', 0, "logical", "Getting help",
|
||||
'file', 'f', 1, "character","File to process"
|
||||
), ncol = 5, byrow = TRUE)
|
||||
opt <- getopt(spec = opt_spec)
|
||||
if ( !is.null(opt$help) || is.null(commandArgs()) ) {
|
||||
cat(getopt(spec = opt_spec, usage = TRUE, command = "yourCmd"))
|
||||
q(status=0)
|
||||
}
|
||||
# some inital value
|
||||
if ( is.null(opt$???) ) { opt$??? <- ??? }
|
||||
|
||||
snippet optparse
|
||||
require("optparse", quietly = TRUE)
|
||||
option_list <-
|
||||
list(make_option(c("-n", "--add_numbers"), action="store_true", default=FALSE,
|
||||
help="Print line number at the beginning of each line [default]")
|
||||
)
|
||||
parser <- OptionParser(usage = "%prog [options] file", option_list=option_list)
|
||||
arguments <- parse_args(parser, positional_arguments = TRUE)
|
||||
opt <- arguments$options
|
||||
|
||||
if(length(arguments$args) != 1) {
|
||||
cat("Incorrect number of required positional arguments\n\n")
|
||||
print_help(parser)
|
||||
stop()
|
||||
} else {
|
||||
file <- arguments$args
|
||||
}
|
||||
|
||||
if( file.access(file) == -1) {
|
||||
stop(sprintf("Specified file ( %s ) does not exist", file))
|
||||
} else {
|
||||
file_text <- readLines(file)
|
||||
}
|
||||
|
||||
snippet #!
|
||||
#!/usr/bin/env Rscript
|
||||
|
||||
snippet debug
|
||||
# Development & Debugging, don't forget to uncomment afterwards!
|
||||
#--------------------------------------------------------------------------------
|
||||
#setwd("~/Projekte/${1:}")
|
||||
#opt <- list(${2:}
|
||||
# )
|
||||
#--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
# Took from pandoc-plugin <<<<
|
||||
# Underline with `=`s or `-`s
|
||||
snippet #===
|
||||
#`repeat('=', strlen(getline(line(".") - 1)))`
|
||||
${1}
|
||||
snippet #---
|
||||
#`repeat('-', strlen(getline(line(".") - 1)))`
|
||||
${1}
|
||||
|
||||
# >>>>
|
||||
|
||||
snippet r
|
||||
\`\`\`{r ${1:chung_tag}, echo = FALSE ${2:options}}
|
||||
${3:}
|
||||
\`\`\`
|
||||
snippet ri
|
||||
\`{r ${1:}}\`
|
||||
|
||||
snippet copt
|
||||
\`\`\` {r setup, echo = FALSE}
|
||||
opts_chunk$set(fig.path='../figures/${1:}', cache.path='../cache/-'
|
||||
, fig.align='center', fig.show='hold', par=TRUE)
|
||||
#opts_knit$set(upload.fun = imgur_upload) # upload images
|
||||
\`\`\`
|
||||
|
||||
|
||||
# End of File ===================================================================
|
||||
# vim: set noexpandtab:
|
1
sources_non_forked/vim-snippets/snippets/svelte.snippets
Normal file
1
sources_non_forked/vim-snippets/snippets/svelte.snippets
Normal file
@ -0,0 +1 @@
|
||||
extends html, javascript, css
|
@ -289,7 +289,9 @@ snippet sum \sum^{}_{}
|
||||
snippet lim \lim_{}
|
||||
\\lim_{${1:n \\to \\infty}} ${0}
|
||||
snippet frame frame environment
|
||||
\\begin{frame}[${1:t}]{${2:title}}
|
||||
\\begin{frame}[${1:t}]
|
||||
\frametitle{${2:title}}
|
||||
\framesubtitle{${3:subtitle}}
|
||||
${0:${VISUAL}}
|
||||
\\end{frame}
|
||||
snippet block block environment
|
||||
|
@ -75,6 +75,16 @@ snippet prc
|
||||
${2}
|
||||
end if;
|
||||
end process;
|
||||
# process with clock and reset
|
||||
snippet prcr
|
||||
process (${1:clk}, ${2:nrst})
|
||||
begin
|
||||
if ($2 = '${3:0}') then
|
||||
${4}
|
||||
elsif rising_edge($1) then
|
||||
${5}
|
||||
end if;
|
||||
end process;
|
||||
# process all
|
||||
snippet pra
|
||||
process (${1:all})
|
||||
|
Reference in New Issue
Block a user