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

Updated vim plugins

This commit is contained in:
amix
2017-07-06 14:57:35 +02:00
parent 48a2c325c3
commit 391f8b5c06
82 changed files with 2016 additions and 2757 deletions

View File

@ -88,10 +88,20 @@ snippet def
snippet defd
@doc """
${1:doc string}
"""
def ${2:name} do
${0}
end
snippet defsd
@doc """
${1:doc string}
"""
@spec ${2:name} :: ${3:no_return}
def ${2} do
${0}
end
snippet defim
defimpl ${1:protocol_name}, for: ${2:data_type} do
${0}
@ -117,6 +127,7 @@ snippet defr
snippet doc
@doc """
${0}
"""
snippet docf
@doc false
@ -125,6 +136,7 @@ snippet fn
snippet mdoc
@moduledoc """
${0}
"""
snippet mdocf
@moduledoc false

View File

@ -226,3 +226,29 @@ snippet bench benchmark function
}
}
${0}
# composite literals
snippet cl
type ${1:name} struct {
${2:attrName} ${3:attrType}
}
# if key in a map
snippet om
if ${1:value}, ok := ${2:map}[${3:key}]; ok == true {
${4:/* code */}
}
# Grouped globals with anonymous struct
snippet gg
var ${1:var} = struct{
${2:name} ${3:type}
}{
$2: ${4:value},
}
# Marshalable json alias
snippet ja
type ${1:parentType}Alias $1
func (p *$1) MarshalJSON() ([]byte, error) {
return json.Marshal(&struct{ *$1Alias }{(*$1Alias)(p)})
}

View File

