blob: f2931946bf8f935f0da922d45e6fa4c891a3b0c9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
{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'
deleteCommand:
type: 'string'
default: 'd 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
consumeVimMode: (vimMode) -> @vimMode = vimMode
deactivate: () -> @disposables.dispose()
|