new snippet

This commit is contained in:
Yannick Reiß 2023-08-06 16:54:40 +02:00
parent 6d739e9ce5
commit 25b04043d4
No known key found for this signature in database
GPG Key ID: 5A3AF456F0A0338C
2 changed files with 24 additions and 9 deletions

View File

@ -68,6 +68,14 @@ snippet img "Images"
$0 $0
endsnippet endsnippet
snippet figure "add figure" b
\\begin{figure}[${1:h}]
\\centering
$0
\\caption{$2}
\\end{figure}
endsnippet
snippet document "Add document environment" snippet document "Add document environment"
\\begin{document} \\begin{document}
\\input{~/latex/formulas.tex} \\input{~/latex/formulas.tex}
@ -164,7 +172,7 @@ snippet () "( ... )"
\\left( $1 \\right) $0 \\left( $1 \\right) $0
endsnippet endsnippet
snippet ,text "Mathmode-text" iA snippet ,mt "Mathmode-text" iA
\\text{ $1 }$0 \\text{ $1 }$0
endsnippet endsnippet
@ -264,7 +272,7 @@ endsnippet
snippet ben "enumerate" snippet ben "enumerate"
\\begin{enumerate} \\begin{enumerate}
\\item $1`!p t[1] = t[1].replace(" \n", "\n\t\\item")` \\item $1`!p t[1] = t[1].replace(" \n", "\n\t\\item")`
\\end{enumerate} \\end{enumerate}
$0 $0
endsnippet endsnippet
@ -327,7 +335,7 @@ $0
endsnippet endsnippet
snippet edraw "Draw into electric circuit" snippet edraw "Draw into electric circuit"
\\draw(${1:0}, ${2:0}) \\draw(${1:0}, ${2:0})
$3 $3
; ;
$0 $0
@ -505,11 +513,11 @@ snippet tikzenv "tikzenvironment" A
$0 $0
endsnippet endsnippet
snippet flowstart "insert flowstart" snippet flowstart "insert flowstart"
\\flowstart{$1}{$2}$0 \\flowstart{$1}{$2}$0
endsnippet endsnippet
snippet flowstop "insert flowstop" snippet flowstop "insert flowstop"
\\flowstop{$1}{$2}$0 \\flowstop{$1}{$2}$0
endsnippet endsnippet
@ -533,3 +541,7 @@ snippet != "not equal" iA
\\neq $0 \\neq $0
endsnippet endsnippet
snippet "@(\w)" "insert greek letter" irA
\\`!p letters = {'a': 'alpha', 'A': 'Alpha', 'b': 'beta', 'B': 'Beta', 'g': 'gamma', 'G': 'Gamma', 'e': 'epsilon', 'E': 'Epsilon', 'o': 'omega', 'O': 'Omega'}
snip.rv = letters[ match.group(1) ]`
endsnippet

View File

@ -1,7 +1,11 @@
snippet "reg []" "Register of size." A snippet reg_ "Register of size." iA
reg [${1:7}:${2:0}] ${3:register};$0 reg [${1:7}:${2:0}] ${3:register};$0
endsnippet endsnippet
snippet wire_ "Wire as bus" iA
wire [${1:7}:${2:0}] ${3:wire};$0
endsnippet
global !p global !p
def complete(t, opts): def complete(t, opts):
if t: if t:
@ -14,12 +18,11 @@ endglobal
snippet always "Do something always @" b snippet always "Do something always @" b
always @($1`!p snip.rv=complete(t[1], ['*', 'posedge clk', 'negedge clk', 'posedge rst_n', 'negedge rst_n'])`) begin always @($1`!p snip.rv=complete(t[1], ['*', 'posedge clk', 'negedge clk', 'posedge rst_n', 'negedge rst_n'])`) begin
$2 $2
end $0 end$0
endsnippet endsnippet
snippet al "Do something always @" b snippet al "Do something always @" b
always @($1) begin always @($1) begin
$2 $2
end $0 end$0
endsnippet endsnippet