]>
Commit | Line | Data |
---|---|---|
24c7594d BB |
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' | |
455f099b BB |
23 | deleteCommand: |
24 | type: 'string' | |
25 | default: 'd s' | |
24c7594d BB |
26 | |
27 | activate: (state) -> | |
28 | @commandClasses = [ | |
29 | Surround, Delete, Change | |
30 | ] | |
31 | ||
32 | @configLoop = atom.config.observe 'vim-surround', (config) => | |
33 | @disposables.dispose() if @disposables? | |
34 | @disposables = new CompositeDisposable | |
35 | ||
36 | @commands = [] | |
37 | ||
38 | for cls in @commandClasses | |
39 | command = new cls config | |
40 | @commands.push command | |
41 | @disposables.add command.disposables | |
42 | ||
455f099b BB |
43 | consumeVimMode: (vimMode) -> @vimMode = vimMode |
44 | ||
45 | deactivate: () -> @disposables.dispose() |