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

Updated plugins

This commit is contained in:
amix
2017-03-07 18:04:28 +01:00
parent fe46dfbbe6
commit ccb7854aa2
103 changed files with 1729 additions and 445 deletions

View File

@ -96,4 +96,8 @@ snippet datetime "YYYY-MM-DD hh:mm" w
`!v strftime("%Y-%m-%d %H:%M")`
endsnippet
snippet todo "TODO comment" bw
`!p snip.rv=get_comment_format()[0]` ${2:TODO}: $0${3: <${4:`!v strftime('%d-%m-%y')`}${5:, `!v g:snips_author`}>} `!p snip.rv=get_comment_format()[2]`
endsnippet
# vim:ft=snippets:

View File

@ -4,6 +4,28 @@ extends c
# We want to overwrite everything in parent ft.
priority -49
###########################################################################
# Global functions #
###########################################################################
global !p
def write_docstring_args(arglist, snip):
args = str(arglist).split(',')
if len(args) > 1:
c = 0
for arg in args:
if c == 0:
snip.rv += arg
c = 1
else:
snip += '* : %s' % arg.strip()
else:
snip.rv = args[0]
endglobal
###########################################################################
# TextMate Snippets #
@ -70,4 +92,19 @@ public:
#endif /* $2 */
endsnippet
snippet fnc "Basic c++ doxygen function template" b
/**
* @brief: ${4:brief}
*
* @param: `!p write_docstring_args(t[3],snip)`
*
* @return: `!p snip.rv = t[1]`
*/
${1:ReturnType} ${2:FunctionName}(${3:param})
{
${0:FunctionBody}
}
endsnippet
# vim:ft=snippets:

View File

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

View File

@ -132,6 +132,14 @@ snippet eh "expect to be hidden (js)" b
expect(${1:target}).toBeHidden();
endsnippet
snippet eth "expect to throw (js)" b
expect(${1:target}).toThrow(${2:value});
endsnippet
snippet ethe "expect to throw error (js)" b
expect(${1:target}).toThrowError(${2:value});
endsnippet
snippet notx "expect not (js)" b
expect(${1:target}).not$0;
endsnippet
@ -145,7 +153,7 @@ expect(${1:target}).not.toBeLessThan(${2:value});
endsnippet
snippet notg "expect to not be greater than (js)" b
expect(${1:target})..not.toBeGreaterThan(${2:value});
expect(${1:target}).not.toBeGreaterThan(${2:value});
endsnippet
snippet notm "expect not to match (js)" b
@ -184,6 +192,14 @@ snippet noth "expect not to be hidden (js)" b
expect(${1:target}).not.toBeHidden();
endsnippet
snippet notth "expect not to throw (js)" b
expect(${1:target}).not.toThrow(${2:value});
endsnippet
snippet notthe "expect not to throw error (js)" b
expect(${1:target}).not.toThrowError(${2:value});
endsnippet
snippet s "spy on (js)" b
spyOn(${1:object}, '${2:method}')$0;
endsnippet

View File

