1
0
mirror of https://github.com/amix/vimrc synced 2025-06-16 01:25:00 +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:
amix
2017-11-24 14:54:40 +01:00
parent 7fc202ec88
commit e9aac9794b
255 changed files with 2898 additions and 3752 deletions

View File

@ -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

View File

@ -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"
});

View File

@ -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:

View File

@ -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

View File

@ -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 #
############

View File

@ -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: