Commit 6f9d39c1 authored by Nigel Kukard's avatar Nigel Kukard
Browse files

Added customized AWIT snippets

parent 15985965
License: MIT license
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
License: MIT license
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# Global snippets
snippet date
options word
`strftime("%d %b %Y")`
snippet date_full
alias df
options word
`strftime("%Y-%m-%dT%H:%M:%S")`
snippet date_day
alias dd
options word
`strftime("%Y-%m-%d")`
snippet date_time
alias dt
options word
`strftime("%H:%M:%S")`
snippet lastmod
abbr Last modified time
alias lmod
Last Modified: `strftime("%Y-%m-%dT%H:%M:%S")`
snippet filename
alias fname
options word
`bufname('%') ==#'[Command Line]' ? expand('#') : expand('%')`${0}
snippet path
options word
`substitute(bufname('%') ==#'[Command Line]' ? expand('#:p') : expand('%:p'), '//\+', '/', 'g')`${0}
snippet rpath
options word
`substitute(bufname('%') ==#'[Command Line]' ? expand('#:h') : expand('%:h'), '\(//*\|/*$\)', '/', 'g')`${0}
snippet basename
alias bname
options word
`bufname('%') ==#'[Command Line]' ? expand('#:t:r:r:r') : expand('%:t:r:r:r')`${0}
snippet filename_upper_camel
alias fnameuc
options word
`substitute(bufname('%') ==#'[Command Line]' ? expand('#:t:r:r:r') : expand('%:t:r:r:r'), '\%(^\(.\)\|_\(.\)\)', '\u\1\u\2', 'g')`${0}
snippet filename_lower_camel
alias fnamelc
options word
`substitute(bufname('%') ==#'[Command Line]' ? expand('#:t:r:r:r') : expand('%:t:r:r:r'), '\%(_\(.\)\)', '\u\1', 'g')`${0}
snippet allow
AllowOverride ${1:#:AuthConfig} ${2:#:FileInfo} ${3:#:Indexes} ${4:#:Limit} ${5:#:Options}
snippet opt
Options ${1:#:All} ${2:#:ExecCGI} ${3:#:FollowSymLinks} ${4:#:Includes} ${5:#:IncludesNOEXEC} ${6:#:Indexes} ${7:#:MultiViews} ${8:#:SymLinksIfOwnerMatch}
snippet vhost
<VirtualHost ${1:example.org}>
ServerAdmin webmaster@${1}
DocumentRoot /www/vhosts/${1}
ServerName ${1}
ErrorLog logs/${1}-error_log
CustomLog logs/${1}-access_log common
</VirtualHost>
snippet dir
<Directory ${1:/Library/WebServer/}>
${0}
</Directory>
snippet ifmodule
<IfModule ${1:module_name}>
${2}
</IfModule>
snippet if
<If ${1:condition}>
${2}
</If>
snippet RemoteIPHeader
RemoteIPHeader X-Forwarded-For
snippet location
<Location ${1:location}>
${2:config}
</Location>
snippet locationmatch
<LocationMatch "${1:regex}">
${2:config}
</LocationMatch>
snippet directoryindex
DirectoryIndex index.php index.html
snippet require
Require all granted
snippet article
alias @article
@article{${1:LABEL},
author = {${2}},
title = {${3}},
journal = {${4}},
year = {${5}},
memo = {volume, number, pages, month, note}
}
snippet book
alias @book
@book{${1:LABEL},
author/editor = {${2}},
title = {${3}},
publisher = {${4}},
year = {${5}},
memo = {volume, series, address, edition, month, note},
}
snippet booklet
alias @booklet
@booklet{${1:LABEL},
title = {${2}},
memo = {author, howpublished, address, month, year, note},
}
snippet inbook
alias @inbook
@inbook{${1:LABEL},
author/editor = {${2}},
title = {${3}},
chapter/pages = {${4}},
publisher = {${5}},
year = {${6}},
memo = {volume, series, address, edition, month, note},
}
snippet incollection
alias @incollection
@incollection{${1:LABEL},
author = {${2}},
title = {${3}},
booktitle = {${4}},
year = {${4}},
memo = {editor, pages, organization, publisher, address, month, note},
}
snippet inproceedings
alias @inproceedings @conference conference
@inproceedings{${1:LABEL},
author = {${2}},
title = {${3}},
booktitle = {${4}},
year = {${5}},
memo = {editor, volume, number, series, pages, address, month,
organization, publisher, note}
}
snippet manual
alias @manual
@manual{${1:LABEL},
title = {${2}},
memo = {author, organization, address, edition, month, year, note},
}
snippet mastersthesis
alias @mastersthesis
@mastersthesis{${1:LABEL},
author = {${2}},
title = {${3}},
school = {${4}},
year = {${5}},
memo = {address, month, note},
}
snippet misc
alias @misc
@misc{${1:LABEL},
memo = {author, title, howpublished, month, year, note},
}
snippet online
alias @online
@online{${1:LABEL},
author = {${1}},
title = {${2}},
url = {${3}},
note = {year/date},
}
snippet phdthesis
alias @phdthesis
@phdthesis{${1:LABEL},
author = {${2}},
title = {${3}},
school = {${4}},
year = {${5}},
memo = {address, month, note},
}
snippet proceedings
alias @proceedings
@proceedings{${1:LABEL},
title = {${2}},
year = {${3}},
memo = {editor, publisher, organization, address, month, note},
}
snippet techreport
alias @techreport
@techreport{${1:LABEL},
author = {${2}},
title = {${3}},
institution = {${4}},
year = {${5}},
memo = {type, number, address, month, note},
}
snippet unpublished
alias @unpublished
@unpublished{${1:LABEL},
author = {${2}},
title = {${3}},
note = {${4}},
memo = {month, year},
}
snippet address
address = {${1}},
${0}
snippet annote
annote = {${1}},
${0}
snippet author
author = {${1}},
${0}
snippet booktitle
booktitle = {${1}},
${0}
snippet crossref
crossref = {${1}},
${0}
snippet chapter
chapter = {${1}},
${0}
snippet edition
edition = {${1}},
${0}
snippet editor
editor = {${1}},
${0}
snippet eprint
eprint = {${1}},
${0}
snippet howpublished
howpublished = {${1}},
${0}
snippet institution
institution = {${1}},
${0}
snippet journal
journal = {${1}},
${0}
snippet key
key = {${1}},
${0}
snippet month
month = {${1}},
${0}
snippet note
note = {${1}},
${0}
snippet number
number = {${1}},
${0}
snippet organization
organization = {${1}},
${0}
snippet pages
pages = {${1}},
${0}
snippet publisher
publisher = {${1}},
${0}
snippet school
school = {${1}},
${0}
snippet series
series = {${1}},
${0}
snippet title
title = {${1}},
${0}
snippet type
type = {${1}},
${0}
snippet url
url = {${1}},
${0}
snippet volume
volume = {${1}},
${0}
snippet year
year = {${1}},
${0}
snippet if
abbr if () {}
if (${1:#:condition}) {
${0:TARGET}
}
snippet else
else {
${0:TARGET}
}
snippet elseif
else if (${1:#:condition}) {
${0:TARGET}
}
snippet ifelse
abbr if () {} else {}
if (${1:#:condition}) {
${2:TARGET}
} else {
${3}
}
snippet for
abbr for () {}
for (${1:int} ${2:i} = ${3:0}; $2 < ${4}; $2++) {
${0:#:TARGET}
}
snippet while
abbr while () {}
while (${1:#:condition}) {
${0:TARGET}
}
snippet do_while
alias do
do {
${0:TARGET:code}
} while (${1:#:condition});
snippet switch
abbr switch () {}
switch (${1:#:var}) {
case ${2:#:val}:
${0:TARGET}
break;
}
snippet function
alias func
abbr func() {}
${1:void} ${2:#:func_name}(${3:#:args}) {
${0:TARGET}
}
snippet struct
abbr struct {}
struct ${1:#:name} {
${0:TARGET:data}
};
# Typedef struct
snippet struct_typedef
typedef struct ${1:#:name} {
${0:TARGET:data}
};
snippet enum
abbr enum {}
enum ${1:#:name} {
${0:TARGET}
};
# hard-tab is necessary; C indent doesn't support this.
snippet main
int main(int argc, char const* argv[])
{
${0:TARGET}
return 0;
}
# #include <...>
snippet inc
alias #inc, #include
#include <${1:stdio}.h>${0}
# #include "..."
snippet inc2
alias #inc2, #include2
#include "${1}.h"${0}
snippet ifndef
alias #ifndef
abbr #ifndef ... #define ... #endif
#ifndef $1
#define ${1:#:SYMBOL}
#endif${0}
snippet def
alias #def, #define
#define
# Include-Guard
snippet once
abbr include-guard
#ifndef ${1:SYMBOL}
#define $1
${0:TARGET}
#endif /* end of include guard */
# Ternary conditional operator
snippet conditional
(${1:#:condition}) ? ${2:#:a} : ${3:#:b}
snippet typedef
typedef ${1:#:base_type} ${2:#:custom_type};
snippet printf
abbr printf("...\n", ...);
printf("${1}\n", ${2});
snippet fprintf
abbr fprintf(..., "...\n", ...);
fprintf(${1:stderr}, "${2}\n"${3});
snippet comment
alias /*
/* ${1:#:comment} */
${0}
snippet sizeof
alias size
sizeof(${0:TARGET})
snippet helloworld
#include <stdio.h>
int main(int argc, char const* argv[])
{
puts("hello, world!");
return 0;
}
snippet fopen
abbr fopen("...", "...");
fopen("${1:PATH}", "${2:MODE}");
${0:TARGET}
fclose(${3:FD});
snippet fgets
abbr fgets(row, length, file);
fgets(${0:ROW}, ${1:LENGTH}, ${2:FILE});
include c.snip
# #include <...>
snippet inc
alias #inc, #include
#include <${1:iostream}>${0}
# #include "..."
snippet inc2
alias #inc2, #include2
#include "${1}"${0}
snippet template
abbr template <T>
template<typename ${1:T}>
snippet class
abbr class {}
class ${1:#:name} {
${2}
public:
$1(${3});
};
$1::$1($3) {
${0:TARGET}
}
snippet class-without-constructor
abbr class {}
class ${1:#:name} {
${2}
};
snippet try
abbr try catch
try {
${1:#:TARGET}
} catch (${2:...}) {
${3}
}
# range based for ( C++11 feature )
snippet for_CPP11
abbr for (:) {}
for (${1:auto&& }${2:var} : ${3:container}) {
${0:TARGET}
}
# lambda expression ( C++11 feature )
snippet lambda
abbr [](){}
[${1}](${2})${3}{ ${4:TARGET} }${0:;}
# scoped enumeration ( C++11 feature )
snippet enum_scoped
abbr enum struct {};
enum struct ${1:#:name} { ${2:#:TARGET} };
# static assert ( C++11 feature )
snippet static_assert
abbr static_assert(,"")
static_assert( ${1}, "${2}" );${0}
delete namespace
snippet namespace
abbr namespace {}
options head
namespace ${1:#:name} {
${0:TARGET}
} // namespace $1
snippet static_cast
abbr static_cast<>()
static_cast<${1}>(${2})${0}
snippet reinterpret_cast
abbr reinterpret_cast<>()
reinterpret_cast<${1}>(${2})${0}
snippet const_cast
abbr const_cast<>()
const_cast<${1}>(${2})${0}
snippet dynamic_cast
abbr dynamic_cast<>()
dynamic_cast<${1}>(${2})${0}
snippet helloworld
abbr #include<iostream> int main...
#include <iostream>
int main(int argc, char const* argv[])
{
std::cout << "hello, world!" << std::endl;
return 0;
}
snippet p
options head
std::cout << ${0:TARGET} << std::endl;
snippet background
alias bg
background:${1};${2}
snippet backattachment
alias ba
background-attachment:${1};${2}
snippet backcolor
alias bc
background-color:${1};${2}
snippet backimage
alias bi
background-image:${1};${2}
snippet backposition
alias bp