aboutsummaryrefslogtreecommitdiff
path: root/atom/packages/vim-surround/lib/vim-surround.coffee
diff options
context:
space:
mode:
Diffstat (limited to 'atom/packages/vim-surround/lib/vim-surround.coffee')
-rw-r--r--atom/packages/vim-surround/lib/vim-surround.coffee41
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()