parent
d056a9b61b
commit
5e4cc8398c
5
IDEAS
5
IDEAS
|
@ -1,3 +1,8 @@
|
||||||
|
2007/08/11:
|
||||||
|
|
||||||
|
Instead of storing method state in the method objects (for mode callback stuff),
|
||||||
|
we should probably store it in the buffer.
|
||||||
|
|
||||||
2007/07/19:
|
2007/07/19:
|
||||||
|
|
||||||
Convert all classes to subclass object.
|
Convert all classes to subclass object.
|
||||||
|
|
16
method.py
16
method.py
|
@ -157,7 +157,8 @@ class RegexReverseSearch(RegexSearch):
|
||||||
|
|
||||||
class Replace(Method):
|
class Replace(Method):
|
||||||
'''Replace occurances of string X with string Y'''
|
'''Replace occurances of string X with string Y'''
|
||||||
args = [Argument('before', prompt="Replace: ",
|
is_literal = True
|
||||||
|
args = [Argument('before', prompt="Replace String: ",
|
||||||
default=default.last_replace_before, load_default=True),
|
default=default.last_replace_before, load_default=True),
|
||||||
Argument('after', prompt="Replace With: ",
|
Argument('after', prompt="Replace With: ",
|
||||||
default=default.last_replace_after, load_default=True)]
|
default=default.last_replace_after, load_default=True)]
|
||||||
|
@ -167,6 +168,19 @@ class Replace(Method):
|
||||||
a.last_replace_after = self.after = vargs['after']
|
a.last_replace_after = self.after = vargs['after']
|
||||||
self.old_window = w
|
self.old_window = w
|
||||||
a.open_mini_buffer('I-Replace: ', lambda x: None, self, None, 'replace')
|
a.open_mini_buffer('I-Replace: ', lambda x: None, self, None, 'replace')
|
||||||
|
class RegexReplace(Method):
|
||||||
|
'''Replace occurances of string X with string Y'''
|
||||||
|
is_literal = False
|
||||||
|
args = [Argument('before', prompt="Replace Regex: ",
|
||||||
|
default=default.last_replace_before, load_default=True),
|
||||||
|
Argument('after', prompt="Replace With: ",
|
||||||
|
default=default.last_replace_after, load_default=True)]
|
||||||
|
def _execute(self, w, **vargs):
|
||||||
|
w.application.last_replace_before = self.before = vargs['before']
|
||||||
|
w.application.last_replace_after = self.after = vargs['after']
|
||||||
|
self.old_window = w
|
||||||
|
f = lambda x: None
|
||||||
|
w.application.open_mini_buffer('I-RegexReplace: ', f, self, None, 'replace')
|
||||||
|
|
||||||
# navigating between buffers
|
# navigating between buffers
|
||||||
class OpenFile(Method):
|
class OpenFile(Method):
|
||||||
|
|
|
@ -133,7 +133,8 @@ class PythonTabber(tab2.StackTabber):
|
||||||
elif self.is_rightmost_token(y, i):
|
elif self.is_rightmost_token(y, i):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
self._pop()
|
#self._pop()
|
||||||
|
pass
|
||||||
elif fqname == 'keyword':
|
elif fqname == 'keyword':
|
||||||
if token.string in self.endlevel_names:
|
if token.string in self.endlevel_names:
|
||||||
# we know we'll unindent at least once
|
# we know we'll unindent at least once
|
||||||
|
|
|
@ -57,7 +57,10 @@ def _find_next(m, move=False):
|
||||||
w = m.old_window
|
w = m.old_window
|
||||||
c = w.logical_cursor()
|
c = w.logical_cursor()
|
||||||
try:
|
try:
|
||||||
|
if m.is_literal:
|
||||||
r = re.compile(searchutil.escape_literal(s))
|
r = re.compile(searchutil.escape_literal(s))
|
||||||
|
else:
|
||||||
|
r = re.compile(s)
|
||||||
except:
|
except:
|
||||||
(m.p1, m.p2) = (None, None)
|
(m.p1, m.p2) = (None, None)
|
||||||
return False
|
return False
|
||||||
|
|
1
mode2.py
1
mode2.py
|
@ -126,6 +126,7 @@ class Fundamental(Handler):
|
||||||
self.add_bindings('regex-reverse-search', ('M-C-r',))
|
self.add_bindings('regex-reverse-search', ('M-C-r',))
|
||||||
self.add_bindings('toggle-margins', ('M-m',))
|
self.add_bindings('toggle-margins', ('M-m',))
|
||||||
self.add_bindings('replace', ('M-%',))
|
self.add_bindings('replace', ('M-%',))
|
||||||
|
self.add_bindings('regex-replace', ('M-$',))
|
||||||
self.add_bindings('open-file', ('C-x C-f',))
|
self.add_bindings('open-file', ('C-x C-f',))
|
||||||
self.add_bindings('kill-buffer', ('C-x k',))
|
self.add_bindings('kill-buffer', ('C-x k',))
|
||||||
self.add_bindings('list-buffers', ('C-x C-b',))
|
self.add_bindings('list-buffers', ('C-x C-b',))
|
||||||
|
|
Loading…
Reference in New Issue