如何仅使用键盘在屏幕缓冲区中上下滚动(我在屏幕缓冲区大小中设置了 6000 高度)。

如何仅使用键盘在屏幕缓冲区中上下滚动(我在屏幕缓冲区大小中设置了 6000 高度)。

我正在使用 Windows 10 - PowerShell 通过 ssh 连接到一些 VPS。

如何仅使用键盘在屏幕缓冲区中上下滚动(我在屏幕缓冲区大小中设置了 6000 高度)。

我已经在 Windows 10 中尝试过 - Powershell 使用Ctrl+ PgUp/ Ctrl+PgDnShift+ PgUp/ Shift+PgDn逐行滚动,但它在我的 Windows 10 上不起作用。

在此处输入图片描述

在此处输入图片描述

我知道有一个“more”命令可用于翻阅屏幕缓冲区,但使用一些键盘快捷键会更方便。我的键盘上有PgUpPgDn键(标准 TKL 键盘)。但它们根本无法与Ctrl或一起Shift逐行滚动输出。

它们本身无法工作,也无法将缓冲区向上或向下滚动一页。

我在这里寻找答案: Powershell 屏幕缓冲区
但我不明白“回滚是由 Windows 控制台本身提供的,而不是由内部的 shell 提供的(就像 xterm 和 Unix 中的类似应用程序一样)。”是什么意思。

我也尝试过这里没有结果。

答案1

您的链接给出的答案确实有效: Powershell 屏幕缓冲区

您可以输入以下序列: Alt+ Space,,EL

从现在开始,直到您按下 EscEnter,箭头和分页键将滚动屏幕缓冲区。

您也可以使用按键宏产品,例如 自动热键,将整个序列分配给一个热键,以方便使用。

答案2

如果您使用的是 powershell 独立版而不是在终端中带有选项卡的版本,则可以设置自己的绑定:

Set-PSReadLineKeyHandler -Chord F4 -ScriptBlock { [Microsoft.PowerShell.PSConsoleReadLine]::ScrollDisplayUp() }
Set-PSReadLineKeyHandler -Chord Ctrl+F4 -ScriptBlock { [Microsoft.PowerShell.PSConsoleReadLine]::ScrollDisplayDown() }

要查看所有当前快捷方式,您可以输入Get-PSReadLineKeyHandler

默认绑定是:

Basic editing functions
=======================

Key              Function           Description
---              --------           -----------
Enter            AcceptLine         Accept the input or move to the next line if input is missing a closing token.
Shift+Enter      AddLine            Move the cursor to the next line without attempting to execute the input
Backspace        BackwardDeleteChar Delete the character before the cursor
Ctrl+h           BackwardDeleteChar Delete the character before the cursor
Ctrl+Home        BackwardDeleteLine Delete text from the cursor to the start of the line
Ctrl+Backspace   BackwardKillWord   Move the text from the start of the current or previous word to the cursor to the
                                    kill ring
Ctrl+w           BackwardKillWord   Move the text from the start of the current or previous word to the cursor to the
                                    kill ring
Ctrl+C           Copy               Copy selected region to the system clipboard.  If no region is selected, copy the
                                    whole line
Ctrl+c           CopyOrCancelLine   Either copy selected text to the clipboard, or if no text is selected, cancel
                                    editing the line with CancelLine.
Ctrl+x           Cut                Delete selected region placing deleted text in the system clipboard
Delete           DeleteChar         Delete the character under the cursor
Ctrl+End         ForwardDeleteLine  Delete text from the cursor to the end of the line
Ctrl+Enter       InsertLineAbove    Inserts a new empty line above the current line without attempting to execute the
                                    input
Shift+Ctrl+Enter InsertLineBelow    Inserts a new empty line below the current line without attempting to execute the
                                    input
Alt+d            KillWord           Move the text from the cursor to the end of the current or next word to the kill
                                    ring
Ctrl+Delete      KillWord           Move the text from the cursor to the end of the current or next word to the kill
                                    ring
Ctrl+v           Paste              Paste text from the system clipboard
Shift+Insert     Paste              Paste text from the system clipboard
Ctrl+y           Redo               Redo an undo
Escape           RevertLine         Equivalent to undo all edits (clears the line except lines imported from history)
Ctrl+z           Undo               Undo a previous edit
Alt+.            YankLastArg        Copy the text of the last argument to the input


