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

Updated plugins

This commit is contained in:
amix
2015-01-18 12:58:28 +00:00
parent c3ba0f3c06
commit e7a01094b6
274 changed files with 4547 additions and 3075 deletions

View File

@ -15,7 +15,7 @@ snippet lorem
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
snippet GPL2
${1:One line to give the program's name and a brief description.}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
Copyright (C) `strftime("%Y")` ${2:`g:snips_author`}
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
@ -33,7 +33,7 @@ snippet GPL2
${0}
snippet LGPL2
${1:One line to give the program's name and a brief description.}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
Copyright (C) `strftime("%Y")` ${2:`g:snips_author`}
This library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
@ -51,7 +51,7 @@ snippet LGPL2
${0}
snippet GPL3
${1:one line to give the program's name and a brief description.}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
Copyright (C) `strftime("%Y")` ${2:`g:snips_author`}
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
@ -69,7 +69,7 @@ snippet GPL3
${0}
snippet LGPL3
${1:One line to give the program's name and a brief description.}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
Copyright (C) `strftime("%Y")` ${2:`g:snips_author`}
This library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
@ -87,7 +87,7 @@ snippet LGPL3
${0}
snippet AGPL3
${1:one line to give the program's name and a brief description.}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
Copyright (C) `strftime("%Y")` ${2:`g:snips_author`}
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
@ -102,10 +102,19 @@ snippet AGPL3
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
${0}
snippet GMGPL linking exception
As a special exception, if other files instantiate generics from
this unit, or you link this unit with other files to produce an
executable, this unit does not by itself cause the resulting
executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU Public License.
${0}
snippet BSD2
${1:one line to give the program's name and a brief description}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
Copyright (C) `strftime("%Y")` ${2:`g:snips_author`}
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -135,7 +144,7 @@ snippet BSD2
${0}
snippet BSD3
${1:one line to give the program's name and a brief description}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
Copyright (C) `strftime("%Y")` ${2:`g:snips_author`}
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -163,7 +172,7 @@ snippet BSD3
${0}
snippet BSD4
${1:one line to give the program's name and a brief description}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
Copyright (C) `strftime("%Y")` ${2:`g:snips_author`}
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -194,7 +203,7 @@ snippet BSD4
${0}
snippet MIT
${1:one line to give the program's name and a brief description}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
Copyright (C) `strftime("%Y")` ${2:`g:snips_author`}
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the "Software"),
@ -217,7 +226,7 @@ snippet MIT
${0}
snippet APACHE
${1:one line to give the program's name and a brief description}
Copyright `strftime("%Y")` ${2:copyright holder}
Copyright `strftime("%Y")` ${2:`g:snips_author`}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -233,21 +242,20 @@ snippet APACHE
${0}
snippet BEERWARE
${2:one line to give the program's name and a brief description}
Copyright `strftime("%Y")` ${3:copyright holder}
${1:one line to give the program's name and a brief description}
Copyright `strftime("%Y")` ${2:`g:snips_author`}
Licensed under the "THE BEER-WARE LICENSE" (Revision 42):
${1:`g:snips_author`} wrote this file. As long as you retain this notice you
$2 wrote this file. As long as you retain this notice you
can do whatever you want with this stuff. If we meet some day, and you think
this stuff is worth it, you can buy me a beer or coffee in return
${0}
snippet WTFPL
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright `strftime("%Y")` ${0:copyright holder}
Copyright `strftime("%Y")` ${0:`g:snips_author`}
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
@ -257,3 +265,11 @@ snippet WTFPL
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
${0}
snippet MPL2
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
${0}

View File

@ -75,10 +75,6 @@ snippet do
do {
${0}
} while (${1:cond})
snippet wh
while ${1:cond}{
${0}
}
snippet for enumerate names
for (${1:var} in ${2:object}){
${0}

View File

@ -215,41 +215,3 @@ snippet getl Ada.Text_IO.Get_Line
snippet newline Ada.Text_IO.New_Line
Ada.Text_IO.New_Line(${1:1});${0}
snippet gpl GPL license header
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU ${1}General Public License as published by
-- the Free Software Foundation; either version ${2:3} 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 $1General Public License for more details.
--
-- You should have received a copy of the GNU $1General Public License
-- along with this program; if not, see <http://www.gnu.org/licenses/>.
--
-- Copyright (C) ${3:Author}, ${4:`strftime("%Y")`}
${0}
snippet gplf GPL file license header
-- This file is part of ${1:Program-Name}.
--
-- $1 is free software: you can redistribute it and/or modify
-- it under the terms of the GNU ${2}General Public License as published by
-- the Free Software Foundation, either version ${3:3} of the License, or
-- (at your option) any later version.
--
-- $1 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 $2General Public License for more details.
--
-- You should have received a copy of the GNU $2General Public License
-- along with $1. If not, see <http://www.gnu.org/licenses/>.
--
-- Copyright (C) ${4:Author}, ${5:`strftime("%Y")`}
${0}

View File

@ -0,0 +1,102 @@
# cannot use /usr/bin/env because it does not support parameters (as -f)
snippet #! #!/usr/bin/awk -f
#!/usr/bin/awk -f
# @include is a gawk extension
snippet inc @include
@include "${1}"${0}
# @load is a gawk extension
snippet loa @load
@load "${1}"${0}
snippet beg BEGIN { ... }
BEGIN {
${0}
}
# BEGINFILE is a gawk extension
snippet begf BEGINFILE { ... }
BEGINFILE {
${0}
}
snippet end END { ... }
END {
${0}
}
# ENDFILE is a gawk extension
snippet endf ENDFILE { ... }
ENDFILE {
${0}
}
snippet pri print
print ${1:"${2}"}${0}
snippet printf printf
printf("${1:%s}\n", ${2})${0}
snippet ign IGNORECASE
IGNORECASE = ${1:1}
snippet if if {...}
if (${1}) {
${0}
}
snippet ife if ... else ...
if (${1}) {
${2}
} else {
${0}
}
snippet eif else if ...
else if (${1}) {
${0}
}
snippet el else {...}
else {
${0}
}
snippet wh while
while (${1}) {
${2}
}
snippet do do ... while
do {
${0}
} while (${1})
snippet for for
for (${2:i} = 0; i < ${1:n}; ${3:++i}) {
${0}
}
snippet fore for each
for (${1:i} in ${2:array}) {
${0}
}
# the switch is a gawk extension
snippet sw switch
switch (${1}) {
case ${2}:
${3}
break
default:
${0}
break
}
# the switch is a gawk extension
snippet case case
case ${1}:
${0}
break

View File

@ -1,76 +1,73 @@
snippet comm
(comment
${0}
)
${0})
snippet condp
(condp ${1:pred} ${2:expr}
${0})
${0})
snippet def
(def ${0})
snippet defm
(defmethod ${1:multifn} "${2:doc-string}" ${3:dispatch-val} [${4:args}]
${0})
${0})
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})
snippet defp
(defprotocol ${1:name}
${0})
${0})
snippet defr
(defrecord ${1:name} [${2:fields}]
${3:protocol}
${0})
${3:protocol}
${0})
snippet deft
(deftest ${1:name}
(is (= ${2:assertion})))
${0})
(is (= ${0:assertion})))
snippet is
(is (= ${1} ${0}))
snippet defty
(deftype ${1:Name} [${2:fields}]
${3:Protocol}
${0})
${3:Protocol}
${0})
snippet doseq
(doseq [${1:elem} ${2:coll}]
${0})
${0})
snippet fn
(fn [${1:arg-list}] ${0})
snippet if
(if ${1:test-expr}
${2:then-expr}
${0:else-expr})
${2:then-expr}
${0:else-expr})
snippet if-let
(if-let [${1:result} ${2:test-expr}]
(${3:then-expr} $1)
(${0:else-expr}))
snippet imp
(:import [${1:package}])
& {:keys [${1:keys}] :or {${0:defaults}}}
& {:keys [${1:keys}] :or {${0:defaults}}}
snippet let
(let [${1:name} ${2:expr}]
${0})
snippet letfn
(letfn [(${1:name) [${2:args}]
${0})])
(letfn [(${1:name}) [${2:args}]
${0})])
snippet map
(map ${1:func} ${0:coll})
snippet mapl
(map #(${1:lambda}) ${0:coll})
snippet met
(${1:name} [${2:this} ${3:args}]
${0})
${0})
snippet ns
(ns ${1:name}
${0})
(ns ${0:name})
snippet dotimes
(dotimes [_ 10]
(time
(dotimes [_ ${1:times}]
${0})))
(time
(dotimes [_ ${1:times}]
${0})))
snippet pmethod
(${1:name} [${2:this} ${0:args}])
snippet refer

View File

@ -0,0 +1,218 @@
# Based on nebjak/snipmate.vim/snippets/php.snippets
# Controller
snippet ci_controller
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class ${1:ClassName} extends CI_Controller
{
function __construct()
{
parent::__construct();
${2:// code...}
}
function ${3:index}()
{
${4:// code...}
}
}
# Model
snippet ci_model
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class ${1:ClassName_model} extends CI_Model
{
function __construct()
{
parent::__construct();
${2:// code...}
}
}
snippet ci_model_crudl
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class ${1:ClassName_model} extends CI_Model
{
private $table = '${2:table_name}';
function __construct()
{
parent::__construct();
${3:// code...}
}
// public create(data) {{{
/**
* create
*
* @param mixed $data
* @access public
* @return boolean
*/
public function create($data)
{
if($this->db->insert($table, $data))
return true;
else
return false;
}
// }}}
// public read(id) {{{
/**
* read
*
* @param int $id
* @access public
* @return boolean
*/
public function read($id)
{
return $this->db->get_where($table, array('id', $id))->result();
}
// }}}
// public update(id,data) {{{
/**
* update
*
* @param int $id
* @param mixed $data
* @access public
* @return boolean
*/
public function update($id, $data)
{
if($this->db->update($table, $data, array('id' => $id)))
return true;
else
return false;
}
// }}}
// public delete(id) {{{
/**
* delete
*
* @param mixed $id (int o array of int)
* @access public
* @return boolean
*/
public function delete($id)
{
if(is_array($id))
{
$this->db->trans_start();
foreach($id as $elem)
$this->db->delete($table, array('id' => $elem));
$this->db->trans_complete();
}
else
{
if($this->db->delete($table, array('id' => $id)))
return true;
else
return false;
}
}
// }}}
// public listRows(limit=null,offset=0) {{{
/**
* listRows
*
* @param int $limit
* @param int $offset
* @access public
* @return boolean
*/
public function listRows($limit = null, $offset = 0)
{
if(!is_null($limit))
$this->db->limit($limit, $offset);
return $this->db->get($table)->result();
}
// }}}
}
# Load view
snippet ci_load-view
$this->load->view("${1:view_name}", $${2:data});${3}
# DB Class snippets
snippet ci_db-insert
$this->db->insert("${1:table}", $${2:data});${3}
snippet ci_db-select
$this->db->select("${1:id, ...}");${2}
snippet ci_db-from
$this->db->from("${1:table}");${2}
snippet ci_db-join
$this->db->join("${1:table}", "${2:condition}", "${3:type}");${4}
snippet ci_db-where
$this->db->where("${1:key}", "${2:value}");${3}
snippet ci_db-or_where
$this->db->or_where("${1:key}", "${2:value}");${3}
snippet ci_db-get
$this->db->get("${1:table}", ${2:limit}, ${3:offset});${4}
snippet ci_db-delete
$this->db->delete("${1:table}", "${2:where}");${3}
snippet ci_db-update
$this->db->update("${1:table}", $${2:set}, $${3:where});${4}
# Input Class snippets
snippet ci_input-post
$this->input->post("${1:index}");${2}
snippet ci_input-get
$this->input->get("${1:index}");${2}
snippet ci_input-cookie
$this->input->cookie("${1:index}");${2}
snippet ci_input-server
$this->input->server("${1:index}");${2}
snippet ci_input-user_agent
$this->input->user_agent();${1}
snippet ci_input-is_ajax_request
$this->input->is_ajax_request();${1}
snippet ci_input-is_cli_request
$this->input->is_cli_request();${1}
# Form Validation Class and Form Helper snippets
snippet ci_form_validation-set_rules
$this->form_validation->set_rules("${1:field}", "${2:label}", "${3:trim|required}");${4}
snippet ci_form_open
form_open("${1:action}");${2}
snippet ci_form_open_multipart
form_open_multipart("${1:action}");${2}
snippet ci_form_hidden
form_hidden("${1:name}", "${2:value}");${3}
snippet ci_form_input
form_input("${1:name}", "${2:value}");${3}
snippet ci_form_password
form_password("${1:name}", "${2:value}");${3}
snippet ci_form_upload
form_upload("${1:name}", "${2:value}");${3}
snippet ci_form_textarea
form_textarea("${1:name}", "${2:value}");${3}
snippet ci_form_dropdown
form_dropdown("${1:name}", $${2:options}, $${3:selected);${4}
snippet ci_form_checkbox
form_checkbox("${1:name}", "${2:value}");${3}
snippet ci_form_radio
form_radio("${1:name}", "${2:value}");${3}
snippet ci_form_submit
form_submit("${1:name}", "${2:value}");${3}
snippet ci_form_reset
form_reset("${1:name}", "${2:value}");${3}
snippet ci_form_button
form_button("${1:name}", "${2:value}");${3}
snippet ci_form_label
form_label("${1:label text}", "${2:id}");${3}
snippet ci_form_close
form_close();${1}
snippet ci_validation_errors
validation_errors();${1}
# Session Class snippets
snippet ci_session_userdata
$this->session->userdata("${1:item}");${2}
snippet ci_session_set_userdata
$this->session->set_userdata($${1:array});${2}
snippet ci_session_flashdata
$this->session->flashdata("${1:item}");${2}
snippet ci_session_set_flashdata
$this->session->set_flashdata("${1:item}", "${2:value}");${3}

View File

@ -0,0 +1,93 @@
snippet impl
implicit none
$0
snippet prog
program ${1:main}
$0
end program $1
snippet mod
module ${1:modulename}
$0
end module $1
snippet proc
procedure ${1:name}
${0}
end procedure $1
snippet iface
interface ${1:name}
${0}
end interface $1
snippet doc
! """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
! File: ${2:`vim_snippets#Filename('$1')`}
! Author: `g:snips_author`
! Email: `g:snips_email`
! Github: `g:snips_github`
! Description: $1
! """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
$0
# Variables definitions
# Boolean
snippet bool
logical :: $0
# Integer
snippet int
integer :: $0
snippet real
real :: $0
# Double Precision
snippet double
double precision :: $0
# Char
snippet str
character(len=${1:*}) :: ${0:}
# Types
snippet type
type(${1:name})
$0
end type
snippet const
${1:type}, parameter :: $2 = $0
snippet arr
${1:type}, allocatable, dimension(${2::}) :: $0
snippet intent
${1:type}, intent(inout) :: $0
# Array
snippet /
(/ $1 /) ${2:,&} $0
snippet if
if (${1:condition}) then
$2
end if
snippet case
select case (${1:expr})
case ($2)
case default
$3
end select $0
snippet do
do ${1:i} = ${2:start},${3:end}, ${4:incr}
$4
end do
snippet dow
do while (${1:condition})
$2
end do
snippet sub
subroutine ${1:name}($2)
$0
end subroutine $1
snippet func
function ${1:name}($2) result($3)
$0
end function $1
snippet pr
write(*,*) $0
snippet read
read( unit = ${1:fp}, file = ${2:filename}${3:, iostat = IERR }) $0
snippet write
write( unit = ${1:fp}, file = ${2:filename}${3:, iostat = IERR }) $0
snippet open
open (unit = ${1:fp}, file = ${2:filename}, status = unknown${3:, iostat = IERR }) $0
snippet close
close ( unit = ${1:fp} ) $0

View File

@ -148,8 +148,8 @@ snippet fun
${0}
# function on receiver
snippet fum
func (self ${1:type}) ${2:funcName}(${3}) ${4:error} {
${5}
func (${1:receiver} ${2:type}) ${3:funcName}(${4}) ${5:error} {
${6}
}
${0}
# log printf
@ -173,6 +173,9 @@ snippet main
# new
snippet nw
new(${0:type})
# package
snippet pa
package ${1:main}
# panic
snippet pn
panic("${0:msg}")

View File

@ -2,6 +2,8 @@ snippet lang
{-# LANGUAGE ${0:OverloadedStrings} #-}
snippet haddock
{-# OPTIONS_HADDOCK ${0:hide} #-}
snippet inline
{-# INLINE ${0:name} #-}
snippet info
-- |
-- Module : ${1:Module.Namespace}

View File

@ -462,8 +462,8 @@ snippet html5
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
${2:link}
</head>
@ -475,8 +475,8 @@ snippet html5l
<!DOCTYPE html>
<html lang="${1:es}">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>${2:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
${3:link}
</head>
@ -702,6 +702,10 @@ snippet output
<output>${0}</output>
snippet p
<p>${0}</p>
snippet p.
<p class="${1}">${0}</p>
snippet p#
<p id="${1}">${0}</p>
snippet param
<param name="${1}" value="${2}" />
snippet pre

View File

@ -2,26 +2,75 @@
# Includes octopress (http://octopress.org/) snippets
snippet [
[${1:text}](http://${2:address} "${0:title}")
snippet [*
[${1:link}](${2:`@*`} "${3:title}")
# The suffix `c` stands for "Clipboard".
snippet [
[${1:text}](http://${2:address})
snippet [*
[${1:link}](${2:`@*`})
snippet [c
[${1:link}](${2:`@+`})
snippet ["
[${1:text}](http://${2:address} "${3:title}")
snippet ["*
[${1:link}](${2:`@*`} "${3:title}")
snippet ["c
[${1:link}](${2:`@+`} "${3:title}")
snippet [:
[${1:id}]: http://${2:url} "${0:title}"
[${1:id}]: http://${2:url}
snippet [:*
[${1:id}]: ${2:`@*`} "${0:title}"
[${1:id}]: ${2:`@*`}
snippet [:c
[${1:id}]: ${2:`@+`}
snippet [:"
[${1:id}]: http://${2:url} "${3:title}"
snippet [:"*
[${1:id}]: ${2:`@*`} "${3:title}"
snippet [:"c
[${1:id}]: ${2:`@+`} "${3:title}"
snippet ![
![${1:alttext}](${2:/images/image.jpg} "${0:title}")
![${1:alttext}](${2:/images/image.jpg})
snippet ![*
![${1:alt}](${2:`@*`})
snippet ![c
![${1:alt}](${2:`@+`})
snippet !["
![${1:alttext}](${2:/images/image.jpg} "${3:title}")
snippet !["*
![${1:alt}](${2:`@*`} "${3:title}")
snippet !["c
![${1:alt}](${2:`@+`} "${3:title}")
snippet ![:
![${1:id}]: ${2:url} "${0:title}"
snippet ![:*
![${1:id}]: ${2:`@*`} "${0:title}"
![${1:id}]: ${2:url}
snippet ![:*
![${1:id}]: ${2:`@*`}
snippet ![:"
![${1:id}]: ${2:url} "${3:title}"
snippet ![:"*
![${1:id}]: ${2:`@*`} "${3:title}"
snippet ![:"c
![${1:id}]: ${2:`@+`} "${3:title}"
snippet <
<http://${1:url}>
snippet <*
<`@*`>
snippet <c
<`@+`>
snippet **
**${1:bold}**
snippet __
__${1:bold}__
snippet ===
`repeat('=', strlen(getline(line(".") - 1)) - strlen(getline('.')))`
@ -46,15 +95,16 @@ snippet blockquote-link
${0:quote}
{% endblockquote %}
snippet bt-codeblock-short
```
${0:code_snippet}
```
snippet ```
\`\`\`
${1:code}
\`\`\`
snippet bt-codeblock-full
``` ${1:language} ${2:title} ${3:URL} ${4:link_text}
${0:code_snippet}
```
# Language.
snippet ```l
\`\`\`${1:language}
${2:code}
\`\`\`
snippet codeblock-short
{% codeblock %}

View File

@ -129,9 +129,16 @@ snippet pdb
# ipython debugger (ipdb)
snippet ipdb
import ipdb; ipdb.set_trace()
# embed ipython itself
snippet iem
import IPython; IPython.embed()
# ipython debugger (pdbbb)
snippet pdbbb
import pdbpp; pdbpp.set_trace()
# python_prompt_toolkit
snippet ppt
from prompt_toolkit.contrib.repl import embed
embed(globals(), locals(), vi_mode=${1:default=False}, history_filename=${2:default=None})
# python console debugger (pudb)
snippet pudb
import pudb; pudb.set_trace()
@ -208,3 +215,9 @@ snippet kwg
self.${1:var_name} = kwargs.get('$1', ${2:None})
snippet lkwg
${1:var_name} = kwargs.get('$1', ${2:None})
snippet args
*args${1:,}${0}
snippet kwargs
**kwargs${1:,}${0}
snippet akw
*args, **kwargs${1:,}${0}

View File

@ -73,10 +73,32 @@ snippet ife
snippet eif
elsif ${1:condition}
${0}
snippet ifee
if ${1:condition}
$2
elsif ${3:condition}
$4
else
$0
end
snippet unless
unless ${1:condition}
${0}
end
snippet unlesse
unless ${1:condition}
$2
else
$0
end
snippet unlesee
unless ${1:condition}
$2
elsif ${3:condition}
$4
else
$0
end
snippet wh
while ${1:condition}
${0}

View File

@ -4,11 +4,7 @@
# Functions
snippet fn
fn ${1:function_name}(${2}) {
${0}
}
snippet fn-
fn ${1:function_name}(${2}) -> ${3} {
fn ${1:function_name}(${2})${3} {
${0}
}
snippet test
@ -16,6 +12,13 @@ snippet test
fn ${1:test_function_name}() {
${0}
}
snippet bench "Bench function" b
#[bench]
fn ${1:bench_function_name}(b: &mut test::Bencher) {
b.iter(|| {
${0}
})
}
snippet new
pub fn new(${2}) -> ${1:Name} {
${0}return $1 { ${3} };
@ -25,7 +28,9 @@ snippet main
${0}
}
snippet let
let ${1:name}${3} = ${2};
let ${1:name: type} = ${2};
snippet let
let mut ${1:name: type} = ${2};
snippet pln
println!("${1}");
snippet pln,
@ -52,25 +57,48 @@ snippet allow
#[allow(${1:unused_variable})]
snippet feat
#![feature(${1:macro_rules})]
snippet der "#[deriving(..)]" b
#[deriving(${1:Show})]
snippet attr "#[..]" b
#[${1:inline}]
# Common types
snippet opt
Option<${1:int}>
snippet res
Result<${1:~str}, ${2:()}>
snippet if
if ${1:/* condition */} {
if ${1} {
${0}
}
snippet ife
if ${1} {
${2}
} else {
${0}
}
snippet el
else {
${0}
}
snippet eli
else if ${1} {
${0}
}
snippet mat
match ${1} {
${2} => ${3},
}
snippet loop "loop {}" b
loop {
${0}
}
snippet while
while ${1:condition} {
${0}
}
snippet for
for ${1:i} in ${2:range(0u, 10)} {
for ${1:i} in ${2:0u..10} {
${0}
}
snippet spawn
@ -83,12 +111,19 @@ snippet duplex
let (${1:from_child}, ${2:to_child}) = sync::duplex();
# TODO commenting
snippet todo
// [TODO]: ${1:Description}
// [TODO]: ${0:Description}
snippet fixme "FIXME comment"
// FIXME: $0
# Struct
snippet st
struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} {
${0}
}
snippet stn
struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} {
${0}
}
impl $1 {
pub fn new(${2}) -> $1 {
@ -97,9 +132,11 @@ snippet st
};
}
}
snippet typ
type ${1:NewName} = $0;
# Enum
snippet enum
enum ${1:enum_name} {
enum ${1:Name} {
${0},
}
# Impl
@ -122,4 +159,4 @@ snippet trait
snippet ss
static ${1}: &'static str = "${0}";
snippet stat
static ${1}: ${2:uint} = ${0};
static ${1}: ${2:usize} = ${0};

View File

@ -298,19 +298,25 @@ snippet scalatest
${0:import org.scalatest.FunSuite}
#assert
snippet assert
assert(${1:a}==${0:b})
assert(${1:a} === ${0:b})
#ensuring(p 296)
snippet ensuring
ifel ensuring(${1:a}==${0:b})
#expect
snippet expect
expect(${0:what}) {
expect(${1:what}) {
${0}
}
#intercept
snippet intercept
intercept[${0:IllegalArgumentException}] {
intercept[${1:IllegalArgumentException}] {
${0}
}
#test
snippet test
test("${0:description}") {
test("${1:description}") {
${0}
}
#suite
snippet suite
class ${0:name} extends Suite {

View File

@ -18,8 +18,14 @@ snippet if
@if ${1:condition} {
${0}
}
snippet else
@else ${1:condition} {
snippet ife
@if ${1:condition} {
${2}
} @else {
${0}
}
snippet eif
@else if ${1:condition} {
${0}
}
snippet for

File diff suppressed because it is too large Load Diff