Skip to content

Commit 92b4d42

Browse files
committed
Add a setting to allow jumping behind last characters in a line by default
1 parent bcb414f commit 92b4d42

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

AceJump.sublime-settings

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
// Toggles case sensitive search in word and character modes.
99
"search_case_sensitivity": true,
1010

11+
// If turned on, character mode will jump after a character
12+
// it it's the last character on a line.
13+
"jump_behind_last_characters": false,
14+
1115
// View settings that should be respected when switching the syntax
1216
// highlighting mode. In case a plugin you use adds a new
1317
// setting to a view, you probably want to add it to this list.

ace_jump.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77

88
next_search = False
99

10+
# MODES
11+
# 0: default (jumps in front of the selection)
12+
# 1: select
13+
# 2: add-cursor
14+
# 3: jump-after
1015
mode = 0
1116

1217
ace_jump_active = False
@@ -95,6 +100,7 @@ def run(self, current_buffer_only = False):
95100
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
96101
)
97102
self.case_sensitivity = settings.get("search_case_sensitivity", True)
103+
self.jump_behind_last = settings.get("jump_behind_last_characters", False)
98104

99105
self.view_settings = settings.get("view_settings", [])
100106
self.view_values = get_views_settings(
@@ -203,7 +209,6 @@ def remove_labels(self):
203209

204210
def jump(self, index):
205211
"""Performs the jump action"""
206-
207212
if self.target == "" or index < 0 or index >= last_index:
208213
return
209214

@@ -267,6 +272,15 @@ def after_jump(self, view):
267272
view.run_command("move", {"by": "characters", "forward": True})
268273
mode = 0
269274

275+
def jump(self, index):
276+
global mode
277+
278+
view = self.changed_views[self.view_for_index(index)]
279+
if self.jump_behind_last and "\n" in view.substr(hints[index].end()):
280+
mode = 3
281+
282+
return AceJumpCommand.jump(self, index)
283+
270284
class AceJumpLineCommand(AceJumpCommand):
271285
"""Specialized command for line-mode"""
272286

@@ -310,7 +324,6 @@ def run(self):
310324
global mode
311325

312326
mode = 0 if mode == 3 else 3
313-
print(mode)
314327

315328
class AddAceJumpLabelsCommand(sublime_plugin.TextCommand):
316329
"""Command for adding labels to the views"""
@@ -370,6 +383,7 @@ class PerformAceJumpCommand(sublime_plugin.TextCommand):
370383
"""Command performing the jump"""
371384

372385
def run(self, edit, target):
386+
global mode
373387
if mode == 0 or mode == 3:
374388
self.view.sel().clear()
375389

0 commit comments

Comments
 (0)