Skip to content

Commit

Permalink
Backport PR #10330: Add config option for vi/emacs style open-editor …
Browse files Browse the repository at this point in the history
…shortcuts

F2 is always enabled, but passing the option to prompt_toolkit binds `v` (in vi mode, overriding its 'visual mode' function), and `C-X C-E` in emacs mode.

Closes gh-10259
Closes gh-10278
  • Loading branch information
Carreau authored and MeeseeksDev[bot] committed Feb 23, 2017
1 parent dad2d0e commit 3af8dd0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions IPython/terminal/interactiveshell.py
Expand Up @@ -192,7 +192,12 @@ def _displayhook_class_default(self):
default_value='multicolumn').tag(config=True)

highlight_matching_brackets = Bool(True,
help="Highlight matching brackets .",
help="Highlight matching brackets.",
).tag(config=True)

extra_open_editor_shortcuts = Bool(False,
help="Enable vi (v) or Emacs (C-X C-E) shortcuts to open an external editor. "
"This is in addition to the F2 binding, which is always enabled."
).tag(config=True)

@observe('term_title')
Expand Down Expand Up @@ -221,7 +226,9 @@ def prompt():
return

# Set up keyboard shortcuts
kbmanager = KeyBindingManager.for_prompt()
kbmanager = KeyBindingManager.for_prompt(
enable_open_in_editor=self.extra_open_editor_shortcuts,
)
register_ipython_shortcuts(kbmanager.registry, self)

# Pre-populate history from IPython's history database
Expand Down

0 comments on commit 3af8dd0

Please sign in to comment.