mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
Updated plugins, also experimenting with a new font
The font is IBM Plex Mono: https://ibm.github.io/type/
This commit is contained in:
@ -258,31 +258,31 @@ snippet hr "<hr>"
|
||||
endsnippet
|
||||
|
||||
snippet html "HTML basic structure" b
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<title>${1:`!p snip.rv = snip.basename.replace('-', ' ').capitalize()`}</title>
|
||||
</head>
|
||||
<body>
|
||||
${0:body}
|
||||
</body>
|
||||
</html>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<title>${1:`!p snip.rv = snip.basename.replace('-', ' ').capitalize()`}</title>
|
||||
</head>
|
||||
<body>
|
||||
${0:body}
|
||||
</body>
|
||||
</html>
|
||||
endsnippet
|
||||
|
||||
snippet htmll "HTML basic structure with the lang attribute" b
|
||||
<!DOCTYPE html>
|
||||
<html lang="${1:es}">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<title>${2:`!p snip.rv = snip.basename.replace('-', ' ').capitalize()`}</title>
|
||||
</head>
|
||||
<body>
|
||||
${0:body}
|
||||
</body>
|
||||
</html>
|
||||
<!DOCTYPE html>
|
||||
<html lang="${1:es}">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<title>${2:`!p snip.rv = snip.basename.replace('-', ' ').capitalize()`}</title>
|
||||
</head>
|
||||
<body>
|
||||
${0:body}
|
||||
</body>
|
||||
</html>
|
||||
endsnippet
|
||||
|
||||
snippet i "<i>" w
|
||||
@ -318,7 +318,7 @@ snippet label "<label>"
|
||||
endsnippet
|
||||
|
||||
snippet legend "<legend>"
|
||||
<legend>$1</leyend>
|
||||
<legend>$1</legend>
|
||||
endsnippet
|
||||
|
||||
snippet li "list item" w
|
||||
@ -432,15 +432,15 @@ snippet small "<small>" w
|
||||
endsnippet
|
||||
|
||||
snippet span "<span>" w
|
||||
<span> ${0:${VISUAL}} </span>
|
||||
<span>${0:${VISUAL}}</span>
|
||||
endsnippet
|
||||
|
||||
snippet span# "<span> with ID & class" w
|
||||
<span`!p snip.rv=' id="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""``!p snip.rv=' class="' if t[2] else ""`${2:name}`!p snip.rv = '"' if t[2] else ""`> ${0:${VISUAL}} </span>
|
||||
<span`!p snip.rv=' id="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""``!p snip.rv=' class="' if t[2] else ""`${2:name}`!p snip.rv = '"' if t[2] else ""`>${0:${VISUAL}}</span>
|
||||
endsnippet
|
||||
|
||||
snippet span. "<span> with class" w
|
||||
<span`!p snip.rv=' class="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""`> ${0:${VISUAL}} </span>
|
||||
<span`!p snip.rv=' class="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""`>${0:${VISUAL}}</span>
|
||||
endsnippet
|
||||
|
||||
snippet strong "<strong>" w
|
||||
|
@ -1,205 +0,0 @@
|
||||
snippet sapmlabel
|
||||
var $1 = new sap.m.Label({
|
||||
design : $2,
|
||||
text : $3,
|
||||
visible : $4,
|
||||
textAlign : $5,
|
||||
textDirection : $6,
|
||||
width : $7,
|
||||
required : $7
|
||||
});
|
||||
|
||||
snippet sapmtext
|
||||
var $1 = new sap.m.Text({
|
||||
text :$2,
|
||||
textDirection :$3,
|
||||
visible :$4,
|
||||
wrapping : $5,
|
||||
textAlign : $6,
|
||||
width :$7,
|
||||
maxLines :$8
|
||||
});
|
||||
|
||||
snippet sapmbutton
|
||||
var $1 = new sap.m.Button({
|
||||
text : $2,
|
||||
type : $3,
|
||||
width : $4,
|
||||
enabled :$5,
|
||||
visible :$6,
|
||||
icon : $7,
|
||||
iconFirst : $8,
|
||||
activeIcon :$9,
|
||||
iconDensityAware : $10,
|
||||
});
|
||||
snippet sapmflexbox
|
||||
var $1 = new sap.m.FlexBox({
|
||||
visible : $2,
|
||||
height : $3,
|
||||
width : $4,
|
||||
displayInline :$5,
|
||||
direction :$6,
|
||||
fitContainer : $7,
|
||||
renderType : $8,
|
||||
justifyContent :$9,
|
||||
alignItems : $10,
|
||||
items:[]
|
||||
});
|
||||
snippet sapmhbox
|
||||
var $1 = new sap.m.HBox({
|
||||
visible : $2,
|
||||
height : $3,
|
||||
width : $4,
|
||||
displayInline :$5,
|
||||
direction :$6,
|
||||
fitContainer : $7,
|
||||
renderType : $8,
|
||||
justifyContent :$9,
|
||||
alignItems : $10,
|
||||
items:[]
|
||||
});
|
||||
|
||||
snippet sapmvbox
|
||||
var $1 = new sap.m.VBox({
|
||||
visible : $2,
|
||||
height : $3,
|
||||
width : $4,
|
||||
displayInline :$5,
|
||||
direction :$6,
|
||||
fitContainer : $7,
|
||||
renderType : $8,
|
||||
justifyContent :$9,
|
||||
alignItems : $10,
|
||||
items:[]
|
||||
});
|
||||
|
||||
snippet sapcomponent
|
||||
sap.ui.controller("$1", {
|
||||
onInit: function(){
|
||||
},
|
||||
onAfterRendering: function() {
|
||||
},
|
||||
onAfterRendering: function() {
|
||||
},
|
||||
onExit: function() {
|
||||
},
|
||||
});
|
||||
|
||||
snippet sapminput
|
||||
var $1 = new sap.m.Input({
|
||||
value :$2,
|
||||
width : $3,
|
||||
enabled :$4,
|
||||
visible :$5,
|
||||
valueState :$6,
|
||||
name : $7,
|
||||
placeholder : $8,
|
||||
editable : $9,
|
||||
type : $10,
|
||||
maxLength :$11,
|
||||
valueStateText :$12,
|
||||
showValueStateMessage :$13,
|
||||
dateFormat :$14,
|
||||
showValueHelp :$15,
|
||||
showSuggestion :$16,
|
||||
valueHelpOnly :$17,
|
||||
filterSuggests :$18,
|
||||
maxSuggestionWidth :$19,
|
||||
startSuggestion : $20,
|
||||
showTableSuggestionValueHelp : $21,
|
||||
description : $22,
|
||||
fieldWidth : $23,
|
||||
valueLiveUpdate :$24,
|
||||
suggestionItems :[$25],
|
||||
suggestionColumns : [$26],
|
||||
suggestionRows : [$27],
|
||||
liveChange : $28,
|
||||
valueHelpRequest :$29,
|
||||
suggest : $30,
|
||||
suggestionItemSelected : $31
|
||||
});
|
||||
snippet _sthis
|
||||
var _self = this;
|
||||
|
||||
snippet sapmresponsivepopup
|
||||
var $1 = new sap.m.ResponsivePopover({
|
||||
placement :$2 ,//sap.m.PlacementType (default: sap.m.PlacementType.Right)
|
||||
showHeader :$3 ,//boolean (default: true)
|
||||
title : $4,//string
|
||||
icon :$5 ,//sap.ui.core.URI
|
||||
modal :$6 ,// boolean
|
||||
offsetX :$7, //int
|
||||
offsetY :$8, //int
|
||||
contentWidth : $9,//sap.ui.core.CSSSize
|
||||
contentHeight :$10, //sap.ui.core.CSSSize
|
||||
horizontalScrolling :$11, //boolean
|
||||
verticalScrolling :$12, //boolean
|
||||
showCloseButton :$13, //boolean (default: true)
|
||||
//Aggregations
|
||||
content :$14, //sap.ui.core.Control[]
|
||||
customHeader :$15, //sap.m.IBar
|
||||
subHeader : $16, //sap.m.IBar
|
||||
beginButton :$17, //sap.m.Button
|
||||
endButton : $18, //sap.m.Button
|
||||
//Associations
|
||||
initialFocus : $19, //string | sap.ui.core.Control
|
||||
//Events
|
||||
beforeOpen :$20, //fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
|
||||
afterOpen : $21, //fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
|
||||
beforeClose : $22, //fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
|
||||
afterClose : $23 //fnList
|
||||
});
|
||||
|
||||
snippet sapicon
|
||||
var $1 = new sap.ui.core.Icon({
|
||||
src :$2 , //sap.ui.core.URI
|
||||
size :$3 , //sap.ui.core.CSSSize
|
||||
color :$4 , //sap.ui.core.CSSColor
|
||||
hoverColor : $5 , // sap.ui.core.CSSColor
|
||||
activeColor :$6 , //sap.ui.core.CSSColor
|
||||
width :$7 , //sap.ui.core.CSSSize
|
||||
height : $8 ,//sap.ui.core.CSSSize
|
||||
backgroundColor :$8 , //sap.ui.core.CSSColor
|
||||
hoverBackgroundColor :$9 , //sap.ui.core.CSSColor
|
||||
activeBackgroundColor :$10 , //sap.ui.core.CSSColor
|
||||
visible :$11 , //boolean (default: true)
|
||||
decorative : $12 ,//boolean (default: true)
|
||||
});
|
||||
snippet extendVerticalL
|
||||
sap.ui.layout.VerticalLayout.extend("$1", {
|
||||
metadata: {
|
||||
properties: {
|
||||
$2
|
||||
},
|
||||
aggregations: {
|
||||
$3
|
||||
},
|
||||
events: {
|
||||
$4
|
||||
}
|
||||
},
|
||||
init: function(){
|
||||
$5
|
||||
},
|
||||
|
||||
renderer: "$6"
|
||||
});
|
||||
snippet extendHorizontalL
|
||||
sap.ui.layout.HorizontalLayout.extend("$1", {
|
||||
metadata: {
|
||||
properties: {
|
||||
$2
|
||||
},
|
||||
aggregations: {
|
||||
$3
|
||||
},
|
||||
events: {
|
||||
$4
|
||||
}
|
||||
},
|
||||
init: function(){
|
||||
$5
|
||||
},
|
||||
|
||||
renderer: "$6"
|
||||
});
|
@ -257,4 +257,30 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet testcase6 "class XYZTest extends TestCase { ... }"
|
||||
<?php
|
||||
|
||||
namespace `!p
|
||||
relpath = os.path.relpath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
||||
if m:
|
||||
snip.rv = m.group().replace('/', '\\')
|
||||
`;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @author `!v g:snips_author`
|
||||
*/
|
||||
class `!p
|
||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
` extends TestCase
|
||||
{
|
||||
public function test$1()
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
# :vim:ft=snippets:
|
||||
|
@ -1,4 +1,4 @@
|
||||
priority -50
|
||||
priority -20
|
||||
|
||||
global !p
|
||||
import os
|
||||
@ -38,63 +38,63 @@ library("${3:${2/^(\w+)_.*$/(?1:$1)/ga}}")
|
||||
endsnippet
|
||||
|
||||
snippet lib "Import a library"
|
||||
library(${0:package})
|
||||
library('${0:${VISUAL:package}}')
|
||||
endsnippet
|
||||
|
||||
snippet req "Require a file"
|
||||
require(${0:package})
|
||||
require('${0:${VISUAL:package}}')
|
||||
endsnippet
|
||||
|
||||
snippet source "Source a file"
|
||||
source('${0:file}')
|
||||
source('${0:${VISUAL:file}}')
|
||||
endsnippet
|
||||
|
||||
snippet if "If statement"
|
||||
if ($1) {
|
||||
$0
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet eif "Else-If statement"
|
||||
else if ($1) {
|
||||
$0
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet el "Else statement"
|
||||
else {
|
||||
$0
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet ife "if .. else"
|
||||
if ($1) {
|
||||
$2
|
||||
${2:${VISUAL}}
|
||||
} else {
|
||||
$3
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet wh "while loop"
|
||||
while($1) {
|
||||
$2
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet for "for loop"
|
||||
for (${1:item} in ${2:list}) {
|
||||
$3
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet fun "Function definition"
|
||||
${1:name} <- function ($2) {
|
||||
$0
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet ret "Return call"
|
||||
return($0)
|
||||
return(${0:${VISUAL}})
|
||||
endsnippet
|
||||
|
||||
snippet df "Data frame"
|
||||
@ -102,51 +102,51 @@ ${1:name}[${2:rows}, ${0:cols}]
|
||||
endsnippet
|
||||
|
||||
snippet c "c function"
|
||||
c(${0:items})
|
||||
c(${0:${VISUAL:items}})
|
||||
endsnippet
|
||||
|
||||
snippet li "list function"
|
||||
list(${0:items})
|
||||
list(${0:${VISUAL:items}})
|
||||
endsnippet
|
||||
|
||||
snippet mat "matrix function"
|
||||
matrix(${1:data}, nrow = ${2:rows}, ncol = ${0:cols})
|
||||
matrix(${1:${VISUAL:data}}, nrow = ${2:rows}, ncol = ${0:cols})
|
||||
endsnippet
|
||||
|
||||
snippet apply "apply function"
|
||||
apply(${1:array}, ${2:margin}, ${0:function})
|
||||
apply(${1:${VISUAL:array}}, ${2:margin}, ${0:function})
|
||||
endsnippet
|
||||
|
||||
snippet lapply "lapply function"
|
||||
lapply(${1:list}, ${0:function})
|
||||
lapply(${1:${VISUAL:list}}, ${0:function})
|
||||
endsnippet
|
||||
|
||||
snippet sapply "sapply function"
|
||||
sapply(${1:list}, ${0:function})
|
||||
sapply(${1:${VISUAL:list}}, ${0:function})
|
||||
endsnippet
|
||||
|
||||
snippet vapply "vapply function"
|
||||
vapply(${1:list}, ${2:function}, ${0:type})
|
||||
vapply(${1:${VISUAL:list}}, ${2:function}, ${0:type})
|
||||
endsnippet
|
||||
|
||||
snippet mapply "mapply function"
|
||||
mapply(${1:function}, ${0:...})
|
||||
mapply(${1:${VISUAL:function}}, ${0:...})
|
||||
endsnippet
|
||||
|
||||
snippet tapply "tapply function"
|
||||
tapply(${1:vector}, ${2:index}, ${0:function})
|
||||
tapply(${1:${VISUAL:vector}}, ${2:index}, ${0:function})
|
||||
endsnippet
|
||||
|
||||
snippet rapply "rapply function"
|
||||
rapply(${1:list}, ${0:function})
|
||||
rapply(${1:${VISUAL:list}}, ${0:function})
|
||||
endsnippet
|
||||
|
||||
snippet pl "Plot function"
|
||||
plot(${1:x}, ${0:y})
|
||||
plot(${1:${VISUAL:x}}, ${0:y})
|
||||
endsnippet
|
||||
|
||||
snippet ggp "ggplot2 plot"
|
||||
ggplot(${1:data}, aes(${0:aesthetics}))
|
||||
ggplot(${1:${VISUAL:data}}, aes(${0:aesthetics}))
|
||||
endsnippet
|
||||
|
||||
snippet fis "Fisher test"
|
||||
@ -176,3 +176,15 @@ endsnippet
|
||||
snippet kvt "KV test"
|
||||
kv.test(${1:x}, ${0:y})
|
||||
endsnippet
|
||||
|
||||
#################################
|
||||
# easily create string vector #
|
||||
#################################
|
||||
# Given individual words separated by spaces
|
||||
# Select words (e.g. shift-v for whole line (such as the line above)
|
||||
# then press <Tab> then type "vec", press <Tab> again to get this:
|
||||
# var <- c("#","Given","individual","words","separated","by","spaces")
|
||||
# var <- c("#","type","out","individual","words","separated","by","spaces")
|
||||
snippet vec
|
||||
${1:var} <- c("${0:${VISUAL:/ /","/g}}")
|
||||
endsnippet
|
||||
|
@ -41,6 +41,8 @@ INCLUDABLE_DIRECTIVES = ['image', 'figure', 'include']
|
||||
# http://stackoverflow.com/questions/2718196/find-all-chinese-text-in-a-string-using-python-and-regex
|
||||
CJK_RE = re.compile(u'[⺀-⺙⺛-⻳⼀-⿕々〇〡-〩〸-〺〻㐀-䶵一-鿃豈-鶴侮-頻並-龎]', re.UNICODE)
|
||||
|
||||
#http://www.pygal.org/en/stable/documentation/types/index.html
|
||||
CHART_TYPES = ["Line", "StackedLine", "HorizontalLine", "Bar", "StackedBar", "HorizontalBar", "Histogram", "XY", "DateLine", "TimeLine", "TimeDeltaLine", "DateTimeLine", "Pie", "Radar", "Box", "Dot", "Funnel", "Gauge", "SolidGauge", "Pyramid", "Treemap"]
|
||||
|
||||
def has_cjk(s):
|
||||
"""Detect if s contains CJK characters."""
|
||||
@ -299,6 +301,19 @@ snippet fnt "Footnote or Citation" i
|
||||
.. [$1] ${2:Reference}
|
||||
endsnippet
|
||||
|
||||
# Only for Nikola — Static Site Generator
|
||||
snippet chart "Pygal chart for Nikola" b
|
||||
.. chart:: $1`!p snip.rv=complete(t[1], CHART_TYPES)`
|
||||
:title: '${2:Browser usage evolution (in %)}'
|
||||
:x_labels: [${3:"2002", "2003", "2004", "2005", "2006", "2007"}]
|
||||
|
||||
'Firefox', [None, None, 0, 16.6, 25, 31]
|
||||
'Chrome', [None, None, None, None, None, None]
|
||||
'IE', [85.8, 84.6, 84.7, 74.5, 66, 58.6]
|
||||
'Others', [14.2, 15.4, 15.3, 8.9, 9, 10.4]
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
############
|
||||
# Sphinx #
|
||||
############
|
||||
|
@ -59,8 +59,7 @@ snippet desc "Description" b
|
||||
endsnippet
|
||||
|
||||
snippet it "Individual item" b
|
||||
\item $1
|
||||
$0
|
||||
\item $0
|
||||
endsnippet
|
||||
|
||||
snippet part "Part" b
|
||||
@ -146,4 +145,11 @@ endsnippet
|
||||
snippet lp "Long parenthesis"
|
||||
\left(${1:${VISUAL:contents}}\right)$0
|
||||
endsnippet
|
||||
|
||||
snippet "mint(ed)?( (\S+))?" "Minted code typeset" br
|
||||
\begin{minted}{${1:`!p
|
||||
snip.rv = match.group(3) if match.group(2) is not None else "language"`}}
|
||||
${2:${VISUAL:code}}
|
||||
\end{minted}$0
|
||||
endsnippet
|
||||
# vim:ft=snippets:
|
||||
|
@ -1,5 +1,5 @@
|
||||
snippet init
|
||||
cmake_minimum_required(version ${1:2.8.2})
|
||||
cmake_minimum_required(VERSION ${1:2.8.2})
|
||||
project(${2:ProjectName})
|
||||
|
||||
find_package(${3:library})
|
||||
@ -16,7 +16,7 @@ snippet proj
|
||||
project(${0:Name})
|
||||
|
||||
snippet min
|
||||
cmake_minimum_required(version ${0:2.8.2})
|
||||
cmake_minimum_required(VERSION ${0:2.8.2})
|
||||
|
||||
snippet include
|
||||
include_directories(${${0:include_dir}})
|
||||
|
@ -1,14 +1,15 @@
|
||||
snippet lib
|
||||
#library('${1}');
|
||||
library ${1};
|
||||
${0}
|
||||
snippet im
|
||||
#import('${1}');
|
||||
${0}
|
||||
snippet so
|
||||
#source('${1}');
|
||||
import 'package:${1}/${2}.dart';
|
||||
${0}
|
||||
snippet rgx
|
||||
new RegExp(r'${1}')
|
||||
snippet var
|
||||
var ${1} = ${2};
|
||||
snippet main
|
||||
static void main() {
|
||||
main() {
|
||||
${0}
|
||||
}
|
||||
snippet st
|
||||
|
@ -32,3 +32,5 @@ snippet ff
|
||||
|
||||
<%= submit "Submit" %>
|
||||
<% end %>
|
||||
snippet pry
|
||||
<% require IEx; IEx.pry %>
|
||||
|
@ -88,7 +88,6 @@ snippet def
|
||||
snippet defd
|
||||
@doc """
|
||||
${1:doc string}
|
||||
|
||||
"""
|
||||
def ${2:name} do
|
||||
${0}
|
||||
@ -96,7 +95,6 @@ snippet defd
|
||||
snippet defsd
|
||||
@doc """
|
||||
${1:doc string}
|
||||
|
||||
"""
|
||||
@spec ${2:name} :: ${3:no_return}
|
||||
def ${2} do
|
||||
@ -127,8 +125,9 @@ snippet defr
|
||||
snippet doc
|
||||
@doc """
|
||||
${0}
|
||||
|
||||
"""
|
||||
snippet im
|
||||
@impl true
|
||||
snippet docf
|
||||
@doc false
|
||||
snippet fn
|
||||
@ -136,7 +135,6 @@ snippet fn
|
||||
snippet mdoc
|
||||
@moduledoc """
|
||||
${0}
|
||||
|
||||
"""
|
||||
snippet mdocf
|
||||
@moduledoc false
|
||||
@ -185,6 +183,8 @@ snippet qu
|
||||
snippet beh
|
||||
@behaviour ${1:Mix.Task}
|
||||
${0}
|
||||
snippet p
|
||||
|> ${0}
|
||||
snippet >e pipe to each
|
||||
|> Enum.each(fn ${1} -> ${0} end)
|
||||
snippet >m pipe to map
|
||||
@ -197,3 +197,39 @@ snippet >i pipe to inspect
|
||||
|> IO.inspect
|
||||
snippet >il pipe to inspect with label
|
||||
|> IO.inspect(label: "${1:label}")
|
||||
snippet cs
|
||||
@doc false
|
||||
def child_spec(${1:_opts}) do
|
||||
%{
|
||||
id: __MODULE__,
|
||||
start: {__MODULE__, :start_link, ${2:[]}},
|
||||
restart: ${3::permanent},
|
||||
shutdown: ${4:5000},
|
||||
type: ${5::worker}
|
||||
}
|
||||
end
|
||||
snippet genserver basic genserver structure
|
||||
use GenServer
|
||||
|
||||
@doc false
|
||||
def start_link do
|
||||
GenServer.start_link(__MODULE__, ${1:Map.new})
|
||||
end
|
||||
|
||||
@impl true
|
||||
def init(state) do
|
||||
{:ok, state}
|
||||
end
|
||||
snippet genserver: basic genserver structure
|
||||
use GenServer
|
||||
|
||||
@doc false
|
||||
def start_link, do: GenServer.start_link(__MODULE__, ${1:Map.new})
|
||||
|
||||
@impl true
|
||||
def init(state), do: {:ok, state}
|
||||
snippet impl
|
||||
@impl true
|
||||
def ${1:name} do
|
||||
${0}
|
||||
end
|
||||
|
@ -56,3 +56,47 @@ snippet test
|
||||
snippet doc
|
||||
{-| ${0}
|
||||
-}
|
||||
snippet p
|
||||
|> ${0}
|
||||
snippet program
|
||||
import Html exposing (Html)
|
||||
|
||||
|
||||
type alias Model =
|
||||
{}
|
||||
|
||||
|
||||
type Msg
|
||||
= Noop
|
||||
|
||||
|
||||
main : Program Never Model Msg
|
||||
main =
|
||||
Html.program
|
||||
{ init = init
|
||||
, view = view
|
||||
, update = update
|
||||
, subscriptions = subscriptions
|
||||
}
|
||||
|
||||
|
||||
init : ( Model, Cmd Msg )
|
||||
init =
|
||||
{} ! []
|
||||
|
||||
|
||||
update : Msg -> Model -> ( Model, Cmd Msg )
|
||||
update msg model =
|
||||
case msg of
|
||||
Noop ->
|
||||
model ! []
|
||||
|
||||
|
||||
subscriptions : Model -> Sub Msg
|
||||
subscriptions model =
|
||||
Sub.none
|
||||
|
||||
|
||||
view : Model -> Html Msg
|
||||
view model =
|
||||
Html.text "Hello, sailor!"
|
||||
|
@ -31,8 +31,12 @@ snippet importq
|
||||
snippet inst
|
||||
instance ${1:Monoid} ${2:Type} where
|
||||
${0}
|
||||
snippet ty
|
||||
type ${1:Type} = ${0:Type}
|
||||
snippet type
|
||||
type ${1:Type} = ${0:Type}
|
||||
snippet da
|
||||
data ${1:Type} = ${2:$1} ${0:Int}
|
||||
snippet data
|
||||
data ${1:Type} = ${2:$1} ${0:Int}
|
||||
snippet newtype
|
||||
@ -54,6 +58,12 @@ snippet const
|
||||
snippet fn
|
||||
${1:fn} :: ${2:a} -> ${3:a}
|
||||
$1 ${4} = ${0:undefined}
|
||||
snippet fn0
|
||||
${1:fn} :: ${2:a}
|
||||
$1 = ${0:undefined}
|
||||
snippet fn1
|
||||
${1:fn} :: ${2:a} -> ${3:a}
|
||||
$1 ${4} = ${0:undefined}
|
||||
snippet fn2
|
||||
${1:fn} :: ${2:a} -> ${3:a} -> ${4:a}
|
||||
$1 ${5} = ${0:undefined}
|
||||
@ -130,3 +140,6 @@ snippet itp
|
||||
$0
|
||||
snippet sb
|
||||
\`shouldBe\` $0
|
||||
snippet doc
|
||||
{-| ${0}
|
||||
-}
|
||||
|
@ -13,9 +13,34 @@ snippet for
|
||||
end
|
||||
snippet forp
|
||||
for ${1:i},${2:v} in pairs(${3:table_name}) do
|
||||
${0:-- body}
|
||||
${0:-- body}
|
||||
end
|
||||
snippet fori
|
||||
for ${1:i},${2:v} in ipairs(${3:table_name}) do
|
||||
${0:-- body}
|
||||
${0:-- body}
|
||||
end
|
||||
snippet if
|
||||
if ${1:condition} then
|
||||
${2:-- body}
|
||||
end
|
||||
snippet ife
|
||||
if ${1:condition} then
|
||||
${2:-- if condition}
|
||||
else
|
||||
${0:-- else}
|
||||
end
|
||||
snippet elif
|
||||
elseif ${1:condition} then
|
||||
${0:--body}
|
||||
snippet repeat
|
||||
repeat
|
||||
${1:--body}
|
||||
until ${0:condition}
|
||||
snippet while
|
||||
while ${1:condition} do
|
||||
${0:--body}
|
||||
end
|
||||
snippet print
|
||||
print("${1:string}")
|
||||
snippet im
|
||||
import "${1:import file}"
|
||||
|
@ -214,6 +214,9 @@ snippet mount
|
||||
device => "${0:device name or path}",
|
||||
}
|
||||
|
||||
snippet notify
|
||||
notify { "${1:message}": }
|
||||
|
||||
snippet package
|
||||
package { "${1:package name}":
|
||||
ensure => ${0:present},
|
||||
|
@ -55,3 +55,17 @@ snippet if
|
||||
${2:${VISUAL}}
|
||||
else
|
||||
${0}
|
||||
snippet doc
|
||||
{-| ${0}
|
||||
-}
|
||||
snippet ty
|
||||
type ${1:Type} =
|
||||
${0}
|
||||
snippet da
|
||||
data ${1:Type} =
|
||||
${0:$1}
|
||||
snippet nty
|
||||
newtype ${1:Type} =
|
||||
${2:$1} ${0:Int}
|
||||
snippet fi
|
||||
foreign import ${1} :: ${2}
|
||||
|
@ -33,6 +33,9 @@ snippet dowh
|
||||
snippet with
|
||||
with ${1:expr} as ${2:var}:
|
||||
${0:${VISUAL}}
|
||||
snippet awith
|
||||
async with ${1:expr} as ${2:var}:
|
||||
${0:${VISUAL}}
|
||||
# New Class
|
||||
snippet cl
|
||||
class ${1:ClassName}(${2:object}):
|
||||
@ -49,10 +52,21 @@ snippet def
|
||||
snippet deff
|
||||
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
|
||||
${0}
|
||||
snippet adef
|
||||
async def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
|
||||
"""${3:docstring for $1}"""
|
||||
${0}
|
||||
snippet adeff
|
||||
async def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
|
||||
${0}
|
||||
# New Method
|
||||
snippet defm
|
||||
def ${1:mname}(self, ${2:arg}):
|
||||
${0}
|
||||
snippet adefm
|
||||
async def ${1:mname}(self, ${2:arg}):
|
||||
${0}
|
||||
|
||||
# New Property
|
||||
snippet property
|
||||
def ${1:foo}():
|
||||
@ -128,43 +142,33 @@ snippet _
|
||||
__${1:init}__
|
||||
# python debugger (pdb)
|
||||
snippet pdb
|
||||
import pdb
|
||||
pdb.set_trace()
|
||||
__import__('pdb').set_trace()
|
||||
# bpython debugger (bpdb)
|
||||
snippet bpdb
|
||||
import bpdb
|
||||
bpdb.set_trace()
|
||||
__import__('bpdb').set_trace()
|
||||
# ipython debugger (ipdb)
|
||||
snippet ipdb
|
||||
import ipdb
|
||||
ipdb.set_trace()
|
||||
__import__('ipdb').set_trace()
|
||||
# embed ipython itself
|
||||
snippet iem
|
||||
import IPython
|
||||
IPython.embed()
|
||||
__import__('IPython').embed()
|
||||
# remote python debugger (rpdb)
|
||||
snippet rpdb
|
||||
import rpdb
|
||||
rpdb.set_trace()
|
||||
__import__('rpdb').set_trace()
|
||||
# web python debugger (wdb)
|
||||
snippet wdb
|
||||
import wdb
|
||||
wdb.set_trace()
|
||||
__import__('wdb').set_trace()
|
||||
# ptpython
|
||||
snippet ptpython
|
||||
from ptpython.repl import embed
|
||||
embed(globals(), locals(), vi_mode=${1:False}, history_filename=${2:None})
|
||||
__import__('ptpython.repl', fromlist=('repl')).embed(globals(), locals(), vi_mode=${1:False}, history_filename=${2:None})
|
||||
# python console debugger (pudb)
|
||||
snippet pudb
|
||||
import pudb
|
||||
pudb.set_trace()
|
||||
__import__('pudb').set_trace()
|
||||
# pdb in nosetests
|
||||
snippet nosetrace
|
||||
from nose.tools import set_trace
|
||||
set_trace()
|
||||
__import__('nose').tools.set_trace()
|
||||
snippet pprint
|
||||
import pprint
|
||||
pprint.pprint(${1})
|
||||
__import__('pprint').pprint(${1})
|
||||
snippet "
|
||||
"""${0:doc}
|
||||
"""
|
||||
@ -181,6 +185,11 @@ snippet testcase
|
||||
|
||||
def test_${2:description}(self):
|
||||
${0}
|
||||
# test given when then
|
||||
snippet tgwt
|
||||
# given: ${1}
|
||||
# when: ${2}
|
||||
# then: ${3}
|
||||
snippet fut
|
||||
from __future__ import ${0}
|
||||
#getopt
|
||||
@ -204,18 +213,18 @@ snippet getopt
|
||||
# glog = get log
|
||||
snippet glog
|
||||
import logging
|
||||
logger = logging.getLogger(${0:__name__})
|
||||
LOGGER = logging.getLogger(${0:__name__})
|
||||
snippet le
|
||||
logger.error(${0:msg})
|
||||
LOGGER.error(${0:msg})
|
||||
# conflict with lambda=ld, therefor we change into Logger.debuG
|
||||
snippet lg
|
||||
logger.debug(${0:msg})
|
||||
LOGGER.debug(${0:msg})
|
||||
snippet lw
|
||||
logger.warning(${0:msg})
|
||||
LOGGER.warning(${0:msg})
|
||||
snippet lc
|
||||
logger.critical(${0:msg})
|
||||
LOGGER.critical(${0:msg})
|
||||
snippet li
|
||||
logger.info(${0:msg})
|
||||
LOGGER.info(${0:msg})
|
||||
snippet epydoc
|
||||
"""${1:Description}
|
||||
|
||||
@ -240,3 +249,13 @@ snippet kwargs
|
||||
**kwargs${1:,}${0}
|
||||
snippet akw
|
||||
*args, **kwargs${1:,}${0}
|
||||
|
||||
# comprehensions
|
||||
snippet lcp list comprehension
|
||||
[${1} for ${2} in ${3:${VISUAL}}]${0}
|
||||
|
||||
snippet dcp dict comprehension
|
||||
{${1}: ${2} for ${3} in ${4:${VISUAL}}}${0}
|
||||
|
||||
snippet scp set comprehension
|
||||
{${1} for ${2} in ${3:${VISUAL}}}${0}
|
||||
|
@ -50,3 +50,19 @@ snippet bun Vundle.vim Plugin definition
|
||||
Plugin '${0}'
|
||||
snippet plug Vundle.vim Plugin definition
|
||||
Plugin '${0}'
|
||||
snippet let
|
||||
let ${1:variable} = ${0: value}
|
||||
snippet se
|
||||
set ${1:setting};
|
||||
snippet set
|
||||
set ${1:setting} = ${0:value}
|
||||
snippet nn
|
||||
nnoremap ${1} ${2}<CR>
|
||||
snippet no
|
||||
noremap ${1} ${2}
|
||||
snippet vm
|
||||
vmap ${1} ${2}
|
||||
snippet im
|
||||
imap ${1} ${2}
|
||||
snippet exe
|
||||
execute ${1}
|
||||
|
@ -29,7 +29,7 @@ snippet vbase
|
||||
<script>
|
||||
export default{
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
|
||||
|
Reference in New Issue
Block a user