@ -16,7 +16,7 @@ snippet rp
snippet rpc
= render :partial => "${1:item}", :collection => ${0:@$1s}
snippet rpl
= render :partial => "${1:item}", :locals => { :${2:$1} => ${0:@$1}
= render :partial => "${1:item}", :locals => { :${2:$1} => ${0:@$1} }
snippet rpo
= render :partial => "${1:item}", :object => ${0:@$1}
snippet lt

View File

@ -4,7 +4,8 @@ snippet ri1
# Import both React and Component
snippet ri2
import React, { Component, PropTypes } from 'react'
import React, { Component } from 'react'
import PropTypes from 'prop-types'
# React class
snippet rcla
@ -40,7 +41,7 @@ snippet rcdp
# Presentational component
snippet rcom
(props) => {
props => {
return (
${0:<div></div>}
)

View File

@ -0,0 +1,175 @@
snippet des "Describe (js)"
describe('${1:description}', function() {
$0
});
snippet it "it (js)"
it('${1:description}', function() {
$0
});
snippet bef "before each (js)"
beforeEach(function() {
$0
});
snippet aft "after each (js)"
afterEach(function() {
$0
});
snippet befa "before all (js)"
beforeAll(function() {
$0
});
snippet afta "after all (js)"
afterAll(function() {
$0
});
snippet any "any (js)"
jasmine.any($1)
snippet anyt "anything (js)"
jasmine.anything()
snippet objc "object containing (js)"
jasmine.objectContaining({
${VISUAL}$0
});
snippet arrc "array containing (js)"
jasmine.arrayContaining([${1:value1}]);
snippet strm "string matching (js)"
jasmine.stringMatching("${1:matcher}")
snippet ru "runs (js)"
runs(function() {
$0
});
snippet wa "waits (js)"
waits($1);
snippet ex "expect (js)"
expect(${1:target})$0;
snippet ee "expect to equal (js)"
expect(${1:target}).toEqual(${2:value});
snippet el "expect to be less than (js)"
expect(${1:target}).toBeLessThan(${2:value});
snippet eg "expect to be greater than (js)"
expect(${1:target}).toBeGreaterThan(${2:value});
snippet eb "expect to be (js)"
expect(${1:target}).toBe(${2:value});
snippet em "expect to match (js)"
expect(${1:target}).toMatch(${2:pattern});
snippet eha "expect to have attribute (js)"
expect(${1:target}).toHaveAttr('${2:attr}'${3:, '${4:value}'});
snippet et "expect to be truthy (js)"
expect(${1:target}).toBeTruthy();
snippet ef "expect to be falsy (js)"
expect(${1:target}).toBeFalsy();
snippet ed "expect to be defined (js)"
expect(${1:target}).toBeDefined();
snippet eud "expect to be defined (js)"
expect(${1:target}).toBeUndefined();
snippet en "expect to be null (js)"
expect(${1:target}).toBeNull();
snippet ec "expect to contain (js)"
expect(${1:target}).toContain(${2:value});
snippet ev "expect to be visible (js)"
expect(${1:target}).toBeVisible();
snippet eh "expect to be hidden (js)"
expect(${1:target}).toBeHidden();
snippet eth "expect to throw (js)"
expect(${1:target}).toThrow(${2:value});
snippet ethe "expect to throw error (js)"
expect(${1:target}).toThrowError(${2:value});
snippet notx "expect not (js)"
expect(${1:target}).not$0;
snippet note "expect not to equal (js)"
expect(${1:target}).not.toEqual(${2:value});
snippet notl "expect to not be less than (js)"
expect(${1:target}).not.toBeLessThan(${2:value});
snippet notg "expect to not be greater than (js)"
expect(${1:target}).not.toBeGreaterThan(${2:value});
snippet notm "expect not to match (js)"
expect(${1:target}).not.toMatch(${2:pattern});
snippet notha "expect to not have attribute (js)"
expect(${1:target}).not.toHaveAttr('${2:attr}'${3:, '${4:value}'});
snippet nott "expect not to be truthy (js)"
expect(${1:target}).not.toBeTruthy();
snippet notf "expect not to be falsy (js)"
expect(${1:target}).not.toBeFalsy();
snippet notd "expect not to be defined (js)"
expect(${1:target}).not.toBeDefined();
snippet notn "expect not to be null (js)"
expect(${1:target}).not.toBeNull();
snippet notc "expect not to contain (js)"
expect(${1:target}).not.toContain(${2:value});
snippet notv "expect not to be visible (js)"
expect(${1:target}).not.toBeVisible();
snippet noth "expect not to be hidden (js)"
expect(${1:target}).not.toBeHidden();
snippet notth "expect not to throw (js)"
expect(${1:target}).not.toThrow(${2:value});
snippet notthe "expect not to throw error (js)"
expect(${1:target}).not.toThrowError(${2:value});
snippet s "spy on (js)"
spyOn(${1:object}, '${2:method}')$0;
snippet sr "spy on and return (js)"
spyOn(${1:object}, '${2:method}').and.returnValue(${3:arguments});
snippet st "spy on and throw (js)"
spyOn(${1:object}, '${2:method}').and.throwError(${3:exception});
snippet sct "spy on and call through (js)"
spyOn(${1:object}, '${2:method}').and.callThrough();
snippet scf "spy on and call fake (js)"
spyOn(${1:object}, '${2:method}').and.callFake(${3:function});
snippet ethbc "expect to have been called (js)"
expect(${1:target}).toHaveBeenCalled();
snippet nthbc "expect not to have been called (js)"
expect(${1:target}).not.toHaveBeenCalled();
snippet ethbcw "expect to have been called with (js)"
expect(${1:target}).toHaveBeenCalledWith(${2:arguments});

View File

@ -72,16 +72,15 @@ snippet **
snippet __
__${1:bold}__
snippet ===
`repeat('=', strlen(getline(line(".") - 1)) - strlen(getline('.')))`
`repeat('=', strlen(getline(line('.') - 3)))`
${0}
snippet -
- ${0}
snippet ---
`repeat('-', strlen(getline(line(".") - 1)) - strlen(getline('.')))`
`repeat('-', strlen(getline(line('.') - 3)))`
${0}
snippet blockquote
{% blockquote %}
${0:quote}

View File

@ -142,10 +142,6 @@ snippet ipdb
snippet iem
import IPython
IPython.embed()
# ipython debugger (pdbbb)
snippet pdbbb
import pdbpp
pdbpp.set_trace()
# remote python debugger (rpdb)
snippet rpdb
import rpdb

View File

@ -34,11 +34,11 @@ snippet main "Main function"
snippet let "let variable declaration with type inference"
let ${1} = ${2};
snippet lett "let variable declaration with explicit type annotation"
let ${1}: ${2} = ${3};
let ${1}: ${2} = ${3};
snippet letm "let mut variable declaration with type inference"
let mut ${1} = ${2};
let mut ${1} = ${2};
snippet lettm "let mut variable declaration with explicit type annotation"
let mut ${1}: ${2} = ${3};
let mut ${1}: ${2} = ${3};
snippet pri "print!"
print!("${1}");
snippet pri, "print! with format param"
@ -188,6 +188,6 @@ snippet chan "Declare (Sender, Receiver) pair of asynchronous channel()"
let (${1:tx}, ${2:rx}): (Sender<${3:i32}>, Receiver<${4:i32}>) = channel();
# Testing
snippet as "assert!"
assert!(${1:predicate})
assert!(${1:predicate});
snippet ase "assert_eq!"
assert_eq!(${1:expected}, ${2:actual})
assert_eq!(${1:expected}, ${2:actual});

View File

@ -203,33 +203,33 @@ snippet citey \citeyear
snippet fcite \footcite[]{}
\\footcite[${1}]{${2}}${0}
#Formating text: italic, bold, underline, small capital, emphase ..
snippet it italic text
\\textit{${0:${VISUAL:text}}}
snippet ita italic text
\\textit{${1:${VISUAL:text}}} ${0}
snippet bf bold face text
\\textbf{${0:${VISUAL:text}}}
\\textbf{${1:${VISUAL:text}}} ${0}
snippet under underline text
\\underline{${0:${VISUAL:text}}}
\\underline{${1:${VISUAL:text}}} ${0}
snippet emp emphasize text
\\emph{${0:${VISUAL:text}}}
\\emph{${1:${VISUAL:text}}} ${0}
snippet sc small caps text
\\textsc{${0:${VISUAL:text}}}
\\textsc{${1:${VISUAL:text}}} ${0}
#Choosing font
snippet sf sans serife text
\\textsf{${0:${VISUAL:text}}}
\\textsf{${1:${VISUAL:text}}} ${0}
snippet rm roman font text
\\textrm{${0:${VISUAL:text}}}
\\textrm{${1:${VISUAL:text}}} ${0}
snippet tt typewriter (monospace) text
\\texttt{${0:${VISUAL:text}}}
\\texttt{${1:${VISUAL:text}}} ${0}
#Math font
snippet mf mathfrak
\\mathfrak{${0:${VISUAL:text}}}
\\mathfrak{${1:${VISUAL:text}}} ${0}
snippet mc mathcal
\\mathcal{${0:${VISUAL:text}}}
\\mathcal{${1:${VISUAL:text}}} ${0}
snippet ms mathscr
\\mathscr{${0:${VISUAL:text}}}
\\mathscr{${1:${VISUAL:text}}} ${0}
#misc
snippet ft \footnote
\\footnote{${0:${VISUAL:text}}}
\\footnote{${1:${VISUAL:text}}} ${0}
snippet fig figure environment (includegraphics)
\\begin{figure}
\\begin{center}
@ -259,12 +259,19 @@ snippet subfig subfigure environment
\\label{fig:${5}}
\\end{subfigure}
${0}
snippet tikzcd tikzcd environment
\begin{equation}
\begin{tikzcd}
snippet tikzcd tikzcd environment in equation
\\begin{equation}
\\begin{tikzcd}
${1}
\end{tikzcd}
\end{equation}
\\end{tikzcd}
\\end{equation}
${0}
snippet tikzcd* tikzcd environment in equation*
\\begin{equation*}
\\begin{tikzcd}
${1}
\\end{tikzcd}
\\end{equation*}
${0}
#math
snippet stackrel \stackrel{}{}

View File

@ -1 +1,183 @@
extends html, javascript, css
# This snippet file enables vue files to use tabs for html, js and css. It also
# includes some vue-specific html-like snippets, as well as some general
# boilerplate code for vue.
extends html, javascript, css
# These snippets form a port of Sarah Drasner's vue-sublime-snippets
# some html-like snippets
snippet slot
<slot></slot>
snippet template
<template></template>
snippet transition
<transition></transition>
# The following snippets create more complex boilerplate code.
snippet vbase
<template>
<div>
</div>
</template>
<script>
export default{
}
</script>
<style scoped>
</style>
snippet vimport:c
import New from './components/New.vue';
export default{
components: {
appNew: New
}
}
snippet vactionsis now
actions: {
updateValue({commit}, payload) {
commit(updateValue, payload);
}
}
# Add in js animation hooks
snippet vanim:js:el
<transition
@before-enter="beforeEnter"
@enter="enter"
@after-enter="afterEnter"
@enter-cancelled="enterCancelled"
@before-Leave="beforeLeave"
@leave="leave"
@after-leave="afterLeave"
@leave-cancelled="leaveCancelled"
:css="false">
</transition>
snippet vanim:js:method
methods: {
beforeEnter(el) {
console.log('beforeEnter');
},
enter(el, done) {
console.log('enter');
done();
},
afterEnter(el) {
console.log('afterEnter');
},
enterCancelled(el, done) {
console.log('enterCancelled');
},
beforeLeave(el) {
console.log('beforeLeave');
},
leave(el, done) {
console.log('leave');
done();
},
afterLeave(el) {
console.log('afterLeave');
},
leaveCancelled(el, done) {
console.log('leaveCancelled');
}
}
snippet vcl
@click=""
snippet vdata
data: function () {
return {
key: value
};
}
snippet vfilter
filters: {
fnName: function (v) {
return;
}
}
snippet vfor
<div v-for="item in items" :key="item.id">
{{ item }}
</div
snippet vgetters
getters: {
value: state => {
return state.value;
}
}
snippet vimport
import New from './components/New.vue';
snippet vkeep
<keep-alive>
<component :is="">
<p>default</p>
</component>
</keep-alive>
snippet vmixin
// define a mixin object
var myMixin = {
created: function () {
this.hello()
},
methods: {
hello: function () {
console.log('hello from mixin!')
}
}
}
// define a component that uses this mixin
var Component = Vue.extend({
mixins: [myMixin]
})
var component = new Component() // -> "hello from mixin!"
snippet vmutations
// define a mixin object
var myMixin = {
created: function () {
this.hello()
},
methods: {
hello: function () {
console.log('hello from mixin!')
}
}
}
// define a component that uses this mixin
var Component = Vue.extend({
mixins: [myMixin]
})
var component = new Component() // -> "hello from mixin!"
snippet vprops:d
propName: {
type: Number,
default: 100
},
snippet vprops
propName: {
type: Number
},