Skip to content

Commit f42ee71

Browse files
committed
Added modified snippets for vim's ultisnips plugin
Filenames are prepended with 'javascript_' so UltiSnips will load them for javascript files.
1 parent b765eab commit f42ee71

7 files changed

+133
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2974,6 +2974,12 @@ Use file templates or snippets to help follow consistent styles and patterns. He
29742974
- set [neosnippet.vim](https://github.com/Shougo/neosnippet.vim)
29752975
- copy snippets to snippet directory
29762976
2977+
- vim UltiSnips snippets that follow these styles and guidelines.
2978+
2979+
- Download the [vim Angular UltiSnips snippets](assets/vim-angular-ultisnips?raw=true)
2980+
- set [UltiSnips](https://github.com/SirVer/ultisnips)
2981+
- copy snippets to UltiSnips directory
2982+
29772983
```javascript
29782984
ngcontroller // creates an Angular controller
29792985
ngdirective // creates an Angular directive
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
snippet ngcontroller
2+
(function() {
3+
'use strict';
4+
5+
angular
6+
.module('${1:module}')
7+
.controller('${2:Controller}Controller', $2Controller);
8+
9+
/* @ngInject */
10+
function $2Controller(${3:dependencies}) {
11+
var vm = this;
12+
vm.title = '$2Controller';
13+
14+
activate();
15+
16+
////////////////
17+
18+
function activate() {
19+
}
20+
}
21+
})();
22+
endsnippet
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
snippet ngdirective
2+
(function() {
3+
'use strict';
4+
5+
angular
6+
.module('${1:module}')
7+
.directive('${2:directive}', $2);
8+
9+
/* @ngInject */
10+
function $2(${3:dependencies}) {
11+
// Usage:
12+
//
13+
// Creates:
14+
//
15+
var directive = {
16+
bindToController: true,
17+
controller: ${4:Controller},
18+
controllerAs: '${5:vm}',
19+
link: link,
20+
restrict: 'A',
21+
scope: {
22+
}
23+
};
24+
return directive;
25+
26+
function link(scope, element, attrs) {
27+
}
28+
}
29+
30+
/* @ngInject */
31+
function $4() {
32+
33+
}
34+
})();
35+
endsnippet
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
snippet ngfactory
2+
(function() {
3+
'use strict';
4+
5+
angular
6+
.module('${1:module}')
7+
.factory('${2:factory}', $2);
8+
9+
/* @ngInject */
10+
function $2(${3:dependencies}) {
11+
var service = {
12+
${4:func}: $4
13+
};
14+
return service;
15+
16+
////////////////
17+
18+
function $4() {
19+
}
20+
}
21+
})();
22+
endsnippet
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
snippet ngfilter
2+
(function() {
3+
'use strict';
4+
5+
angular
6+
.module('${1:module}')
7+
.filter('${2:filter}', $2);
8+
9+
function $2() {
10+
return $2Filter;
11+
12+
////////////////
13+
function $2Filter(${3:params}) {
14+
return $3;
15+
};
16+
}
17+
18+
})();
19+
endsnippet
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
snippet ngmodule
2+
(function() {
3+
'use strict';
4+
5+
angular
6+
.module('${1:module}', [
7+
'${2:dependencies}'
8+
]);
9+
})();
10+
endsnippet
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
snippet ngservice
2+
(function() {
3+
'use strict';
4+
5+
angular
6+
.module('${1:module}')
7+
.service('${2:Service}', $2);
8+
9+
/* @ngInject */
10+
function $2(${3:dependencies}) {
11+
this.${4:func} = $4;
12+
13+
////////////////
14+
15+
function $4() {
16+
}
17+
}
18+
})();
19+
endsnippet

0 commit comments

Comments
 (0)