]> git.r.bdr.sh - rbdr/dotfiles/blame - atom/packages/vim-surround/lib/vim-surround.coffee
Adds atom
[rbdr/dotfiles] / atom / packages / vim-surround / lib / vim-surround.coffee
CommitLineData
24c7594d
BB
1{CompositeDisposable} = require 'atom'
2
3Surround = require './command/surround'
4Delete = require './command/delete'
5Change = require './command/change'
6
7module.exports =
8 config:
9 pairs:
10 type: 'array'
11 default: ['()', '{}', '[]', '""', "''"]
12 items:
13 type: 'string'
14 changeSurroundCommand:
15 type: 'string'
16 default: 'c s'
17 deleteSurroundCommand:
18 type: 'string'
19 default: 'd s'
20 surroundCommand:
21 type: 'string'
22 default: 's'
23
24 activate: (state) ->
25 @commandClasses = [
26 Surround, Delete, Change
27 ]
28
29 @configLoop = atom.config.observe 'vim-surround', (config) =>
30 @disposables.dispose() if @disposables?
31 @disposables = new CompositeDisposable
32
33 @commands = []
34
35 for cls in @commandClasses
36 command = new cls config
37 @commands.push command
38 @disposables.add command.disposables
39
40 deactivate: () ->
41 @disposables.dispose()