Skip to content

Commit

Permalink
Add Shortcut Alt+Z to wrap lines action
Browse files Browse the repository at this point in the history
  • Loading branch information
maurerle committed Oct 12, 2023
1 parent 68240de commit b4200cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions spyder/config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@
'editor/close split panel': "Alt+Shift+W",
'editor/docstring': "Ctrl+Alt+D",
'editor/autoformatting': "Ctrl+Alt+I",
'editor/wrap lines': "Alt+Z",
'editor/show in external file explorer': '',
# -- Internal console --
'console/inspect current object': "Ctrl+I",
Expand Down
7 changes: 4 additions & 3 deletions spyder/plugins/editor/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,8 @@ def get_plugin_actions(self):
'underline_errors', 'set_underline_errors_enabled')

wrap_lines_action = self._create_checkable_action(
_("Wrap lines"), 'wrap', 'set_wrap_enabled')
_("Wrap lines"), 'wrap', 'set_wrap_enabled',
shortcut=CONF.get_shortcut('editor', 'wrap lines'))

self.checkable_actions = {
'blank_spaces': showblanks_action,
Expand Down Expand Up @@ -1359,7 +1360,7 @@ def set_ancestor(self, ancestor):
except RuntimeError:
pass

def _create_checkable_action(self, text, conf_name, method=''):
def _create_checkable_action(self, text, conf_name, method='', shortcut=None):
"""Helper function to create a checkable action.
Args:
Expand All @@ -1373,7 +1374,7 @@ def toogle(checked):
self.switch_to_plugin()
self._toggle_checkable_action(checked, method, conf_name)

action = create_action(self, text, toggled=toogle)
action = create_action(self, text, toggled=toogle, shortcut=shortcut)
action.blockSignals(True)

if conf_name not in ['pycodestyle', 'pydocstyle']:
Expand Down

0 comments on commit b4200cb

Please sign in to comment.