From f38a1dda43d3eff4275db18a67300ddf22ab610b Mon Sep 17 00:00:00 2001 From: Paul Anton Letnes Date: Mon, 23 Jan 2012 21:54:08 +0100 Subject: [PATCH 1/6] added initial fortran snippets --- snippets/fortran.snippets | 146 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 snippets/fortran.snippets diff --git a/snippets/fortran.snippets b/snippets/fortran.snippets new file mode 100644 index 00000000..1633ffc0 --- /dev/null +++ b/snippets/fortran.snippets @@ -0,0 +1,146 @@ +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright 2010 Paul Anton Letnes + +# Fortran program snippet +snippet program + program ${1:name} + implicit none + ${2} + contains + ${3:!TODO} + end program $1 +# Use statement +snippet use + use ${1:module}, only: ${2:symbols} +# Module snippet +snippet module + module ${1:name} + implicit none + ${2:contents} + contains + ${3:!TODO} + end module $1 + +# Do loop +snippet do + do ${1:loopvar} = ${2:lower}, ${3:higher} + ${4} + end do +# Until loop +snippet until + do + ${1:statements} + until ${2:logical expression} +# While loop +snippet while + while ${1:logical expression} do + ${2:statements} + enddo +# OMP parallel do loop +snippet ompdo + !$omp parallel do private(${5:privatevars}) shared(${6:sharedvars}) + do ${1:loopvar} = ${2:lower}, ${3:higher} + ${4} + end do + !$omp end parallel do + +# Write statement +snippet write + write (${1:*}, ${2:*}) ${3:variable} + +# Where / elsewhere construct +snippet elsewhere + where (${1:condition}) + ${2:! TODO} + elsewhere + ${3:! TODO} + end where +# Where statement +snippet where + where (${1:condition}) ${2:code} + +# General variables +snippet var + ${1:type}(${2:kind})${3:, properties} :: ${4:varname} +# Function arguments, with intent statement +snippet fvar + ${1:type}(${2:kind}), intent(${3:inout})${4:, properties} :: ${5:varname} + +# Derived datatypes +snippet type + type ${1:name} + ${2:members} + end type $1 + +# Subroutines +snippet sub + subroutine ${1:name}(${2:parameters}) + implicit none + ${3} + end subroutine $1 +# Functions +snippet func + function ${1:name}(${2:parameters}) + implicit none + ${3} + end function $1 +# Pure functions +snippet pfunc + pure function ${1:name}(${2:parameters}) + implicit none + ${3} + end function $1 +# Elemental functions +snippet efunc + elemental function ${1:name}(${2:parameters}) + implicit none + ${3} + end function $1 + +# If construct +snippet if + if (${1:condition}) then + ${2} + end if +# If-else construct +snippet ifelse + if (${1:condition}) then + ${2} + else + ${3:! TODO} + end if + + +# Read statement +snippet read + read (${1:*}, ${2:*}) ${3:target} + +# GPL header snippet +snippet gplheader + ! This program is free software: you can redistribute it and/or modify + ! it under the terms of the GNU General Public License as published by + ! the Free Software Foundation, either version 3 of the License, or + ! (at your option) any later version. + ! + ! This program is distributed in the hope that it will be useful, + ! but WITHOUT ANY WARRANTY; without even the implied warranty of + ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ! GNU General Public License for more details. + ! + ! You should have received a copy of the GNU General Public License + ! along with this program. If not, see . + ! + ! Copyright ${1:year}, ${2:author} + From 38b8b2eca0f0bfa64164dd45f3848bc2dc6ac214 Mon Sep 17 00:00:00 2001 From: Paul Anton Letnes Date: Mon, 30 Jan 2012 15:02:04 +0100 Subject: [PATCH 2/6] added a few tex snippets --- snippets/tex-mine.snippets | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 snippets/tex-mine.snippets diff --git a/snippets/tex-mine.snippets b/snippets/tex-mine.snippets new file mode 100644 index 00000000..ae6fa530 --- /dev/null +++ b/snippets/tex-mine.snippets @@ -0,0 +1,6 @@ +# Parentheses with auto-sizing +snippet left + \left( ${1:foo} \right) +# Fractions +snippet frac + \frac{${1:a}}{${2:b}} From a8ce77af1fdd7c5b046da0104f3c120e0bef9d4a Mon Sep 17 00:00:00 2001 From: Paul Anton Letnes Date: Mon, 13 Feb 2012 10:00:23 +0100 Subject: [PATCH 3/6] added foldmarkers for latex code --- snippets/tex-mine.snippets | 46 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/snippets/tex-mine.snippets b/snippets/tex-mine.snippets index ae6fa530..8835ad45 100644 --- a/snippets/tex-mine.snippets +++ b/snippets/tex-mine.snippets @@ -4,3 +4,49 @@ snippet left # Fractions snippet frac \frac{${1:a}}{${2:b}} +# Floating figures +snippet fig + \begin{figure}[htb] + \centering + \includegraphics{${1:file}} + \caption{\label{fig:${2:label}} + ${3:caption} + } + \end{figure} +# Chapter +snippet cha + \chapter{${1:chapter name}} % {{{ + \label{cha:${2:$1}} + ${3} + % chapter $2 }}} +# Section +snippet sec + \section{${1:section name}} % {{{ + \label{sec:${2:$1}} + ${3} + % section $2 }}} +# Sub Section +snippet sub + \subsection{${1:subsection name}} % {{{ + \label{sub:${2:$1}} + ${3} + % subsection $2 }}} +# Sub Sub Section +snippet subs + \subsubsection{${1:subsubsection name}} % {{{ + \label{ssub:${2:$1}} + ${3} + % subsubsection $2 }}} +# Paragraph +snippet par + \paragraph{${1:paragraph name}} % {{{ + \label{par:${2:$1}} + ${3} + % paragraph $2 }}} +# Sub Paragraph +snippet subp + \subparagraph{${1:subparagraph name}} % {{{ + \label{subp:${2:$1}} + ${3} + % subparagraph $2 }}} + From 7abb7e227bd42a438160fab963e421fe96c45c86 Mon Sep 17 00:00:00 2001 From: Paul Anton Letnes Date: Mon, 13 Feb 2012 10:02:27 +0100 Subject: [PATCH 4/6] removed doubly defined snippets for tex --- snippets/tex.snippets | 70 +++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/snippets/tex.snippets b/snippets/tex.snippets index 22f73165..cc945323 100644 --- a/snippets/tex.snippets +++ b/snippets/tex.snippets @@ -66,41 +66,41 @@ snippet part ${3} % part $2 (end) # Chapter -snippet cha - \chapter{${1:chapter name}} % (fold) - \label{cha:${2:$1}} - ${3} - % chapter $2 (end) -# Section -snippet sec - \section{${1:section name}} % (fold) - \label{sec:${2:$1}} - ${3} - % section $2 (end) -# Sub Section -snippet sub - \subsection{${1:subsection name}} % (fold) - \label{sub:${2:$1}} - ${3} - % subsection $2 (end) -# Sub Sub Section -snippet subs - \subsubsection{${1:subsubsection name}} % (fold) - \label{ssub:${2:$1}} - ${3} - % subsubsection $2 (end) -# Paragraph -snippet par - \paragraph{${1:paragraph name}} % (fold) - \label{par:${2:$1}} - ${3} - % paragraph $2 (end) -# Sub Paragraph -snippet subp - \subparagraph{${1:subparagraph name}} % (fold) - \label{subp:${2:$1}} - ${3} - % subparagraph $2 (end) +#snippet cha +# \chapter{${1:chapter name}} % (fold) +# \label{cha:${2:$1}} +# ${3} +# % chapter $2 (end) +## Section +#snippet sec +# \section{${1:section name}} % (fold) +# \label{sec:${2:$1}} +# ${3} +# % section $2 (end) +## Sub Section +#snippet sub +# \subsection{${1:subsection name}} % (fold) +# \label{sub:${2:$1}} +# ${3} +# % subsection $2 (end) +## Sub Sub Section +#snippet subs +# \subsubsection{${1:subsubsection name}} % (fold) +# \label{ssub:${2:$1}} +# ${3} +# % subsubsection $2 (end) +## Paragraph +#snippet par +# \paragraph{${1:paragraph name}} % (fold) +# \label{par:${2:$1}} +# ${3} +# % paragraph $2 (end) +## Sub Paragraph +#snippet subp +# \subparagraph{${1:subparagraph name}} % (fold) +# \label{subp:${2:$1}} +# ${3} +# % subparagraph $2 (end) snippet itd \item[${1:description}] ${2:item} snippet figure From e2b2e3b495fa90db042603bf37d0f27902f2ee24 Mon Sep 17 00:00:00 2001 From: Paul Anton Letnes Date: Wed, 30 May 2012 10:18:12 +0200 Subject: [PATCH 5/6] modified snippets for tex --- snippets/tex-mine.snippets | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/snippets/tex-mine.snippets b/snippets/tex-mine.snippets index 8835ad45..344dfe90 100644 --- a/snippets/tex-mine.snippets +++ b/snippets/tex-mine.snippets @@ -15,38 +15,38 @@ snippet fig \end{figure} # Chapter snippet cha - \chapter{${1:chapter name}} % {{{ + \chapter{${1:chapter name}} % <<< \label{cha:${2:$1}} ${3} - % chapter $2 }}} + % chapter $2 >>> # Section snippet sec - \section{${1:section name}} % {{{ + \section{${1:section name}} % <<< \label{sec:${2:$1}} ${3} - % section $2 }}} + % section $2 >>> # Sub Section snippet sub - \subsection{${1:subsection name}} % {{{ + \subsection{${1:subsection name}} % <<< \label{sub:${2:$1}} ${3} - % subsection $2 }}} + % subsection $2 >>> # Sub Sub Section snippet subs - \subsubsection{${1:subsubsection name}} % {{{ + \subsubsection{${1:subsubsection name}} % <<< \label{ssub:${2:$1}} ${3} - % subsubsection $2 }}} + % subsubsection $2 >>> # Paragraph snippet par - \paragraph{${1:paragraph name}} % {{{ + \paragraph{${1:paragraph name}} % <<< \label{par:${2:$1}} ${3} - % paragraph $2 }}} + % paragraph $2 >>> # Sub Paragraph snippet subp - \subparagraph{${1:subparagraph name}} % {{{ + \subparagraph{${1:subparagraph name}} % <<< \label{subp:${2:$1}} ${3} - % subparagraph $2 }}} + % subparagraph $2 >>> From f9f0defc9c0ed844c904559e5b5250d07f5b6f59 Mon Sep 17 00:00:00 2001 From: Paul Anton Letnes Date: Wed, 30 May 2012 10:19:15 +0200 Subject: [PATCH 6/6] added lua snippets --- snippets/lua.snippets | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 snippets/lua.snippets diff --git a/snippets/lua.snippets b/snippets/lua.snippets new file mode 100644 index 00000000..339457ce --- /dev/null +++ b/snippets/lua.snippets @@ -0,0 +1,32 @@ +# Function +snippet fun + function ${1:function_name} (${2:argument}) + ${3} + end +# Anonymous Function +snippet f + function(${1}) ${2} end +# if +snippet if + if ${1:true} then ${2} end; +# for (...) {...} +snippet for + for ${2:i}=1,#${1:Things} do + ${4:$1[$2]} + end +snippet forp + for ${1:i} in pairs(${2:Things}) do + ${3} + end +snippet fori + for ${1:i} in ipairs(${2:Things}) do + ${3} + end +snippet wh + while ${1:true} do + ${2} + end +snippet l + local ${1} +snippet p + print(${1})