Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add option to choose console editing mode #970

Merged
merged 3 commits into from
Mar 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions brownie/_cli/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from prompt_toolkit import PromptSession
from prompt_toolkit.auto_suggest import AutoSuggest, Suggestion
from prompt_toolkit.completion import Completer, Completion
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.history import FileHistory
from prompt_toolkit.key_binding import KeyBindings
from prompt_toolkit.key_binding.defaults import load_key_bindings
Expand Down Expand Up @@ -128,6 +129,8 @@ def __init__(self, project=None, extra_locals=None):
kwargs["auto_suggest"] = ConsoleAutoSuggest(self, locals_dict)
if console_settings["completions"]:
kwargs["completer"] = ConsoleCompleter(self, locals_dict)
if console_settings["editing_mode"]:
kwargs["editing_mode"] = EditingMode(console_settings["editing_mode"].upper())

self.compile_mode = "single"
self.prompt_session = PromptSession(
Expand Down
1 change: 1 addition & 0 deletions brownie/data/default-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ console:
color_style: monokai
auto_suggest: true
completions: true
editing_mode: emacs

reports:
exclude_paths: null
Expand Down
6 changes: 6 additions & 0 deletions docs/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,12 @@ Console

default value: ``true``

.. py:attribute:: editing_mode

Choose between ``emacs`` and ``vi`` console editing modes.

default value: ``emacs``

.. _config-reports:

Reports
Expand Down