Add UltiSnips snippets
This commit is contained in:
parent
79844e9f3b
commit
9d0a0f85f7
3
UltiSnips/all.snippets
Normal file
3
UltiSnips/all.snippets
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
snippet tab "Insert tab literal"
|
||||||
|
$0
|
||||||
|
endsnippet
|
184
UltiSnips/c.snippets
Normal file
184
UltiSnips/c.snippets
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
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:int} ${2:index} = ${3:0}; $2 ${4:<} ${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 copydoc "Doxygen copydoc block"
|
||||||
|
/// @copydoc $0
|
||||||
|
endsnippet
|
441
UltiSnips/cmake.snippets
Normal file
441
UltiSnips/cmake.snippets
Normal file
@ -0,0 +1,441 @@
|
|||||||
|
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
|
||||||
|
|
||||||
|
snippet configure_file "configure_file"
|
||||||
|
configure_file(${1:input} ${2:output}${3: COPYONLY}${4: ESCAPE_QUOTES}${5: @ONLY}${6: NEWLINE_STYLE $7`!p snip.rv=complete(t[7], ['UNIX','DOS','WIN32','LF','CRLF'])`})
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet create_test_sourcelist "create_test_sourcelist"
|
||||||
|
create_test_sourcelist(
|
||||||
|
${1:sourceListName}
|
||||||
|
${2:driverName}
|
||||||
|
${3:tests}
|
||||||
|
EXTRA_INCLUDE ${4:include}
|
||||||
|
FUNCTION ${5:function})
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet define_property "define_property"
|
||||||
|
define_property($1`!p snip.rv=complete(t[1], ['GLOBAL','DIRECTORY','TARGET','SOURCE','TEST','VARIABLE','CACHED_VARIABLE'])`
|
||||||
|
PROPERTY ${2:name}${3: INHERITED}
|
||||||
|
BRIEF_DOCS ${4:brief-docs}
|
||||||
|
FULL_DOCS ${5:full-docs})
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet elseif "elseif"
|
||||||
|
elseif(${1:condition})
|
||||||
|
$0
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet enable_language "enable_language"
|
||||||
|
enable_language($1`!p snip.rv=complete(t[1], ['C', 'CXX', 'FORTRAN'])`${2: OPTIONAL})
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet enable_testing "enable_testing"
|
||||||
|
enable_testing()
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet execute_process "execute_process"
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${1:commands}${2:
|
||||||
|
WORKING_DIRECTORY ${3:directory}}${4:
|
||||||
|
TIMEOUT ${5:seconds}}${6:
|
||||||
|
RESULT_VARIABLE ${7:variable}}${8:
|
||||||
|
OUTPUT_VARIABLE ${9:variable}}${10:
|
||||||
|
ERROR_VARIABLE ${11:variable}}${12:
|
||||||
|
INPUT_FILE ${13:file}}${14:
|
||||||
|
OUTPUT_FILE ${15:file}}${16:
|
||||||
|
ERROR_FILE ${17:file}}${18:
|
||||||
|
OUTPUT_QUIET}${19:
|
||||||
|
ERROR_QUIET}${20:
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE}${21:
|
||||||
|
ERROR_STRIP_TRAILING_WHITESPACE})
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet export "export"
|
||||||
|
export(EXPORT ${1:export-name}${2: NAMESPACE ${3:namespace}}${4: FILE ${5:filename}})
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet file "file WRITE"
|
||||||
|
file(WRITE ${1:filename} "${2:message to write}")
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet file "file APPEND"
|
||||||
|
file(APPEND ${1:filename} "${2:message to write}")
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet file "file READ"
|
||||||
|
file(READ ${1:filename} ${2:variable}${3: LIMIT ${4:numBytes}}${5: OFFSET ${6:offset}}${7: HEX})
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet file "file HASH"
|
||||||
|
file($1`!p snip.rv=complete(t[1], ['MD5','SHA1','SHA224','SHA256','SHA384','SHA512'])` ${2:filename} ${3:variable})
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
# file(STRINGS filename variable [LIMIT_COUNT num]
|
||||||
|
# [LIMIT_INPUT numBytes] [LIMIT_OUTPUT numBytes]
|
||||||
|
# [LENGTH_MINIMUM numBytes] [LENGTH_MAXIMUM numBytes]
|
||||||
|
# [NEWLINE_CONSUME] [REGEX regex]
|
||||||
|
# [NO_HEX_CONVERSION])
|
||||||
|
# file(GLOB variable [RELATIVE path] [globbing expressions]...)
|
||||||
|
# file(GLOB_RECURSE variable [RELATIVE path]
|
||||||
|
# [FOLLOW_SYMLINKS] [globbing expressions]...)
|
||||||
|
# file(RENAME <oldname> <newname>)
|
||||||
|
# file(REMOVE [file1 ...])
|
||||||
|
# file(REMOVE_RECURSE [file1 ...])
|
||||||
|
# file(MAKE_DIRECTORY [directory1 directory2 ...])
|
||||||
|
# file(RELATIVE_PATH variable directory file)
|
||||||
|
# file(TO_CMAKE_PATH path result)
|
||||||
|
# file(TO_NATIVE_PATH path result)
|
||||||
|
# file(DOWNLOAD url file [INACTIVITY_TIMEOUT timeout]
|
||||||
|
# [TIMEOUT timeout] [STATUS status] [LOG log] [SHOW_PROGRESS]
|
||||||
|
# [EXPECTED_HASH ALGO=value] [EXPECTED_MD5 sum]
|
||||||
|
# [TLS_VERIFY on|off] [TLS_CAINFO file])
|
||||||
|
# file(UPLOAD filename url [INACTIVITY_TIMEOUT timeout]
|
||||||
|
# [TIMEOUT timeout] [STATUS status] [LOG log] [SHOW_PROGRESS])
|
||||||
|
# file(TIMESTAMP filename variable [<format string>] [UTC])
|
||||||
|
# file(GENERATE OUTPUT output_file
|
||||||
|
# <INPUT input_file|CONTENT input_content>
|
||||||
|
# [CONDITION expression])
|
||||||
|
|
||||||
|
# TODO: find_file()
|
||||||
|
# TODO: find_package()
|
||||||
|
# TODO: find_path()
|
||||||
|
|
||||||
|
snippet find_program "find_program"
|
||||||
|
find_program(${1:variable}
|
||||||
|
NAMES ${2:names}${3:
|
||||||
|
HINTS ${4:paths}${5: ENV ${6:variable}}}${7:
|
||||||
|
PATHS ${8:paths}${9: ENV ${10:variable}}}${11:
|
||||||
|
PATH_SUFFIXES ${12:suffixes}}${13:
|
||||||
|
DOC "${14:doc string}"}${15:${16:
|
||||||
|
NO_DEFAULT_PATH}${17:
|
||||||
|
NO_CMAKE_ENVIRONMENT_PATH}${18:
|
||||||
|
NO_CMAKE_PATH}${19:
|
||||||
|
NO_SYSTEM_ENVIRONMENT_PATH}${20:
|
||||||
|
NO_CMAKE_SYSTEM_PATH}${21:
|
||||||
|
$22`!p snip.rv=complete(t[22], ['CMAKE_FIND_ROOT_PATH_BOTH', 'ONLY_CMAKE_FIND_ROOT_PATH', 'NO_CMAKE_FIND_ROOT_PATH'])`}})
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
# TODO: fltk_wrap_ui()
|
||||||
|
|
||||||
|
snippet foreach "foreach"
|
||||||
|
foreach(${1:item} \$\{${2:list}\})
|
||||||
|
$0
|
||||||
|
endforeach()
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet function "function"
|
||||||
|
function(${1:name} ${2:...})
|
||||||
|
$0
|
||||||
|
endfunction()
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
# TODO: get_cmake_property()
|
||||||
|
# TODO: get_directory_property()
|
||||||
|
# TODO: get_filename_property()
|
||||||
|
# TODO: get_property()
|
||||||
|
# TODO: get_source_file_property()
|
||||||
|
# TODO: get_target_property()
|
||||||
|
# TODO: get_test_property()
|
||||||
|
|
||||||
|
snippet if "if"
|
||||||
|
if(${1:condition})
|
||||||
|
$0
|
||||||
|
endif()
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet include_directories "include_directories"
|
||||||
|
include_directories($1)
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
# TODO: include_external_msproject()
|
||||||
|
# TODO: include_regular_expression()
|
||||||
|
# TODO: include()
|
||||||
|
# TODO: install()
|
||||||
|
# TODO: link_directories()
|
||||||
|
# TODO: list()
|
||||||
|
# TODO: load_cache()
|
||||||
|
# TODO: load_command()
|
||||||
|
# TODO: macro()
|
||||||
|
# TODO: mark_as_advanced()
|
||||||
|
# TODO: math()
|
||||||
|
|
||||||
|
snippet message "message"
|
||||||
|
message($1`!p snip.rv=complete(t[1], ['STATUS', 'WARNING', 'AUTHOR_WARNING', 'SEND_ERROR', 'FATAL_ERROR', 'DEPRECATION'])` "$2")
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet option "option"
|
||||||
|
option(${1:option} "${2:description}." $3`!p snip.rv=complete(t[3], ['ON', 'OFF'])`)
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet project "project"
|
||||||
|
project(${1:name}${2: VERSION ${4:version}}${5: LANGUAGES ${6:languages}})
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
# TODO: qt_wrap_cpp()
|
||||||
|
# TODO: qt_wrap_ui()
|
||||||
|
# TODO: remove_definitions()
|
||||||
|
|
||||||
|
snippet return "return"
|
||||||
|
return()
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet separate_arguments "separate_arguments"
|
||||||
|
separate_arguments(${1:variable} $2`!p snip.rv=complete(t[2], ['UNIX_COMMAND', 'WINDOWS_COMMAND'])` "${3:arguments}")
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet set_directory_properties "set_directory_properties"
|
||||||
|
set_directory_properties(PROPERTIES ${1:property} ${2:value})
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet set_property "set_property"
|
||||||
|
set_property($1`!p
|
||||||
|
scopes=['GLOBAL', 'DIRECTORY', 'TARGET', 'SOURCE', 'TEST', 'CACHE']
|
||||||
|
snip.rv=complete(t[1], scopes)`${2/(.*)/(?1: :)/}${2:`!p
|
||||||
|
if 0 == len(t[1]):
|
||||||
|
snip.rv=''
|
||||||
|
elif 'DIRECTORY'.startswith(t[1]):
|
||||||
|
snip.rv='directory'
|
||||||
|
elif 2 <= len(t[1]) and 'TARGET'.startswith(t[1]):
|
||||||
|
snip.rv='targets'
|
||||||
|
elif 'SOURCE'.startswith(t[1]):
|
||||||
|
snip.rv='sources'
|
||||||
|
elif 2 <= len(t[1]) and 'TEST'.startswith(t[1]):
|
||||||
|
snip.rv='tests'
|
||||||
|
elif 'CACHE'.startswith(t[1]):
|
||||||
|
snip.rv='entries'
|
||||||
|
else:
|
||||||
|
snip.rv=''`}${3:
|
||||||
|
APPEND}${4:
|
||||||
|
APPEND_STRING}
|
||||||
|
PROPERTY ${5:name}${6: ${7:values}})
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet set "set"
|
||||||
|
set(${1:variable} ${2:value})
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet set_source_files_properties "set_source_files_properties"
|
||||||
|
set_source_files_properties(${1:files}
|
||||||
|
PROPERTIES ${property} ${value})
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet set_target_properties "set_target_properties"
|
||||||
|
set_target_properties(${1:targets}
|
||||||
|
PROPERTIES ${2:property} ${3:value})
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet set_tests_properties "set_tests_properties"
|
||||||
|
set_tests_properties(${1:tests}
|
||||||
|
PROPERTIES ${2:property} ${3:value})
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet site_name "site_name"
|
||||||
|
site_name(${1:variable})
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet source_group "source_group"
|
||||||
|
source_group(${1:name}${2:
|
||||||
|
FILES ${3:sources}}${4:
|
||||||
|
REGULAR_EXPRESSION "${5:regex}"})
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
#string(REGEX MATCH <regular_expression>
|
||||||
|
# <output variable> <input> [<input>...])
|
||||||
|
#string(REGEX MATCHALL <regular_expression>
|
||||||
|
# <output variable> <input> [<input>...])
|
||||||
|
#string(REGEX REPLACE <regular_expression>
|
||||||
|
# <replace_expression> <output variable>
|
||||||
|
# <input> [<input>...])
|
||||||
|
#string(REPLACE <match_string>
|
||||||
|
# <replace_string> <output variable>
|
||||||
|
# <input> [<input>...])
|
||||||
|
#string(CONCAT <output variable> [<input>...])
|
||||||
|
#string(<MD5|SHA1|SHA224|SHA256|SHA384|SHA512>
|
||||||
|
# <output variable> <input>)
|
||||||
|
#string(COMPARE EQUAL <string1> <string2> <output variable>)
|
||||||
|
#string(COMPARE NOTEQUAL <string1> <string2> <output variable>)
|
||||||
|
#string(COMPARE LESS <string1> <string2> <output variable>)
|
||||||
|
#string(COMPARE GREATER <string1> <string2> <output variable>)
|
||||||
|
#string(ASCII <number> [<number> ...] <output variable>)
|
||||||
|
#string(CONFIGURE <string1> <output variable>
|
||||||
|
# [@ONLY] [ESCAPE_QUOTES])
|
||||||
|
#string(TOUPPER <string1> <output variable>)
|
||||||
|
#string(TOLOWER <string1> <output variable>)
|
||||||
|
#string(LENGTH <string> <output variable>)
|
||||||
|
#string(SUBSTRING <string> <begin> <length> <output variable>)
|
||||||
|
#string(STRIP <string> <output variable>)
|
||||||
|
#string(RANDOM [LENGTH <length>] [ALPHABET <alphabet>]
|
||||||
|
# [RANDOM_SEED <seed>] <output variable>)
|
||||||
|
#string(FIND <string> <substring> <output variable> [REVERSE])
|
||||||
|
#string(TIMESTAMP <output variable> [<format string>] [UTC])
|
||||||
|
#string(MAKE_C_IDENTIFIER <input string> <output variable>)
|
||||||
|
|
||||||
|
snippet target_compile_definitions "target_compile_options"
|
||||||
|
target_compile_definitions(${1:target}
|
||||||
|
$2`!p snip.rv=complete(t[2], ['INTERFACE', 'PUBLIC', 'PRIVATE'])` ${4:definitions})
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet target_compile_options "target_compile_options"
|
||||||
|
target_compile_options(${1:target}${2: BEFORE}
|
||||||
|
$3`!p snip.rv=complete(t[3], ['INTERFACE', 'PUBLIC', 'PRIVATE'])` ${4:options})
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet target_include_directories "target_include_directories"
|
||||||
|
target_include_directories(${1:target}${2: SYSTEM}${3: BEFORE}
|
||||||
|
$4`!p snip.rv=complete(t[4], ['INTERFACE', 'PUBLIC', 'PRIVATE'])` ${5:includes})
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet target_link_libraries "target_link_libraries"
|
||||||
|
target_link_libraries(${1:target}
|
||||||
|
$2`!p snip.rv=complete(t[2], ['PRIVATE', 'PUBLIC', 'INTERFACE'])` ${3:libraries})
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet try_compile "try_compile CMAKE"
|
||||||
|
try_compile(${1:result} ${2:binary_dir} ${3:source_dir}
|
||||||
|
${4:project_name}${5: ${6:target_name}}${7: CMAKE_FLAGS ${8:flags}}${9:
|
||||||
|
OUTPUT_VARIABLE ${10:variable}})
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet try_compile "try_compile RAW"
|
||||||
|
try_compile(${1:result} ${2:binary_dir}${3: SOURCES} ${4:source_files}${5:
|
||||||
|
CMAKE_FLAGS ${6:flags}}${7:
|
||||||
|
COMPILE_DEFINITIONS ${8:flags}}${9:
|
||||||
|
LINK_LIBRARIES ${10:libs}}${11:
|
||||||
|
OUTPUT_VARIABLE ${12:output}}${13:
|
||||||
|
COPY_FILE ${14:file_name} COPY_FILE_ERROR ${15:copy_result}})
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet try_run "try_run"
|
||||||
|
try_run(${1:run_result} ${2:compile_result}
|
||||||
|
${3:binary_dir} ${4:source_file}${5: CMAKE_FLAGS ${6:flags}}${7:
|
||||||
|
COMPILE_DEFINITIONS ${8:flags}}${9:
|
||||||
|
COMPILE_OUTPUT_VARIABLE ${10:compile_output}}${11:
|
||||||
|
RUN_OUTPUT_VARIABLE ${12:run_output}}${13:
|
||||||
|
OUTPUT_VARIABLE ${14:output}}${15:
|
||||||
|
ARGS ${16:arguments}})
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet unset "unset"
|
||||||
|
unset(${1:variable}${2: $3`!p snip.rv=complete(t[3], ['CACHE', 'PARENT_SCOPE'])`})
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet variable_watch "variable_watch"
|
||||||
|
variable_watch(${1:variable}${2: ${3:command}})
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet while "while"
|
||||||
|
while(${1:condition})
|
||||||
|
$0
|
||||||
|
endwhile()
|
||||||
|
endsnippet
|
47
UltiSnips/cpp.snippets
Normal file
47
UltiSnips/cpp.snippets
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
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 for "For loop, index or range"
|
||||||
|
for (${1:auto} ${2:index} ${3/(.*;.*)|(\w*)/(?1:=:\:)/} ${3:0; $2 < ${4:count}; $2${5:++}}) {
|
||||||
|
$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/}();
|
||||||
|
|
||||||
|
private:
|
||||||
|
$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
52
UltiSnips/html.snippets
Normal 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
|
56
UltiSnips/html_reveal.js.snippets
Normal file
56
UltiSnips/html_reveal.js.snippets
Normal 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
144
UltiSnips/redmine.snippets
Normal 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
17
UltiSnips/xml.snippets
Normal 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}="${0: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
|
Loading…
x
Reference in New Issue
Block a user