1
0
Fork 0
mirror of synced 2024-11-04 08:28:57 -05:00
ultimate-vim/sources_non_forked/vim-snippets/UltiSnips/javascript-node.snippets

66 lines
1 KiB
Text
Raw Normal View History

2015-12-08 08:20:04 -05:00
priority -50
2019-08-22 11:36:17 -04:00
snippet #! "#!/usr/bin/env node" b
2015-12-08 08:20:04 -05:00
#!/usr/bin/env node
endsnippet
snippet vreq "assign a CommonJS-style module to a var"
2017-02-11 08:01:38 -05:00
var ${0:${1/(.+\/)*(\w+)(-|\b|$)(\..+$)?/\u$2/g}} = require('$1');
2015-12-08 08:20:04 -05:00
endsnippet
snippet ex "module.exports"
2017-02-11 08:01:38 -05:00
module.exports = $1;
2015-12-08 08:20:04 -05:00
endsnippet
snippet hcs "http.createServer"
2017-02-11 08:01:38 -05:00
http.createServer($1).listen($2);
2015-12-08 08:20:04 -05:00
endsnippet
snippet ncs "net.createServer"
net.createServer(function(${1:socket}){
2017-02-11 08:01:38 -05:00
$1.on('data', function(${3:data}){
$4
2015-12-08 08:20:04 -05:00
});
2017-02-11 08:01:38 -05:00
$1.on('end', function(){
$5
2015-12-08 08:20:04 -05:00
});
}).listen(${6:8124});
endsnippet
snippet pipe "pipe"
2017-02-11 08:01:38 -05:00
pipe(${1:stream})$2
2015-12-08 08:20:04 -05:00
endsnippet
# Express snippets
snippet eget "express GET"
2017-02-11 08:01:38 -05:00
${1:app}.get('$2', $3);
2015-12-08 08:20:04 -05:00
endsnippet
snippet epost "express POST"
2017-02-11 08:01:38 -05:00
${1:app}.post('$2', $3);
2015-12-08 08:20:04 -05:00
endsnippet
snippet eput "express PUT"
2017-02-11 08:01:38 -05:00
${1:app}.put('$2', $3);
2015-12-08 08:20:04 -05:00
endsnippet
snippet edelete "express DELETE"
2017-02-11 08:01:38 -05:00
${1:app}.delete('$2', $3);
2015-12-08 08:20:04 -05:00
endsnippet
# process snippets
snippet stdout "stdout"
process.stdout
endsnippet
snippet stdin "stdin"
process.stdin
endsnippet
snippet stderr "stderr"
process.stderr
endsnippet