1
0
mirror of https://github.com/amix/vimrc synced 2025-06-17 10:36:28 +08:00

Updated plugins

This commit is contained in:
Amir
2020-12-04 22:15:32 +01:00
parent e83f5ea2e7
commit a06964dd3b
261 changed files with 6955 additions and 2773 deletions

View File

@ -1,7 +1,33 @@
###########################################################################
# TextMate Snippets #
###########################################################################
# --------------
# Functions
# --------------
global !p
def printf_expand_args(snip):
"""
This will look how many placeholders printf has and adds the separated commas
at the end.
"""
# now add so many "," as much as the amount of placeholders
amount_placeholders = snip.tabstops[1].current_text.count("%")
output = ""
# Add the amount of tabstops
for placeholder_index in range(3, amount_placeholders + 3):
output += f", ${placeholder_index}"
# convert them into tabstops
snip.expand_anon(output)
endglobal
# ==============
# Snippets
# ==============
priority -50
snippet def "#define ..."
@ -49,6 +75,16 @@ for (${4:int} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) {
}
endsnippet
snippet fora "for-loop" b
for (${1:var}; ${2:condition}; `!p
if len(t[1]) > 0:
snip.rv = t[1].split('=')[0].split()[-1]
`++) {
$0
} /* for ($1; $2; `!p if len(t[1]) > 0: snip.rv = t[1].split('=')[0].split()[-1]`++) */
endsnippet
snippet once "Include header once only guard"
#ifndef ${1:`!p
if not snip.c:
@ -75,8 +111,9 @@ else if (${1:/* condition */}) {
}
endsnippet
snippet printf "printf .. (printf)"
printf("${1:%s}\n"${1/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$2${1/([^%]|%%)*(%.)?.*/(?2:\);)/}
post_jump "printf_expand_args(snip)"
snippet "printf" "printf with auto-expand args" wr
printf("$1\n"$2);
endsnippet
snippet st "struct"

View File

@ -30,6 +30,12 @@ endglobal
###########################################################################
# TextMate Snippets #
###########################################################################
snippet forc "general for loop (for)"
for (${6:auto} ${1:i} = ${2:v.begin()}; `!p import re; snip.rv = re.split("[^\w]",t[1])[-1]` ${4:!=} ${3:`!p m = re.search(r'^(?:(.*)(\.|->)begin\(\)|((?:std|boost)::)?begin\((.*)\))$', t[2]); snip.rv = (((m.group(3) if m.group(3) else "") + "end(" + m.group(4) + ")") if m.group(4) else (m.group(1) + m.group(2) + "end()")) if m else ""`}; ${5:++`!p snip.rv = t[1].split(" ")[-1]`}) {
${VISUAL}$0
}
endsnippet
snippet beginend "$1.begin(), $1.end() (beginend)"
${1:v}${1/^.*?(-)?(>)?$/(?2::(?1:>:.))/}begin(), $1${1/^.*?(-)?(>)?$/(?2::(?1:>:.))/}end()
endsnippet
@ -106,5 +112,68 @@ ${1:ReturnType} ${2:FunctionName}(${3:param})
{
${0:FunctionBody}
}
endsnippet
snippet boost_test "Boost test module" b
#define BOOST_TEST_MODULE ${1:TestModuleName}
#include <boost/test/included/unit_test.hpp>
BOOST_AUTO_TEST_CASE(${2:TestCaseName})
{
${0:TestDefinition}
}
endsnippet
snippet boost_suite "Boost test suite module" b
#define BOOST_TEST_MODULE ${1:TestModuleName}
#include <boost/test/included/unit_test.hpp>
BOOST_AUTO_TEST_SUITE(${2:SuiteName})
BOOST_AUTO_TEST_CASE(${3:TestCaseName})
{
${0:TestDefinition}
}
BOOST_AUTO_TEST_SUITE_END()
endsnippet
snippet boost_test_fixture "Boost test module with fixture" b
#define BOOST_TEST_MODULE ${1:TestModuleName}
#include <boost/test/included/unit_test.hpp>
struct ${2:FixtureName} {
$2() {}
virtual ~$2() {}
/* define members here */
};
BOOST_FIXTURE_TEST_CASE(${3:SuiteName}, $2)
{
${0:TestDefinition}
}
endsnippet
snippet boost_suite_fixture "Boost test suite with fixture" b
#define BOOST_TEST_MODULE ${1:TestModuleName}
#include <boost/test/included/unit_test.hpp>
struct ${2:FixtureName} {
$2() {}
virtual ~$2() {}
/* define members here */
};
BOOST_FIXTURE_TEST_SUITE(${3:SuiteName}, $2)
BOOST_AUTO_TEST_CASE(${4:TestCaseName})
{
${0:TestDefinition}
}
BOOST_AUTO_TEST_SUITE_END()
endsnippet
# vim:ft=snippets:

View File

@ -148,7 +148,6 @@ class ${1:MODELNAME}(models.Model):
def save(self):
return super($1, self).save()
@models.permalink
def get_absolute_url(self):
return ('')

View File

@ -1,5 +1,13 @@
priority -50
snippet impq "Qualified import"
import qualified ${1:Data.Text} as ${0:`!p snip.rv = t[1].split(".")[-1]`}
snippet imp "Simple import"
import ${1:${2:Data}.${0:Text}}
endsnippet
snippet imp2 "Selective import" b
import ${1:${2:Data}.${3:Text}} (${4})${0}
endsnippet
snippet impq "Qualified import"
import qualified ${1:${2:Data}.${3:Text}} as ${0:`!p snip.rv = t[1].split(".")[-1]`}
endsnippet

View File

@ -276,7 +276,7 @@ snippet htmll "HTML basic structure with the lang attribute" b
<html lang="${1:es}">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>${2:`!p snip.rv = snip.basename.replace('-', ' ').capitalize()`}</title>
</head>
<body>

View File

@ -30,7 +30,7 @@ endsnippet
snippet useCB "useCallback(fn, inputs)" b
const ${1:callback} = useCallback((${2})) => ${3:{
${4}
}}, [${5}]
}}, [${5}])
endsnippet
snippet useM "useMemo(fn, inputs)" b
const ${1:memorized} = useMemo(() => ${2:{

View File

@ -104,7 +104,7 @@ endsnippet
# Common stuff #
################
snippet link "Link to something"
[${1:${VISUAL:Text}}](${3:http://${2:www.url.com}})$0
[${1:${VISUAL:Text}}](${3:https://${2:www.url.com}})$0
endsnippet
snippet img "Image"
@ -125,7 +125,7 @@ endsnippet
snippet refl "Reference Link"
[${1:${VISUAL:Text}}][${2:id}]$0
[$2]:${4:http://${3:www.url.com}} "${5:$4}"
[$2]:${4:https://${3:www.url.com}} "${5:$4}"
endsnippet
snippet fnt "Footnote"

View File

@ -45,8 +45,8 @@ snippet .it ".iter()" i
endsnippet
snippet impl "Struct/Trait implementation" b
impl ${1:Type/Trait}${2: for ${3:Type}} {
$0
impl$4 ${1:Type/Trait}${2: for ${3:Type}}${4:<${5:T}>} {
${0}
}
endsnippet

View File

@ -9,15 +9,15 @@ def create_table(snip):
cols = snip.buffer[snip.line].split('x')[1]
int_val = lambda string: int(''.join(s for s in string if s.isdigit()))
rows = int_val(rows)
cols = int_val(cols)
offset = cols + 1
old_spacing = snip.buffer[snip.line][:snip.buffer[snip.line].rfind('\t') + 1]
snip.buffer[snip.line] = ''
final_str = old_spacing + "\\begin{tabular}{|" + "|".join(['$' + str(i + 1) for i in range(cols)]) + "|}\n"
for i in range(rows):
@ -35,7 +35,7 @@ def add_row(snip):
old_spacing = snip.buffer[snip.line][:snip.buffer[snip.line].rfind('\t') + 1]
snip.buffer[snip.line] = ''
final_str = old_spacing
final_str += " & ".join(['$' + str(j + 1) for j in range(row_len)])
final_str += " \\\\\\"
@ -63,7 +63,7 @@ $0${2/(?<=.)(c|l|r)|./(?1: & )/g}
endsnippet
pre_expand "create_table(snip)"
snippet "gentbl(\d+)x(\d+)" "Generate table of *width* by *height*" r
snippet "gentbl(\d+)x(\d+)" "Generate table of *width* by *height*" r
endsnippet
pre_expand "add_row(snip)"
@ -193,8 +193,6 @@ snippet acl "Acroynm expanded" b
$0
endsnippet
snippet ni "Non-indented paragraph" b
\noindent
$0
@ -241,4 +239,20 @@ snippet glnl "New long glossary item" b
${0:description}
}
endsnippet
# Bold text
snippet bf "Bold"
\textbf{$1} $0
endsnippet
# Italic text
snippet ita "Italics"
\textit{$1} $0
endsnippet
# Underlined text
snippet und "Underline"
\underline{$1} $0
endsnippet
# vim:ft=snippets:

View File

@ -1,3 +1,5 @@
# vim:set et fileencoding=utf8 sts=0 sw=4 ts=4:
"""Helper methods used in UltiSnips snippets."""
import string, vim, re
@ -82,12 +84,13 @@ def get_comment_format():
def make_box(twidth, bwidth=None):
b, m, e, i = (s.strip() for s in get_comment_format())
m0 = m[0] if m else ''
bwidth_inner = bwidth - 3 - max(len(b), len(i + e)) if bwidth else twidth + 2
sline = b + m + bwidth_inner * m[0] + 2 * m[0]
sline = b + m + bwidth_inner * m0 + 2 * m0
nspaces = (bwidth_inner - twidth) // 2
mlines = i + m + " " + " " * nspaces
mlinee = " " + " "*(bwidth_inner - twidth - nspaces) + m
eline = i + m + bwidth_inner * m[0] + 2 * m[0] + e
eline = i + m + bwidth_inner * m0 + 2 * m0 + e
return sline, mlines, mlinee, eline
def foldmarker():
@ -114,5 +117,3 @@ def has_cjk(s):
cjk_re = re.compile(u'[⺀-⺙⺛-⻳⼀-⿕々〇〡-〩〸-〺〻㐀-䶵一-鿃豈-鶴侮-頻並-龎]', re.UNICODE)
return cjk_re.search(s) is not None
# vim:set et sts=0 sw=4 ts=4:

View File

@ -8,21 +8,21 @@ snippet def
(def ${0})
snippet defm
(defmethod ${1:multifn} "${2:doc-string}" ${3:dispatch-val} [${4:args}]
${0})
${0:code})
snippet defmm
(defmulti ${1:name} "${2:doc-string}" ${0:dispatch-fn})
snippet defma
(defmacro ${1:name} "${2:doc-string}" ${0:dispatch-fn})
snippet defn
(defn ${1:name} "${2:doc-string}" [${3:arg-list}]
${0})
${0:code})
snippet defp
(defprotocol ${1:name}
${0})
${0:code})
snippet defr
(defrecord ${1:name} [${2:fields}]
${3:protocol}
${0})
${0:code})
snippet deft
(deftest ${1:name}
(is (= ${0:assertion})))
@ -31,12 +31,12 @@ snippet is
snippet defty
(deftype ${1:Name} [${2:fields}]
${3:Protocol}
${0})
${0:code})
snippet doseq
(doseq [${1:elem} ${2:coll}]
${0})
${0:code})
snippet fn
(fn [${1:arg-list}] ${0})
(fn [${1:arg-list}] ${0:code})
snippet if
(if ${1:test-expr}
${2:then-expr}
@ -50,24 +50,24 @@ snippet imp
& {:keys [${1:keys}] :or {${0:defaults}}}
snippet let
(let [${1:name} ${2:expr}]
${0})
${0:code})
snippet letfn
(letfn [(${1:name}) [${2:args}]
${0})])
${0:code})])
snippet map
(map ${1:func} ${0:coll})
snippet mapl
(map #(${1:lambda}) ${0:coll})
snippet met
(${1:name} [${2:this} ${3:args}]
${0})
${0:code})
snippet ns
(ns ${0:name})
snippet dotimes
(dotimes [_ 10]
(time
(dotimes [_ ${1:times}]
${0})))
${0:code})))
snippet pmethod
(${1:name} [${2:this} ${0:args}])
snippet refer

