Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"noarg": true,
"noempty": true,
"nonew": true,
"quotmark": false,
"quotmark": "double",
"undef": true,
"unused": true,
"strict": false,
Expand All @@ -31,6 +31,8 @@
"white": true,

"globals": {

"define": true,
"brackets": true,
"Mustache": true
}
}
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 1.2.0
* Added support for snippet keyboard shortcuts

## 1.1.0
* Added new settings panel - [#34](https://github.com/jrowny/brackets-snippets/pull/34)
* Added support for inline snippets - [#15](https://github.com/jrowny/brackets-snippets/issues/15)
Expand Down
3 changes: 2 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
The MIT License (MIT)

Copyright (c) 2014 Jonathan Rowny and other contributors
https://github.com/jrowny/brackets-snippets/graphs/contributors
http://www.jonathanrowny.com
http://github.com/jrowny/brackets-snippets/graphs/contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
40 changes: 37 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,40 @@ for (x = 0; x < myArray.length; x++) {

If you omit parameters, an inline form will appear. Use `ESC` to close the inline form or `ENTER` to complete the insertion.

Adding Snippets
===============
You can create new JSON files in the ```data``` directory or you can edit the existing ```javascript.json``` file. Your JSON files can reference template files if they have a `.snippet` extension and are in the `data\snippets` directory. See html5.snippet for an example.
![Example animation](https://raw.github.com/jrowny/brackets-snippets/master/docs/angularExample.gif)

Own snippets
============

It's recommended to copy data directory from extension to your own place and link to it through settings dialog.
You can edit the data directory inside the extension __but this will be overridden on every extension update__.

You can create new JSON files in the ```data``` directory or you can edit the existing ```javascript.json``` file.
Your JSON files can reference template files if they have a `.snippet` extension and are in the `data\snippets` directory. See html5.snippet for an example.

Snippets with keyboard shortcuts
================================

You can defined own shortcuts for immediate snippet execution on current cursor position like this:

```
{
"name": "Sample inline script for console logging",
"trigger": "log",
"usage": "log x",
"description": "Log a message into console",
"template": "console.log($${message});!!{cursor}",
"inline": true,
"shortcut": "Alt-L"
}
```

And then simply use it while working on your code:

- using arguments on the line:

![Shortcut sample animation](https://raw.github.com/jrowny/brackets-snippets/master/docs/snippetShortcutArgs.gif)

- or using snippet widget:

![Shortcut sample animation 2](https://raw.github.com/jrowny/brackets-snippets/master/docs/snippetShortcutWidget.gif)
3 changes: 2 additions & 1 deletion data/javascript.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"usage": "log x",
"description": "Log a message into console",
"template": "console.log($${message});!!{cursor}",
"inline": true
"inline": true,
"shortcut": "Alt-L"
}
]
Binary file added docs/angularExample.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/snippetShortcutArgs.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/snippetShortcutWidget.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading