mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated plugins
This commit is contained in:
@ -200,10 +200,12 @@ snippet lld
|
||||
# snippets exception
|
||||
snippet try
|
||||
try {
|
||||
|
||||
|
||||
}catch(${1}) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
snippet af auto function
|
||||
auto ${1:name}(${2}) -> ${3:void}
|
||||
{
|
||||
${0}
|
||||
};
|
||||
|
@ -1,19 +1,19 @@
|
||||
# Snippets for
|
||||
# Snippets for
|
||||
# Authored by Trevor Sullivan <trevor@trevorsullivan.net>
|
||||
|
||||
# PowerShell Class
|
||||
snippet class
|
||||
class {
|
||||
[string] ${0:FirstName}
|
||||
[string] ${1:FirstName}
|
||||
}
|
||||
|
||||
# PowerShell Advanced Function
|
||||
# PowerShell Advanced Function
|
||||
snippet function
|
||||
function {0:name} {
|
||||
function ${1:name} {
|
||||
[CmdletBinding()]
|
||||
param (
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string] $Param1
|
||||
[string] ${2:Param}
|
||||
)
|
||||
|
||||
begin {
|
||||
@ -29,30 +29,74 @@ snippet function
|
||||
# PowerShell Splatting
|
||||
snippet splatting
|
||||
$Params = @{
|
||||
${0:Param1} = 'Value1'
|
||||
${1:Param2} = 'Value2'
|
||||
${1:Param1} = '{2:Value1}'
|
||||
${3:Param2} = '{4:Value2}'
|
||||
}
|
||||
${3:CommandName}
|
||||
${5:CommandName} @Params
|
||||
|
||||
# PowerShell Enumeration
|
||||
snippet enum
|
||||
enum ${0:name} {
|
||||
${1:item1}
|
||||
${2:item2}
|
||||
enum ${1:name} {
|
||||
${2:item1}
|
||||
${3:item2}
|
||||
}
|
||||
|
||||
# PowerShell if..then
|
||||
snippet if
|
||||
if (${0:condition}) {
|
||||
${1:statement}
|
||||
if (${1:condition}) {
|
||||
${2:statement}
|
||||
}
|
||||
|
||||
# PowerShell if..else
|
||||
snippet ife
|
||||
if ( ${1:condition} ) {
|
||||
${2}
|
||||
}
|
||||
else {
|
||||
${3}
|
||||
}
|
||||
|
||||
# PowerShell While Loop
|
||||
snippet while
|
||||
while (${0:condition}) {
|
||||
${1:statement}
|
||||
while (${1:condition}) {
|
||||
${2:statement}
|
||||
}
|
||||
|
||||
# PowerShell Filter..Sort
|
||||
snippet filtersort
|
||||
${0:command} | Where-Object -FilterScript { $PSItem.${1:property} -${2:operator} '${3:expression}' } | Sort-Object -Property ${4:sortproperty}
|
||||
${1:command} | Where-Object -FilterScript { $PSItem.${2:property} -${3:operator} '${4:expression}' } | Sort-Object -Property ${5:sortproperty}
|
||||
|
||||
# PowerShell foreach
|
||||
snippet foreach
|
||||
foreach ( $${1:iterator} in $${2:collection} ) {
|
||||
${3:statement}
|
||||
}
|
||||
|
||||
# PowerShell export-csv
|
||||
snippet epcsv
|
||||
Export-CSV -NoTypeInformation -Path ${1:path}
|
||||
|
||||
# Powershell Comment Based Help
|
||||
snippet help
|
||||
<#
|
||||
.SYNOPSIS
|
||||
${1:Short Description}
|
||||
.DESCRIPTION
|
||||
${2:Full Description}
|
||||
.PARAMETER ${3:Param1}
|
||||
${4: $3 usage}
|
||||
.EXAMPLE
|
||||
${5:Example}
|
||||
.NOTES
|
||||
${6:notes}
|
||||
.LINK
|
||||
${7:online help}
|
||||
#>
|
||||
|
||||
# Powershell switch statement
|
||||
snippet switch
|
||||
switch ( ${1:test} ){
|
||||
${2:condition1} { ${3:action} }
|
||||
${4:condition2} { ${5:action} }
|
||||
default { ${6:action} }
|
||||
|
||||
|
@ -1,87 +1,60 @@
|
||||
# Snippets for use with VIM and http://www.vim.org/scripts/script.php?script_id=2540
|
||||
#
|
||||
# Please contact R.I.Pienaar <rip@devco.net> for additions and feedback,
|
||||
# Please contact Jorge Vidal <im@jor.ge> for additions and feedback,
|
||||
# see it in action @ http://www.devco.net/archives/2009/09/22/vim_and_puppet.php
|
||||
# Many thanks to the original author R.I.Pienaar <rip@devco.net>
|
||||
|
||||
# Header to match http://docs.puppetlabs.com/guides/style_guide.html#puppet-doc
|
||||
# Header using Puppet Strings (YARD tags) https://puppet.com/docs/puppet/latest/modules_documentation.html
|
||||
# More info: https://github.com/puppetlabs/puppet-strings
|
||||
snippet classheader
|
||||
# == Class: ${1:`vim_snippets#Filename(expand('%:p:s?.*modules/??:h:h'), 'name')`}
|
||||
# ${1:`vim_snippets#Filename(expand('%:p:s?.*modules/??:h:h'), 'class-name')`}
|
||||
# ${2:A description of what this class does}
|
||||
#
|
||||
# ${2:Full description of class $1 here}
|
||||
# @summary ${3:A short summary of the purpose of this class}
|
||||
#
|
||||
# === Parameters
|
||||
# @param ${4:parameter1} [${5:String}]
|
||||
# ${6:Explanation of what this parameter affects.}
|
||||
#
|
||||
# Document parameters here.
|
||||
# @example Simple use
|
||||
# class { '$1': }
|
||||
#
|
||||
# [*parameter1*]
|
||||
# Explanation of what this parameter affects and what it defaults to.
|
||||
# e.g. "Specify one or more upstream ntp servers as an array."
|
||||
# @example Use with params
|
||||
# class { '$1':
|
||||
# $$4 => '${7:undef}',
|
||||
# }
|
||||
#
|
||||
# === Variables
|
||||
# @author ${8:`g:snips_author`} <${9:`g:snips_email`}>
|
||||
#
|
||||
# Here you should define a list of variables that this module would require.
|
||||
# @note Copyright `strftime("%Y")` $8
|
||||
#
|
||||
# [*variable1*]
|
||||
# Explanation of how this variable affects the funtion of this class and
|
||||
# if it has a default. e.g. "The parameter enc_ntp_servers must be set by the
|
||||
# External Node Classifier as a comma separated list of hostnames."
|
||||
#
|
||||
# === Examples
|
||||
#
|
||||
# class { '$1':
|
||||
# parameter1 => [ 'just', 'an', 'example', ]
|
||||
# }
|
||||
#
|
||||
# === Authors
|
||||
#
|
||||
# `g:snips_author` <`g:snips_email`>
|
||||
#
|
||||
# === Copyright
|
||||
#
|
||||
# Copyright `strftime("%Y")` `g:snips_author`
|
||||
#
|
||||
class $1 (${3}){
|
||||
${4}
|
||||
class $1(
|
||||
$$4 = undef,
|
||||
) {
|
||||
${0}
|
||||
}
|
||||
|
||||
snippet defheader
|
||||
# == Define: ${1:`vim_snippets#Filename(expand('%:p:s?.*modules/??:r:s?/manifests/?::?'), 'name')`}
|
||||
# ${1:`vim_snippets#Filename(expand('%:p:s?.*modules/??:h:h'), 'define-name')`}
|
||||
# ${2:A description of what this define does}
|
||||
#
|
||||
# ${2:Full description of defined resource type $1 here}
|
||||
# @summary ${3:A short summary of the purpose of this define}
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# Document parameters here
|
||||
#
|
||||
# [*namevar*]
|
||||
# If there is a parameter that defaults to the value of the title string
|
||||
# when not explicitly set, you must always say so. This parameter can be
|
||||
# referred to as a "namevar," since it's functionally equivalent to the
|
||||
# namevar of a core resource type.
|
||||
#
|
||||
# [*basedir*]
|
||||
# Description of this variable. For example, "This parameter sets the
|
||||
# base directory for this resource type. It should not contain a trailing
|
||||
# slash."
|
||||
#
|
||||
# === Examples
|
||||
#
|
||||
# Provide some examples on how to use this type:
|
||||
# @param ${4:parameter1} [${5:String}]
|
||||
# ${6:Explanation of what this parameter affects.}
|
||||
#
|
||||
# @example Simple use
|
||||
# $1 { 'namevar':
|
||||
# basedir => '/tmp/src',
|
||||
# $$4 => '${7:undef}',
|
||||
# }
|
||||
#
|
||||
# === Authors
|
||||
# @author ${8:`g:snips_author`} <${9:`g:snips_email`}>
|
||||
#
|
||||
# `g:snips_author` <`g:snips_email`>
|
||||
# @note Copyright `strftime("%Y")` $8
|
||||
#
|
||||
# === Copyright
|
||||
#
|
||||
# Copyright `strftime("%Y")` `g:snips_author`
|
||||
#
|
||||
define $1(${3}) {
|
||||
${4}
|
||||
define $1(
|
||||
$$4 = undef,
|
||||
) {
|
||||
${0}
|
||||
}
|
||||
|
||||
# Language Constructs
|
||||
|
@ -115,21 +115,21 @@ snippet try Try/Except
|
||||
${1:${VISUAL}}
|
||||
except ${2:Exception} as ${3:e}:
|
||||
${0:raise $3}
|
||||
snippet try Try/Except/Else
|
||||
snippet trye Try/Except/Else
|
||||
try:
|
||||
${1:${VISUAL}}
|
||||
except ${2:Exception} as ${3:e}:
|
||||
${4:raise $3}
|
||||
else:
|
||||
${0}
|
||||
snippet try Try/Except/Finally
|
||||
snippet tryf Try/Except/Finally
|
||||
try:
|
||||
${1:${VISUAL}}
|
||||
except ${2:Exception} as ${3:e}:
|
||||
${4:raise $3}
|
||||
finally:
|
||||
${0}
|
||||
snippet try Try/Except/Else/Finally
|
||||
snippet tryef Try/Except/Else/Finally
|
||||
try:
|
||||
${1:${VISUAL}}
|
||||
except ${2:Exception} as ${3:e}:
|
||||
|
@ -42,10 +42,10 @@ snippet defcreate
|
||||
if @$1.save
|
||||
flash[:notice] = '$2 was successfully created.'
|
||||
format.html { redirect_to(@$1) }
|
||||
format.xml { render xml: @$1, status: :created, location: @$1 }
|
||||
format.json { render json: @$1, status: :created, location: @$1 }
|
||||
else
|
||||
format.html { render action: 'new' }
|
||||
format.xml { render xml: @$1.errors, status: :unprocessable_entity }
|
||||
format.json { render json: @$1.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -56,7 +56,7 @@ snippet defdestroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to($1s_url) }
|
||||
format.xml { head :ok }
|
||||
format.json { head :ok }
|
||||
end
|
||||
end
|
||||
snippet defedit
|
||||
@ -69,7 +69,7 @@ snippet defindex
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.xml { render xml: @$1s }
|
||||
format.json { render json: @$1s }
|
||||
end
|
||||
end
|
||||
snippet defnew
|
||||
@ -78,7 +78,7 @@ snippet defnew
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.xml { render xml: @$1 }
|
||||
format.json { render json: @$1 }
|
||||
end
|
||||
end
|
||||
snippet defshow
|
||||
@ -87,7 +87,7 @@ snippet defshow
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.xml { render xml: @$1 }
|
||||
format.json { render json: @$1 }
|
||||
end
|
||||
end
|
||||
snippet defupdate
|
||||
@ -98,10 +98,10 @@ snippet defupdate
|
||||
if @$1.update($1_params)
|
||||
flash[:notice] = '$2 was successfully updated.'
|
||||
format.html { redirect_to(@$1) }
|
||||
format.xml { head :ok }
|
||||
format.json { head :ok }
|
||||
else
|
||||
format.html { render action: 'edit' }
|
||||
format.xml { render xml: @$1.errors, status: :unprocessable_entity }
|
||||
format.json { render json: @$1.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -292,7 +292,9 @@ snippet block block environment
|
||||
\\begin{block}{${1:title}}
|
||||
${0:${VISUAL}}
|
||||
\\end{block}
|
||||
snippet alert alertblock environment
|
||||
snippet alert alert text
|
||||
\\alert{${1:${VISUAL:text}}} ${0}
|
||||
snippet alertblock alertblock environment
|
||||
\\begin{alertblock}{${1:title}}
|
||||
${0:${VISUAL}}
|
||||
\\end{alertblock}
|
||||
@ -309,6 +311,12 @@ snippet col2 two-column environment
|
||||
${0}
|
||||
\\end{column}
|
||||
\\end{columns}
|
||||
snippet multicol2 two-column environment with multicol
|
||||
\\begin{multicols}{2}
|
||||
${1}
|
||||
\columnbreak
|
||||
${0}
|
||||
\\end{multicols}
|
||||
snippet \{ \{ \}
|
||||
\\{ ${0} \\}
|
||||
#delimiter
|
||||
|
Reference in New Issue
Block a user