View File

@ -81,6 +81,8 @@ snippet cb
@callback ${1:name}(${2:args}) :: ${3:returns}
snippet df
def ${1:name}, do: ${2}
snippet dfw
def ${1:name}(${2:args}) when ${3:guard}, do:
snippet def
def ${1:name} do
${0}
@ -92,12 +94,21 @@ snippet defd
def ${2:name} do
${0}
end
snippet defs
@spec ${1:name}(${2:arg types}) :: ${3:no_return}
def $1(${4:args}) do
${0}
end
snippet defsd
@doc """
${1:doc string}
"""
@spec ${2:name} :: ${3:no_return}
def ${2} do
@spec ${2:name}(${3:arg types}) :: ${4:no_return}
def $2(${5:args}) do
${0}
end
snippet defw
def ${1:name}(${2:args}) when ${3:guard} do
${0}
end
snippet defim
@ -112,12 +123,24 @@ snippet defmo
defmodule ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} do
${0}
end
snippet %M
%__MODULE__{
${1:key_name}: ${2:value}
}
snippet enfk
@enforce_keys [:${1:key_name}]
snippet dfp
defp ${1:name}, do: ${2}
snippet dfpw
defp ${1:name}(${2:args}) when ${3:guard}, do: ${4}
snippet defp
defp ${1:name} do
${0}
end
snippet defpw
defp ${1:name}(${2:args}) when ${3:guard} do
${0}
end
snippet defpr
defprotocol ${1:name}, [${0:function}]
snippet defr
@ -173,12 +196,28 @@ snippet des
describe "${1:test group subject}" do
${0}
end
snippet destag
@describetag :${1:describe tag}
snippet mtag
@moduletag :${1:module tag}
snippet dt
doctest ${1:filename}
snippet tp
@tag :pending
snippet exunit
defmodule ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} do
use ExUnit.Case, async: true
${0}
end
snippet setup
setup do
${1}
end
snippet setupa
setup_all do
${1}
end
snippet try try .. rescue .. end
try do
${1:${VISUAL}}

