mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
Updated plugins and added vim-markdown
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
# more can be found in snippets/html_minimal.snippets
|
||||
# these UltiSnips override snippets because nested placeholders are being used
|
||||
|
||||
priority -50
|
||||
priority -49
|
||||
|
||||
snippet id
|
||||
id="$1"$2
|
||||
|
@ -608,6 +608,12 @@ returning ${1:variable} do${2/(^(?<var>\s*[a-z_][a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet cmm "Create Migration Model Class"
|
||||
class Migration${1/(?:^|_)(\w)/\u$1/g} < ApplicationRecord
|
||||
self.table_name = :${1:model_name}s
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet t. "t.binary (tcbi)"
|
||||
t.binary :${1:title}${2:, :limit => ${3:2}.megabytes}
|
||||
t.$0
|
||||
|
@ -8,7 +8,7 @@ priority -50
|
||||
# Built In library #
|
||||
######################
|
||||
snippet cat "Catenate"
|
||||
Catenate SEPARATOR=${1:---} ${2:Hello} ${3:world}
|
||||
\${${1:name}}= Catenate SEPARATOR=${2:---} ${3:Hello} ${4:world}
|
||||
endsnippet
|
||||
|
||||
snippet eval "Evaluate"
|
||||
@ -109,6 +109,10 @@ snippet sgv "Set Global Variable"
|
||||
Set Global Variable \${${1:name}} ${2:${value}}
|
||||
endsnippet
|
||||
|
||||
snippet sbe "Should Be Equal"
|
||||
Should Be Equal "\${${1:var}}" "${2:expected value}" ${3:"optional error msg"} ${4:ignore_case=True}
|
||||
endsnippet
|
||||
|
||||
snippet sleep "Sleep"
|
||||
Sleep ${1:2 minutes 10 seconds}
|
||||
endsnippet
|
||||
@ -142,6 +146,12 @@ Import library Dialogs
|
||||
Pause execution
|
||||
endsnippet
|
||||
|
||||
snippet tpause "Teardown Pause - pause test execution only on failure"
|
||||
[Teardown] Run Keyword If Test Failed Run Keywords
|
||||
... Import library Dialogs AND
|
||||
... Pause execution
|
||||
endsnippet
|
||||
|
||||
|
||||
##############################
|
||||
# Selenium2Library library #
|
||||
|
@ -2,6 +2,48 @@ priority -50
|
||||
|
||||
extends texmath
|
||||
|
||||
global !p
|
||||
|
||||
def create_table(snip):
|
||||
rows = snip.buffer[snip.line].split('x')[0]
|
||||
cols = snip.buffer[snip.line].split('x')[1]
|
||||
|
||||
int_val = lambda string: int(''.join(s for s in string if s.isdigit()))
|
||||
|
||||
rows = int_val(rows)
|
||||
cols = int_val(cols)
|
||||
|
||||
offset = cols + 1
|
||||
old_spacing = snip.buffer[snip.line][:snip.buffer[snip.line].rfind('\t') + 1]
|
||||
|
||||
snip.buffer[snip.line] = ''
|
||||
|
||||
final_str = old_spacing + "\\begin{tabular}{|" + "|".join(['$' + str(i + 1) for i in range(cols)]) + "|}\n"
|
||||
|
||||
for i in range(rows):
|
||||
final_str += old_spacing + '\t'
|
||||
final_str += " & ".join(['$' + str(i * cols + j + offset) for j in range(cols)])
|
||||
|
||||
final_str += " \\\\\\\n"
|
||||
|
||||
final_str += old_spacing + "\\end{tabular}\n$0"
|
||||
|
||||
snip.expand_anon(final_str)
|
||||
|
||||
def add_row(snip):
|
||||
row_len = int(''.join(s for s in snip.buffer[snip.line] if s.isdigit()))
|
||||
old_spacing = snip.buffer[snip.line][:snip.buffer[snip.line].rfind('\t') + 1]
|
||||
|
||||
snip.buffer[snip.line] = ''
|
||||
|
||||
final_str = old_spacing
|
||||
final_str += " & ".join(['$' + str(j + 1) for j in range(row_len)])
|
||||
final_str += " \\\\\\"
|
||||
|
||||
snip.expand_anon(final_str)
|
||||
|
||||
endglobal
|
||||
|
||||
snippet "b(egin)?" "begin{} / end{}" br
|
||||
\begin{${1:something}}
|
||||
${0:${VISUAL}}
|
||||
@ -20,6 +62,14 @@ $0${2/(?<=.)(c|l|r)|./(?1: & )/g}
|
||||
\end{$1${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}}
|
||||
endsnippet
|
||||
|
||||
pre_expand "create_table(snip)"
|
||||
snippet "gentbl(\d+)x(\d+)" "Generate table of *width* by *height*" r
|
||||
endsnippet
|
||||
|
||||
pre_expand "add_row(snip)"
|
||||
snippet "tr(\d+)" "Add table row of dimension ..." r
|
||||
endsnippet
|
||||
|
||||
snippet table "Table environment" b
|
||||
\begin{table}[${1:htpb}]
|
||||
\centering
|
||||
|
38
sources_non_forked/vim-snippets/snippets/alpaca.snippets
Normal file
38
sources_non_forked/vim-snippets/snippets/alpaca.snippets
Normal file
@ -0,0 +1,38 @@
|
||||
snippet mod
|
||||
module ${0:`expand('%:t:r')`}
|
||||
snippet imp
|
||||
import ${0:http}
|
||||
snippet impt
|
||||
import type ${0:option.option}
|
||||
snippet exp
|
||||
export ${0}
|
||||
snippet expt
|
||||
export ${0}
|
||||
snippet fn
|
||||
val ${1:fn} ${2}: fn ${3:'a} -> ${4:'a}
|
||||
let $1 ${5} =
|
||||
${0:${VISUAL}}
|
||||
snippet mat
|
||||
match ${1} with
|
||||
| ${2} -> ${0}
|
||||
snippet -
|
||||
| ${1} -> ${0}
|
||||
snippet let
|
||||
let ${1} = ${2:${VISUAL}} in
|
||||
${0}
|
||||
snippet letf
|
||||
let ${1} =
|
||||
${0:${VISUAL}}
|
||||
snippet ty
|
||||
type ${1:msg}
|
||||
= ${0}
|
||||
snippet test
|
||||
test "${1}" =
|
||||
${0:${VISUAL}}
|
||||
snippet doc
|
||||
{-| ${0}
|
||||
-}
|
||||
snippet p
|
||||
|> ${0}
|
||||
snippet ae
|
||||
assert.equal ${0}
|
@ -48,6 +48,17 @@ snippet once
|
||||
${0}
|
||||
|
||||
#endif /* end of include guard: $1 */
|
||||
# Disable C++ name mangling in C headers
|
||||
snippet nocxx
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
${0}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
##
|
||||
## Control Statements
|
||||
# if
|
||||
|
@ -138,6 +138,10 @@ snippet ns
|
||||
namespace ${1:`vim_snippets#Filename('', 'my')`} {
|
||||
${0}
|
||||
} /* namespace $1 */
|
||||
snippet ans
|
||||
namespace {
|
||||
${0}
|
||||
}
|
||||
##
|
||||
## Input/Output
|
||||
# std::cout
|
||||
|
@ -144,7 +144,7 @@ snippet rec
|
||||
${0}
|
||||
end
|
||||
snippet req
|
||||
require ${0:module_name}
|
||||
require ${0:Logger}
|
||||
snippet imp
|
||||
import ${0:module_name}
|
||||
snippet ali
|
||||
@ -153,6 +153,10 @@ snippet test
|
||||
test "${1:test name}" do
|
||||
${0}
|
||||
end
|
||||
snippet testc
|
||||
test "${1:test_name}", ctx do
|
||||
${0}
|
||||
end
|
||||
snippet testa
|
||||
test "${1:test_name}", %{${2:arg: arg}} do
|
||||
${0}
|
||||
|
@ -49,6 +49,12 @@ snippet module
|
||||
) where
|
||||
`expand('%') =~ 'Main' ? "\nmain :: IO ()\nmain = undefined" : ""`
|
||||
|
||||
snippet mod
|
||||
module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')`
|
||||
( ${1}
|
||||
) where
|
||||
|
||||
`expand('%') =~ 'Main' ? "\nmain :: IO ()\nmain = undefined" : ""`
|
||||
snippet main
|
||||
main :: IO ()
|
||||
main = ${0:undefined}
|
||||
|
36
sources_non_forked/vim-snippets/snippets/kotlin.snippets
Normal file
36
sources_non_forked/vim-snippets/snippets/kotlin.snippets
Normal file
@ -0,0 +1,36 @@
|
||||
snippet fun
|
||||
fun ${1:name}(${2}): ${3:String} {
|
||||
${4}
|
||||
}
|
||||
snippet pfun
|
||||
private fun ${1:name}(${2}): ${3:String} {
|
||||
${4}
|
||||
}
|
||||
snippet ret
|
||||
return ${0}
|
||||
snippet whe
|
||||
when (${1:${VISUAL}}) {
|
||||
${2} -> ${3}
|
||||
}
|
||||
snippet cla
|
||||
class ${1} {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet cobj
|
||||
companion object {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet obj
|
||||
object ${1} {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet if
|
||||
if (${1}) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet ife
|
||||
if (${1}) {
|
||||
${2:${VISUAL}}
|
||||
} else {
|
||||
${0}
|
||||
}
|
@ -97,8 +97,8 @@ snippet blockquote-link
|
||||
{% endblockquote %}
|
||||
|
||||
snippet ```
|
||||
\`\`\`
|
||||
${1:code}
|
||||
\`\`\`${1}
|
||||
${0:${VISUAL}}
|
||||
\`\`\`
|
||||
|
||||
# Language.
|
||||
|
@ -1,6 +1,9 @@
|
||||
snippet #!
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
snippet #!2
|
||||
#!/usr/bin/env python2
|
||||
# -*- coding: utf-8 -*-
|
||||
snippet #!3
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
@ -211,6 +214,20 @@ snippet getopt
|
||||
${0}
|
||||
elif option in ("-v", "--verbose"):
|
||||
verbose = argument
|
||||
# argparse
|
||||
snippet addp
|
||||
parser = ${VISUAL:argparse.}ArgumentParser()
|
||||
snippet addsp
|
||||
${0:sub_parser} = parser.add_subparsers().add_parser("${1:name}")
|
||||
snippet addarg
|
||||
parser.add_argument("${0:short_arg}", "${1:long_arg}", default=${2:None}, help="${3:Help text}")
|
||||
snippet addnarg
|
||||
parser.add_argument("${0:arg}", nargs="${1:*}", default"${2:None}, help="${3:Help text}")
|
||||
snippet addaarg
|
||||
parser.add_argument("${0:arg}", "${1:long_arg}", action="${2:store_true}", default=${3:False}, help="${4:Help text}")
|
||||
snippet pargs
|
||||
"${VISUAL:return }"parser.parse_args()
|
||||
|
||||
# logging
|
||||
# glog = get log
|
||||
snippet glog
|
||||
@ -261,3 +278,166 @@ snippet dcp dict comprehension
|
||||
|
||||
snippet scp set comprehension
|
||||
{${1} for ${2} in ${3:${VISUAL}}}${0}
|
||||
|
||||
snippet contain "methods for emulating a container type" b
|
||||
def __len__(self):
|
||||
${1:pass}
|
||||
|
||||
def __getitem__(self, key):
|
||||
${2:pass}
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
${3:pass}
|
||||
|
||||
def __delitem__(self, key):
|
||||
${4:pass}
|
||||
|
||||
def __iter__(self):
|
||||
${5:pass}
|
||||
|
||||
def __reversed__(self):
|
||||
${6:pass}
|
||||
|
||||
def __contains__(self, item):
|
||||
${7:pass}
|
||||
|
||||
snippet context "context manager methods" b
|
||||
def __enter__(self):
|
||||
${1:pass}
|
||||
|
||||
def __exit__(self, exc_type, exc_value, traceback):
|
||||
${2:pass}
|
||||
|
||||
snippet attr "methods for customizing attribute access" b
|
||||
def __getattr__(self, name):
|
||||
${1:pass}
|
||||
|
||||
def __setattr__(self, name, value):
|
||||
${2:pass}
|
||||
|
||||
def __delattr__(self, name):
|
||||
${3:pass}
|
||||
|
||||
snippet desc "methods implementing descriptors" b
|
||||
def __get__(self, instance, owner):
|
||||
${1:pass}
|
||||
|
||||
def __set__(self, instance, value):
|
||||
${2:pass}
|
||||
|
||||
def __delete__(self, instance):
|
||||
${3:pass}
|
||||
|
||||
snippet cmp "methods implementing rich comparison"
|
||||
def __eq__(self, other):
|
||||
${1:pass}
|
||||
|
||||
def __ne__(self, other):
|
||||
${2:pass}
|
||||
|
||||
def __lt__(self, other):
|
||||
${3:pass}
|
||||
|
||||
def __le__(self, other):
|
||||
${4:pass}
|
||||
|
||||
def __gt__(self, other):
|
||||
${5:pass}
|
||||
|
||||
def __ge__(self, other):
|
||||
${6:pass}
|
||||
|
||||
def __cmp__(self, other):
|
||||
${7:pass}
|
||||
|
||||
snippet repr "methods implementing string representation"
|
||||
def __repr__(self):
|
||||
${1:pass}
|
||||
|
||||
def __str__(self):
|
||||
${2:pass}
|
||||
|
||||
def __unicode__(self):
|
||||
${3:pass}
|
||||
|
||||
# note: reflected operands and augmented arithmeitc assignements have been
|
||||
# intentionally ommited to reduce verbosity.
|
||||
snippet numeric "methods for emulating a numeric type" b
|
||||
def __add__(self, other):
|
||||
${1:pass}
|
||||
|
||||
def __sub__(self, other):
|
||||
${2:pass}
|
||||
|
||||
def __mul__(self, other):
|
||||
${3:pass}
|
||||
|
||||
def __div__(self, other):
|
||||
${4:pass}
|
||||
|
||||
def __truediv__(self, other):
|
||||
${5:pass}
|
||||
|
||||
def __floordiv__(self, other):
|
||||
${6:pass}
|
||||
|
||||
def __mod__(self, other):
|
||||
${7:pass}
|
||||
|
||||
def __divmod__(self, other):
|
||||
${8:pass}
|
||||
|
||||
def __pow__(self, other):
|
||||
${9:pass}
|
||||
|
||||
def __lshift__(self, other):
|
||||
${10:pass}
|
||||
|
||||
def __rshift__(self, other):
|
||||
${11:pass}
|
||||
|
||||
def __and__(self, other):
|
||||
${12:pass}
|
||||
|
||||
def __xor__(self, other):
|
||||
${13:pass}
|
||||
|
||||
def __or__(self, other):
|
||||
${14:pass}
|
||||
|
||||
def __neg__(self):
|
||||
${15:pass}
|
||||
|
||||
def __pos__(self):
|
||||
${16:pass}
|
||||
|
||||
def __abs__(self):
|
||||
${17:pass}
|
||||
|
||||
def __invert__(self):
|
||||
${18:pass}
|
||||
|
||||
def __complex__(self):
|
||||
${19:pass}
|
||||
|
||||
def __int__(self):
|
||||
${20:pass}
|
||||
|
||||
def __long__(self):
|
||||
${21:pass}
|
||||
|
||||
def __float__(self):
|
||||
${22:pass}
|
||||
|
||||
def __oct__(self):
|
||||
${22:pass}
|
||||
|
||||
def __hex__(self):
|
||||
${23:pass}
|
||||
|
||||
def __index__(self):
|
||||
${24:pass}
|
||||
|
||||
def __coerce__(self, other):
|
||||
${25:pass}
|
||||
|
||||
|
@ -347,6 +347,19 @@ snippet mct
|
||||
create_table :${1:table_name} do |t|
|
||||
${0}
|
||||
end
|
||||
snippet mrev reversible do |dir| ... dir.up .. dir.down .. end
|
||||
reversible do |dir|
|
||||
dir.up do
|
||||
${0}
|
||||
end
|
||||
|
||||
dir.down do
|
||||
end
|
||||
end
|
||||
snippet cmm class Migration... < ApplicationModel .. self.table_name .. end
|
||||
class Migration${1:class_name} < ApplicationRecord
|
||||
self.table_name = :${2:model_name}s
|
||||
end
|
||||
snippet migration class .. < ActiveRecord::Migration .. def up .. def down .. end
|
||||
class `substitute( substitute(vim_snippets#Filename(), '^\d\+_', '',''), '\(_\|^\)\(.\)', '\u\2', 'g')` < ActiveRecord::Migration
|
||||
def up
|
||||
|
@ -42,13 +42,13 @@ snippet lettm "let mut variable declaration with explicit type annotation"
|
||||
snippet pri "print!"
|
||||
print!("${1}");
|
||||
snippet pri, "print! with format param"
|
||||
print!("${1}", ${2});
|
||||
print!("${1}{${2}}", ${3});
|
||||
snippet pln "println!"
|
||||
println!("${1}");
|
||||
snippet pln, "println! with format param"
|
||||
println!("${1}", ${2});
|
||||
println!("${1}{${2}}", ${3});
|
||||
snippet fmt "format!"
|
||||
format!("${1}", ${2});
|
||||
format!("${1}{${2}}", ${3});
|
||||
|
||||
# Modules
|
||||
snippet ec "extern crate"
|
||||
|
@ -209,6 +209,8 @@ snippet bf bold face text
|
||||
\\textbf{${1:${VISUAL:text}}} ${0}
|
||||
snippet under underline text
|
||||
\\underline{${1:${VISUAL:text}}} ${0}
|
||||
snippet over overline text
|
||||
\\overline{${1:${VISUAL:text}}} ${0}
|
||||
snippet emp emphasize text
|
||||
\\emph{${1:${VISUAL:text}}} ${0}
|
||||
snippet sc small caps text
|
||||
@ -339,3 +341,6 @@ snippet urlc
|
||||
\\url{`@+`} ${0}
|
||||
snippet hrefc
|
||||
\\href{`@+`}{${1}} ${0}
|
||||
# enquote from package csquotes
|
||||
snippet enq enquote
|
||||
\\enquote{${1:${VISUAL:text}}} ${0}
|
||||
|
Reference in New Issue
Block a user