]> git.r.bdr.sh - rbdr/dotfiles/blob - atom/packages/vim-surround/lib/vim-surround.coffee
b9fd33258f69698e213c0ad0a1c3a48b552efa48
[rbdr/dotfiles] / atom / packages / vim-surround / lib / vim-surround.coffee
1 {CompositeDisposable} = require 'atom'
2
3 Surround = require './command/surround'
4 Delete = require './command/delete'
5 Change = require './command/change'
6
7 module.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()