View File

@ -46,8 +46,9 @@ snippet conf
<% content_for :${1:head} do %>
${0}
<% end %>
snippet cs
<%= collection_select <+object+>, <+method+>, <+collection+>, <+value_method+>, <+text_method+><+, <+[options]+>, <+[html_options]+>+> %>
snippet cs
<%= collection_select(:${1:object}, :${2:method}, ${3:collection}, :${4:value_method}, :${5:text_method}, options = {${0:prompt: true}}) %>
snippet ct
<%= content_tag '${1:DIV}', ${2:content}${0:,options} %>
snippet ff
@ -80,6 +81,8 @@ snippet ffta
<%= ${1:f}.text_area :${0:attribute} %>
snippet fftf
<%= ${1:f}.text_field :${0:attribute} %>
snippet fcs
<%= ${1:f}.collection_select(:${2:method}, ${3:collection}, :${4:value_method}, :${5:text_method}, options = {${0:prompt: true}}) %>
snippet fields
<%= fields_for :${1:model}, @$1 do |${2:f}| %>
${0}

View File

@ -0,0 +1,2 @@
snippet co
Co-authored-by: ${1} <${2}>

View File

@ -129,7 +129,7 @@ snippet fum "method"
}
${0}
snippet fumh "http handler function on reciever"
snippet fumh "http handler function on receiver"
func (${1:receiver} ${2:type}) ${3:funcName}(${4:w} http.ResponseWriter, ${5:r} *http.Request) {
${0:${VISUAL}}
}

