[c/cpp] Added postfix tab stop to most snippets
This allows for people to quickly tab to the end of the snippet and continue writing code without having to exit insert mode.
This commit is contained in:
parent
5ea5d2893a
commit
67c276b85d
@ -27,11 +27,11 @@ snippet def
|
||||
snippet ifdef
|
||||
#ifdef ${1:FOO}
|
||||
${2:#define }
|
||||
#endif
|
||||
#endif${3}
|
||||
snippet #if
|
||||
#if ${1:FOO}
|
||||
${2}
|
||||
#endif
|
||||
#endif${3}
|
||||
# Header Include-Guard
|
||||
snippet once
|
||||
#ifndef ${1:`toupper(Filename('$1_H', 'UNTITLED_H'))`}
|
||||
@ -45,15 +45,15 @@ snippet once
|
||||
snippet if
|
||||
if (${1:/* condition */}) {
|
||||
${2:/* code */}
|
||||
}
|
||||
}${3}
|
||||
snippet el
|
||||
else {
|
||||
${1}
|
||||
}
|
||||
}${2}
|
||||
snippet elif
|
||||
else if (${1:/* condition */}) {
|
||||
${2:/* code */}
|
||||
}
|
||||
}${3}
|
||||
# Ternary conditional
|
||||
snippet t
|
||||
${1:/* condition */} ? ${2:a} : ${3:b}
|
||||
@ -61,28 +61,28 @@ snippet t
|
||||
snippet do
|
||||
do {
|
||||
${2:/* code */}
|
||||
} while (${1:/* condition */});
|
||||
} while (${1:/* condition */});${3}
|
||||
# While Loop
|
||||
snippet wh
|
||||
while (${1:/* condition */}) {
|
||||
${2:/* code */}
|
||||
}
|
||||
}${3}
|
||||
# For Loop
|
||||
snippet for
|
||||
for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) {
|
||||
${4:/* code */}
|
||||
}
|
||||
}${5}
|
||||
# Custom For Loop
|
||||
snippet forr
|
||||
for (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) {
|
||||
${5:/* code */}
|
||||
}
|
||||
}${6}
|
||||
# Function
|
||||
snippet fun
|
||||
${1:void} ${2:function_name}(${3})
|
||||
{
|
||||
${4:/* code */}
|
||||
}
|
||||
}${5}
|
||||
# Function Declaration
|
||||
snippet fund
|
||||
${1:void} ${2:function_name}(${3});${4}
|
||||
@ -98,12 +98,12 @@ snippet st
|
||||
snippet tds
|
||||
typedef struct ${2:_$1 }{
|
||||
${3:/* data */}
|
||||
} ${1:`Filename('$1_t', 'name')`};
|
||||
} ${1:`Filename('$1_t', 'name')`};${4}
|
||||
# Typdef enum
|
||||
snippet tde
|
||||
typedef enum {
|
||||
${1:/* data */}
|
||||
} ${2:foo};
|
||||
} ${2:foo};${3}
|
||||
# printf
|
||||
# unfortunately version this isn't as nice as TextMates's, given the lack of a
|
||||
# dynamic `...`
|
||||
|
@ -80,7 +80,7 @@ snippet cl
|
||||
# member function implementation
|
||||
snippet mfun
|
||||
${4:void} ${1:`Filename('$1', 'ClassName')`}::${2:memberFunction}(${3}) {
|
||||
${5:return};
|
||||
${5:/* code */}
|
||||
}
|
||||
# namespace
|
||||
snippet ns
|
||||
@ -91,10 +91,10 @@ snippet ns
|
||||
## Input/Output
|
||||
# std::cout
|
||||
snippet cout
|
||||
std::cout << ${1} << std::endl;
|
||||
std::cout << ${1} << std::endl;${2}
|
||||
# std::cin
|
||||
snippet cin
|
||||
std::cin >> ${1};
|
||||
std::cin >> ${1};${2}
|
||||
# read file into vector
|
||||
snippet readfile
|
||||
std::vector<char> v;
|
||||
@ -111,22 +111,22 @@ snippet readfile
|
||||
snippet fori
|
||||
for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) {
|
||||
${4:/* code */}
|
||||
}
|
||||
}${5}
|
||||
|
||||
# foreach
|
||||
snippet fore
|
||||
for (${1:auto} ${2:i} : ${3:container}) {
|
||||
${4:/* code */}
|
||||
}
|
||||
}${5}
|
||||
# iterator
|
||||
snippet iter
|
||||
for (${1:std::vector}<${2:type}>::${3:const_iterator} ${4:i} = ${5:container}.begin(); $4 != $5.end(); ++$4) {
|
||||
${6}
|
||||
}
|
||||
}${7}
|
||||
|
||||
# auto iterator
|
||||
snippet itera
|
||||
for (auto ${1:i} = $1.begin(); $1 != $1.end(); ++$1) {
|
||||
${2:std::cout << *$1 << std::endl;}
|
||||
}
|
||||
}${3}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user