@ -1,5 +1,19 @@
priority -50
############
# COMMON #
############
# The smart snippets use a global options called
# "g:ultisnips_javascript.{option}" which can control the format
# of trailing semicolon, space before function paren, etc.
global !p
from javascript_snippets import (
semi, space_before_function_paren, keyword_spacing
)
endglobal
###########################################################################
# TextMate Snippets #
###########################################################################
@ -8,13 +22,13 @@ getElement${1/(T)|.*/(?1:s)/}By${1:T}${1/(T)|(I)|.*/(?1:agName)(?2:d)/}('$2')
endsnippet
snippet '':f "object method string"
'${1:${2:#thing}:${3:click}}': function(element) {
'${1:${2:#thing}:${3:click}}': function`!p snip.rv = space_before_function_paren(snip)`(element) {
${VISUAL}$0
}${10:,}
endsnippet
snippet :f "Object Method"
${1:method_name}: function(${3:attribute}) {
${1:method_name}: function`!p snip.rv = space_before_function_paren(snip)`(${3:attribute}) {
${VISUAL}$0
}${10:,}
endsnippet
@ -28,48 +42,99 @@ ${1:key}: ${2:"${3:value}"}${4:, }
endsnippet
snippet proto "Prototype (proto)"
${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) {
${1:class_name}.prototype.${2:method_name} = function`!p snip.rv = space_before_function_paren(snip)`(${3:first_argument}) {
${VISUAL}$0
};
}`!p snip.rv = semi(snip)`
endsnippet
snippet fun "function (fun)" w
function ${1:function_name}(${2:argument}) {
function ${1:function_name}`!p snip.rv = space_before_function_paren(snip)`(${2:argument}) {
${VISUAL}$0
}
endsnippet
snippet vf "Function assigned to var"
${1:var }${2:function_name} = function $2($3) {
${1:var }${2:function_name} = function $2`!p snip.rv = space_before_function_paren(snip)`($3) {
${VISUAL}$0
};
}`!p snip.rv = semi(snip)`
endsnippet
snippet af "Anonymous Function" i
function($1) {
function`!p snip.rv = space_before_function_paren(snip)`($1) {
${VISUAL}$0
}
endsnippet
snippet iife "Immediately-Invoked Function Expression (iife)"
(function(${1:window}) {
(function`!p snip.rv = space_before_function_paren(snip)`(${1:window}) {
${VISUAL}$0
}(${2:$1}));
}(${2:$1}))`!p snip.rv = semi(snip)`
endsnippet
snippet ;fe "Minify safe iife"
;(function`!p snip.rv = space_before_function_paren(snip)`(${1}) {
${VISUAL}$0
}(${2}))
endsnippet
snippet timeout "setTimeout function"
setTimeout(function() {
setTimeout(function`!p snip.rv = space_before_function_paren(snip)`() {
${VISUAL}$0
}${2:.bind(${3:this})}, ${1:10});
}${2:.bind(${3:this})}, ${1:10})`!p snip.rv = semi(snip)`
endsnippet
snippet fi "for prop in obj using hasOwnProperty" b
for (${1:prop} in ${2:obj}){
if ($2.hasOwnProperty($1)) {
for`!p snip.rv = keyword_spacing(snip)`(${1:prop} in ${2:obj}){
if`!p snip.rv = keyword_spacing(snip)`($2.hasOwnProperty($1)) {
${VISUAL}$0
}
}
endsnippet
snippet if "if (condition) { ... }"
if`!p snip.rv = keyword_spacing(snip)`(${1:true}) {
${VISUAL}$0
}
endsnippet
snippet ife "if (condition) { ... } else { ... }"
if`!p snip.rv = keyword_spacing(snip)`(${1:true}) {
${VISUAL}$0
}`!p snip.rv = keyword_spacing(snip)`else`!p snip.rv = keyword_spacing(snip)`{
${2}
}
endsnippet
snippet switch
switch`!p snip.rv = keyword_spacing(snip)`(${VISUAL}${1:expression}) {
case '${VISUAL}${3:case}':
${4}
break`!p snip.rv = semi(snip)`
${0}
default:
${2}
}
endsnippet
snippet case "case 'xyz': ... break"
case`!p snip.rv = keyword_spacing(snip)`'${VISUAL}${1:case}':
${VISUAL}$0
break`!p snip.rv = semi(snip)`
endsnippet
snippet do "do { ... } while (condition)"
do`!p snip.rv = keyword_spacing(snip)`{
${VISUAL}$0
}`!p snip.rv = keyword_spacing(snip)`while`!p snip.rv = keyword_spacing(snip)`(${1:/* condition */})`!p snip.rv = semi(snip)`
endsnippet
snippet ret "Return statement"
return ${VISUAL}$0`!p snip.rv = semi(snip)`
endsnippet
snippet us
'use strict'`!p snip.rv = semi(snip)`
endsnippet
# vim:ft=snippets:

View File

@ -0,0 +1,24 @@
priority -50
snippet switch "switch ... otherwise"
switch ${1:n}
case ${2:0}
${3}${4:
otherwise
${5}}
end
endsnippet
snippet clc "class with constructor" b
classdef ${1:`!p
snip.rv = snip.basename or "class_name"`}
properties
${2}
end
methods
function obj = $1(${3})
${4}
end${0}
end
end
endsnippet

View File

@ -1,5 +1,26 @@
priority -50
#
# Global functions
#
global !p
def write_instance_vars(arglist, snip):
args = str(arglist).split(',')
for arg in args:
name = arg.strip().replace(':', ' ').split(' ', 1)[0]
if name:
snip += ' @{} = {}'.format(name, name)
else:
snip += ''
endglobal
#
# Snippets
#
snippet "^#!" "#!/usr/bin/env ruby" r
#!/usr/bin/env ruby
$0
@ -17,8 +38,7 @@ end
endsnippet
snippet defi "def initialize ..."
def initialize${1:(${2:*args})}
$0
def initialize($1)`!p write_instance_vars(t[1],snip)`$0
end
endsnippet
@ -212,32 +232,6 @@ except:
end
endsnippet
snippet "(\S+)\.Each_?w(ith)?_?i(ndex)?" ".each_with_index { |<element>,<i>| <block> }" r
`!p snip.rv=match.group(1)`.each_with_index { |${1:`!p
element_name = match.group(1).lstrip('$@')
ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name)
try:
wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1))
snip.rv = wmatch.group(1).lower()
except:
snip.rv = 'element'
`},${2:i}| $0 }
endsnippet
snippet "(\S+)\.each_?w(ith)?_?i(ndex)?" ".each_with_index do |<element>,<i>| <block> end" r
`!p snip.rv=match.group(1)`.each_with_index do |${1:`!p
element_name = match.group(1).lstrip('$@')
ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name)
try:
wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1))
snip.rv = wmatch.group(1).lower()
except:
snip.rv = 'element'
`},${2:i}|
$0
end
endsnippet
snippet "(\S+)\.Each_?p(air)?" ".each_pair { |<key>,<value>| <block> }" r
`!p snip.rv=match.group(1)`.each_pair { |${1:key},${2:value}| $0 }
endsnippet
@ -298,20 +292,6 @@ rescue
end
endsnippet
snippet begin "begin ... rescue ... else ... ensure ... end"
begin
${1:# Raise exception}
rescue Exception => e
puts e.message
puts e.backtrace.inspect
${2:# Rescue}
else
${3:# other exception}
ensure
${0:# always excute}
end
endsnippet
snippet rescue
rescue Exception => e
puts e.message
@ -326,10 +306,6 @@ $0
end
endsnippet
snippet alias "alias :<new_name> :<old_name>"
alias :${1:new_name} :${2:old_name}
endsnippet
snippet class "class <class_name> def initialize ... end end"
class ${1:class_name}
def initialize(${2:*args})

View File

@ -2,15 +2,15 @@ priority -50
# We use a little hack so that the snippet is expanded
# and parsed correctly
snippet snip "Snippet definition" b
snippet usnip "Ultisnips snippet definition" b
`!p snip.rv = "snippet"` ${1:Tab_trigger} "${2:Description}" ${3:b}
$0
${0:${VISUAL}}
`!p snip.rv = "endsnippet"`
endsnippet
snippet global "Global snippet" b
`!p snip.rv = "global"` !p
$0
${0:${VISUAL}}
`!p snip.rv = "endglobal"`
endsnippet

View File

@ -0,0 +1,48 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Helper utilities to format javascript snippets.
"""
ALWAYS = 'always'
NEVER = 'never'
def get_option(snip, option, default=None):
return snip.opt('g:ultisnips_javascript["{}"]'.format(option), default)
def semi(snip):
option = get_option(snip, 'semi', ALWAYS)
if option == NEVER:
ret = ''
elif option == ALWAYS:
ret = ';'
else:
ret = ';'
return ret
def space_before_function_paren(snip):
option = get_option(snip, 'space-before-function-paren', NEVER)
if option == NEVER:
ret = ''
elif option == ALWAYS:
ret = ' '
else:
ret = ''
return ret
def keyword_spacing(snip):
option = get_option(snip, 'keyword-spacing', ALWAYS)
if option == NEVER:
ret = ''
elif option == ALWAYS:
ret = ' '
else:
ret = ''
return ret

View File

@ -130,6 +130,84 @@ snippet fun
{
${4}
}
# function definition with zero parameters
snippet fun0
${1:void} ${2:function_name}()
{
${3}
}
# function definition with Doxygen documentation
snippet dfun0
/*! \brief ${1:Brief function description here}
*
* ${2:Detailed description of the function}
*
* \return ${3:Return parameter description}
*/
${4:void} ${5:function_name}()
{
${6}
}
# function definition with one parameter
snippet fun1
${1:void} ${2:function_name}(${3:Type} ${4:Parameter})
{
${5}
}
# function definition with one parameter with Doxygen documentation
snippet dfun1
/*! \brief ${1:Brief function description here}
*
* ${2:Detailed description of the function}
*
* \param $3 ${4:Parameter description}
* \return ${5:Return parameter description}
*/
${6:void} ${7:function_name}(${8:Type} ${3:Parameter})
{
${9}
}
# function definition with two parameters
snippet fun2
${1:void} ${2:function_name}(${3:Type} ${4:Parameter}, ${5:Type} ${6:Parameter})
{
${7}
}
# function definition with two parameters with Doxygen documentation
snippet dfun2
/*! \brief ${1:Brief function description here}
*
* ${2:Detailed description of the function}
*
* \param $3 ${4:Parameter description}
* \param $5 ${6:Parameter description}
* \return ${7:Return parameter description}
*/
${8:void} ${9:function_name}(${10:Type} ${3:Parameter}, ${11:Type} ${5:Parameter})
{
${12}
}
# function definition with two parameters
snippet fun3
${1:void} ${2:function_name}(${3:Type} ${4:Parameter}, ${5:Type} ${6:Parameter}, ${7:Type} ${8:Parameter})
{
${9}
}
# function definition with two parameters with Doxygen documentation
snippet dfun3
/*! \brief ${1:Brief function description here}
*
* ${2:Detailed description of the function}
*
* \param $3 ${4:Parameter description}
* \param $5 ${6:Parameter description}
* \param $7 ${8:Parameter description}
* \return ${9:Return parameter description}
*/
${10:void} ${11:function_name}(${12:Type} ${3:Parameter}, ${13:Type} ${5:Parameter}, ${14:Type} ${7:Parameter})
{
${15}
}
# function declaration
snippet fund
${1:void} ${2:function_name}(${3});
@ -140,21 +218,39 @@ snippet td
typedef ${1:int} ${2:MyCustomType};
# struct
snippet st
/*! \struct $1
* \brief ${3:Brief struct description}
*
* ${4:Detailed description}
*/
struct ${1:`vim_snippets#Filename('$1_t', 'name')`} {
${2:/* data */}
}${3: /* optional variable list */};
${2:Data} /*!< ${4:Description} */
}${5: /* optional variable list */};
# typedef struct
snippet tds
/*! \struct $2
* \brief ${5:Brief struct description}
*
* ${6:Detailed description}
*/
typedef struct ${2:_$1 }{
${3:/* data */}
m_${3:Data} /*!< ${4:Description} */
} ${1:`vim_snippets#Filename('$1_t', 'name')`};
snippet enum
/*! \enum $1
*
* ${2:Detailed description}
*/
enum ${1:name} { ${0} };
# typedef enum
snippet tde
/*! \enum $2
*
* ${4:Detailed description}
*/
typedef enum {
${1:/* data */}
${1:Data} /*!< ${3:Description} */
} ${2:foo};
##
## Input/Output
@ -228,6 +324,11 @@ snippet getopt
}
}
##
# TODO section
snippet todo
/*! TODO: ${1:Todo description here}
* \todo $1
*/
## Miscellaneous
# This is kind of convenient
snippet .

View File

@ -78,20 +78,61 @@ snippet mu
## Class
# class
snippet cl
/*! \class $1
* \brief ${3:Brief class description}
*
* ${4:Detailed description}
*/
class ${1:`vim_snippets#Filename('$1', 'name')`}
{
public:
$1(${2});
~$1();
virtual ~$1();
private:
${0:/* data */}
protected:
m_${5}; /*!< ${6:Member description} */
};
# member function implementation
snippet mfun
${4:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}(${3}) {
${0}
}
# member function implementation without parameters
snippet dmfun0
/*! \brief ${4:Brief function description here}
*
* ${5:Detailed description}
*
* \return ${6:Return parameter description}
*/
${3:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}() {
${0}
}
# member function implementation with one parameter
snippet dmfun1
/*! \brief ${6:Brief function description here}
*
* ${7:Detailed description}
*
* \param $4 ${8:Parameter description}
* \return ${9:Return parameter description}
*/
${5:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}(${3:Type} ${4:Parameter}) {
${0}
}
# member function implementation with two parameter
snippet dmfun2
/*! \brief ${8:Brief function description here}
*
* ${9:Detailed description}
*
* \param $4 ${10:Parameter description}
* \param $6 ${11:Parameter description}
* \return ${12:Return parameter description}
*/
${7:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}(${3:Type} ${4:Parameter},${5:Type} ${6:Parameter}) {
${0}
}
# namespace
snippet ns
namespace ${1:`vim_snippets#Filename('', 'my')`} {
@ -152,3 +193,13 @@ snippet lld
[${1}](${2}){
${3}
};
# snippets exception
snippet try
try {
}catch(${1}) {
}

View File

@ -28,9 +28,12 @@ snippet doc
$0
snippet dox
!> @brief ${1}
!!
!> ${2}
!> @author `g:snips_author`
${0}
snippet doxp
!> @param[${1}]${0}
# Variables definitions
# Boolean
snippet bool

View File

@ -78,7 +78,7 @@ snippet spaceless
snippet ssi
{% ssi ${0} %}
snippet trans
{% trans "${0:string}" %}
{% trans %}${0}{% endtrans %}
snippet url
{% url ${1} as ${0} %}
snippet widthratio

View File

@ -0,0 +1,64 @@
snippet if if
if ${1}
${0}
end
snippet ife if ... else
if ${1}
${2}
else
${0}
end
snippet el else
else
${0}
snippet eif elsif
elseif ${1}
${0}
snippet wh while
while ${1}
${0}
end
snippet for for
for ${1:i} = ${2:1:n}
${0}
end
snippet parfor parfor
parfor ${1:i} = ${2:1:n}
${0}
end
snippet fun function
function [${3:out}] = ${1:`vim_snippets#Filename("$1", "fun_name")`}(${2})
${0}
snippet try try ... catch
try
${1}
catch ${2:err}
${0}
end
snippet switch switch
switch ${1:n}
case ${2:0}
${0}
end
snippet @ anonymous function
@(${1:x}) ${0:x*x}
snippet cl class
classdef ${1:`vim_snippets#Filename("$1", "class_name")`}
properties
${2}
end
methods
${0}
end
end

View File

@ -94,9 +94,9 @@ snippet E
$_ENV['${1:variable}']
snippet F
$_FILES['${1:variable}']
snippet G
snippet G "_GET array"
$_GET['${1:variable}']
snippet P
snippet P "_POST array"
$_POST['${1:variable}']
snippet R
$_REQUEST['${1:variable}']

View File

@ -142,21 +142,6 @@ snippet mod module .. end
module ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
${0}
end
snippet mod module .. ClassMethods .. end
module ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
module ClassMethods
${0}
end
module InstanceMethods
end
def self.included(receiver)
receiver.extend ClassMethods
receiver.send :include, InstanceMethods
end
end
# attr_reader
snippet r
attr_reader :${0:attr_names}

View File

@ -142,7 +142,7 @@ snippet stn "Struct with new constructor"
}
impl $1 {
pub fn new(${2}) -> $1 {
pub fn new(${2}) -> Self {
$1 { ${3} }
}
}

View File

@ -1,10 +1,7 @@
# snippets for making snippets :)
snippet snip
snippet ${1:trigger}
${0}
snippet msnip
snippet ${1:trigger} ${2:description}
${0}
snippet ${1:trigger} "${2:description}"
${0:${VISUAL}}
snippet v
{VISUAL}
snippet $