Skip to content

Commit

Permalink
Merge pull request #2371 from smblott-github/add-swap-option-for-marks
Browse files Browse the repository at this point in the history
Add "swap" command option for marks.
  • Loading branch information
smblott-github committed Dec 12, 2017
2 parents fb38b9c + 9fb7559 commit 1199f5b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions content_scripts/marks.coffee
Expand Up @@ -2,6 +2,7 @@
Marks =
previousPositionRegisters: [ "`", "'" ]
localRegisters: {}
currentRegistryEntry: null
mode: null

exit: (continuation = null) ->
Expand All @@ -26,10 +27,14 @@ Marks =
# If <Shift> is depressed, then it's a global mark, otherwise it's a local mark. This is consistent
# vim's [A-Z] for global marks and [a-z] for local marks. However, it also admits other non-Latin
# characters. The exceptions are "`" and "'", which are always considered local marks.
# The "swap" command option inverts global and local marks.
isGlobalMark: (event, keyChar) ->
event.shiftKey and keyChar not in @previousPositionRegisters
shiftKey = event.shiftKey
shiftKey = not shiftKey if @currentRegistryEntry.options.swap
shiftKey and keyChar not in @previousPositionRegisters

activateCreateMode: ->
activateCreateMode: (count, {registryEntry}) ->
@currentRegistryEntry = registryEntry
@mode = new Mode
name: "create-mark"
indicator: "Create mark..."
Expand All @@ -54,7 +59,8 @@ Marks =
@showMessage "Created local mark", keyChar
handlerStack.suppressEvent

activateGotoMode: ->
activateGotoMode: (count, {registryEntry}) ->
@currentRegistryEntry = registryEntry
@mode = new Mode
name: "goto-mark"
indicator: "Go to mark..."
Expand Down

0 comments on commit 1199f5b

Please sign in to comment.