##// END OF EJS Templates
Add config option for vi/emacs style open-editor shortcuts...
Thomas Kluyver -
Show More
@@ -188,7 +188,12 b' class TerminalInteractiveShell(InteractiveShell):'
188 default_value='multicolumn').tag(config=True)
188 default_value='multicolumn').tag(config=True)
189
189
190 highlight_matching_brackets = Bool(True,
190 highlight_matching_brackets = Bool(True,
191 help="Highlight matching brackets .",
191 help="Highlight matching brackets.",
192 ).tag(config=True)
193
194 extra_open_editor_shortcuts = Bool(False,
195 help="Enable vi (v) or Emacs (C-X C-E) shortcuts to open an external editor. "
196 "This is in addition to the F2 binding, which is always enabled."
192 ).tag(config=True)
197 ).tag(config=True)
193
198
194 @observe('term_title')
199 @observe('term_title')
@@ -217,7 +222,9 b' class TerminalInteractiveShell(InteractiveShell):'
217 return
222 return
218
223
219 # Set up keyboard shortcuts
224 # Set up keyboard shortcuts
220 kbmanager = KeyBindingManager.for_prompt()
225 kbmanager = KeyBindingManager.for_prompt(
226 enable_open_in_editor=self.extra_open_editor_shortcuts,
227 )
221 register_ipython_shortcuts(kbmanager.registry, self)
228 register_ipython_shortcuts(kbmanager.registry, self)
222
229
223 # Pre-populate history from IPython's history database
230 # Pre-populate history from IPython's history database
@@ -77,10 +77,6 b' def register_ipython_shortcuts(registry, shell):'
77 filter=HasFocus(DEFAULT_BUFFER)
77 filter=HasFocus(DEFAULT_BUFFER)
78 )(open_input_in_editor)
78 )(open_input_in_editor)
79
79
80 registry.add_binding('v',
81 filter=HasFocus(DEFAULT_BUFFER) & ViNavigationMode()
82 )(open_input_in_editor)
83
84 if shell.display_completions == 'readlinelike':
80 if shell.display_completions == 'readlinelike':
85 registry.add_binding(Keys.ControlI,
81 registry.add_binding(Keys.ControlI,
86 filter=(HasFocus(DEFAULT_BUFFER)
82 filter=(HasFocus(DEFAULT_BUFFER)
General Comments 0
You need to be logged in to leave comments. Login now