diff options
author | Florian Pritz <f-p@gmx.at> | 2009-07-11 19:18:11 +0200 |
---|---|---|
committer | Florian Pritz <f-p@gmx.at> | 2009-07-11 19:18:11 +0200 |
commit | 63d8549694485f1f16833c2c7fc206f40492250a (patch) | |
tree | aa2c8294788bfe5525c40442a2ead8fe8623d903 /.vim/snippets/javascript.snippets | |
parent | 17c9fb56433064f0535e2727d2cf4a3f4faeb7d8 (diff) | |
download | dotfiles-63d8549694485f1f16833c2c7fc206f40492250a.tar.gz dotfiles-63d8549694485f1f16833c2c7fc206f40492250a.tar.xz |
new plugins and keybindings
Diffstat (limited to '.vim/snippets/javascript.snippets')
-rw-r--r-- | .vim/snippets/javascript.snippets | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/.vim/snippets/javascript.snippets b/.vim/snippets/javascript.snippets new file mode 100644 index 0000000..51f5e05 --- /dev/null +++ b/.vim/snippets/javascript.snippets @@ -0,0 +1,74 @@ +# Prototype +snippet proto + ${1:class_name}.prototype.${2:method_name} = + function(${3:first_argument}) { + ${4:// body...} + }; +# Function +snippet fun + function ${1:function_name} (${2:argument}) { + ${3:// body...} + } +# Anonymous Function +snippet f + function(${1}) {${2}}; +# if +snippet if + if (${1:true}) {${2}}; +# if ... else +snippet ife + if (${1:true}) {${2}} + else{${3}}; +# tertiary conditional +snippet t + ${1:/* condition */} ? ${2:a} : ${3:b} +# switch +snippet switch + switch(${1:expression}) { + case '${3:case}': + ${4:// code} + break; + ${5} + default: + ${2:// code} + } +# case +snippet case + case '${1:case}': + ${2:// code} + break; + ${3} +# for (...) {...} +snippet for + for (var ${2:i} = 0; $2 < ${1:Things}.length; $2${3:++}) { + ${4:$1[$2]} + }; +# for (...) {...} (Improved Native For-Loop) +snippet forr + for (var ${2:i} = ${1:Things}.length - 1; $2 >= 0; $2${3:--}) { + ${4:$1[$2]} + }; +# while (...) {...} +snippet wh + while (${1:/* condition */}) { + ${2:/* code */} + } +# do...while +snippet do + do { + ${2:/* code */} + } while (${1:/* condition */}); +# Object Method +snippet :f + ${1:method_name}: function(${2:attribute}) { + ${4} + }${3:,} +# setTimeout function +snippet timeout + setTimeout(function() {${3}}${2}, ${1:10}; +# Get Elements +snippet get + getElementsBy${1:TagName}('${2}')${3} +# Get Element +snippet gett + getElementBy${1:Id}('${2}')${3} |