pmacs3/mode/mini.py

38 lines
1.2 KiB
Python

import method, mode
class MiniCallback(method.Method):
def execute(self, window, **vargs):
window.buffer.do_callback()
class MiniTabComplete(method.Method):
def execute(self, window, **vargs):
b = window.buffer
if b.tabber is None:
window.application.set_error("No tab completion")
return
s1 = b.make_string()
s2, exists, complete = b.tabber.tab_string(s1, window)
b.set_data(s2)
class Mini(mode.Fundamental):
modename = 'Mini'
actions = [MiniCallback, MiniTabComplete]
def __init__(self, w):
mode.Fundamental.__init__(self, w)
# delete actions relating to multiple lines
#self.del_action('center-view')
#self.del_action('next-line')
#self.del_action('previous-line')
#self.del_action('page-down')
#self.del_action('page-up')
#self.del_action('goto-beginning')
#self.del_action('goto-end')
#self.del_action('switch-buffer')
# add some new actions for the minibuffer
self.add_bindings('mini-callback', ('RETURN',))
self.add_bindings('mini-tab-complete', ('TAB',))
install = Mini.install