From 24c7594d62d8d7fbbcdb64b11ce4adc5d8e6991a Mon Sep 17 00:00:00 2001 From: Ben Beltran Date: Fri, 10 Jul 2015 11:12:25 -0500 Subject: Adds atom --- atom/packages/vim-surround/lib/command/surround.coffee | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 atom/packages/vim-surround/lib/command/surround.coffee (limited to 'atom/packages/vim-surround/lib/command/surround.coffee') diff --git a/atom/packages/vim-surround/lib/command/surround.coffee b/atom/packages/vim-surround/lib/command/surround.coffee new file mode 100644 index 0000000..e939f78 --- /dev/null +++ b/atom/packages/vim-surround/lib/command/surround.coffee @@ -0,0 +1,18 @@ +{CompositeDisposable} = require 'atom' + +Base = require './base' + +module.exports = class Surround extends Base + constructor: (config) -> + @command = config.surroundCommand + @context = "atom-text-editor.vim-mode.visual-mode" + super config + + getName: (key) -> "surround-#{key}" + + getRunner: (left, right) -> -> + editor = atom.workspace.getActiveTextEditor() + editor.transact -> + editor.selections.forEach (selection) -> + text = selection.getText() + selection.insertText "#{left}#{text}#{right}" -- cgit