]>
Commit | Line | Data |
---|---|---|
24c7594d BB |
1 | {CompositeDisposable} = require 'atom' |
2 | ||
3 | Base = require './base' | |
4 | ||
5 | module.exports = class Surround extends Base | |
6 | constructor: (config) -> | |
7 | @command = config.surroundCommand | |
8 | @context = "atom-text-editor.vim-mode.visual-mode" | |
9 | super config | |
10 | ||
11 | getName: (key) -> "surround-#{key}" | |
12 | ||
13 | getRunner: (left, right) -> -> | |
14 | editor = atom.workspace.getActiveTextEditor() | |
15 | editor.transact -> | |
16 | editor.selections.forEach (selection) -> | |
17 | text = selection.getText() | |
18 | selection.insertText "#{left}#{text}#{right}" |