Iifefy
Sublime Text 3 plugin for wrapping Javascript code in IIFE's
Details
Installs
- Total 399
- Win 216
- Mac 131
- Linux 52
Feb 22 | Feb 21 | Feb 20 | Feb 19 | Feb 18 | Feb 17 | Feb 16 | Feb 15 | Feb 14 | Feb 13 | Feb 12 | Feb 11 | Feb 10 | Feb 9 | Feb 8 | Feb 7 | Feb 6 | Feb 5 | Feb 4 | Feb 3 | Feb 2 | Feb 1 | Jan 31 | Jan 30 | Jan 29 | Jan 28 | Jan 27 | Jan 26 | Jan 25 | Jan 24 | Jan 23 | Jan 22 | Jan 21 | Jan 20 | Jan 19 | Jan 18 | Jan 17 | Jan 16 | Jan 15 | Jan 14 | Jan 13 | Jan 12 | Jan 11 | Jan 10 | Jan 9 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Mac | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Linux | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
iifefy
A Sublime Text 3 plugin for wrapping Javascript code in immediately invoking function expressions.
Installation
Using Package Control (Recommended)
For all Sublime Text 2/3 users we recommend install via Package Control.
- Install Package Control if you haven't already
- Use
cmd+shift+P
(orctrl+shift+P
for Windows) then selectPackage Control: Install Package
- Search for
iifefy
and select to install
Manual Install
- Click the
Preferences > Browse Packages…
menu - Browse up a folder and then into the
Installed Packages/
folder - Download the zip archive, rename it to
Iifefy.sublime-package
and copy it into theInstalled Packages/
directory - Restart Sublime Text
Usage
This plugin provides two commands:
iifefy
: Wraps each current selection in an IIFE. If nothing is selected it wraps the entire document.
iifefy_skip_initial_comments
: Same as iifefy
, except it begins wrapping at the first non-comment, non-blank line. This is useful for certain per-file configuration comments, which some prefer to keep as the opening line.
Both of these commands add 'use strict';
and a trailing newline to each IIFE by default, but you can change the opening and closing strings that form the IIFE to whatever you like under Preferences > Package Settings > iifefy > Settings - User
.
The commands themselves are accessible directly in the context menu and from the Edit > Wrap
submenu. Keyboard shortcuts can be added by going to Preferences > Key Bindings - User
and adding the following to the file, replacing the key values with your preferred shortcuts:
{ "keys": [ "ctrl+i" ], "command": "iifefy", "context":
[{ "key": "selector", "operator": "equal", "operand": "source.js", "match_all": true }]
},
{ "keys": [ "ctrl+shift+i" ], "command": "iifefy_skip_initial_comments", "context":
[{ "key": "selector", "operator": "equal", "operand": "source.js", "match_all": true }]
}
Contributing
- Fork the repository
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request
License
Code copyright 2014 Professant LLC. Code released under the MIT License.