From a973f6bc4692fd5e15a55f2ab922629d5a9aec5b Mon Sep 17 00:00:00 2001 From: Felix Jung Date: Thu, 5 Jun 2014 17:41:17 +0200 Subject: [PATCH 1/6] Initial commit --- snippets/julia.snippets | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 snippets/julia.snippets diff --git a/snippets/julia.snippets b/snippets/julia.snippets new file mode 100644 index 0000000..b92c8c4 --- /dev/null +++ b/snippets/julia.snippets @@ -0,0 +1,36 @@ +snippet fun + function ${1:functionname}(${2:parameters}) + ${0} + end + +# For loop iterating over iterable container +snippet forin + for ${1} in ${2} + ${0} + end + +# Standard for loop +snippet for + for ${1} = ${2} + ${0} + end + +# Nested for loop +snippet fornest + for ${1} = ${2}, ${3} = ${4} + ${0} + end + +# While loop +snippet while + while ${1} ${2:<=} ${3} + ${0} + end + +# Try catch +snippet try + try + ${1} + catch ${2} + ${0} + end From 7cd12215811c013d53370d58adeb0e075b40a814 Mon Sep 17 00:00:00 2001 From: Felix Jung Date: Wed, 11 Jun 2014 20:06:51 +0200 Subject: [PATCH 2/6] Changed from spaces to tabs --- snippets/julia.snippets | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/snippets/julia.snippets b/snippets/julia.snippets index b92c8c4..3f84db5 100644 --- a/snippets/julia.snippets +++ b/snippets/julia.snippets @@ -1,36 +1,36 @@ snippet fun - function ${1:functionname}(${2:parameters}) - ${0} - end + function ${1:functionname}(${2:parameters}) + ${0} + end # For loop iterating over iterable container snippet forin - for ${1} in ${2} - ${0} - end + for ${1} in ${2} + ${0} + end # Standard for loop snippet for - for ${1} = ${2} - ${0} - end + for ${1} = ${2} + ${0} + end # Nested for loop snippet fornest - for ${1} = ${2}, ${3} = ${4} - ${0} - end + for ${1} = ${2}, ${3} = ${4} + ${0} + end # While loop snippet while - while ${1} ${2:<=} ${3} - ${0} - end + while ${1} ${2:<=} ${3} + ${0} + end # Try catch snippet try - try - ${1} - catch ${2} - ${0} - end + try + ${1} + catch ${2} + ${0} + end From cbbb5b1720a4821254327f302077ee3b603baf06 Mon Sep 17 00:00:00 2001 From: Felix Jung Date: Wed, 11 Jun 2014 20:45:53 +0200 Subject: [PATCH 3/6] Fix indentation --- snippets/julia.snippets | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/snippets/julia.snippets b/snippets/julia.snippets index 3f84db5..8a1dccc 100644 --- a/snippets/julia.snippets +++ b/snippets/julia.snippets @@ -1,36 +1,36 @@ snippet fun - function ${1:functionname}(${2:parameters}) - ${0} - end + function ${1:functionname}(${2:parameters}) + ${0} + end # For loop iterating over iterable container snippet forin - for ${1} in ${2} - ${0} - end + for ${1} in ${2} + ${0} + end # Standard for loop snippet for - for ${1} = ${2} - ${0} - end + for ${1} = ${2} + ${0} + end # Nested for loop snippet fornest - for ${1} = ${2}, ${3} = ${4} - ${0} - end + for ${1} = ${2}, ${3} = ${4} + ${0} + end # While loop snippet while - while ${1} ${2:<=} ${3} - ${0} - end + while ${1} ${2:<=} ${3} + ${0} + end # Try catch snippet try - try - ${1} - catch ${2} - ${0} - end + try + ${1} + catch ${2} + ${0} + end From 8161986df3aadf1a77840fe2109d8ec41afe0379 Mon Sep 17 00:00:00 2001 From: Felix Jung Date: Wed, 11 Jun 2014 20:48:03 +0200 Subject: [PATCH 4/6] Fix indentation --- snippets/julia.snippets | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/snippets/julia.snippets b/snippets/julia.snippets index 8a1dccc..7fc2c7a 100644 --- a/snippets/julia.snippets +++ b/snippets/julia.snippets @@ -1,36 +1,36 @@ snippet fun - function ${1:functionname}(${2:parameters}) - ${0} - end + function ${1:functionname}(${2:parameters}) + ${0} + end # For loop iterating over iterable container snippet forin - for ${1} in ${2} - ${0} - end + for ${1} in ${2} + ${0} + end # Standard for loop snippet for - for ${1} = ${2} - ${0} - end + for ${1} = ${2} + ${0} + end # Nested for loop snippet fornest - for ${1} = ${2}, ${3} = ${4} - ${0} - end + for ${1} = ${2}, ${3} = ${4} + ${0} + end # While loop snippet while - while ${1} ${2:<=} ${3} - ${0} - end + while ${1} ${2:<=} ${3} + ${0} + end # Try catch snippet try - try - ${1} - catch ${2} - ${0} - end + try + ${1} + catch ${2} + ${0} + end From 335637c3b6378761ae413d2ddcc43a43572a7e2c Mon Sep 17 00:00:00 2001 From: Felix Jung Date: Wed, 11 Jun 2014 20:48:03 +0200 Subject: [PATCH 5/6] Fix indentation --- snippets/julia.snippets | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/snippets/julia.snippets b/snippets/julia.snippets index 8a1dccc..e96bb50 100644 --- a/snippets/julia.snippets +++ b/snippets/julia.snippets @@ -1,36 +1,37 @@ +# Standard function definition snippet fun - function ${1:functionname}(${2:parameters}) - ${0} - end + function ${1}(${2}) + ${0} + end # For loop iterating over iterable container snippet forin - for ${1} in ${2} - ${0} - end + for ${1} in ${2} + ${0} + end # Standard for loop snippet for - for ${1} = ${2} - ${0} - end + for ${1} = ${2} + ${0} + end # Nested for loop snippet fornest - for ${1} = ${2}, ${3} = ${4} - ${0} - end + for ${1} = ${2}, ${3} = ${4} + ${0} + end # While loop snippet while - while ${1} ${2:<=} ${3} - ${0} - end + while ${1} ${2:<=} ${3} + ${0} + end # Try catch snippet try - try - ${1} - catch ${2} - ${0} - end + try + ${1} + catch ${2} + ${0} + end From 40e9ffc37108f1d4e339759c0d145b775088d304 Mon Sep 17 00:00:00 2001 From: Felix Jung Date: Thu, 12 Jun 2014 16:19:37 +0200 Subject: [PATCH 6/6] Fixes and additions Various fixes to comply with vim-snippets conventions. Addition of various new snippets. --- snippets/julia.snippets | 86 +++++++++++++++++++++++++++++++++++------ 1 file changed, 74 insertions(+), 12 deletions(-) diff --git a/snippets/julia.snippets b/snippets/julia.snippets index e96bb50..77a7dac 100644 --- a/snippets/julia.snippets +++ b/snippets/julia.snippets @@ -1,37 +1,99 @@ -# Standard function definition -snippet fun +snippet #! + #!/usr/bin/env julia + +# Functions +snippet fun function definition function ${1}(${2}) ${0} end -# For loop iterating over iterable container -snippet forin +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 -# Standard for loop -snippet for +snippet for standard for loop for ${1} = ${2} ${0} end -# Nested for loop -snippet fornest +snippet fornest nested for loop for ${1} = ${2}, ${3} = ${4} ${0} end -# While loop -snippet while +snippet wh while loop while ${1} ${2:<=} ${3} ${0} end -# Try catch -snippet try +# 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 + +# 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}