parent
a9e1c757af
commit
e858fa7ba7
|
@ -12,6 +12,7 @@ class Replace(mode.Fundamental):
|
||||||
self.bindings = {}
|
self.bindings = {}
|
||||||
|
|
||||||
self.add_action_and_bindings(ReplaceAll(), ('a', '!',))
|
self.add_action_and_bindings(ReplaceAll(), ('a', '!',))
|
||||||
|
self.add_action_and_bindings(ReplaceDone(), ('d',))
|
||||||
self.add_action_and_bindings(ReplaceOne(), ('y', 'SPACE',))
|
self.add_action_and_bindings(ReplaceOne(), ('y', 'SPACE',))
|
||||||
self.add_action_and_bindings(SkipReplace(), ('n', 'DELETE',))
|
self.add_action_and_bindings(SkipReplace(), ('n', 'DELETE',))
|
||||||
self.add_action_and_bindings(CancelReplace(), ('q', 'RETURN', 'C-]', 'C-n', 'C-p', 'C-a', 'C-e', 'C-f', 'C-b'))
|
self.add_action_and_bindings(CancelReplace(), ('q', 'RETURN', 'C-]', 'C-n', 'C-p', 'C-a', 'C-e', 'C-f', 'C-b'))
|
||||||
|
@ -30,6 +31,13 @@ class ReplaceOne(method.Method):
|
||||||
_find_next(m, False)
|
_find_next(m, False)
|
||||||
_finish(m, w)
|
_finish(m, w)
|
||||||
|
|
||||||
|
class ReplaceDone(method.Method):
|
||||||
|
def execute(self, w, **vargs):
|
||||||
|
m = w.buffer.method
|
||||||
|
_replace(m)
|
||||||
|
_end(w)
|
||||||
|
w.set_error("Replace done")
|
||||||
|
|
||||||
class SkipReplace(method.Method):
|
class SkipReplace(method.Method):
|
||||||
def execute(self, w, **vargs):
|
def execute(self, w, **vargs):
|
||||||
m = w.buffer.method
|
m = w.buffer.method
|
||||||
|
@ -83,9 +91,9 @@ def _set_prompt(m):
|
||||||
y += 1
|
y += 1
|
||||||
x = 0
|
x = 0
|
||||||
if count > 1:
|
if count > 1:
|
||||||
p = 'Replace %r with %r [ynaq] (%d occurances)?' % (m.before, m.after, count)
|
p = 'Replace %r with %r [ynadq] (%d occurances)?' % (m.before, m.after, count)
|
||||||
else:
|
else:
|
||||||
p = 'Replace %r with %r [ynaq] (1 occurance)?' % (m.before, m.after)
|
p = 'Replace %r with %r [ynadq] (1 occurance)?' % (m.before, m.after)
|
||||||
w.application.mini_prompt = p
|
w.application.mini_prompt = p
|
||||||
|
|
||||||
def _replace(m):
|
def _replace(m):
|
||||||
|
|
Loading…
Reference in New Issue