Skip to content

Commit 3c0a577

Browse files
committed
add snippets for keywords
1 parent edd715c commit 3c0a577

File tree

19 files changed

+133
-22
lines changed

19 files changed

+133
-22
lines changed

snippets/julia-mode/.yas-setup.el

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
(require 'yasnippet)
2+
3+
(defun yas-julia-iteration-keyword-choice ()
4+
"Choose the iteration keyword for for-loop"
5+
(yas-choose-value '("=" "in" "")))

snippets/julia-mode/atype

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# -*- mode: snippet -*-
2+
# name: abstract type ... end
3+
# key: atype
4+
# contributor: hankail05
5+
# --
6+
abstract type ${1:${2:type} <: ${3:supertype}} end$0

snippets/julia-mode/begin

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# -*- mode: snippet -*-
2+
# name: begin ... end
3+
# key: begin
4+
# contributor: hankail05
5+
# --
6+
begin
7+
${1:body}
8+
end
9+
$0

snippets/julia-mode/do

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# -*- mode: snippet -*-
22
# name: do ... ... end
33
# key: do
4-
# contributor : hankail05
4+
# contributor: hankail05
55
# --
66
do ${1:x}
7-
$0
8-
end
7+
${2:body}
8+
end
9+
$0

snippets/julia-mode/for

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# -*- mode: snippet -*-
2-
# name: for ... in ... ... end
2+
# name: for ... ... end
33
# key: for
4-
# contributor : hankail05
4+
# contributor: hankail05
55
# --
6-
for ${1:i} in ${2:1:n}
7-
$0
6+
for ${1:i} ${2:$$(yas-julia-iteration-keyword-choice)} ${3:1:n}
7+
${4:body}
88
end
9+
$0
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# -*- mode: snippet -*-
22
# name: function(...) ... end
33
# key: fun
4-
# contributor : hankail05
4+
# contributor: hankail05
55
# --
66
function ${1:fun}(${2:args})
7-
$0
8-
end
7+
${3:body}
8+
end
9+
$0

snippets/julia-mode/if

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# -*- mode: snippet -*-
22
# name: if ... ... end
33
# key: if
4-
# contributor : hankail05
4+
# contributor: hankail05
55
# --
66
if ${1:cond}
7-
$0
7+
${2:body}
88
end
9+
$0

snippets/julia-mode/ife

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# -*- mode: snippet -*-
22
# name: if ... ... else ... end
33
# key: ife
4-
# contributor : hankail05
4+
# contributor: hankail05
55
# --
66
if ${1:cond}
7-
$2
7+
${2:true}
88
else
9-
$0
10-
end
9+
${3:false}
10+
end
11+
$0

snippets/julia-mode/let

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# -*- mode: snippet -*-
2+
# name: let ... ... end
3+
# key: let
4+
# contributor: hankail05
5+
# --
6+
let ${1:x = 0}
7+
${2:body}
8+
end
9+
$0

snippets/julia-mode/macro

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# -*- mode: snippet -*-
2+
# name: macro(...) ... end
3+
# key: macro
4+
# contributor: hankail05
5+
# --
6+
macro ${1:macro}(${2:args})
7+
${3:body}
8+
end
9+
$0

0 commit comments

Comments
 (0)