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} + 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}) diff --git a/snippets/tex-mine.snippets b/snippets/tex-mine.snippets new file mode 100644 index 00000000..344dfe90 --- /dev/null +++ b/snippets/tex-mine.snippets @@ -0,0 +1,52 @@ +# Parentheses with auto-sizing +snippet left + \left( ${1:foo} \right) +# 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 >>> + 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