]> git.r.bdr.sh - rbdr/dotfiles/blob - atom/packages/vim-mode/lib/operators/indent-operators.coffee
0ad37e0296d984729d61ca60abe219b362f194bf
[rbdr/dotfiles] / atom / packages / vim-mode / lib / operators / indent-operators.coffee
1 {Operator} = require './general-operators'
2
3 class AdjustIndentation extends Operator
4 execute: (count=1) ->
5 mode = @vimState.mode
6 @motion.select(count)
7 {start} = @editor.getSelectedBufferRange()
8
9 @indent()
10
11 if mode isnt 'visual'
12 @editor.setCursorBufferPosition([start.row, 0])
13 @editor.moveToFirstCharacterOfLine()
14 @vimState.activateCommandMode()
15
16 class Indent extends AdjustIndentation
17 indent: ->
18 @editor.indentSelectedRows()
19
20 class Outdent extends AdjustIndentation
21 indent: ->
22 @editor.outdentSelectedRows()
23
24 class Autoindent extends AdjustIndentation
25 indent: ->
26 @editor.autoIndentSelectedRows()
27
28 module.exports = {Indent, Outdent, Autoindent}