From aa82d8fddd577abc2a0f21e4eb6b4d1639207f8c Mon Sep 17 00:00:00 2001 From: Luflosi Date: Tue, 22 Jan 2019 01:08:27 +0100 Subject: [PATCH 1/5] Change default of "macos_option_as_alt" option from True to False --- kitty/config_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kitty/config_data.py b/kitty/config_data.py index 30ef55ede..93d9dbb66 100644 --- a/kitty/config_data.py +++ b/kitty/config_data.py @@ -798,7 +798,7 @@ incompatible with :opt:`background_opacity`. If you want to use both, you are probably better off just hiding the titlebar with :opt:`hide_window_decorations`. ''')) -o('macos_option_as_alt', True, long_text=_(''' +o('macos_option_as_alt', False, long_text=_(''' Use the option key as an alt key. With this set to no, kitty will use the macOS native :kbd:`Option+Key` = unicode character behavior. This will break any :kbd:`Alt+key` keyboard shortcuts in your terminal programs, but you From 0d60b88f1d2ab56a81562e38da978a3a5a63ecad Mon Sep 17 00:00:00 2001 From: Luflosi Date: Tue, 22 Jan 2019 01:09:12 +0100 Subject: [PATCH 2/5] Add more common macOS keyboard shortcuts --- docs/changelog.rst | 1 + docs/index.rst | 34 +++++++++++++++--------------- kitty/config_data.py | 49 ++++++++++++++++++++++++++++++++++++-------- 3 files changed, 59 insertions(+), 25 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 34f42796c..df6e3e820 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -21,6 +21,7 @@ Changelog - Fix window title for minimized windows not being updated (:iss:`1332`) +- macOS: Add a bunch of common macOS keyboard shortcuts 0.13.3 [2019-01-19] ------------------------------ diff --git a/docs/index.rst b/docs/index.rst index 6fe8c7a1e..41156b1dc 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -108,12 +108,12 @@ Scrolling ======================== ======================= Action Shortcut ======================== ======================= -Scroll line up :sc:`scroll_line_up` -Scroll line down :sc:`scroll_line_down` -Scroll page up :sc:`scroll_page_up` -Scroll page down :sc:`scroll_page_down` -Scroll to top :sc:`scroll_home` -Scroll to bottom :sc:`scroll_end` +Scroll line up :sc:`scroll_line_up` (also :kbd:`⌥+⌘+⇞` and :kbd:`⌘+↑` on macOS) +Scroll line down :sc:`scroll_line_down` (also :kbd:`⌥+⌘+⇟` and :kbd:`⌘+↓` on macOS) +Scroll page up :sc:`scroll_page_up` (also :kbd:`⌘+⇞` on macOS) +Scroll page down :sc:`scroll_page_down` (also :kbd:`⌘+⇟` on macOS) +Scroll to top :sc:`scroll_home` (also :kbd:`⌘+↖` on macOS) +Scroll to bottom :sc:`scroll_end` (also :kbd:`⌘+↘` on macOS) ======================== ======================= Tabs @@ -123,13 +123,14 @@ Tabs Action Shortcut ======================== ======================= New tab :sc:`new_tab` (also :kbd:`⌘+t` on macOS) -Close tab :sc:`close_tab` -Next tab :sc:`next_tab` (also :kbd:`control+tab` on macOS) -Previous tab :sc:`previous_tab` (also :kbd:`control+shift+tab` on macOS) +New tab with cwd :sc:`new_tab_with_cwd` (also :kbd:`⇧+⌘+t` on macOS) +Close tab :sc:`close_tab` (also :kbd:`⌘+w` on macOS) +Next tab :sc:`next_tab` (also :kbd:`^+⇥` on macOS) +Previous tab :sc:`previous_tab` (also :kbd:`⇧+^+⇥` on macOS) Next layout :sc:`next_layout` Move tab forward :sc:`move_tab_forward` Move tab backward :sc:`move_tab_backward` -Set tab title :sc:`set_tab_title` +Set tab title :sc:`set_tab_title` (also :kbd:`⇧+⌘+i` on macOS) ======================== ======================= @@ -141,7 +142,8 @@ Action Shortcut ======================== ======================= New window :sc:`new_window` New OS window :sc:`new_os_window` (also :kbd:`⌘+n` on macOS) -Close window :sc:`close_window` (also :kbd:`⌘+w` on macOS) +New OS window with cwd :sc:`new_os_window_with_cwd` (also :kbd:`⇧+⌘+n` on macOS) +Close window :sc:`close_window` (also :kbd:`⇧+⌘+d` on macOS) Next window :sc:`next_window` Previous window :sc:`previous_window` Move window forward :sc:`move_window_forward` @@ -177,13 +179,13 @@ Action Shortcut Copy to clipboard :sc:`copy_to_clipboard` (also :kbd:`⌘+c` on macOS) Paste from clipboard :sc:`paste_from_clipboard` (also :kbd:`⌘+v` on macOS) Paste from selection :sc:`paste_from_selection` -Increase font size :sc:`increase_font_size` -Decrease font size :sc:`decrease_font_size` -Restore font size :sc:`reset_font_size` -Toggle fullscreen :sc:`toggle_fullscreen` (also :kbd:`^⌘+f` on macOS) +Increase font size :sc:`increase_font_size` (also :kbd:`⌘++` on macOS) +Decrease font size :sc:`decrease_font_size` (also :kbd:`⌘+-` on macOS) +Restore font size :sc:`reset_font_size` (also :kbd:`⌘+0` on macOS) +Toggle fullscreen :sc:`toggle_fullscreen` (also :kbd:`^+⌘+f` on macOS) Input unicode character :sc:`input_unicode_character` Click URL using the keyboard :sc:`open_url` -Reset the terminal :sc:`reset_terminal` +Reset the terminal :sc:`reset_terminal` (also :kbd:`⌘+r` on macOS) Pass current selection to program :sc:`pass_selection_to_program` Edit |kitty| config file :sc:`edit_config_file` Open a |kitty| shell :sc:`kitty_shell` diff --git a/kitty/config_data.py b/kitty/config_data.py index 93d9dbb66..f1755b0c1 100644 --- a/kitty/config_data.py +++ b/kitty/config_data.py @@ -854,13 +854,14 @@ You can have kitty remove all shortcut definition seen up to this point. Useful, instance, to remove the default shortcuts.''')) g('shortcuts.clipboard') # {{{ -if is_macos: - k('copy_to_clipboard', 'cmd+c', 'copy_to_clipboard', _('Copy to clipboard'), add_to_docs=False) - k('paste_from_clipboard', 'cmd+v', 'paste_from_clipboard', _('Paste from clipboard'), add_to_docs=False) k('copy_to_clipboard', 'kitty_mod+c', 'copy_to_clipboard', _('Copy to clipboard'), long_text=_(''' There is also a :code:`copy_or_interrupt` action that can be optionally mapped to :kbd:`Ctrl+c`. It will copy only if there is a selection and send an interrupt otherwise.''')) +if is_macos: + k('copy_to_clipboard', 'cmd+c', 'copy_to_clipboard', _('Copy to clipboard'), add_to_docs=False) k('paste_from_clipboard', 'kitty_mod+v', 'paste_from_clipboard', _('Paste from clipboard')) +if is_macos: + k('paste_from_clipboard', 'cmd+v', 'paste_from_clipboard', _('Paste from clipboard'), add_to_docs=False) k('paste_from_selection', 'kitty_mod+s', 'paste_from_selection', _('Paste from selection')) k('paste_from_selection', 'shift+insert', 'paste_from_selection', _('Paste from selection')) k('pass_selection_to_program', 'kitty_mod+o', 'pass_selection_to_program', _('Pass selection to program'), long_text=_(''' @@ -880,13 +881,27 @@ window, by using the @selection placeholder:: g('shortcuts.scrolling') # {{{ k('scroll_line_up', 'kitty_mod+up', 'scroll_line_up', _('Scroll line up')) +if is_macos: + k('scroll_line_up', 'alt+cmd+page_up', 'scroll_line_up', _('Scroll line up'), add_to_docs=False) + k('scroll_line_up', 'cmd+up', 'scroll_line_up', _('Scroll line up'), add_to_docs=False) k('scroll_line_up', 'kitty_mod+k', 'scroll_line_up') k('scroll_line_down', 'kitty_mod+down', 'scroll_line_down', _('Scroll line down')) k('scroll_line_down', 'kitty_mod+j', 'scroll_line_down') +if is_macos: + k('scroll_line_down', 'alt+cmd+page_down', 'scroll_line_down', _('Scroll line down'), add_to_docs=False) + k('scroll_line_down', 'cmd+down', 'scroll_line_down', _('Scroll line down'), add_to_docs=False) k('scroll_page_up', 'kitty_mod+page_up', 'scroll_page_up', _('Scroll page up')) +if is_macos: + k('scroll_page_up', 'cmd+page_up', 'scroll_page_up', _('Scroll page up'), add_to_docs=False) k('scroll_page_down', 'kitty_mod+page_down', 'scroll_page_down', _('Scroll page down')) +if is_macos: + k('scroll_page_down', 'cmd+page_down', 'scroll_page_down', _('Scroll page down'), add_to_docs=False) k('scroll_home', 'kitty_mod+home', 'scroll_home', _('Scroll to top')) +if is_macos: + k('scroll_home', 'cmd+home', 'scroll_home', _('Scroll to top'), add_to_docs=False) k('scroll_end', 'kitty_mod+end', 'scroll_end', _('Scroll to bottom')) +if is_macos: + k('scroll_end', 'cmd+end', 'scroll_end', _('Scroll to bottom'), add_to_docs=False) k('show_scrollback', 'kitty_mod+h', 'show_scrollback', _('Browse scrollback buffer in less'), long_text=_(''' You can pipe the contents of the current screen + history buffer as @@ -920,12 +935,13 @@ For example:: map ctrl+enter new_window @ some_program ''')) -if is_macos: - k('new_os_window', 'cmd+n', 'new_os_window', _('New OS window')) k('new_os_window', 'kitty_mod+n', 'new_os_window', _('New OS window')) +if is_macos: + k('new_os_window', 'cmd+n', 'new_os_window', _('New OS window'), add_to_docs=False) + k('new_os_window_with_cwd', 'shift+cmd+n', 'new_os_window_with_cwd', _('New OS window with cwd'), add_to_docs=False) k('close_window', 'kitty_mod+w', 'close_window', _('Close window')) if is_macos: - k('close_window', 'cmd+w', 'close_window', _('Close window'), add_to_docs=False) + k('close_window', 'shift+cmd+d', 'close_window', _('Close window'), add_to_docs=False) k('next_window', 'kitty_mod+]', 'next_window', _('Next window')) k('previous_window', 'kitty_mod+[', 'previous_window', _('Previous window')) k('move_window_forward', 'kitty_mod+f', 'move_window_forward', _('Move window forward')) @@ -945,19 +961,26 @@ k('tenth_window', 'kitty_mod+0', 'tenth_window', _('Tenth window')) # }}} g('shortcuts.tab') # {{{ -if is_macos: - k('next_tab', 'ctrl+tab', 'next_tab', _('Next tab'), add_to_docs=False) k('next_tab', 'kitty_mod+right', 'next_tab', _('Next tab')) if is_macos: - k('previous_tab', 'ctrl+shift+tab', 'previous_tab', _('Previous tab'), add_to_docs=False) + k('next_tab', 'ctrl+tab', 'next_tab', _('Next tab'), add_to_docs=False) k('previous_tab', 'kitty_mod+left', 'previous_tab', _('Previous tab')) +if is_macos: + k('previous_tab', 'shift+ctrl+tab', 'previous_tab', _('Previous tab'), add_to_docs=False) k('new_tab', 'kitty_mod+t', 'new_tab', _('New tab')) if is_macos: k('new_tab', 'cmd+t', 'new_tab', _('New tab'), add_to_docs=False) + k('new_tab_with_cwd', 'shift+cmd+t', 'new_tab_with_cwd', _('New tab with cwd'), add_to_docs=False) k('close_tab', 'kitty_mod+q', 'close_tab', _('Close tab')) +if is_macos: + k('close_tab', 'cmd+w', 'close_tab', _('Close tab'), add_to_docs=False) + # Not yet implemented + # k('close_os_window', 'shift+cmd+w', 'close_os_window', _('Close os window'), add_to_docs=False) k('move_tab_forward', 'kitty_mod+.', 'move_tab_forward', _('Move tab forward')) k('move_tab_backward', 'kitty_mod+,', 'move_tab_backward', _('Move tab backward')) k('set_tab_title', 'kitty_mod+alt+t', 'set_tab_title', _('Set tab title')) +if is_macos: + k('set_tab_title', 'shift+cmd+i', 'set_tab_title', _('Set tab title'), add_to_docs=False) # }}} g('shortcuts.layout') # {{{ @@ -966,8 +989,14 @@ k('next_layout', 'kitty_mod+l', 'next_layout', _('Next layout')) g('shortcuts.fonts') # {{{ k('increase_font_size', 'kitty_mod+equal', 'change_font_size all +2.0', _('Increase font size')) +if is_macos: + k('increase_font_size', 'cmd+plus', 'change_font_size all +2.0', _('Increase font size'), add_to_docs=False) k('decrease_font_size', 'kitty_mod+minus', 'change_font_size all -2.0', _('Decrease font size')) +if is_macos: + k('decrease_font_size', 'cmd+minus', 'change_font_size all -2.0', _('Decrease font size'), add_to_docs=False) k('reset_font_size', 'kitty_mod+backspace', 'change_font_size all 0', _('Reset font size')) +if is_macos: + k('reset_font_size', 'cmd+0', 'change_font_size all 0', _('Reset font size'), add_to_docs=False) # }}} g('shortcuts.selection') # {{{ @@ -1005,6 +1034,8 @@ k('increase_background_opacity', 'kitty_mod+a>m', 'set_background_opacity +0.1', k('decrease_background_opacity', 'kitty_mod+a>l', 'set_background_opacity -0.1', _('Decrease background opacity')) k('full_background_opacity', 'kitty_mod+a>1', 'set_background_opacity 1', _('Make background fully opaque')) k('reset_background_opacity', 'kitty_mod+a>d', 'set_background_opacity default', _('Reset background opacity')) +if is_macos: + k('reset_terminal', 'cmd+r', 'clear_terminal reset active', _('Reset the terminal'), add_to_docs=False) k('reset_terminal', 'kitty_mod+delete', 'clear_terminal reset active', _('Reset the terminal'), long_text=_(''' You can create shortcuts to clear/reset the terminal. For example:: From 6d3ad7d903e372d1fac541a6916a382a11779c5a Mon Sep 17 00:00:00 2001 From: Luflosi Date: Wed, 23 Jan 2019 11:27:32 +0100 Subject: [PATCH 3/5] Implement suggestions for macOS keyboard shortcuts --- docs/index.rst | 7 ++++--- kitty/config_data.py | 16 ++++++++++++++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index 41156b1dc..278aebd86 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -140,7 +140,7 @@ Windows ======================== ======================= Action Shortcut ======================== ======================= -New window :sc:`new_window` +New window :sc:`new_window` (also :kbd:`⌘+↩` on macOS) New OS window :sc:`new_os_window` (also :kbd:`⌘+n` on macOS) New OS window with cwd :sc:`new_os_window_with_cwd` (also :kbd:`⇧+⌘+n` on macOS) Close window :sc:`close_window` (also :kbd:`⇧+⌘+d` on macOS) @@ -150,6 +150,7 @@ Move window forward :sc:`move_window_forward` Move window backward :sc:`move_window_backward` Move window to top :sc:`move_window_to_top` Focus specific window :sc:`first_window`, :sc:`second_window` ... :sc:`tenth_window` + (also :kbd:`⌘+1`, :kbd:`⌘+2` ... :kbd:`⌘+9` on macOS) (clockwise from the top-left) ======================== ======================= @@ -185,7 +186,7 @@ Restore font size :sc:`reset_font_size` (also :kbd:`⌘+0` on Toggle fullscreen :sc:`toggle_fullscreen` (also :kbd:`^+⌘+f` on macOS) Input unicode character :sc:`input_unicode_character` Click URL using the keyboard :sc:`open_url` -Reset the terminal :sc:`reset_terminal` (also :kbd:`⌘+r` on macOS) +Reset the terminal :sc:`reset_terminal` Pass current selection to program :sc:`pass_selection_to_program` Edit |kitty| config file :sc:`edit_config_file` Open a |kitty| shell :sc:`kitty_shell` @@ -217,7 +218,7 @@ You can switch between layouts using the :sc:`next_layout` key combination. You also create shortcuts to select particular layouts, and choose which layouts you want to enable/disable, see :ref:`conf-kitty-shortcuts.layout` for examples. -You can resize windows inside layouts. Press :sc:`start_resizing_window` to +You can resize windows inside layouts. Press :sc:`start_resizing_window` (also :kbd:`⌘+r` on macOS) to enter resizing mode and follow the on-screen instructions. In a given window layout only some operations may be possible for a particular window. For example, in the Tall layout you can make the first window wider/narrower, but diff --git a/kitty/config_data.py b/kitty/config_data.py index f1755b0c1..2e7ecfac6 100644 --- a/kitty/config_data.py +++ b/kitty/config_data.py @@ -935,6 +935,8 @@ For example:: map ctrl+enter new_window @ some_program ''')) +if is_macos: + k('new_window', 'cmd+enter', 'new_window', _('New window'), add_to_docs=False) k('new_os_window', 'kitty_mod+n', 'new_os_window', _('New OS window')) if is_macos: k('new_os_window', 'cmd+n', 'new_os_window', _('New OS window'), add_to_docs=False) @@ -948,6 +950,8 @@ k('move_window_forward', 'kitty_mod+f', 'move_window_forward', _('Move window fo k('move_window_backward', 'kitty_mod+b', 'move_window_backward', _('Move window backward')) k('move_window_to_top', 'kitty_mod+`', 'move_window_to_top', _('Move window to top')) k('start_resizing_window', 'kitty_mod+r', 'start_resizing_window', _('Start resizing window')) +if is_macos: + k('start_resizing_window', 'cmd+r', 'start_resizing_window', _('Start resizing window'), add_to_docs=False) k('first_window', 'kitty_mod+1', 'first_window', _('First window')) k('second_window', 'kitty_mod+2', 'second_window', _('Second window')) k('third_window', 'kitty_mod+3', 'third_window', _('Third window')) @@ -958,6 +962,16 @@ k('seventh_window', 'kitty_mod+7', 'seventh_window', _('Seventh window')) k('eighth_window', 'kitty_mod+8', 'eighth_window', _('Eight window')) k('ninth_window', 'kitty_mod+9', 'ninth_window', _('Ninth window')) k('tenth_window', 'kitty_mod+0', 'tenth_window', _('Tenth window')) +if is_macos: + k('first_window', 'cmd+1', 'first_window', _('First window'), add_to_docs=False) + k('second_window', 'cmd+2', 'second_window', _('Second window'), add_to_docs=False) + k('third_window', 'cmd+3', 'third_window', _('Third window'), add_to_docs=False) + k('fourth_window', 'cmd+4', 'fourth_window', _('Fourth window'), add_to_docs=False) + k('fifth_window', 'cmd+5', 'fifth_window', _('Fifth window'), add_to_docs=False) + k('sixth_window', 'cmd+6', 'sixth_window', _('Sixth window'), add_to_docs=False) + k('seventh_window', 'cmd+7', 'seventh_window', _('Seventh window'), add_to_docs=False) + k('eighth_window', 'cmd+8', 'eighth_window', _('Eight window'), add_to_docs=False) + k('ninth_window', 'cmd+9', 'ninth_window', _('Ninth window'), add_to_docs=False) # }}} g('shortcuts.tab') # {{{ @@ -1034,8 +1048,6 @@ k('increase_background_opacity', 'kitty_mod+a>m', 'set_background_opacity +0.1', k('decrease_background_opacity', 'kitty_mod+a>l', 'set_background_opacity -0.1', _('Decrease background opacity')) k('full_background_opacity', 'kitty_mod+a>1', 'set_background_opacity 1', _('Make background fully opaque')) k('reset_background_opacity', 'kitty_mod+a>d', 'set_background_opacity default', _('Reset background opacity')) -if is_macos: - k('reset_terminal', 'cmd+r', 'clear_terminal reset active', _('Reset the terminal'), add_to_docs=False) k('reset_terminal', 'kitty_mod+delete', 'clear_terminal reset active', _('Reset the terminal'), long_text=_(''' You can create shortcuts to clear/reset the terminal. For example:: From 6690c4f91636b5c18b8ced7fa7b48aceff6109f1 Mon Sep 17 00:00:00 2001 From: Luflosi Date: Wed, 23 Jan 2019 11:37:54 +0100 Subject: [PATCH 4/5] Add default keyboard shortcuts to jump words on macOS --- docs/index.rst | 2 ++ kitty/config_data.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/docs/index.rst b/docs/index.rst index 278aebd86..0e5496b1a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -194,6 +194,8 @@ Increase background opacity :sc:`increase_background_opacity` Decrease background opacity :sc:`decrease_background_opacity` Full background opacity :sc:`full_background_opacity` Reset background opacity :sc:`reset_background_opacity` +Jump left one word :kbd:`⌥+←` (only on macOS) +Jump right one word :kbd:`⌥+→` (only on macOS) ================================== ======================= diff --git a/kitty/config_data.py b/kitty/config_data.py index 2e7ecfac6..36a41e3c9 100644 --- a/kitty/config_data.py +++ b/kitty/config_data.py @@ -1091,6 +1091,9 @@ the line (same as pressing the Home key):: map ctrl+alt+a send_text normal Word\\x1b[H map ctrl+alt+a send_text application Word\\x1bOH ''')) +if is_macos: + k('send_text', 'alt+left', 'send_text all \x1b\x62', _('Jump left one word'), add_to_docs=False) + k('send_text', 'alt+right', 'send_text all \x1b\x66', _('Jump right one word'), add_to_docs=False) # }}} # }}} From 440db8f4bd82792be7a9ead4c2f80f7c7f48ff2d Mon Sep 17 00:00:00 2001 From: Luflosi Date: Wed, 30 Jan 2019 12:02:17 +0100 Subject: [PATCH 5/5] Revert "Add default keyboard shortcuts to jump words on macOS" This reverts commit e114c8d6b854e1cfd839ee4a2abf1b450f963f4f. --- docs/index.rst | 2 -- kitty/config_data.py | 3 --- 2 files changed, 5 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index 0e5496b1a..278aebd86 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -194,8 +194,6 @@ Increase background opacity :sc:`increase_background_opacity` Decrease background opacity :sc:`decrease_background_opacity` Full background opacity :sc:`full_background_opacity` Reset background opacity :sc:`reset_background_opacity` -Jump left one word :kbd:`⌥+←` (only on macOS) -Jump right one word :kbd:`⌥+→` (only on macOS) ================================== ======================= diff --git a/kitty/config_data.py b/kitty/config_data.py index 36a41e3c9..2e7ecfac6 100644 --- a/kitty/config_data.py +++ b/kitty/config_data.py @@ -1091,9 +1091,6 @@ the line (same as pressing the Home key):: map ctrl+alt+a send_text normal Word\\x1b[H map ctrl+alt+a send_text application Word\\x1bOH ''')) -if is_macos: - k('send_text', 'alt+left', 'send_text all \x1b\x62', _('Jump left one word'), add_to_docs=False) - k('send_text', 'alt+right', 'send_text all \x1b\x66', _('Jump right one word'), add_to_docs=False) # }}} # }}}