Add '.vim/UltiSnips/' from commit '84cd9817817a28d58e92eb715273479509e51187'

git-subtree-dir: .vim/UltiSnips
git-subtree-mainline: f258dd00078a9aebb235c358b6048aac250d445a
git-subtree-split: 84cd9817817a28d58e92eb715273479509e51187
This commit is contained in:
Kenneth Benzie (Benie) 2016-02-11 14:35:59 +00:00
parent e1f3a40124
commit b7bedfe837
8 changed files with 685 additions and 0 deletions

9
UltiSnips/all.snippets Normal file
View File

@ -0,0 +1,9 @@
snippet tab "Insert tab literal"
$0
endsnippet
snippet codeplay "Codeplay Software Ltd. copywrite"
${1://} Copyright (C) 2002-2016 Codeplay Software Limited. All Rights Reserved.
$0
endsnippet

193
UltiSnips/c.snippets Normal file
View File

@ -0,0 +1,193 @@
priority 0
global !p
def complete(t, opts):
if t:
opts = [m[len(t):] for m in opts if m.startswith(t)]
if len(opts) == 1:
return opts[0]
elif len(opts) == 0:
return "-error"
return '(' + '|'.join(opts) + ')'
endglobal
snippet i8 "int8_t" i
int8_t
endsnippet
snippet u8 "uint8_t" i
uint8_t
endsnippet
snippet i16 "int16_t" i
int16_t
endsnippet
snippet u16 "uint16_t" i
uint16_t
endsnippet
snippet i32 "int32_t" i
int32_t
endsnippet
snippet u32 "uint32_t" i
uint32_t
endsnippet
snippet i64 "int64_t" i
int64_t
endsnippet
snippet u64 "uint64_t" i
uint64_t
endsnippet
snippet #include "Include directive"
#include <${1:header}>
endsnippet
snippet #define "Macro definition"
#define ${1:SYMBOL} $0
endsnippet
snippet #ifndef "Guarded macro definition"
#ifndef ${1/([A-Za-z0-9_]+).*/$1/}
#define ${1:SYMBOL} ${0:VALUE}
#endif // ${1/([A-Za-z0-9_]+).*/$1/}
endsnippet
snippet #if "#if block"
#if ${1:SYMBOL}
$0
#endif // ${1/([A-Za-z0-9_]+).*/$1/}
endsnippet
snippet #ifdef "#if defined(...) block"
#if defined(${1:SYMBOL})
$0
#endif // $1
endsnippet
snippet once "Include guard"
#ifndef ${2/([A-Za-z_]){1}([A-Za-z0-9_]+).*/$1$2/}$1
#define $2${1:`!p import string
snip.rv = re.sub(r'[^A-Za-z0-9]+','_', snip.fn).upper()`_INCLUDED}
$0
#endif // ${2/([A-Za-z_]){1}([A-Za-z0-9_]+).*/$1$2/}$1
endsnippet
snippet typedef "Typedef"
typedef ${1:type} ${2:custom_type};$0
endsnippet
snippet enum "Typedef enumeration"
typedef enum ${1:name} {
$0
} $1;
endsnippet
snippet struct "Typedef struct"
typedef struct ${1:name} {
$0
} $1;
endsnippet
snippet if "If statement"
if (${1:condition}) {
$0
}
endsnippet
snippet else "Else continuation"
else {
$0
}
endsnippet
snippet elif "Else if continuation"
else if (${1:condition}) {
$0
}
endsnippet
snippet for "For loop, index or range"
for (${1:auto} ${2:index} ${3/(.*;.*)|(\w*)/(?1:=:\:)/} ${3:0; $2 < ${5:count}; $2${6:++}}) {
$0
}
endsnippet
snippet while "While loop"
while (${1:condition}) {
$0
}
endsnippet
snippet do "Do while loop"
do {
$0
} while (${1:condition})
endsnippet
snippet switch "Switch statement"
switch (${1:expression}) {
$0
}
endsnippet
snippet case "Switch case"
case ${1:constant}: {
$0
} break;
endsnippet
snippet default "Switch default case"
default: {
$0
} break;
endsnippet
snippet main "Main function stub"
int main(int argc, char **argv) {
$0
}
endsnippet
# TODO: Should this be in all.snippets?
# 1. Take the form '<comment> TODO: issue ${1:id} $0'
snippet todo "Todo comment"
// TODO: redmine(${1:issue}) $0
endsnippet
# TODO: Should this be in all.snippets?
# 1. Take the form '<comment> NOTE: issue ${1:id} $0'
snippet note "Note comment"
// NOTE: $0
endsnippet
snippet in "Doxygen [in]" i
[in]
endsnippet
snippet out "Doxygen [out]" i
[out]
endsnippet
snippet @param "Doxygen param tag"
@param[$1`!p snip.rv = complete(t[1], ['in', 'out'])`]
endsnippet
snippet doxygen "Doxygen file block" b
/// @file
///
/// @brief $0
///
/// @coderight
/// Copyright (C) 2002-2016 Codeplay Software Limited. All Rights Reserved.
endsnippet
snippet copydoc "Doxygen copydoc block"
/// @copydoc $0
endsnippet

174
UltiSnips/cmake.snippets Normal file
View File

@ -0,0 +1,174 @@
global !p
def complete(t, opts):
if t:
opts = [m[len(t):] for m in opts if m.startswith(t)]
if len(opts) == 1:
return opts[0]
elif len(opts) == 0:
return ""
return '[' + '|'.join(opts) + ']'
endglobal
snippet add_compile_options "add_compile_options"
add_compile_options($1)
endsnippet
snippet add_custom_command "add_custom_command OUTPUT"
add_custom_command(OUTPUT ${1:outputs...}
COMMAND ${2:command}${3:
COMMAND ${4:command}}${5:
MAIN_DEPENDENCY ${6:depend}}${7:
DEPENDS ${8:depends...}}${9:
IMPLICIT_DEPENDS ${10:lang} ${11:depend}}${12:
WORKING_DIRECTORY ${13:dir}}${14:
COMMENT "${15:comment}"}${16: VERBATIM}${17: APPEND})
endsnippet
snippet add_custom_command "add_custom_command TARGET"
add_custom_command(TARGET ${1:target} $2`!p snip.rv=complete(t[2], ['PRE_BUILD', 'PRE_LINK', 'POST_BUILD'])`
COMMAND ${3:command}${4:
COMMAND ${5:command}}${6:
WORKING_DIRECTORY ${7:directory}}${8:
COMMENT "${9:comment}"}${10: VERBATIM})
endsnippet
snippet add_custom_target "add_custom_target"
add_custom_target(${1:target} ${2:ALL}
${3:command}${4:
COMMAND ${5:command}}${6:
DEPENDS ${7:depends...}}${8:
WORKING_DIRECTORY ${9:directory}}${10:
COMMENT "${11:comment}"}${12: VERBATIM}${13:
SOURCES ${14:sources}})
endsnippet
snippet add_definitions "add_definitions"
add_definitions(-D${1:MACRO}$2)
endsnippet
snippet add_dependencies "add_dependencies"
add_dependencies(${1:target} ${2:dependencies...})
endsnippet
snippet add_executable "add_executable"
add_executable(${1:target}${2: WIN32}${3: MACOSX_BUNDLE}${4:
EXCLUDE_FROM_ALL}
${0:sources...})
endsnippet
snippet add_library "add_library"
add_library(${1:target} $2`!p snip.rv=complete(t[2], ['STATIC', 'SHARED', 'MODULE'])`${4:
EXCLUDE_FROM_ALL}
${0:sources...})
endsnippet
snippet add_subdirectory "add_subdirectory"
add_subdirectory(${1:source_dir} ${2:binary_dir}${3: EXCLUDE_FROM_ALL})
endsnippet
snippet add_test "add_test"
add_test(NAME ${1:name}
COMMAND ${2:command}${3:
CONFIGURATIONS ${4:config}}${5:
WORKING_DIRECTORY ${6:directory}})
endsnippet
snippet aux_source_directory "aux_source_directory"
aux_source_directory(${1:directory} ${2:variable})
endsnippet
snippet break "break"
break()
endsnippet
snippet build_command "build_command"
build_command(${1:variable}${2:
CONFIGURATION ${3:config}}${4:
TARGET ${6:target}})
endsnippet
snippet cmake_host_system_information "cmake_host_system_information"
cmake_host_system_information(RESULT ${1:variable} QUERY $2`!p snip.rv=complete(t[2], ['NUMBER_OF_LOGICAL_CORES', 'NUMBER_OF_PHYSICAL_CORES', 'HOSTNAME', 'FQDN', 'TOTAL_VIRTUAL_MEMORY', 'AVAILABLE_VIRTUAL_MEMORY', 'TOTAL_PHYSICAL_MEMORY', 'AVAILABLE_PHYSICAL_MEMORY'])`)
endsnippet
snippet cmake_minimum_required "cmake_minimum_required"
cmake_minimum_required(VERSION $1${2: FATAL_ERROR})
endsnippet
snippet cmake_policy "cmake_policy VERSION"
cmake_policy(VERSION ${1:version})
endsnippet
snippet cmake_policy "cmake_policy SET"
cmake_policy(SET CMP${1:0000} $2`!p snip.rv=complete(t[2], ['OLD', 'NEW'])`)
endsnippet
snippet cmake_policy "cmake_policy GET"
cmake_policy(GET CMP${1:0000} ${2:variable})
endsnippet
snippet cmake_policy "cmake_policy PUSH/POP"
cmake_policy($1`!p snip.rv=complete(t[1], ['PUSH', 'POP'])`)
endsnippet
# TODO: file()
# TODO: find_file()
# TODO: find_package()
# TODO: find_path()
# TODO: find_program()
snippet foreach "foreach"
foreach(${1:ITEM} \$\{${2:LIST}\})
$0
endforeach()
endsnippet
snippet function "function"
function(${1:NAME} ${2:...})
$0
endfunction()
endsnippet
global !p
def if_completion_list():
return ['NOT', 'COMMAND', 'POLICY', 'TARGET', 'EXISTS', 'IS_DIRECTORY', 'IS_SYMLINK', 'IS_ABSOLUTE', 'DEFINED']
endglobal
snippet if "if"
if($1`!p snip.rv=complete(t[1], if_completion_list()) + ' '`$2)
$0
endif()
endsnippet
snippet elseif "elseif"
elseif($1`!p snip.rv=complete(t[1], if_completion_list()) + ' '`$0)
endsnippet
snippet include_directories "include_directories"
include_directories(\$\{${1:CMAKE_CURRENT_SOURCE_DIR}\}/$0)
endsnippet
# TODO: install()
# TODO: list()
snippet message "message"
message($1`!p snip.rv=complete(t[1], ['STATUS', 'WARNING', 'AUTHOR_WARNING', 'SEND_ERROR', 'FATAL_ERROR', 'DEPRECATION'])` "$2")
endsnippet
snippet set "set"
set(${1:VARIABLE} ${2:VALUE})
endsnippet
# TODO: set_property()
# TODO: set_target_properties()
# TODO: string()
snippet option "option"
option(${1:OPTION} "${2:Description}." $3`!p snip.rv=complete(t[3], ['ON', 'OFF'])`)
endsnippet
# TODO: target_include_directories()
snippet target_link_libraries "target_link_libraries"
target_link_libraries(${1:TARGET} ${2:LIBRARIES})
endsnippet

40
UltiSnips/cpp.snippets Normal file
View File

@ -0,0 +1,40 @@
extends c
priority 1
# TODO: include
# 1. Default should be '#include <filename.h>'.
# 2. Relative paths should only allow inserting a single '"'.
snippet enum "Enumeration"
enum ${1:name} {
$0
};
endsnippet
snippet struct "Structure"
struct ${1:name} {
$0
};
endsnippet
snippet class "Class"
class ${1:name} {
public:
${1/(\w+)\s.*/$1/}();
~${1/(\w+)\s.*/$1/}();
$0
};
endsnippet
snippet template "Template"
template <typename ${1:type}>$0
endsnippet
snippet namespace "Named or anonymous namespace"
namespace ${1:}${1/\w+/ /}{
$0
}${1/\w+/ \/\/ $0/}
endsnippet

52
UltiSnips/html.snippets Normal file
View File

@ -0,0 +1,52 @@
global !p
def complete(t, opts):
if t:
opts = [m[len(t):] for m in opts if m.startswith(t)]
if len(opts) == 1:
return opts[0]
elif len(opts) == 0:
return "-error"
return '(' + '|'.join(opts) + ')'
endglobal
# html snippets
snippet class "HTML class tag"
class="$1"$0
endsnippet
snippet img "HTML img tag"
<img src="$1"${2: alt="$3"}/>
endsnippet
snippet span "HTML span tag" i
<span>$0</span>
endsnippet
snippet code "HTML code tab" i
<code>$0</code>
endsnippet
snippet section "HTML section tag"
<section$1>
$0
</section>
endsnippet
snippet table "HTML table"
<table>
<thead>
<tr>
<th>$1</th>
</tr>
</thead>
<tbody>
<tr>
<td>$0</td>
</tr>
</tbody>
</table>
endsnippet
snippet text-align "CSS text-align"
style="text-align:$1`!p snip.rv=complete(t[1], ['left', 'center', 'right'])`"
endsnippet

View File

@ -0,0 +1,56 @@
# snippet completion function
global !p
def complete(t, opts):
if t:
opts = [m[len(t):] for m in opts if m.startswith(t)]
if len(opts) == 1:
return opts[0]
elif len(opts) == 0:
return "-error"
return '(' + '|'.join(opts) + ')'
endglobal
# shared fragment style completion list
global !p
def fragments():
return ['grow', 'shrink', 'fade-in', 'fade-out', 'current-visible',
'highlight-current-blue', 'highlight-red', 'highlight-green',
'highlight-blue']
endglobal
# reveal.js html snippets
snippet frag "reveal.js fragment class" i
fragment $1`!p snip.rv=complete(t[1], fragments())`
endsnippet
snippet bg "reveal.js data-background"
data-background="$1"$0
endsnippet
snippet trans "reveal.js data-transition"
data-transition="$1`!p snip.rv=complete(t[1], ['slide', 'none', 'fade',
'convex', 'concave', 'zoom'])`"
endsnippet
snippet index "reveal.js data-fragment-index"
data-fragment-index="$1"$0
endsnippet
snippet notes "reveal.js speaker notes"
<aside class="notes">
$0
</aside>
endsnippet
# reveal.js markdown section snippets
snippet mdsec "Reveal.js markdown section"
<section data-markdown>
<script type="text/template">
$0
</script>
</section>
endsnippet
snippet mdelem "reveal.js markdown element"
<!-- .element: class="$1"$2 -->$0
endsnippet

144
UltiSnips/redmine.snippets Normal file
View File

@ -0,0 +1,144 @@
snippet issue "Issue Link"
#${1:id}${2:!#note-${3:id}}$0
endsnippet
snippet link "Link"
"${2:name}":${3:url}$0
endsnippet
snippet email "Email Link"
"${1:name}":mailto:${2:email}$0
endsnippet
snippet acronym "Acronym"
${1:acronym}(${2:meaning})$0
endsnippet
snippet acr "Acronym"
${1:acronym}(${2:meaning})$0
endsnippet
snippet bold "Bold"
*$1*$0
endsnippet
snippet b "Bold"
*$1*$0
endsnippet
snippet italic "Italic"
_$1_$0
endsnippet
snippet i "Italic"
_$1_$0
endsnippet
snippet bolditalic "Bold Italic"
*_$1_*$0
endsnippet
snippet bi "Bold Italic"
*_$1_*$0
endsnippet
snippet strike "Strike-through"
-$1-$0
endsnippet
snippet super "Superscript"
^$1^$0
endsnippet
snippet sub "Supscript"
~$1~$0
endsnippet
snippet mono "Inline Monospace"
@$1@$0
endsnippet
snippet m "Inline Monospace"
@$1@$0
endsnippet
snippet f "Inline Monospace"
@$1@$0
endsnippet
snippet red "Red Color"
%{color:red}${1:text}%$0
endsnippet
snippet lred "Red Color"
%{color:lightred}${1:text}%$0
endsnippet
snippet green "Green Color"
%{color:green}${1:text}%$0
endsnippet
snippet lgreen "Light Green Color"
%{color:green}${1:text}%$0
endsnippet
snippet blue "Blue Color"
%{color:blue}${1:text}%$0
endsnippet
snippet lblue "Light Blue Color"
%{color:lightblue}${1:text}%$0
endsnippet
snippet yellow "Yellow Color"
%{color:yellow}${1:text}%$0
endsnippet
snippet lyellow "Light Yellow Color"
%{color:lightyellow}${1:text}%$0
endsnippet
snippet bred "Red Background Color"
%{background:red}${1:text}%$0
endsnippet
snippet lbred "Light Red Background Color"
%{background:red}${1:text}%$0
endsnippet
snippet bgreen "Green Background Color"
%{background:green}${1:text}%$0
endsnippet
snippet lbgreen "Light Green Background Color"
%{background:green}${1:text}%$0
endsnippet
snippet bblue "Blue Background Color"
%{background:blue}${1:text}%$0
endsnippet
snippet lbblue "Light Blue Background Color"
%{background:lightblue}${1:text}%$0
endsnippet
snippet byellow "Yellow Background Color"
%{background:yellow}${1:text}%$0
endsnippet
snippet blyellow "Light Yellow Background Color"
%{background:lightyellow}${1:text}%$0
endsnippet
snippet # "Heading 1" b
h1. $0
endsnippet
snippet ## "Heading 2" b
h2. $0
endsnippet
snippet ### "Heading 3" b
h3. $0
endsnippet
snippet rule "Horizontal Rule" b
----
$0
endsnippet
snippet pre "Predefined Block" b
<pre>$0</pre>
endsnippet
snippet code "Monospace Block" b
<pre><code class="${1:cpp}">
$0
</code></pre>
endsnippet

17
UltiSnips/xml.snippets Normal file
View File

@ -0,0 +1,17 @@
snippet t "XML inline tag" i
<${1:tag}>${2:content}</${1/([\w:._-]+).*/$1/}>
endsnippet
snippet a "XML attribute" i
${1:attrib}="${2:value}"
endsnippet
snippet < "XML inline tag" i
<${1:tag}>${2:content}</${1/([\w:._-]+).*/$1/}>
endsnippet
snippet tb "XML inline tag" i
<${1:tag}>
${2:content}
</${1/([\w:._-]+).*/$1/}>
endsnippet