1
0
mirror of https://github.com/amix/vimrc synced 2025-07-03 14:14:59 +08:00

updated plugins and added eslint goodies

This commit is contained in:
Max Alcala
2016-02-19 10:35:36 -06:00
parent a1deb28314
commit f3143286d3
402 changed files with 14389 additions and 4024 deletions

View File

@ -25,7 +25,7 @@ snippet Inc
snippet ndef
#ifndef $1
#define ${1:SYMBOL} ${2:value}
#endif
#endif /* ifndef $1 */
# define
snippet def
#define
@ -98,6 +98,8 @@ snippet case
case ${1:/* variable case */}:
${2}
${3:break;}
snippet ret
return ${0};
##
## Loops
# for
@ -146,6 +148,9 @@ snippet tds
typedef struct ${2:_$1 }{
${3:/* data */}
} ${1:`vim_snippets#Filename('$1_t', 'name')`};
snippet enum
enum ${1:name} { ${0} };
# typedef enum
snippet tde
typedef enum {
@ -221,23 +226,3 @@ snippet getopt
# This is kind of convenient
snippet .
[${1}]
# GPL
snippet gpl
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
* Copyright (C) ${1:Author}, `strftime("%Y")`
*/
${0}

View File

@ -1,58 +1,83 @@
snippet cmake
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(${1:ProjectName})
snippet init
cmake_minimum_required(version ${1:2.8.2})
project(${2:ProjectName})
FIND_PACKAGE(${2:LIBRARY})
find_package(${3:library})
INCLUDE_DIRECTORIES(
${$2_INCLUDE_DIR}
)
include_directories(${$3_INCLUDE_DIRS})
ADD_SUBDIRECTORY(${0:src})
add_subdirectory(${0:src})
ADD_EXECUTABLE($1)
add_executable($2)
TARGET_LINK_LIBRARIES($1
${$2_LIBRARIES}
)
target_link_libraries($2 ${$3_LIBRARIES})
snippet proj
project(${0:Name})
snippet min
cmake_minimum_required(version ${0:2.8.2})
snippet include
INCLUDE_DIRECTORIES(
${${0:INCLUDE_DIR}}
)
include_directories(${${0:include_dir}})
snippet find
FIND_PACKAGE(${0:LIBRARY})
find_package(${1:library} ${0:REQUIRED})
snippet glob
FILE(GLOB ${1:SRCS} *.${0:cpp})
file(glob ${1:srcs} *.${0:cpp})
snippet subdir
ADD_SUBDIRECTORY(${0:src})
add_subdirectory(${0:src})
snippet lib
ADD_LIBRARY(${1:lib} ${2:STATIC}
${${0:SRCS}}
)
add_library(${1:lib} ${${0:srcs}})
snippet link
TARGET_LINK_LIBRARIES(${1:bin}
${0:somelib}
)
target_link_libraries(${1:bin} ${0:somelib})
snippet bin
ADD_EXECUTABLE(${1:bin})
add_executable(${1:bin})
snippet set
SET(${1:var} ${0:val})
set(${1:var} ${0:val})
snippet dep
ADD_DEPENDENCIES(${1:target}
add_dependencies(${1:target}
${0:dep}
)
snippet Ext_url
include(ExternalProject)
ExternalProject_Add(${1:googletest}
URL ${2:http://googletest.googlecode.com/files/gtest-1.7.0.zip}
URL_HASH SHA1=${3:f85f6d2481e2c6c4a18539e391aa4ea8ab0394af}
SOURCE_DIR "${4:${CMAKE_BINARY_DIR}/gtest-src}"
BINARY_DIR "${0:${CMAKE_BINARY_DIR}/gtest-build}"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
snippet Ext_git
include(ExternalProject)
ExternalProject_Add(${1:googletest}
GIT_REPOSITORY ${2:https://github.com/google/googletest.git}
GIT_TAG ${3:master}
SOURCE_DIR "${4:${CMAKE_BINARY_DIR}/googletest-src}"
BINARY_DIR "${0:${CMAKE_BINARY_DIR}/googletest-build}"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
snippet props
SET_TARGET_PROPERTIES(${1:target}
${2:PROPERTIES} ${3:COMPILE_FLAGS}
set_target_properties(${1:target}
${2:properties} ${3:compile_flags}
${0:"-O3 -Wall -pedantic"}
)
snippet test
add_test(${1:ATestName} ${0:testCommand --options})

View File

@ -1,5 +1,13 @@
extends c
##
## Preprocessor
# #include <...>
snippet inc
#include <${1:iostream}>
snippet binc
#include <boost/${1:shared_ptr}.hpp>
##
## STL Collections
# std::array
snippet array

View File

@ -1,37 +1,29 @@
snippet %
<% ${0} %>
snippet =
<%= ${0} %>
snippet end
<% end %>
snippet for
<%= for ${1:item} <- ${2:items} ${3:@conn} do %>
${0}
<% end %>
snippet if
<%= if ${1} do %>
${0}
<% end %>
snippet ife
<%= if ${1} do %>
${2}
<%= else %>
${0}
<% end %>
snippet ft
<%= form_tag(${1:"/users"}, method: ${2::post}) %>
${0}
</form>
snippet lin
<%= link "${1:Submit}", to: ${2:"/users"}, method: ${3::delete} %>
snippet ff
<%= form_for @changeset, ${1:"/users"}, fn f -> %>
${0}

View File

@ -70,7 +70,7 @@ snippet defma
${0}
end
snippet defmo
defmodule ${1:module_name} do
defmodule ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} do
${0}
end
snippet defp
@ -95,6 +95,8 @@ snippet mdoc
@moduledoc """
${0}
"""
snippet mdocf
@moduledoc false
snippet rec
receive do
${1} ->
@ -123,3 +125,7 @@ snippet try try .. rescue .. end
snippet pry
require IEx; IEx.pry
${0}
snippet qu
quote do
${1}
end

View File

@ -22,23 +22,23 @@ snippet for
${0}
<% end %>
snippet rp
<%= render :partial => '${0:item}' %>
<%= render partial: '${0:item}' %>
snippet rpl
<%= render :partial => '${1:item}', :locals => { :${2:name} => '${3:value}'${0} } %>
<%= render partial: '${1:item}', locals: { :${2:name} => '${3:value}'${0} } %>
snippet rps
<%= render :partial => '${1:item}', :status => ${0:500} %>
<%= render partial: '${1:item}', status: ${0:500} %>
snippet rpc
<%= render :partial => '${1:item}', :collection => ${0:items} %>
<%= render partial: '${1:item}', collection: ${0:items} %>
snippet lia
<%= link_to '${1:link text...}', :action => '${0:index}' %>
<%= link_to '${1:link text...}', action: '${0:index}' %>
snippet liai
<%= link_to '${1:link text...}', :action => '${2:edit}', :id => ${0:@item} %>
<%= link_to '${1:link text...}', action: '${2:edit}', id: ${0:@item} %>
snippet lic
<%= link_to '${1:link text...}', :controller => '${0:items}' %>
<%= link_to '${1:link text...}', controller: '${0:items}' %>
snippet lica
<%= link_to '${1:link text...}', :controller => '${2:items}', :action => '${0:index}' %>
<%= link_to '${1:link text...}', controller: '${2:items}', action: '${0:index}' %>
snippet licai
<%= link_to '${1:link text...}', :controller => '${2:items}', :action => '${3:edit}', :id => ${0:@item} %>
<%= link_to '${1:link text...}', controller: '${2:items}', action: '${3:edit}', id: ${0:@item} %>
snippet yield
<%= yield ${1::content_symbol} %>
snippet conf
@ -110,11 +110,11 @@ snippet ofcfs
snippet ofs
<%= options_for_select ${1:collection}, ${2:value_method} %>
snippet rf
<%= render :file => "${1:file}"${0} %>
<%= render file: "${1:file}"${0} %>
snippet rt
<%= render :template => "${1:file}"${0} %>
<%= render template: "${1:file}"${0} %>
snippet slt
<%= stylesheet_link_tag ${1::all}, :cache => ${0:true} %>
<%= stylesheet_link_tag ${1::all}, cache: ${0:true} %>
snippet sslt
<%= stylesheet_link_tag "${0}" %>
snippet if

View File

@ -2,11 +2,13 @@ snippet lang
{-# LANGUAGE ${0:OverloadedStrings} #-}
snippet haddock
{-# OPTIONS_HADDOCK ${0:hide} #-}
snippet ghc
{-# OPTIONS_GHC ${0:-fno-warn-unused-imports} #-}
snippet inline
{-# INLINE ${0:name} #-}
snippet info
-- |
-- Module : ${1:Module.Namespace}
-- Module : ${1:`substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')`}
-- Copyright : ${2:Author} ${3:2011-2012}
-- License : ${4:BSD3}
--
@ -40,9 +42,12 @@ snippet class
${0}
snippet module
module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` (
) where
`expand('%') =~ 'Main' ? "\n\nmain = do\n print \"hello world\"" : ""`
) where
`expand('%') =~ 'Main' ? "\nmain :: IO ()\nmain = undefined" : ""`
snippet main
main :: IO ()
main = ${0:undefined}
snippet const
${1:name} :: ${2:a}
$1 = ${0:undefined}
@ -52,25 +57,21 @@ snippet fn
snippet fn2
${1:fn} :: ${2:a} -> ${3:a} -> ${4:a}
$1 ${5} = ${0:undefined}
snippet fn3
${1:fn} :: ${2:a} -> ${3:a} -> ${4:a} -> ${5:a}
$1 ${6} = ${0:undefined}
snippet => "Type constraint"
(${1:Class} ${2:a}) => $2
snippet ap
${1:map} ${2:fn} ${0:list}
snippet do
do
snippet λ
\\${1:x} -> ${0:expression}
snippet \
\\${1:x} -> ${0:expression}
snippet (\
(\\${1:x} -> ${0:expression})
snippet <-
${1:a} <- ${0:m a}
snippet ←
${1:a} <- ${0:m a}
snippet ->
${1:m a} -> ${0:a}
snippet →
${1:m a} -> ${0:a}
snippet tup
(${1:a}, ${0:b})
snippet tup2
@ -90,3 +91,25 @@ snippet let
snippet where
where
${1:fn} = ${0:undefined}
snippet spec
module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` (main, spec) where
import Test.Hspec
import Test.QuickCheck
main :: IO ()
main = hspec spec
spec :: Spec
spec =
describe "${1}" $ do
$0
snippet desc
describe "${1}" $ do
$0
snippet it
it "${1}" $
$0
snippet itp
it "${1}" $ property $
$0

View File

@ -159,18 +159,18 @@ snippet address
${0}
</address>
snippet area
<area shape="${1:rect}" coords="${2}" href="${3}" alt="${0}" />
<area shape="${1:rect}" coords="${2}" href="${3}" alt="${0}">
snippet area+
<area shape="${1:rect}" coords="${2}" href="${3}" alt="${4}" />
<area shape="${1:rect}" coords="${2}" href="${3}" alt="${4}">
area+
snippet area:c
<area shape="circle" coords="${1}" href="${2}" alt="${0}" />
<area shape="circle" coords="${1}" href="${2}" alt="${0}">
snippet area:d
<area shape="default" coords="${1}" href="${2}" alt="${0}" />
<area shape="default" coords="${1}" href="${2}" alt="${0}">
snippet area:p
<area shape="poly" coords="${1}" href="${2}" alt="${0}" />
<area shape="poly" coords="${1}" href="${2}" alt="${0}">
snippet area:r
<area shape="rect" coords="${1}" href="${2}" alt="${0}" />
<area shape="rect" coords="${1}" href="${2}" alt="${0}">
snippet article
<article>
${0}
@ -200,7 +200,7 @@ snippet audio
snippet b
<b>${0}</b>
snippet base
<base href="${1}" target="${0}" />
<base href="${1}" target="${0}">
snippet bdi
<bdi>${0}</bdo>
snippet bdo
@ -218,7 +218,7 @@ snippet body
${0}
</body>
snippet br
<br />
<br>
snippet button
<button type="${1:submit}">${0}</button>
snippet button.
@ -240,9 +240,9 @@ snippet cite
snippet code
<code>${0}</code>
snippet col
<col />
<col>
snippet col+
<col />
<col>
col+
snippet colgroup
<colgroup>
@ -254,11 +254,11 @@ snippet colgroup+
col+${0}
</colgroup>
snippet command
<command type="command" label="${1}" icon="${0}" />
<command type="command" label="${1}" icon="${0}">
snippet command:c
<command type="checkbox" label="${1}" icon="${0}" />
<command type="checkbox" label="${1}" icon="${0}">
snippet command:r
<command type="radio" radiogroup="${1}" label="${2}" icon="${0}" />
<command type="radio" radiogroup="${1}" label="${2}" icon="${0}">
snippet datagrid
<datagrid>
${0}
@ -330,7 +330,7 @@ snippet dt+
snippet em
<em>${0}</em>
snippet embed
<embed src="${1}" type="${0}" />
<embed src="${1}" type="${0}">
snippet fieldset
<fieldset>
${0}
@ -423,7 +423,7 @@ snippet h6#
<h6 id="${1}">${0}</h6>
snippet head
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
${0}
@ -449,7 +449,7 @@ snippet hgroup.
${0}
</hgroup>
snippet hr
<hr />
<hr>
snippet html
<html>
${0}
@ -493,59 +493,59 @@ snippet iframe.
snippet iframe#
<iframe id="${1}" src="${2}" frameborder="0"></iframe>
snippet img
<img src="${1}" alt="${2}" />
<img src="${1}" alt="${2}">
snippet img.
<img class="${1}" src="${2}" alt="${3}" />
<img class="${1}" src="${2}" alt="${3}">
snippet img#
<img id="${1}" src="${2}" alt="${3}" />
<img id="${1}" src="${2}" alt="${3}">
snippet input
<input type="${1:text/submit/hidden/button/image}" name="${2}" id="${3:$2}" value="${4}" />
<input type="${1:text/submit/hidden/button/image}" name="${2}" id="${3:$2}" value="${4}">
snippet input.
<input class="${1}" type="${2:text/submit/hidden/button/image}" name="${3}" id="${4:$3}" value="${5}" />
<input class="${1}" type="${2:text/submit/hidden/button/image}" name="${3}" id="${4:$3}" value="${5}">
snippet input:text
<input type="text" name="${1}" id="${2:$1}" value="${3}" />
<input type="text" name="${1}" id="${2:$1}" value="${3}">
snippet input:submit
<input type="submit" name="${1}" id="${2:$1}" value="${3}" />
<input type="submit" name="${1}" id="${2:$1}" value="${3}">
snippet input:hidden
<input type="hidden" name="${1}" id="${2:$1}" value="${3}" />
<input type="hidden" name="${1}" id="${2:$1}" value="${3}">
snippet input:button
<input type="button" name="${1}" id="${2:$1}" value="${3}" />
<input type="button" name="${1}" id="${2:$1}" value="${3}">
snippet input:image
<input type="image" name="${1}" id="${2:$1}" src="${3}" alt="${4}" />
<input type="image" name="${1}" id="${2:$1}" src="${3}" alt="${4}">
snippet input:checkbox
<input type="checkbox" name="${1}" id="${2:$1}" />
<input type="checkbox" name="${1}" id="${2:$1}">
snippet input:radio
<input type="radio" name="${1}" id="${2:$1}" />
<input type="radio" name="${1}" id="${2:$1}">
snippet input:color
<input type="color" name="${1}" id="${2:$1}" value="${3}" />
<input type="color" name="${1}" id="${2:$1}" value="${3}">
snippet input:date
<input type="date" name="${1}" id="${2:$1}" value="${3}" />
<input type="date" name="${1}" id="${2:$1}" value="${3}">
snippet input:datetime
<input type="datetime" name="${1}" id="${2:$1}" value="${3}" />
<input type="datetime" name="${1}" id="${2:$1}" value="${3}">
snippet input:datetime-local
<input type="datetime-local" name="${1}" id="${2:$1}" value="${3}" />
<input type="datetime-local" name="${1}" id="${2:$1}" value="${3}">
snippet input:email
<input type="email" name="${1}" id="${2:$1}" value="${3}" />
<input type="email" name="${1}" id="${2:$1}" value="${3}">
snippet input:file
<input type="file" name="${1}" id="${2:$1}" value="${3}" />
<input type="file" name="${1}" id="${2:$1}" value="${3}">
snippet input:month
<input type="month" name="${1}" id="${2:$1}" value="${3}" />
<input type="month" name="${1}" id="${2:$1}" value="${3}">
snippet input:number
<input type="number" name="${1}" id="${2:$1}" value="${3}" />
<input type="number" name="${1}" id="${2:$1}" value="${3}">
snippet input:password
<input type="password" name="${1}" id="${2:$1}" value="${3}" />
<input type="password" name="${1}" id="${2:$1}" value="${3}">
snippet input:range
<input type="range" name="${1}" id="${2:$1}" value="${3}" />
<input type="range" name="${1}" id="${2:$1}" value="${3}">
snippet input:reset
<input type="reset" name="${1}" id="${2:$1}" value="${3}" />
<input type="reset" name="${1}" id="${2:$1}" value="${3}">
snippet input:search
<input type="search" name="${1}" id="${2:$1}" value="${3}" />
<input type="search" name="${1}" id="${2:$1}" value="${3}">
snippet input:time
<input type="time" name="${1}" id="${2:$1}" value="${3}" />
<input type="time" name="${1}" id="${2:$1}" value="${3}">
snippet input:url
<input type="url" name="${1}" id="${2:$1}" value="${3}" />
<input type="url" name="${1}" id="${2:$1}" value="${3}">
snippet input:week
<input type="week" name="${1}" id="${2:$1}" value="${3}" />
<input type="week" name="${1}" id="${2:$1}" value="${3}">
snippet ins
<ins>${0}</ins>
snippet kbd
@ -579,19 +579,19 @@ snippet lia+
<li><a href="${2:#}">${1}</a></li>
lia+
snippet link
<link rel="${1}" href="${2}" title="${3}" type="${4}" />
<link rel="${1}" href="${2}" title="${3}" type="${4}">
snippet link:atom
<link rel="alternate" href="${1:atom.xml}" title="Atom" type="application/atom+xml" />
<link rel="alternate" href="${1:atom.xml}" title="Atom" type="application/atom+xml">
snippet link:s
<link rel="stylesheet" href="${1:style.css}" />
<link rel="stylesheet" href="${1:style.css}">
snippet link:css
<link rel="stylesheet" href="${1:style.css}" type="text/css" media="${2:all}" />
<link rel="stylesheet" href="${1:style.css}" type="text/css" media="${2:all}">
snippet link:favicon
<link rel="shortcut icon" href="${1:favicon.ico}" type="image/x-icon" />
<link rel="shortcut icon" href="${1:favicon.ico}" type="image/x-icon">
snippet link:rss
<link rel="alternate" href="${1:rss.xml}" title="RSS" type="application/atom+xml" />
<link rel="alternate" href="${1:rss.xml}" title="RSS" type="application/atom+xml">
snippet link:touch
<link rel="apple-touch-icon" href="${1:favicon.png}" />
<link rel="apple-touch-icon" href="${1:favicon.png}">
snippet main
<main role="main">
${0}
@ -610,7 +610,7 @@ snippet map#
</map>
snippet map+
<map name="${1}">
<area shape="${2}" coords="${3}" href="${4}" alt="${5}" />${6}
<area shape="${2}" coords="${3}" href="${4}" alt="${5}">${6}
</map>
snippet mark
<mark>${0}</mark>
@ -627,17 +627,17 @@ snippet menu:t
${0}
</menu>
snippet meta
<meta http-equiv="${1}" content="${2}" />
<meta http-equiv="${1}" content="${2}">
snippet meta:s
<meta ${0} />
<meta ${0}>
snippet meta:d
<meta name="description" content="${0}" />
<meta name="description" content="${0}">
snippet meta:compat
<meta http-equiv="X-UA-Compatible" content="IE=${1:7,8,edge}" />
<meta http-equiv="X-UA-Compatible" content="IE=${1:7,8,edge}">
snippet meta:refresh
<meta http-equiv="refresh" content="text/html;charset=UTF-8" />
<meta http-equiv="refresh" content="text/html;charset=UTF-8">
snippet meta:utf
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<meta http-equiv="content-type" content="text/html;charset=UTF-8">
snippet meter
<meter>${0}</meter>
snippet nav
@ -665,13 +665,13 @@ snippet movie
<object width="$2" height="$3" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
codebase="http://www.apple.com/qtactivex/qtplugin.cab">
<param name="src" value="$1" />
<param name="controller" value="$4" />
<param name="autoplay" value="$5" />
<param name="controller" value="$4">
<param name="autoplay" value="$5">
<embed src="${1:movie.mov}"
width="${2:320}" height="${3:240}"
controller="${4:true}" autoplay="${5:true}"
scale="tofit" cache="true"
pluginspage="http://www.apple.com/quicktime/download/" />
pluginspage="http://www.apple.com/quicktime/download/">
</object>
snippet ol
<ol>
@ -711,7 +711,7 @@ snippet p.
snippet p#
<p id="${1}">${0}</p>
snippet param
<param name="${1}" value="${2}" />
<param name="${1}" value="${2}">
snippet pre
<pre>
${0}
@ -774,7 +774,7 @@ snippet select+
snippet small
<small>${0}</small>
snippet source
<source src="${1}" type="${2}" media="${0}" />
<source src="${1}" type="${2}" media="${0}">
snippet span
<span>${0}</span>
snippet span.
@ -876,4 +876,4 @@ snippet var
snippet video
<video src="${1} height="${2}" width="${3}" preload="${5:none}" autoplay="${6:autoplay}>${7}</video>
snippet wbr
<wbr />
<wbr>

View File

@ -1,5 +1,7 @@
# Generic tags
extends html
snippet %
{% ${1} %}
snippet %%
@ -138,4 +140,3 @@ snippet urlizetrunc
urlizetrunc:${0}
snippet wordwrap
wordwrap:${0}

View File

@ -16,8 +16,8 @@ snippet marginconvention
var ${8:height} = ${9:500} - $1.top - $1.bottom;
var ${10:svg} = d3.select("${11}").append("svg")
.attr("width", $6)
.attr("height", $8)
.attr("width", $6 + $1.left + $1.right)
.attr("height", $8 + $1.top + $1.bottom)
.append("g")
.attr("transform", "translate(" + $1.left + "," + $1.top + ")")
snippet nest

View File

@ -0,0 +1,28 @@
snippet const
const ${1} = ${0};
snippet let
let ${1} = ${0};
snippet im
import ${1} from '${0}';
snippet cla
class ${1} {
${0}
}
snippet clax
class ${1} extends ${2} {
${0}
}
snippet =>
(${1}) => {
${0}
}
snippet af
(${1}) => {
${0}
}
snippet sym
const ${1} = Symbol('${0}');
snippet ed
export default ${0}
snippet ${
${${1}}${0}

View File

@ -11,7 +11,7 @@ snippet fun
${0}
}
# Anonymous Function
snippet f
snippet f "" w
function(${1}) {
${0}
}
@ -80,6 +80,18 @@ snippet try
} catch (${2:e}) {
${0:/* handle error */}
}
# try finally
snippet tryf
try {
${1}
} catch (${2:e}) {
${0:/* handle error */}
} finally {
${3:/* be executed regardless of the try / catch result*/}
}
# throw Error
snippet terr
throw new Error('${1:error message}')
# return
snippet ret
return ${0:result};
@ -88,12 +100,12 @@ snippet ret
# for loop
snippet for
for (var ${2:i} = 0, l = ${1:arr}.length; $2 < l; $2 ++) {
for (var ${2:i} = 0, l = ${1:arr}.length; $2 < l; $2++) {
var ${3:v} = $1[$2];${0:}
}
# Reversed for loop
snippet forr
for (var ${2:i} = ${1:arr}.length - 1; $2 >= 0; $2 --) {
for (var ${2:i} = ${1:arr}.length - 1; $2 >= 0; $2--) {
var ${3:v} = $1[$2];${0:}
}
# While loop
@ -203,7 +215,6 @@ snippet @par
@param {${1:type}} ${2:name} ${0:description}
snippet @ret
@return {${1:type}} ${0:description}
# JSON
# JSON.parse
@ -243,6 +254,9 @@ snippet cl
# console.debug
snippet cd
console.debug(${0});
# console.error
snippet ce
console.error(${0});
# console.trace
snippet ct
console.trace(${0:label});

View File

@ -0,0 +1,142 @@
# Generic tags
extends html
snippet %
{% ${1} %}
snippet %%
{% ${1:tag_name} %}
${0}
{% end$1 %}
snippet {
{{ ${1} }}
# Template Tags
snippet autoescape
{% autoescape ${1:off} %}
${0}
{% endautoescape %}
snippet block
{% block ${1} %}
${0}
{% endblock %}
snippet #
{# ${0:comment} #}
snippet comment
{% comment %}
${0}
{% endcomment %}
snippet cycle
{% cycle ${1:val1} ${2:val2} ${3:as ${4}} %}
snippet debug
{% debug %}
snippet extends
{% extends "${0:base.html}" %}
snippet filter
{% filter ${1} %}
${0}
{% endfilter %}
snippet firstof
{% firstof ${1} %}
snippet for
{% for ${1} in ${2} %}
${0}
{% endfor %}
snippet empty
{% empty %}
${0}
snippet if
{% if ${1} %}
${0}
{% endif %}
snippet el
{% else %}
${1}
snippet eif
{% elif ${1} %}
${0}
snippet ifchanged
{% ifchanged %}${1}{% endifchanged %}
snippet ifequal
{% ifequal ${1} ${2} %}
${0}
{% endifequal %}
snippet ifnotequal
{% ifnotequal ${1} ${2} %}
${0}
{% endifnotequal %}
snippet include
{% include "${0}" %}
snippet load
{% load ${0} %}
snippet now
{% now "${0:jS F Y H:i}" %}
snippet regroup
{% regroup ${1} by ${2} as ${0} %}
snippet spaceless
{% spaceless %}${0}{% endspaceless %}
snippet ssi
{% ssi ${0} %}
snippet trans
{% trans "${0:string}" %}
snippet url
{% url ${1} as ${0} %}
snippet widthratio
{% widthratio ${1:this_value} ${2:max_value} ${0:100} %}
snippet with
{% with ${1} as ${2} %}
${0}
{% endwith %}
# Template Filters
# Note: Since SnipMate can't determine which template filter you are
# expanding without the "|" character, these do not add the "|"
# character. These save a few keystrokes still.
# Note: Template tags that take no arguments are not implemented.
snippet add
add:"${0}"
snippet center
center:"${0}"
snippet cut
cut:"${0}"
snippet date
date:"${0}"
snippet default
default:"${0}"
snippet defaultifnone
default_if_none:"${0}"
snippet dictsort
dictsort:"${0}"
snippet dictsortrev
dictsortreversed:"${0}"
snippet divisibleby
divisibleby:"${0}"
snippet floatformat
floatformat:"${0}"
snippet getdigit
get_digit:"${0}"
snippet join
join:"${0}"
snippet lengthis
length_is:"${0}"
snippet pluralize
pluralize:"${0}"
snippet removetags
removetags:"${0}"
snippet slice
slice:"${0}"
snippet stringformat
stringformat:"${0}"
snippet time
time:"${0}"
snippet truncatewords
truncatewords:${0}
snippet truncatewordshtml
truncatewords_html:${0}
snippet urlizetrunc
urlizetrunc:${0}
snippet wordwrap
wordwrap:${0}

View File

@ -0,0 +1,116 @@
# shebang
snippet #!
#!/usr/bin/env perl6
# Hash Pointer
snippet .
=>
# Function
snippet sub
sub ${1:function_name}(${2:Str $var}) {
${3}
}
snippet mul
multi ${1:function_name}(${2:Str $var}) {
${3}
}
# Conditional
snippet if
if ${1} {
${2}
}
# Conditional if..else
snippet ife
if ${1} {
${2}
}
else {
${3}
}
snippet eif
elsif ${1) {
${2}
}
# Conditional One-line
snippet xif
${1:expression} if ${2:condition};
# Unless conditional
snippet unless
unless ${1} {
${2}
}
# Unless conditional One-line
snippet xunless
${1:expression} unless ${2:condition};
# Ternary conditional
snippet tc
${1:condition} ?? ${2:value-if-true} !! ${3:value-if-false};
# given - when (perl6 switch)
snippet switch
given ${1:$var} {
when ${2:condition} {
${3:# code block ...}
}
${4}
default {
${5}
}
}
# 'loop' - C's for.
snippet loop
loop (my ${1:$i} = 0; $$1 < ${2:count}; $$1++) {
${3}
}
# for loop
snippet for
for ${1:@array} -> ${2:$variable} {
${3}
}
# While Loop
snippet wh
while ${1} {
${2}
}
# Repeat while and repean until
snippet rp
repeat {
${1}
} ${2:while|until} ${3};
# classes ..
snippet cl
${1:my} class ${2:ClassName} ${3:is|does Parent|Role}{
${4}
}
snippet has
has ${1:Type} ${2:$!identifier};
snippet mth
method ${1:method_name}(${2:$attr}) {
${3}
}
snippet pmth
method ${1:!}${2:method_name}(${3:$attr}) {
${4}
}
snippet smth
submethod ${1:submethod_name}(${2:$attr}) {
${3}
}
# Tests
snippet test
use v6;
use Test;
${1:use lib 'lib';}
plan ${2:$num-tests};
# IO
snippet slurp
my ${1:$var} = "${2:filename}".IO.slurp;
snippet rfile
for "${1:filename}".IO.lines -> $line {
${2}
}
snippet open
my $fh = open "${1:filename}", ${2::r|:w|:a};
${3:# actions};
$fh.close;

View File

@ -325,7 +325,7 @@ snippet foreachkil
${0:<!-- html... -->}
<?php endforeach; ?>
# $... = array (...)
snippet array
snippet array b
$${1:arrayName} = array('${2}' => ${3});
snippet try
try {
@ -601,4 +601,29 @@ snippet tc
{
${0:code}
}
snippet te
throw new ${1:Exception}("${2:Error Processing Request}");
snippet fpc "file_put_contents" b
file_put_contents(${1:file}, ${2:content}${3:, FILE_APPEND});$0
snippet sr "str_replace"
str_replace(${1:search}, ${2:replace}, ${3:subject})$0
snippet ia "in_array"
in_array(${1:needle}, ${2:haystack})$0
snippet is "isset"
isset(${1:var})$0
snippet isa "isset array"
isset($${1:array}[${2:key}])$0
snippet in "is_null"
is_null($${1:var})$0
snippet fe "file_exists"
file_exists(${1:file})$0
snippet id "is_dir"
is_dir(${1:path})$0

View File

@ -221,7 +221,7 @@ snippet package
snippet yumrepo
yumrepo { "${1:repo name}":
Descr => "${2:$1}",
descr => "${2:$1}",
enabled => ${0:1},
}

View File

@ -1,6 +1,9 @@
snippet #!
#!/usr/bin/env python
# -*- coding: utf-8 -*-
snippet #!3
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
snippet imp
import ${0:module}
snippet uni
@ -125,28 +128,43 @@ snippet _
__${1:init}__
# python debugger (pdb)
snippet pdb
import pdb; pdb.set_trace()
import pdb
pdb.set_trace()
# bpython debugger (bpdb)
snippet bpdb
import bpdb
bpdb.set_trace()
# ipython debugger (ipdb)
snippet ipdb
import ipdb; ipdb.set_trace()
import ipdb
ipdb.set_trace()
# embed ipython itself
snippet iem
import IPython; IPython.embed()
import IPython
IPython.embed()
# ipython debugger (pdbbb)
snippet pdbbb
import pdbpp; pdbpp.set_trace()
import pdbpp
pdbpp.set_trace()
# remote python debugger (rpdb)
snippet rpdb
import rpdb; rpdb.set_trace()
import rpdb
rpdb.set_trace()
# ptpython
snippet ptpython
from ptpython.repl import embed
embed(globals(), locals(), vi_mode=${1:False}, history_filename=${2:None})
# python console debugger (pudb)
snippet pudb
import pudb; pudb.set_trace()
import pudb
pudb.set_trace()
# pdb in nosetests
snippet nosetrace
from nose.tools import set_trace
set_trace()
snippet pprint
import pprint; pprint.pprint(${1})
import pprint
pprint.pprint(${1})
snippet "
"""${0:doc}
"""

View File

@ -348,7 +348,7 @@ snippet mct
${0}
end
snippet migration class .. < ActiveRecord::Migration .. def up .. def down .. end
class ${1:class_name} < ActiveRecord::Migration
class `substitute( substitute(vim_snippets#Filename(), '^\d\+_', '',''), '\(_\|^\)\(.\)', '\u\2', 'g')` < ActiveRecord::Migration
def up
${0}
end
@ -357,7 +357,7 @@ snippet migration class .. < ActiveRecord::Migration .. def up .. def down .. en
end
end
snippet migration class .. < ActiveRecord::Migration .. def change .. end
class ${1:class_name} < ActiveRecord::Migration
class `substitute( substitute(vim_snippets#Filename(), '^\d\+_', '',''), '\(_\|^\)\(.\)', '\u\2', 'g')` < ActiveRecord::Migration
def change
${0}
end

View File

@ -56,11 +56,40 @@ snippet err:
snippet cau:
.. caution::
${0:Watch out!}
#Spinx only
#Sphinx only
snippet sid:
.. sidebar:: ${1:Title}
${0}
snippet tod:
.. todo::
${0}
snippet lis:
.. list-table:: ${0:Title}
:header-rows: 1
:stub-columns: 1
* - x1,y1
- x2,y1
- x3,y1
* - x1,y2
- x2,y2
- x3,y2
* - x1,y3
- x2,y3
- x3,y3
snippet toc:
.. toctree::
:maxdepth: 2
${0}
snippet dow:
:download:`${0:text} <${1:path}>`
snippet ref:
:ref:`${0:text} <${1:path}>`
snippet doc:
:doc:`${0:text} <${1:path}>`
# CJK optimize, CJK has no space between charaters
snippet *c
\ *${1:Emphasis}*\ ${0}

View File

@ -1,12 +1,7 @@
# encoding for Ruby 1.9
snippet enc
# encoding: utf-8
# #!/usr/bin/env ruby
snippet #!
#!/usr/bin/env ruby
# encoding: utf-8
# New Block
snippet =b
=begin rdoc
@ -29,15 +24,12 @@ snippet beg
${0}
rescue ${1:Exception} => ${2:e}
end
snippet req require
require '${1}'
snippet reqr
require_relative '${1}'
snippet #
# =>
snippet end
__END__
snippet case
case ${1:object}
when ${2:condition}
@ -115,7 +107,7 @@ snippet cla class .. end
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
${0}
end
snippet cla class .. initialize .. end
snippet clai class .. initialize .. end
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
def initialize(${2:args})
${0}

View File

@ -7,6 +7,10 @@ snippet fn "Function definition"
fn ${1:function_name}(${2})${3} {
${0}
}
snippet pfn "Function definition"
pub fn ${1:function_name}(${2})${3} {
${0}
}
snippet test "Unit test function"
#[test]
fn ${1:test_function_name}() {
@ -27,10 +31,14 @@ snippet main "Main function"
pub fn main() {
${0}
}
snippet let "let variable declaration"
let ${1:name}${2:: ${3:type}} = ${4};
snippet letm "let mut variable declaration"
let mut ${1:name}${2:: ${3:type}} = ${4};
snippet let "let variable declaration with type inference"
let ${1} = ${2};
snippet lett "let variable declaration with explicit type annotation"
let ${1}: ${2} = ${3};
snippet letm "let mut variable declaration with type inference"
let mut ${1} = ${2};
snippet lettm "let mut variable declaration with explicit type annotation"
let mut ${1}: ${2} = ${3};
snippet pln "println!"
println!("${1}");
snippet pln, "println! with format param"
@ -106,7 +114,7 @@ snippet loop "loop {}" b
loop {
${0}
}
snippet while "while loop"
snippet wh "while loop"
while ${1:condition} {
${0}
}

View File

@ -1,3 +1,5 @@
extends css
snippet $
$${1:variable}: ${0:value};
snippet imp
@ -8,7 +10,7 @@ snippet mix
}
snippet inc
@include ${1:mixin}(${2});
snippet ex
snippet ext
@extend ${0};
snippet fun
@function ${1:name}(${2:args}) {

View File

@ -0,0 +1,122 @@
snippet sm_controller
<?php
namespace Controllers;
use Core\View;
use Core\Controller;
class ${1:class_name} extends Controller
{
public function __construct()
{
parent::__construct();
}
public function index()
{
${2:}
}
}
snippet sm_model
<?php
namespace Models;
use Core\Model;
class ${1:class_name} extends Model
{
function __construct()
{
parent::__construct();
}
}
snippet sm_model_crud
<?php
namespace Models;
use Core\Model;
class ${1:class_name} extends Model
{
private $${2:table};
function __construct()
{
parent::__construct();
}
public function getRow($where)
{
return $this->db->select('SELECT * FROM '.$table.' WHERE ${3:where}', $data);
}
public function getRows($where)
{
return $this->db->select('SELECT * FROM '.$table.');
}
public function insert($data)
{
$this->db->insert($table, $data);
}
public function update($data, $where)
{
$this->db->update($table ,$data, $where);
}
public function delete($where)
{
$this->db->delete($table, $where);
}
}
snippet sm_render
View::render('${1:view}', $${2:array});
snippet sm_render_template
View::renderTemplate('${1:part}', $${2:array});
# database
snippet sm_db_select
$this->db->select(${1:sql}, ${2:where});
snippet sm_db_insert
$this->db->insert(${1:table}, ${2:data});
snippet sm_db_update
$this->db->update(${1:table}, ${2:data}, ${3:where});
snippet sm_db_delete
$this->db->delete(${1:table}, ${2:where});
snippet sm_db_truncate
$this->db->delete(${1:table});
#session
snippet sm_session_set
Session::set(${1:key}, ${2:value});
snippet sm_session_get
Session::get(${1:key});
snippet sm_session_pull
Session::pull(${1:key});
snippet sm_session_id
Session::id();
snippet sm_session_destroy
Session::set(${1:key});
snippet sm_session_display
Session::display();
#url
snippet sm_url_redirect
Url:redirect('${1:path}');
snippet sm_url_previous
Url:previous();
snippet sm_url_templatepath
Url:templatePath();
snippet sm_url_autolink
Url:autolink('${1:string}');

View File

@ -1,3 +1,16 @@
snippet pry
- binding.pry
snippet renp
= render partial: '${0}'
# Forms
# =====
snippet fieldset
fieldset
legend ${1}
snippet css
link rel="stylesheet" href="${1:style.css}" type="text/css" media="${2:all}"
snippet script
script src="${1:script.js}" type="text/javascript"
# Some useful Unicode entities
# ============================
# Non-Breaking Space
@ -48,17 +61,3 @@ snippet backspace
# ⎋
snippet esc
&#x238B;
# Forms
# =====
snippet fieldset
fieldset
legend ${1}
# Assets
# ======
snippet css
link rel="stylesheet" href="${1:style.css}" type="text/css" media="${2:all}"
snippet script
script src="${1:script.js}" type="text/javascript"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,22 @@
snippet b
(
${0}
)
snippet if
if (${1}) {
${0}
}
snippet ife
if (${1}) {
${2}
} {
${0}
}
snippet for
for (${1:1}, ${2:10}) { |i|
${0}
}
snippet sdef
SynthDef(\\${1:synthName}, {${2}
${0}
}).add;

View File

@ -1,37 +1,6 @@
# if statement
snippet if
if (${1}) begin
${0}
end
# If/else statements
snippet ife
if (${1}) begin
${2}
end
else begin
${1}
end
# Else if statement
snippet eif
else if (${1}) begin
${0}
end
#Else statement
snippet el
else begin
${0}
end
# While statement
snippet wh
while (${1}) begin
${0}
end
# Repeat Loop
snippet rep
repeat (${1}) begin
${0}
end
# Foreach Loopo
extends verilog
# Foreach Loop
snippet fe
foreach (${1}) begin
${0}
@ -41,24 +10,6 @@ snippet dowh
do begin
${0}
end while (${1});
# Case statement
snippet case
case (${1})
{$2}: begin
${0}
end
default: begin
end
endcase
# CaseZ statement
snippet casez
casez (${1})
{$2}: begin
${0}
end
default: begin
end
endcase
# Combinational always block
snippet alc
always_comb begin ${1:: statement_label}
@ -74,11 +25,6 @@ snippet all
always_latch begin ${1:: statement_label}
${0}
end $1
# Module block
snippet mod
module ${1:module_name} (${2});
${0}
endmodule : $1
# Class
snippet cl
class ${1:class_name};

View File

@ -76,6 +76,14 @@ snippet enum enumerate environment
\begin{enumerate}
\item ${0}
\end{enumerate}
snippet enuma enumerate environment
\begin{enumerate}[(a)]
\item ${0}
\end{enumerate}
snippet enumi enumerate environment
\begin{enumerate}[(i)]
\item ${0}
\end{enumerate}
# Itemize
snippet itemize itemize environment
\begin{itemize}
@ -249,7 +257,7 @@ snippet frac \frac{}{}
snippet sum \sum^{}_{}
\sum^{${1:n}}_{${2:i=1}} ${0}
snippet lim \lim_{}
\lim_{${1:x \to +\infty}} ${0}
\lim_{${1:n \to \infty}} ${0}
snippet frame frame environment
\begin{frame}[${1:t}]{${2:title}}
${0}
@ -275,7 +283,11 @@ snippet col2 two-column environment
${0}
\end{column}
\end{columns}
snippet \{ \{ \}
\\{ ${0} \\}
#delimiter
snippet lr left right
\left${1} ${0} \right$1
snippet lr( left( right)
\left( ${0} \right)
snippet lr| left| right|
@ -286,7 +298,6 @@ snippet lr[ left[ right]
\left[ ${0} \right]
snippet lra langle rangle
\langle ${0} \rangle
# Code listings
snippet lst
\begin{listing}[language=${1:language}]

View File

@ -0,0 +1,63 @@
# if statement
snippet if
if (${1}) begin
${0}
end
# If/else statements
snippet ife
if (${1}) begin
${2}
end
else begin
${1}
end
# Else if statement
snippet eif
else if (${1}) begin
${0}
end
#Else statement
snippet el
else begin
${0}
end
# While statement
snippet wh
while (${1}) begin
${0}
end
# Repeat Loop
snippet rep
repeat (${1}) begin
${0}
end
# Case statement
snippet case
case (${1:/* variable */})
${2:/* value */}: begin
${3}
end
default: begin
${4}
end
endcase
# CaseZ statement
snippet casez
casez (${1:/* variable */})
${2:/* value */}: begin
${3}
end
default: begin
${4}
end
endcase
# Always block
snippet al
always @(${1:/* sensitive list */}) begin
${0}
end
# Module block
snippet mod
module ${1:module_name} (${2});
${0}
endmodule

View File

@ -0,0 +1,12 @@
# xml declaration
snippet xml
<?xml version="1.0" encoding="UTF-8"?>
# tag
snippet t
<${1:}>
${2}
</$1>
# inline tag
snippet ti
<${1:}>${2}</$1>