]> git.r.bdr.sh - rbdr/dotfiles/blob - atom/packages/vim-surround/lib/command/selector.coffee
Adds atom
[rbdr/dotfiles] / atom / packages / vim-surround / lib / command / selector.coffee
1 vimModePath = atom.packages.resolvePackagePath('vim-mode')
2 {SelectInsideQuotes, SelectInsideBrackets} = require "#{vimModePath}/lib/text-objects"
3
4 module.exports = class Selector
5 constructor: (@editor, left, right) ->
6 @left = left.trim()
7 @right = right.trim()
8
9 inside: ->
10 if @isBraket()
11 new SelectInsideBrackets(@editor, @left, @right, false)
12 else
13 new SelectInsideQuotes(@editor, @left, false)
14
15 outside: ->
16 if @isBraket()
17 new SelectInsideBrackets(@editor, @left, @right, true)
18 else
19 new SelectInsideQuotes(@editor, @left, true)
20
21 isBraket: ->
22 ['[', ']', '{', '}', '<', '>', '(', ')'].indexOf?(@left.trim()) >= 0