add snippets for keywords
This commit is contained in:
parent
edd715cf78
commit
3c0a57777b
|
@ -0,0 +1,5 @@
|
||||||
|
(require 'yasnippet)
|
||||||
|
|
||||||
|
(defun yas-julia-iteration-keyword-choice ()
|
||||||
|
"Choose the iteration keyword for for-loop"
|
||||||
|
(yas-choose-value '("=" "in" "∈")))
|
|
@ -0,0 +1,6 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: abstract type ... end
|
||||||
|
# key: atype
|
||||||
|
# contributor: hankail05
|
||||||
|
# --
|
||||||
|
abstract type ${1:${2:type} <: ${3:supertype}} end$0
|
|
@ -0,0 +1,9 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: begin ... end
|
||||||
|
# key: begin
|
||||||
|
# contributor: hankail05
|
||||||
|
# --
|
||||||
|
begin
|
||||||
|
${1:body}
|
||||||
|
end
|
||||||
|
$0
|
|
@ -1,8 +1,9 @@
|
||||||
# -*- mode: snippet -*-
|
# -*- mode: snippet -*-
|
||||||
# name: do ... ... end
|
# name: do ... ... end
|
||||||
# key: do
|
# key: do
|
||||||
# contributor : hankail05
|
# contributor: hankail05
|
||||||
# --
|
# --
|
||||||
do ${1:x}
|
do ${1:x}
|
||||||
$0
|
${2:body}
|
||||||
end
|
end
|
||||||
|
$0
|
|
@ -1,8 +1,9 @@
|
||||||
# -*- mode: snippet -*-
|
# -*- mode: snippet -*-
|
||||||
# name: for ... in ... ... end
|
# name: for ... ... end
|
||||||
# key: for
|
# key: for
|
||||||
# contributor : hankail05
|
# contributor: hankail05
|
||||||
# --
|
# --
|
||||||
for ${1:i} in ${2:1:n}
|
for ${1:i} ${2:$$(yas-julia-iteration-keyword-choice)} ${3:1:n}
|
||||||
$0
|
${4:body}
|
||||||
end
|
end
|
||||||
|
$0
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
# -*- mode: snippet -*-
|
# -*- mode: snippet -*-
|
||||||
# name: function(...) ... end
|
# name: function(...) ... end
|
||||||
# key: fun
|
# key: fun
|
||||||
# contributor : hankail05
|
# contributor: hankail05
|
||||||
# --
|
# --
|
||||||
function ${1:fun}(${2:args})
|
function ${1:fun}(${2:args})
|
||||||
$0
|
${3:body}
|
||||||
end
|
end
|
||||||
|
$0
|
|
@ -1,8 +1,9 @@
|
||||||
# -*- mode: snippet -*-
|
# -*- mode: snippet -*-
|
||||||
# name: if ... ... end
|
# name: if ... ... end
|
||||||
# key: if
|
# key: if
|
||||||
# contributor : hankail05
|
# contributor: hankail05
|
||||||
# --
|
# --
|
||||||
if ${1:cond}
|
if ${1:cond}
|
||||||
$0
|
${2:body}
|
||||||
end
|
end
|
||||||
|
$0
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
# -*- mode: snippet -*-
|
# -*- mode: snippet -*-
|
||||||
# name: if ... ... else ... end
|
# name: if ... ... else ... end
|
||||||
# key: ife
|
# key: ife
|
||||||
# contributor : hankail05
|
# contributor: hankail05
|
||||||
# --
|
# --
|
||||||
if ${1:cond}
|
if ${1:cond}
|
||||||
$2
|
${2:true}
|
||||||
else
|
else
|
||||||
$0
|
${3:false}
|
||||||
end
|
end
|
||||||
|
$0
|
|
@ -0,0 +1,9 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: let ... ... end
|
||||||
|
# key: let
|
||||||
|
# contributor: hankail05
|
||||||
|
# --
|
||||||
|
let ${1:x = 0}
|
||||||
|
${2:body}
|
||||||
|
end
|
||||||
|
$0
|
|
@ -0,0 +1,9 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: macro(...) ... end
|
||||||
|
# key: macro
|
||||||
|
# contributor: hankail05
|
||||||
|
# --
|
||||||
|
macro ${1:macro}(${2:args})
|
||||||
|
${3:body}
|
||||||
|
end
|
||||||
|
$0
|
|
@ -0,0 +1,9 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: module ... ... end
|
||||||
|
# key: module
|
||||||
|
# contributor: hankail05
|
||||||
|
# --
|
||||||
|
module ${1:name}
|
||||||
|
${2:body}
|
||||||
|
end
|
||||||
|
$0
|
|
@ -0,0 +1,9 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: mutable struct ... end
|
||||||
|
# key: mutstr
|
||||||
|
# contributor: hankail05
|
||||||
|
# --
|
||||||
|
mutable struct ${1:name}
|
||||||
|
${2:body}
|
||||||
|
end
|
||||||
|
$0
|
|
@ -0,0 +1,6 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: primitive type ... end
|
||||||
|
# key: ptype
|
||||||
|
# contributor: hankail05
|
||||||
|
# --
|
||||||
|
primitive type ${1:${2:type} <: ${3:supertype}} ${4:bits} end$0
|
|
@ -0,0 +1,9 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: quote ... end
|
||||||
|
# key: quote
|
||||||
|
# contributor: hankail05
|
||||||
|
# --
|
||||||
|
quote
|
||||||
|
${1:expr}
|
||||||
|
end
|
||||||
|
$0
|
|
@ -0,0 +1,9 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: struct ... end
|
||||||
|
# key: struct
|
||||||
|
# contributor: hankail05
|
||||||
|
# --
|
||||||
|
struct ${1:name}
|
||||||
|
${2:body}
|
||||||
|
end
|
||||||
|
$0
|
|
@ -0,0 +1,11 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: try ... catch ... end
|
||||||
|
# key: try
|
||||||
|
# contributor: hankail05
|
||||||
|
# --
|
||||||
|
try
|
||||||
|
${1:expr}
|
||||||
|
catch ${2:error}
|
||||||
|
${3:e_expr}
|
||||||
|
end
|
||||||
|
$0
|
|
@ -0,0 +1,13 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: try ... catch ... finally ... end
|
||||||
|
# key: try
|
||||||
|
# contributor: hankail05
|
||||||
|
# --
|
||||||
|
try
|
||||||
|
${1:expr}
|
||||||
|
catch ${2:error}
|
||||||
|
${3:e_expr}
|
||||||
|
finally
|
||||||
|
${4:f_expr}
|
||||||
|
end
|
||||||
|
$0
|
|
@ -1,6 +1,6 @@
|
||||||
# -*- mode: snippet -*-
|
# -*- mode: snippet -*-
|
||||||
# name: using ...
|
# name: using ...
|
||||||
# key: using
|
# key: using
|
||||||
# contributor : hankail05
|
# contributor: hankail05
|
||||||
using ${1:package}
|
# --
|
||||||
$0
|
using ${1:${2:package}:}$0
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
# -*- mode: snippet -*-
|
# -*- mode: snippet -*-
|
||||||
# name: while ... ... end
|
# name: while ... ... end
|
||||||
# key: while
|
# key: while
|
||||||
# contributor : hankail05
|
# contributor: hankail05
|
||||||
|
# --
|
||||||
while ${1:cond}
|
while ${1:cond}
|
||||||
$0
|
${2:body}
|
||||||
end
|
end
|
||||||
|
$0
|
Loading…
Reference in New Issue