diff options
| author | Ben Beltran <ben@nsovocal.com> | 2015-07-10 11:12:25 -0500 |
|---|---|---|
| committer | Ben Beltran <ben@nsovocal.com> | 2015-07-10 11:12:25 -0500 |
| commit | 24c7594d62d8d7fbbcdb64b11ce4adc5d8e6991a (patch) | |
| tree | ded312222bb108923da1820ba40b04d710d20e5b /atom/packages/vim-surround/lib/vim-surround.coffee | |
| parent | eb786e82d170e2abc351a432ade616d6ecdeeb6b (diff) | |
Adds atom
Diffstat (limited to 'atom/packages/vim-surround/lib/vim-surround.coffee')
| -rw-r--r-- | atom/packages/vim-surround/lib/vim-surround.coffee | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/atom/packages/vim-surround/lib/vim-surround.coffee b/atom/packages/vim-surround/lib/vim-surround.coffee new file mode 100644 index 0000000..b9fd332 --- /dev/null +++ b/atom/packages/vim-surround/lib/vim-surround.coffee @@ -0,0 +1,41 @@ +{CompositeDisposable} = require 'atom' + +Surround = require './command/surround' +Delete = require './command/delete' +Change = require './command/change' + +module.exports = + config: + pairs: + type: 'array' + default: ['()', '{}', '[]', '""', "''"] + items: + type: 'string' + changeSurroundCommand: + type: 'string' + default: 'c s' + deleteSurroundCommand: + type: 'string' + default: 'd s' + surroundCommand: + type: 'string' + default: 's' + + activate: (state) -> + @commandClasses = [ + Surround, Delete, Change + ] + + @configLoop = atom.config.observe 'vim-surround', (config) => + @disposables.dispose() if @disposables? + @disposables = new CompositeDisposable + + @commands = [] + + for cls in @commandClasses + command = new cls config + @commands.push command + @disposables.add command.disposables + + deactivate: () -> + @disposables.dispose() |