mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-05 17:00:58 +01:00
add flag to enable/disable syntax highlighting in ptk shell
This commit is contained in:
parent
afacea12de
commit
c5b99cc93d
2 changed files with 5 additions and 1 deletions
|
@ -84,6 +84,7 @@ DEFAULT_ENSURERS = {
|
|||
'BASH_COMPLETIONS': (is_env_path, str_to_env_path, env_path_to_str),
|
||||
'CASE_SENSITIVE_COMPLETIONS': (is_bool, to_bool, bool_to_str),
|
||||
re.compile('\w*DIRS$'): (is_env_path, str_to_env_path, env_path_to_str),
|
||||
'COLOR_INPUT': (is_bool, to_bool, bool_to_str),
|
||||
'COLOR_RESULTS': (is_bool, to_bool, bool_to_str),
|
||||
'COMPLETIONS_DISPLAY': (is_completions_display_value,
|
||||
to_completions_display_value, str),
|
||||
|
@ -185,6 +186,7 @@ DEFAULT_VALUES = {
|
|||
'BASH_COMPLETIONS': BASH_COMPLETIONS_DEFAULT,
|
||||
'CASE_SENSITIVE_COMPLETIONS': ON_LINUX,
|
||||
'CDPATH': (),
|
||||
'COLOR_INPUT': True,
|
||||
'COLOR_RESULTS': True,
|
||||
'COMPLETIONS_DISPLAY': 'multi',
|
||||
'COMPLETIONS_MENU_ROWS': 5,
|
||||
|
@ -305,6 +307,7 @@ DEFAULT_DOCS = {
|
|||
'CDPATH': VarDocs(
|
||||
'A list of paths to be used as roots for a cd, breaking compatibility '
|
||||
'with Bash, xonsh always prefer an existing relative path.'),
|
||||
'COLOR_INPUT': VarDocs('Flag for syntax highlighting interactive input.'),
|
||||
'COLOR_RESULTS': VarDocs('Flag for syntax highlighting return values.'),
|
||||
'COMPLETIONS_DISPLAY': VarDocs(
|
||||
'Configure if and how Python completions are displayed by the '
|
||||
|
|
|
@ -72,7 +72,6 @@ class PromptToolkitShell(BaseShell):
|
|||
'get_rprompt_tokens': get_rprompt_tokens,
|
||||
'style': PygmentsStyle(xonsh_style_proxy(self.styler)),
|
||||
'completer': completer,
|
||||
'lexer': PygmentsLexer(XonshLexer),
|
||||
'multiline': multiline,
|
||||
'get_continuation_tokens': self.continuation_tokens,
|
||||
'history': history,
|
||||
|
@ -81,6 +80,8 @@ class PromptToolkitShell(BaseShell):
|
|||
'key_bindings_registry': self.key_bindings_manager.registry,
|
||||
'display_completions_in_columns': multicolumn,
|
||||
}
|
||||
if builtins.__xonsh_env__.get('COLOR_INPUT'):
|
||||
prompt_args['lexer'] = PygmentsLexer(XonshLexer)
|
||||
line = self.prompter.prompt(**prompt_args)
|
||||
return line
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue