Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Felix Jung 2014-06-11 20:08:00 +02:00
commit 2c86dc71f0
4 changed files with 113 additions and 17 deletions

View File

@ -1,9 +1,42 @@
priority -50 priority -50
global !p
import os
from vimsnippets import complete
FIELD_TYPES = [
'character',
'data.frame',
'integer',
'list',
'logical',
'matrix',
'numeric',
'vector']
endglobal
snippet #! "Hashbang for Rscript (#!)" b snippet #! "Hashbang for Rscript (#!)" b
#!/usr/bin/env Rscript #!/usr/bin/env Rscript
endsnippet endsnippet
snippet setwd "Set workingdir" b
setwd("${1:`!p snip.rv = os.getcwd()`}")
endsnippet
snippet as "Apply type on variable" w
as.$1`!p snip.rv = complete(t[1], FIELD_TYPES)`(${2}${VISUAL})
endsnippet
snippet is "Test type on variable" w
is.$1`!p snip.rv = complete(t[1], FIELD_TYPES)`(${2}${VISUAL})
endsnippet
snippet dl "Download and install a package" b
download.file("${1:${VISUAL:url to package}}", destfile = "${2:${1/.*\/(\S*)$/(?1:$1)/ga}}")
install.packages("$2", type = "source", repos = NULL)
library("${3:${2/^(\w+)_.*$/(?1:$1)/ga}}")
endsnippet
snippet lib "Import a library" snippet lib "Import a library"
library(${0:package}) library(${0:package})
endsnippet endsnippet

View File

@ -84,6 +84,24 @@ snippet LGPL3
You should have received a copy of the GNU Lesser General Public License You should have received a copy of the GNU Lesser General Public License
along with this library; if not, see <http://www.gnu.org/licenses/>. along with this library; if not, see <http://www.gnu.org/licenses/>.
${0}
snippet AGPL3
${1:one line to give the program's name and a brief description.}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 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 Affero General Public License for more details.
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} ${0}
snippet BSD2 snippet BSD2
${1:one line to give the program's name and a brief description} ${1:one line to give the program's name and a brief description}

View File

@ -965,3 +965,23 @@ snippet z:a
z-index: auto; z-index: auto;
snippet zoo snippet zoo
zoom: 1; zoom: 1;
snippet :h
:hover
snippet :fc
:first-child
snippet :lc
:last-child
snippet :nc
:nth-child(${0})
snippet :nlc
:nth-last-child(${0})
snippet :oc
:only-child
snippet :a
:after
snippet :b
:before
snippet ::a
::after
snippet ::b
::before

View File

@ -1,10 +1,10 @@
## Access Modifiers ## Access Modifiers
snippet po snippet po
protected protected ${0}
snippet pu snippet pu
public public ${0}
snippet pr snippet pr
private private ${0}
## ##
## Annotations ## Annotations
snippet before snippet before
@ -25,7 +25,7 @@ snippet oo
## ##
## Basic Java packages and import ## Basic Java packages and import
snippet im snippet im
import import ${0}
snippet j.b snippet j.b
java.beans. java.beans.
snippet j.i snippet j.i
@ -39,17 +39,17 @@ snippet j.u
## ##
## Class ## Class
snippet cl snippet cl
class ${1:`vim_snippets#Filename("", "untitled")`} ${0} class ${1:`vim_snippets#Filename("$1", "untitled")`} ${0}
snippet in snippet in
interface ${1:`vim_snippets#Filename("", "untitled")`} ${2:extends Parent} interface ${1:`vim_snippets#Filename("$1", "untitled")`} ${2:extends Parent}
snippet tc snippet tc
public class ${1:`vim_snippets#Filename()`} extends ${0:TestCase} public class ${1:`vim_snippets#Filename("$1")`} extends ${0:TestCase}
## ##
## Class Enhancements ## Class Enhancements
snippet ext snippet ext
extends extends ${0}
snippet imp snippet imp
implements implements ${0}
## ##
## Comments ## Comments
snippet /* snippet /*
@ -89,15 +89,40 @@ snippet m
snippet v snippet v
${1:String} ${2:var}${3: = null}${4}; ${1:String} ${2:var}${3: = null}${4};
## ##
## Declaration for ArrayList
snippet d.al
List<${1:Object}> ${2:list} = new ArrayList<$1>();${0}
## Declaration for HashMap
snippet d.hm
Map<${1:Object}, ${2:Object}> ${3:map} = new HashMap<$1, $2>();${0}
## Declaration for HashSet
snippet d.hs
Set<${1:Object}> ${2:set} = new HashSet<$1>();${0}
## Declaration for Stack
snippet d.st
Stack<${1:Object}> ${2:stack} = new Stack<$1>();${0}
##
## Singleton Pattern
snippet singlet
private static class Holder {
private static final ${1:`vim_snippets#Filename("$1")`} INSTANCE = new $1();
}
private $1() { }
private static $1 getInstance() {
return Holder.INSTANCE;
}
##
## Enhancements to Methods, variables, classes, etc. ## Enhancements to Methods, variables, classes, etc.
snippet ab snippet ab
abstract abstract ${0}
snippet fi snippet fi
final final ${0}
snippet st snippet st
static static ${0}
snippet sy snippet sy
synchronized synchronized ${0}
## ##
## Error Methods ## Error Methods
snippet err snippet err
@ -113,9 +138,9 @@ snippet as
snippet ca snippet ca
catch(${1:Exception} ${2:e}) ${0} catch(${1:Exception} ${2:e}) ${0}
snippet thr snippet thr
throw throw ${0}
snippet ths snippet ths
throws throws ${0}
snippet try snippet try
try { try {
${0} ${0}
@ -144,7 +169,7 @@ snippet @au
snippet @br snippet @br
@brief ${0:Description} @brief ${0:Description}
snippet @fi snippet @fi
@file ${0:`vim_snippets#Filename()`}.java @file ${0:`vim_snippets#Filename("$1")`}.java
snippet @pa snippet @pa
@param ${0:param} @param ${0:param}
snippet @re snippet @re
@ -206,7 +231,7 @@ snippet get
## ##
## Terminate Methods or Loops ## Terminate Methods or Loops
snippet re snippet re
return return ${0}
snippet br snippet br
break; break;
## ##