add snippets for keywords

This commit is contained in:
hankail05 2019-10-01 12:32:05 +09:00
parent edd715cf78
commit 3c0a57777b
19 changed files with 133 additions and 22 deletions

View file

@ -0,0 +1,5 @@
(require 'yasnippet)
(defun yas-julia-iteration-keyword-choice ()
"Choose the iteration keyword for for-loop"
(yas-choose-value '("=" "in" "")))

View file

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: abstract type ... end
# key: atype
# contributor: hankail05
# --
abstract type ${1:${2:type} <: ${3:supertype}} end$0

View file

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: begin ... end
# key: begin
# contributor: hankail05
# --
begin
${1:body}
end
$0

View file

@ -1,8 +1,9 @@
# -*- mode: snippet -*-
# name: do ... ... end
# key: do
# contributor : hankail05
# contributor: hankail05
# --
do ${1:x}
$0
end
${2:body}
end
$0

View file

@ -1,8 +1,9 @@
# -*- mode: snippet -*-
# name: for ... in ... ... end
# name: for ... ... end
# key: for
# contributor : hankail05
# contributor: hankail05
# --
for ${1:i} in ${2:1:n}
$0
for ${1:i} ${2:$$(yas-julia-iteration-keyword-choice)} ${3:1:n}
${4:body}
end
$0

View file

@ -1,8 +1,9 @@
# -*- mode: snippet -*-
# name: function(...) ... end
# key: fun
# contributor : hankail05
# contributor: hankail05
# --
function ${1:fun}(${2:args})
$0
end
${3:body}
end
$0

View file

@ -1,8 +1,9 @@
# -*- mode: snippet -*-
# name: if ... ... end
# key: if
# contributor : hankail05
# contributor: hankail05
# --
if ${1:cond}
$0
${2:body}
end
$0

View file

@ -1,10 +1,11 @@
# -*- mode: snippet -*-
# name: if ... ... else ... end
# key: ife
# contributor : hankail05
# contributor: hankail05
# --
if ${1:cond}
$2
${2:true}
else
$0
end
${3:false}
end
$0

9
snippets/julia-mode/let Normal file
View file

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: let ... ... end
# key: let
# contributor: hankail05
# --
let ${1:x = 0}
${2:body}
end
$0

View file

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: macro(...) ... end
# key: macro
# contributor: hankail05
# --
macro ${1:macro}(${2:args})
${3:body}
end
$0

View file

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: module ... ... end
# key: module
# contributor: hankail05
# --
module ${1:name}
${2:body}
end
$0

View file

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: mutable struct ... end
# key: mutstr
# contributor: hankail05
# --
mutable struct ${1:name}
${2:body}
end
$0

View file

@ -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

View file

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: quote ... end
# key: quote
# contributor: hankail05
# --
quote
${1:expr}
end
$0

View file

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: struct ... end
# key: struct
# contributor: hankail05
# --
struct ${1:name}
${2:body}
end
$0

11
snippets/julia-mode/try Normal file
View file

@ -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

13
snippets/julia-mode/tryf Normal file
View file

@ -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

View file

@ -1,6 +1,6 @@
# -*- mode: snippet -*-
# name: using ...
# key: using
# contributor : hankail05
using ${1:package}
$0
# contributor: hankail05
# --
using ${1:${2:package}:}$0

View file

@ -1,7 +1,9 @@
# -*- mode: snippet -*-
# name: while ... ... end
# key: while
# contributor : hankail05
# contributor: hankail05
# --
while ${1:cond}
$0
end
${2:body}
end
$0