Cursor movement functions
=========================

Key             Function        Description
---             --------        -----------
LeftArrow       BackwardChar    Move the cursor back one character
Ctrl+LeftArrow  BackwardWord    Move the cursor to the beginning of the current or previous word
Home            BeginningOfLine Move the cursor to the beginning of the line
End             EndOfLine       Move the cursor to the end of the line
RightArrow      ForwardChar     Move the cursor forward one character
Ctrl+]          GotoBrace       Go to matching brace
Ctrl+RightArrow NextWord        Move the cursor forward to the start of the next word


History functions
=================

Key       Function              Description
---       --------              -----------
Alt+F7    ClearHistory          Remove all items from the command line history (not PowerShell history)
Ctrl+s    ForwardSearchHistory  Search history forward interactively
F8        HistorySearchBackward Search for the previous item in the history that starts with the current input - like
                                PreviousHistory if the input is empty
Shift+F8  HistorySearchForward  Search for the next item in the history that starts with the current input - like
                                NextHistory if the input is empty
DownArrow NextHistory           Replace the input with the next item in the history
UpArrow   PreviousHistory       Replace the input with the previous item in the history
Ctrl+r    ReverseSearchHistory  Search history backwards interactively


Completion functions
====================

Key           Function            Description
---           --------            -----------
Ctrl+@        MenuComplete        Complete the input if there is a single completion, otherwise complete the input by
                                  selecting from a menu of possible completions.
Ctrl+Spacebar MenuComplete        Complete the input if there is a single completion, otherwise complete the input by
                                  selecting from a menu of possible completions.
Tab           TabCompleteNext     Complete the input using the next completion
Shift+Tab     TabCompletePrevious Complete the input using the previous completion


Miscellaneous functions
=======================

Key           Function              Description
---           --------              -----------
Ctrl+l        ClearScreen           Clear the screen and redraw the current line at the top of the screen
Alt+0         DigitArgument         Start or accumulate a numeric argument to other functions
Alt+1         DigitArgument         Start or accumulate a numeric argument to other functions
Alt+2         DigitArgument         Start or accumulate a numeric argument to other functions
Alt+3         DigitArgument         Start or accumulate a numeric argument to other functions
Alt+4         DigitArgument         Start or accumulate a numeric argument to other functions
Alt+5         DigitArgument         Start or accumulate a numeric argument to other functions
Alt+6         DigitArgument         Start or accumulate a numeric argument to other functions
Alt+7         DigitArgument         Start or accumulate a numeric argument to other functions
Alt+8         DigitArgument         Start or accumulate a numeric argument to other functions
Alt+9         DigitArgument         Start or accumulate a numeric argument to other functions
Alt+-         DigitArgument         Start or accumulate a numeric argument to other functions
PageDown      ScrollDisplayDown     Scroll the display down one screen
Ctrl+PageDown ScrollDisplayDownLine Scroll the display down one line
PageUp        ScrollDisplayUp       Scroll the display up one screen
Ctrl+PageUp   ScrollDisplayUpLine   Scroll the display up one line
Ctrl+Alt+?    ShowKeyBindings       Show all key bindings
Alt+?         WhatIsKey             Show the key binding for the next chord entered


Selection functions
===================

Key                   Function            Description
---                   --------            -----------
Ctrl+a                SelectAll           Select the entire line. Moves the cursor to the end of the line
Shift+LeftArrow       SelectBackwardChar  Adjust the current selection to include the previous character
Shift+Home            SelectBackwardsLine Adjust the current selection to include from the cursor to the end of the
                                          line
Shift+Ctrl+LeftArrow  SelectBackwardWord  Adjust the current selection to include the previous word
Shift+RightArrow      SelectForwardChar   Adjust the current selection to include the next character
Shift+End             SelectLine          Adjust the current selection to include from the cursor to the start of the
                                          line
Shift+Ctrl+RightArrow SelectNextWord      Adjust the current selection to include the next word


Search functions
================

Key      Function                Description
---      --------                -----------
F3       CharacterSearch         Read a character and move the cursor to the next occurence of that character
Shift+F3 CharacterSearchBackward Read a character and move the cursor to the previous occurence of that character

请参阅 Microsoft 网站上的其他信息。

相关内容