From 1086757dc0e189badb539566dde1750570443a77 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 28 Feb 2024 11:39:16 +0530 Subject: [PATCH] More docs --- kitty/boss.py | 4 ++-- kitty/options/definition.py | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/kitty/boss.py b/kitty/boss.py index 5d485371d..9762a2049 100644 --- a/kitty/boss.py +++ b/kitty/boss.py @@ -1170,10 +1170,10 @@ class Boss: map f1 clear_terminal scrollback active # Scroll the contents of the screen into the scrollback map f1 clear_terminal scroll active - # Clear everything up to the line with the cursor or if the cursor is at a prompt, the first line of the prompt. + # Clear everything up to the line with the cursor or the start of the current prompt (needs shell integration) # Useful for clearing the screen up to the shell prompt and moving the shell prompt to the top of the screen. map f1 clear_terminal to_cursor active - # Clear everything up to the line with the cursor or prompt, saving the cleared lines in the scrollback + # Same as above except cleared lines are moved into scrollback map f1 clear_terminal to_cursor_scroll active ''') def clear_terminal(self, action: str, only_active: bool) -> None: diff --git a/kitty/options/definition.py b/kitty/options/definition.py index 89df6b82f..851598c57 100644 --- a/kitty/options/definition.py +++ b/kitty/options/definition.py @@ -4124,8 +4124,10 @@ You can create shortcuts to clear/reset the terminal. For example:: map f1 clear_terminal scrollback active # Scroll the contents of the screen into the scrollback map f1 clear_terminal scroll active - # Clear everything up to the line with the cursor + # Clear everything up to the line with the cursor or the start of the current prompt (needs shell integration) map f1 clear_terminal to_cursor active + # Same as above except cleared lines are moved into scrollback + map f1 clear_terminal to_cursor_scroll active If you want to operate on all kitty windows instead of just the current one, use :italic:`all` instead of :italic:`active`. @@ -4161,6 +4163,8 @@ the screen, instead of just clearing the screen. For ZSH, in :file:`~/.zshrc`, a zle -N ctrl_l bindkey '^l' ctrl_l +Alternatively, you can just add :code:`map ctrl+l clear_terminal to_cursor_scroll active` to :file:`kitty.conf` which +works with no changes to the shell rc files, but only clears up to the prompt, it does not clear anytext at the prompt itself. ''' )