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