aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts
diff options
context:
space:
mode:
authorStephen Blott2017-12-12 10:46:27 +0000
committerGitHub2017-12-12 10:46:27 +0000
commit1199f5b7b096c7f8e2fab2034a3aa3ea795478af (patch)
tree2aa1f465520db751a8bb328fc75d71c436b2d89c /content_scripts
parentfb38b9c17d32c40a5359f8d4fd2c5cbd38cfe630 (diff)
parent9fb755929f5b629c57f77e6407c5c24ccd06e4a4 (diff)
downloadvimium-1199f5b7b096c7f8e2fab2034a3aa3ea795478af.tar.bz2
Merge pull request #2371 from smblott-github/add-swap-option-for-marks
Add "swap" command option for marks.
Diffstat (limited to 'content_scripts')
-rw-r--r--content_scripts/marks.coffee12
1 files changed, 9 insertions, 3 deletions
diff --git a/content_scripts/marks.coffee b/content_scripts/marks.coffee
index ac653a52..fb1d1b1d 100644
--- a/content_scripts/marks.coffee
+++ b/content_scripts/marks.coffee
@@ -2,6 +2,7 @@
Marks =
previousPositionRegisters: [ "`", "'" ]
localRegisters: {}
+ currentRegistryEntry: null
mode: null
exit: (continuation = null) ->
@@ -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..."
@@ -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..."