blob: 3603e1ed300fc5164b5bc8d169bad9a33a769b67 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
{MotionWithInput, MoveToFirstCharacterOfLine} = require './general-motions'
{ViewModel} = require '../view-models/view-model'
{Point, Range} = require 'atom'
module.exports =
class MoveToMark extends MotionWithInput
constructor: (@editor, @vimState, @linewise=true) ->
super(@editor, @vimState)
@operatesLinewise = @linewise
@viewModel = new ViewModel(this, class: 'move-to-mark', singleChar: true, hidden: true)
isLinewise: -> @linewise
moveCursor: (cursor, count=1) ->
markPosition = @vimState.getMark(@input.characters)
if @input.characters is '`' # double '`' pressed
markPosition ?= [0, 0] # if markPosition not set, go to the beginning of the file
@vimState.setMark('`', cursor.getBufferPosition())
cursor.setBufferPosition(markPosition) if markPosition?
if @linewise
cursor.moveToFirstCharacterOfLine()
|