##// END OF EJS Templates
Make inclusion of vi mode in prompt togglable.
Antony Lee -
Show More
@@ -0,0 +1,5 b''
1 In vi editing mode, whether the prompt includes the current vi mode can now be configured
2 -----------------------------------------------------------------------------------------
3
4 Set the ``TerminalInteractiveShell.prompt_includes_vi_mode`` to a boolean value
5 (default: True) to control this feature.
@@ -225,6 +225,10 b' class TerminalInteractiveShell(InteractiveShell):'
225 help="Allows to enable/disable the prompt toolkit history search"
225 help="Allows to enable/disable the prompt toolkit history search"
226 ).tag(config=True)
226 ).tag(config=True)
227
227
228 prompt_includes_vi_mode = Bool(True,
229 help="Display the current vi mode (when using vi editing mode)."
230 ).tag(config=True)
231
228 @observe('term_title')
232 @observe('term_title')
229 def init_term_title(self, change=None):
233 def init_term_title(self, change=None):
230 # Enable or disable the terminal title.
234 # Enable or disable the terminal title.
@@ -14,9 +14,8 b' class Prompts(object):'
14 self.shell = shell
14 self.shell = shell
15
15
16 def vi_mode(self):
16 def vi_mode(self):
17 if not hasattr(self.shell.pt_app, 'editing_mode'):
17 if (getattr(self.shell.pt_app, 'editing_mode', None) == 'VI'
18 return ''
18 and self.shell.prompt_includes_vi_mode):
19 if self.shell.pt_app.editing_mode == 'VI':
20 return '['+str(self.shell.pt_app.app.vi_state.input_mode)[3:6]+'] '
19 return '['+str(self.shell.pt_app.app.vi_state.input_mode)[3:6]+'] '
21 return ''
20 return ''
22
21
General Comments 0
You need to be logged in to leave comments. Login now