mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +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
|
||||
|
Reference in New Issue
Block a user