aboutsummaryrefslogtreecommitdiff
path: root/vim/bundle/vim-snippets/snippets/julia.snippets
blob: 1876ed848ade3291a02a9d2ee862283091630fb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
snippet #!
	#!/usr/bin/env julia

# Functions
snippet fun function definition
	function ${1}(${2})
		${0}
	end

snippet ret return
	return(${0})

# Printing to console
snippet pr print
	print("${1}")
	${0}

snippet prl print line
	println("${1}")
	${0}

# Includes
snippet use load a package
	using ${0}

snippet incl include source code
	include("${1}")
	${0}

# Loops
snippet forc for loop iterating over iterable container
	for ${1} in ${2}
		${0}
	end

snippet for standard for loop
	for ${1} = ${2}
		${0}
	end

snippet fornest nested for loop
	for ${1} = ${2}, ${3} = ${4}
		${0}
	end

snippet wh while loop
	while ${1} ${2:<=} ${3}
		${0}
	end

# Conditionals
snippet if if statement
	if ${1}
		${0}
	end

snippet el else part of statement
	else
		${0}

snippet eif else if part of if statement
	else if ${1}
		${0}

snippet ife full if-else statement
	if ${1}
		${2}
	else
		${0}
	end

snippet tern ternary operator
	${1} ? ${2} : ${3:nothing}

# Exceptions
snippet try try catch
	try
		${1}
	catch ${2}
		${0}
	end

snippet fin finally statement
	finally
		${0}

snippet thr throw
	throw(${1})
	${0}

# Messages
snippet in
	info("${1}")
	${0}

snippet wa
	warn("${1}")
	${0}

snippet err
	error("${1}")
	${0}