vim-snippets/snippets/julia.snippets

103 lines
1.2 KiB
Plaintext
Raw Normal View History

snippet #!
#!/usr/bin/env julia
# Functions
snippet fun function definition
2014-06-11 14:48:03 -04:00
function ${1}(${2})
${0}
end
2014-06-05 11:41:17 -04:00
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
2014-06-11 14:48:03 -04:00
for ${1} in ${2}
${0}
end
2014-06-05 11:41:17 -04:00
snippet for standard for loop
2014-06-11 14:48:03 -04:00
for ${1} = ${2}
${0}
end
2014-06-05 11:41:17 -04:00
snippet fornest nested for loop
2014-06-11 14:48:03 -04:00
for ${1} = ${2}, ${3} = ${4}
${0}
end
2014-06-05 11:41:17 -04:00
snippet wh while loop
2014-06-11 14:48:03 -04:00
while ${1} ${2:<=} ${3}
${0}
end
2014-06-05 11:41:17 -04:00
# 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
2014-06-23 06:37:17 -04:00
snippet tern ternary operator
${1} ? ${2} : ${3:nothing}
# Exceptions
snippet try try catch
2014-06-11 14:48:03 -04:00
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}