View File

@ -709,7 +709,7 @@ snippet samp
${0}
</samp>
snippet script
<script charset="utf-8">
<script>
${0}
</script>
snippet scripts

View File

@ -175,9 +175,9 @@ snippet tryf
##
## Find Methods
snippet findall
List<${1:listName}> ${2:items} = ${1}.findAll();
List<${1:listName}> ${2:items} = $1.findAll();
snippet findbyid
${1:var} ${2:item} = ${1}.findById(${3});
${1:var} ${2:item} = $1.findById(${3});
##
## Javadocs
snippet /**

View File

@ -1,82 +0,0 @@
# Import only React
snippet ri1
import React from 'react'
# Import both React and Component
snippet ri2
import React, { Component } from 'react'
import PropTypes from 'prop-types'
# React class
snippet rcla
class ${1:MyComponent} extends Component {
render() {
return (
${0:<div></div>}
)
}
}
# React constructor
snippet rcon
constructor(props) {
super(props)
this.state = {
${1}: ${0},
}
}
# Proptypes for React Class
snippet rcpt
static propTypes = {
${1}: PropTypes.${0},
}
# Default props for React Class
snippet rcdp
static defaultProps = {
${1}: ${0},
}
# Presentational component
snippet rcom
props => {
return (
${0:<div></div>}
)
}
# Proptypes for Presentational component
snippet rpt
${1}.propTypes = {
${2}: PropTypes.${0},
}
# Default props for Presentational component
snippet rdp
${1}.defaultProps = {
${2}: ${0},
}
# Lifecycle Methods
snippet rcdm
componentDidMount() {
${0:${VISUAL}}
}
# State
snippet rsst
this.setState({
${1}: ${0},
})
snippet rtst
this.state.${0}
# Props
snippet rp
props.${0}
snippet rtp
this.props.${0}

View File

@ -1,98 +1,190 @@
snippet ir
# Import
snippet ir import React
import React from 'react';
snippet irc
snippet irc import React and Component
import React, { Component } from 'react';
snippet ird
snippet irh import React hooks
import { use$1 } from 'react';
snippet ird import ReactDOM
import ReactDOM from 'react-dom';
snippet cdm
snippet irp import PropTypes
import PropTypes from 'prop-types';
# Lifecycle Methods
snippet cdm componentDidMount
componentDidMount() {
${1}
}
snippet cdup
};
snippet cdup componentDidUpdate
componentDidUpdate(prevProps, prevState) {
${1}
}
snippet cwm
};
snippet cwm componentWillMount
componentWillMount() {
${1}
}
snippet cwr
};
snippet cwr componentWillReceiveProps
componentWillReceiveProps(nextProps) {
${1}
}
snippet cwun
};
snippet cwun componentWillUnmount
componentWillUnmount() {
${1}
}
snippet cwu
};
snippet cwu componentWillUpdate
componentWillUpdate(nextProps, nextState) {
${1}
};
snippet scu shouldComponentUpdate
shouldComponentUpdate(nextProps, nextState) {
${1}
}
snippet fup
forceUpdate(${1:callback});
snippet dp
# Props
snippet spt static propTypes
static propTypes = {
${1}: PropTypes.${2}
};
snippet pt propTypes
${1}.propTypes = {
${2}: PropTypes.${2}
};
snippet sdp static defaultProps
static defaultProps = {
${1}: ${2},
}
${1}: ${2}
};
snippet dp defaultProps
${1}.defaultProps = {
${2}: ${3}
};
snippet pp props
props.${1};
snippet tp this props
this.props.${1};
# State
snippet st
state = {
${1}: ${2},
}
snippet pt
static propTypes = {
${1}: React.PropTypes.${2:type},
}
snippet rfc
const ${1:ComponentName} = (${2:props}) => {
return (
<div>
$1
</div>
);
}
snippet rcc
class ${1:ClassName} extends React.Component {
state = {
};
}
render() {
return (
<div>
$1
</div>
);
}
}
snippet rdr
ReactDOM.render(${1}, ${2})
snippet ercc
export default class ${1:ClassName} extends React.Component {
render() {
return (
${0:<div />}
);
}
}
snippet ctor
constructor() {
super();
${1}
}
snippet ren
render() {
return (
${1:<div />}
);
}
snippet sst
this.setState({
${1}: ${2}
});
snippet scu
shouldComponentUpdate(nextProps, nextState) {
${1}
snippet tst
this.state.${1};
# Component
snippet raf
const ${1:ComponentName} = (${2:props}) => {
${3:state}
return (
<>
${4}
</>
);
};
snippet rcla
class ${1:ClassName} extends Component {
render() {
return (
<>
${2}
</>
);
}
}
snippet prp i
this.props.${1}
snippet ste i
this.state.${1}
snippet ercla
export default class ${1:ClassName} extends Component {
render() {
return (
<>
${2}
</>
);
};
};
snippet ctor
constructor() {
super();
${1:state}
}
snippet ren
render() {
return (
<>
${2}
</>
);
}
snippet fup
forceUpdate(${1:callback});
# Hooks
snippet uses useState
const [${1:state}, set${2}] = useState(${3:initialState});
snippet usee useEffect
useEffect(() => {
${1}
});
snippet userd useReducer
const [${1:state}, ${2:dispatch}] = useReducer(${3:reducer});
snippet userf useRef
const ${1:refContainer} = useRef(${2:initialValue});
snippet usect useContext
const ${1:value} = useContext(${2:MyContext});
snippet usecb useCallback
const ${1:memoizedCallback} = useCallback(
() => {
${2}(${3})
},
[$3]
);
snippet usem useMemo
const ${1:memoizedCallback} = useMemo(() => ${2}(${3}), [$3]);
snippet usei useImperativeHandle
useImperativeHandle(${1:ref}, ${2:createHandle});
snippet used useDebugValue
useDebugValue(${1:value});
# ReactDOM methods
snippet rdr ReactDOM.render
ReactDOM.render(${1}, ${2});
snippet rdh ReactDOM.hydrate
ReactDOM.hydrate(${1:element}, ${2:container}[, ${3:callback}]);
snippet rdcp ReactDOM.createPortal
ReactDOM.createPortal(${1:child}, ${2:container});

View File

@ -311,6 +311,10 @@ snippet foro "for (const prop of object}) { ... }"
for (const ${1:prop} of ${2:object}) {
${0:$1}
}
snippet forl "for (let prop of object}) { ... }"
for (let ${1:prop} of ${2:object}) {
${0:$1}
}
snippet fun*
function* ${1:function_name}(${2}) {
${0:${VISUAL}}
@ -319,10 +323,18 @@ snippet c=>
const ${1:function_name} = (${2}) => {
${0:${VISUAL}}
}
snippet ca=>
const ${1:function_name} = async (${2}) => {
${0:${VISUAL}}
}
snippet caf
const ${1:function_name} = (${2}) => {
${0:${VISUAL}}
}
snippet casf
const ${1:function_name} = async (${2}) => {
${0:${VISUAL}}
}
snippet =>
(${1}) => {
${0:${VISUAL}}
@ -339,5 +351,7 @@ snippet ed
export default ${0}
snippet ${
${${1}}${0}
snippet as "async"
async ${0}
snippet aw "await"
await ${0:${VISUAL}}

View File

@ -5,19 +5,19 @@
# The suffix `c` stands for "Clipboard".
snippet [
[${1:text}](http://${2:address})
[${1:text}](https://${2:address})
snippet [*
[${1:link}](${2:`@*`})
snippet [c
[${1:link}](${2:`@+`})
snippet ["
[${1:text}](http://${2:address} "${3:title}")
[${1:text}](https://${2:address} "${3:title}")
snippet ["*
[${1:link}](${2:`@*`} "${3:title}")
snippet ["c
[${1:link}](${2:`@+`} "${3:title}")
snippet [:
[${1:id}]: http://${2:url}
[${1:id}]: https://${2:url}
snippet [:*
[${1:id}]: ${2:`@*`}
@ -26,7 +26,7 @@ snippet [:c
[${1:id}]: ${2:`@+`}
snippet [:"
[${1:id}]: http://${2:url} "${3:title}"
[${1:id}]: https://${2:url} "${3:title}"
snippet [:"*
[${1:id}]: ${2:`@*`} "${3:title}"

View File

@ -1,7 +1,7 @@
snippet doc
(*
${0}
*)
(** ${0} *)
snippet comment
(* ${0} *)
snippet let
let ${1} = ${2} in
${0}

View File

@ -29,8 +29,8 @@ snippet function
# PowerShell Splatting
snippet splatting
$Params = @{
${1:Param1} = '{2:Value1}'
${3:Param2} = '{4:Value2}'
${1:Param1} = '${2:Value1}'
${3:Param2} = '${4:Value2}'
}
${5:CommandName} @Params
@ -99,4 +99,3 @@ snippet switch
${2:condition1} { ${3:action} }
${4:condition2} { ${5:action} }
default { ${6:action} }

View File

@ -110,7 +110,7 @@ snippet crate "Define create meta attributes"
snippet opt "Option<T>"
Option<${1:i32}>
snippet res "Result<T, E>"
Result<${1:~str}, ${2:()}>
Result<${1:&str}, ${2:()}>
# Control structures
snippet if
if ${1} {
@ -123,7 +123,7 @@ snippet ife "if / else"
${0}
}
snippet ifl "if let (...)"
if let ${1:Some(${2})} = $3 {
if let ${1:Some($2)} = $3 {
${0:${VISUAL}}
}
snippet el "else"
@ -151,7 +151,7 @@ snippet wh "while loop"
${0:${VISUAL}}
}
snippet whl "while let (...)"
while let ${1:Some(${2})} = $3 {
while let ${1:Some($2)} = $3 {
${0:${VISUAL}}
}
snippet for "for ... in ... loop"
@ -165,15 +165,15 @@ snippet fixme "FIXME comment"
// FIXME: $0
# Struct
snippet st "Struct definition"
struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}${2:<${3:T}>} {
struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} {
${0}
}
snippet impl "Struct/Trait implementation"
impl$4 ${1:Type/Trait}${2: for ${3:Type}}${4:<${5:T}>} {
impl ${1:Type/Trait}${2: for $3} {
${0}
}
snippet stn "Struct with new constructor"
pub struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}${2:<${3:T}>} {
pub struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} {
${0}
}
@ -198,7 +198,7 @@ snippet trait "Trait definition"
${0}
}
snippet drop "Drop trait implementation (destructor)"
impl$2 Drop for ${1:Name}${2:<${3:T}>} {
impl Drop for $1 {
fn drop(&mut self) {
${0}
}
@ -209,10 +209,6 @@ snippet ss "static string declaration"
snippet stat "static item declaration"
static ${1}: ${2:usize} = ${0};
# Concurrency
snippet scoped "spawn a scoped thread"
thread::scoped(${1:move }|| {
${0}
});
snippet spawn "spawn a thread"
thread::spawn(${1:move }|| {
${0}
@ -253,4 +249,4 @@ snippet rc "Rc::new()"
snippet unim "unimplemented!()"
unimplemented!()
snippet use "use ...;" b
use ${1:std::${2:io}};
use ${1:std::$2};

View File

@ -358,3 +358,59 @@ snippet hrefc
# enquote from package csquotes
snippet enq enquote
\\enquote{${1:${VISUAL:text}}} ${0}
# Time derivative
snippet ddt time derivative
\\frac{d}{dt} {$1} {$0}
# Limit
snippet lim limit
\\lim_{{$1}} {{$2}} {$0}
# Partial derivative
snippet pdv partial derivation
\\frac{\\partial {$1}}{\partial {$2}} {$0}
# Second order partial derivative
snippet ppdv second partial derivation
\\frac{\partial^2 {$1}}{\partial {$2} \partial {$3}} {$0}
# Ordinary derivative
snippet dv derivative
\\frac{d {$1}}{d {$2}} {$0}
# Summation
snippet summ summation
\\sum_{{$1}} {$0}
# Shorthand for time derivative
snippet dot dot
\\dot{{$1}} {$0}
# Shorthand for second order time derivative
snippet ddot ddot
\\ddot{{$1}} {$0}
# Vector
snippet vec vector
\\vec{{$1}} {$0}
# Cross product
snippet \x cross product
\\times {$0}
# Dot product
snippet . dot product
\\cdot {$0}
# Integral
snippet int integral
\\int_{{$1}}^{{$2}} {$3} \: d{$4} {$5}
# Right arrow
snippet ra rightarrow
\\rightarrow {$0}
# Long right arrow
snippet lra longrightarrow
\\longrightarrow {$0}

View File

@ -1,34 +1,177 @@
snippet bl "{% block xyz %} .. {% endblock xyz %}"
# Tags
snippet apply "twig apply"
{% apply ${1} %}
${0}
{% endapply %}
snippet autoescape "twig autoescape"
{% autoescape %}
${0}
{% endautoescape %}
snippet endautoescape "twig endautoescape"
{% endautoescape %}${0}
snippet bl "twig block"
{% block ${1} %}
${2:${VISUAL}}
{% endblock $1 %}
snippet js "{% javascripts 'xyz' %} .. {% endjavascripts %}"
{% javascripts '${1}' %}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}
snippet css "{% stylesheets 'xyz' %} .. {% endstylesheets %}"
{% stylesheets '${1}' %}
<link rel="stylesheet" href="{{ asset_url }}">
{% endstylesheets %}
snippet if "{% if %} .. {% endif %}"
{% if ${1} %}
${2:${VISUAL}}
{% endif %}
snippet ife "{% if %} .. {% else %} .. {% endif %}"
{% if ${1} %}
${2:${VISUAL}}
{% else %}
${0}
{% endif %}
snippet el "{% else %}"
{% else %}
${0:${VISUAL}}
snippet eif "{% elseif %}"
{% elseif ${1} %}
${0}
snippet for "{% for x in y %} .. {% endfor %}"
${0}
{% endblock %}
snippet block "twig block"
{% block ${1} %}
${0}
{% endblock %}
snippet endblock "twig endblock"
{% endblock %}${0}
snippet cache "twig cache"
{% cache %}
${0}
{% endcache %}
snippet endcache "twig endcache"
{% endcache %}${0}
snippet css "twig css"
{% css %}
${0}
{% endcss %}
snippet endcss "twig endcss"
{% endcss %}${0}
snippet dd "twig dd"
{% dd ${1} %}${0}
snippet do "twig do"
{% do ${1} %}${0}
snippet embed "twig embed"
{% embed "${1}" %}
${0}
{% endembed %}
snippet endembed "twig endembed"
{% endembed %}${0}
snippet exit "twig exit"
{% exit ${1} %}
snippet extends "twig extends"
{% extends "${1}" %}${0}
snippet ext "twig extends"
{% extends "${1}" %}${0}
snippet for "twig for"
{% for ${1} in ${2} %}
${3}
${0}
{% endfor %}
snippet ext "{% extends xyz %}"
{% extends ${1} %}
snippet fore "twig for else"
{% for ${1} in ${2} %}
${3}
{% else %}
${0}
{% endfor %}
snippet endfor "twig endfor"
{% endfor %}${0}
snippet from "twig from"
{% from "${1}" import ${2} %}${0}
snippet header "twig header"
{% header "${1}" %}${0}
snippet hook "twig hook"
{% hook "${1}" %}${0}
snippet html "twig html"
{% html %}
${0}
{% endhtml %}
snippet endhtml "twig endhtml"
{% endhtml %}${0}
snippet if "twig if"
{% if ${1} %}
${0}
{% endif %}
snippet ife "twig if else"
{% if ${1} %}
${2}
{% else %}
${0}
{% endif %}
snippet el "twig else"
{% else %}
snippet eif "twig elseif"
{% elseif ${1} %}
${0}
snippet endif "twig endif"
{% endif %}${0}
snippet import "twig import"
{% import "${1}" as ${2} %}${0}
snippet include "twig include"
{% include "${1}" %}${0}
snippet includewith "twig include with parameters"
{% include "${1}" with ${2} %}${0}
snippet js "twig js"
{% js %}
${0}
{% endjs %}
snippet endjs "twig endjs"
{% endjs %}${0}
snippet macro "twig macro"
{% macro ${1}(${2}) %}
${0}
{% endmacro %}
snippet endmacro "twig endmacro"
{% endmacro %}${0}
snippet namespace "twig namespace"
{% namespace "${1}" %}
${0}
{% endnamespace %}
snippet endnamespace "twig endnamespace"
{% endnamespace %}${0}
snippet nav "twig nav"
{% nav ${1} in ${2} %}
${0}
{% endnav %}
snippet endnav "twig endnav"
{% endnav %}${0}
snippet paginate "twig paginate"
{% paginate ${1} as ${2} %}${0}
snippet redirect "twig redirect"
{% redirect "${1}" %}${0}
snippet requireguest "twig requireguest"
{% requireGuest %}${0}
snippet requirelogin "twig requirelogin"
{% requireLogin %}${0}
snippet requirepermission "twig requirepermission"
{% requirePermission "${1}" %}${0}
snippet set "twig set"
{% set ${1} = ${2} %}${0}
snippet setb "twig set block"
{% set ${1} %}
${0}
{% endset %}
snippet endset "twig endset"
{% endset %}${0}
snippet switch "twig switch"
{% switch ${1} %}
{% case "${2}" %}
${0}
{% default %}
{% endswitch %}
snippet case "twig switch case"
{% case "${1}" %}
${0}
snippet default "twig switch default"
{% default %}
${0}
snippet endswitch "twig endswitch"
{% endswitch %}${0}
snippet use "twig use"
{% use "${1}" %}${0}
snippet verbatim "twig verbatim"
{% verbatim %}
${0}
{% endverbatim %}
snippet endverbatim "twig endverbatim"
{% endverbatim %}${0}
snippet with "twig with"
{% with %}
${0}
{% endwith %}
snippet endwith "twig endwith"
{% endwith %}${0}
# Functions
snippet dump "twig dump"
<pre>
{{ dump(${1}) }}
</pre>
# Filters
snippet translate "twig translate"
{{ "${1}"|t }}${0}

View File

@ -9,8 +9,16 @@ snippet tlet "ts let"
snippet tvar "ts var"
var ${1}: ${2:any} = ${3};
${0}
snippet + "var: type"
snippet + "ts create field"
${1}: ${0:any}
snippet #+ "ts create private field using #"
#${1}: ${0:any}
snippet tpfi "ts create public field"
public ${1}: ${0:any}
snippet tprfi "ts create private field"
private ${1}: ${0:any}
snippet tprofi "ts create protected field"
protected ${1}: ${0:any}
snippet int "interface"
interface ${1} {
${2}: ${3:any};
@ -25,6 +33,22 @@ snippet tfun "ts function"
function ${1}(${2}): ${3:any} {
${0}
}
snippet tpmet "ts public method"
public ${1}(${2}): ${3:any} {
${0}
}
snippet tpsmet "ts public static method"
public static ${1}(${2}): ${3:any} {
${0}
}
snippet tprmet "ts private method"
private ${1}(${2}): ${3:any} {
${0}
}
snippet tpromet "ts protected method"
protected ${1}(${2}): ${3:any} {
${0}
}
snippet tcla "ts class"
class ${1} {
${2}

View File

@ -9,7 +9,7 @@ snippet ife
${2}
end
else begin
${1}
${3}
end
# Else if statement
snippet eif

View File

@ -3,7 +3,7 @@
snippet lib
library ${1}
use ${1}.${2}
use $1.${2}
# Standard Libraries
snippet libs

View File

@ -43,7 +43,6 @@ snippet ife if ... else statement
endif
snippet au augroup ... autocmd block
augroup ${1:AU_NAME}
" this one is which you're most likely to use?
autocmd ${2:BufRead,BufNewFile} ${3:*.ext,*.ext3|<buffer[=N]>} ${0}
augroup end
snippet bun Vundle.vim Plugin definition