Windows Terminal has received support for full keyboard selection

Microsoft has updated both stable and preview versions of Windows Terminal. The stable version 1.14 includes everything from the previously released preview. So the preview channel now hosts a newer version 1.15 that adds a new mark mode that allows selecting the text in terminal using the keyboard only, and several other improvements.

Keyboard selection in Windows Terminal aka mark mode

Starting in Terminal 1.15, you can use your keyboard to select any text. For that, you need to enable mark mode with the Ctrl+Shift+M hotkey. Then you will be able to select text like in any text editor. Move around the words with arrow keys, press and hold Shift to start the selection and move the cursor with arrow keys to select some text.

You can quickly select all text with Ctrl + A. To leave mark mode, press Esc.

Terminal supports the appropriate actions.

  • markMode - enter or leave mark mode.
  • toggleBlockSelection - activate a block selection
  • switchSelectionEndpoint - When modifying a selection using the keyboard, you are moving one end of the selection around. This action switches focus to the other selection marker.

Scroll marks

Additionally, Terminal now supports scroll marks as an experimental feature. You can add a mark to which you can quickly return with a command or hotkey from any place in the output buffer.

To play with marks, add these lines to your profile JSON

 

// actions
        { "keys": "ctrl+up", "command": { "action": "scrollToMark", "direction": "previous" }, "name": "Previous mark" },
        { "keys": "ctrl+down", "command": { "action": "scrollToMark", "direction": "next" }, "name": "Next mark" },
        { "keys": "ctrl+pgup", "command": { "action": "scrollToMark", "direction": "first" }, "name": "First mark" },
        { "keys": "ctrl+pgdn", "command": { "action": "scrollToMark", "direction": "last" }, "name": "Last mark" },
        { "command": { "action": "addMark" } },
        { "command": { "action": "addMark", "color": "#ff00ff" } },
        { "command": { "action": "addMark", "color": "#0000ff" } },
        { "command": { "action": "clearAllMarks" } },

// profiles.defaults
        "experimental.autoMarkPrompts": true,
        "experimental.showMarksOnScrollbar": true,

You can define the following actions for scroll marks.

  • addMark: Adds a scroll mark to your text buffer. If there’s a selection, the mark is placed at the selection, otherwise it’s placed at the cursor row.
    • The addMark action has an optional color parameter that lets you set the color of the scroll mark.
  • scrollToMark: Scrolls to the scroll mark in the given direction.
    • The direction parameter for scrollToMark accepts first, previous, next, and last.
  • clearMark: Clears scroll mark at the current position, either at a selection if there is one or at the cursor position.
  • clearAllMarks: Clears all scroll marks in the text buffer.

Other changes

There are other improvements in Terminal. Color schemes now accept "magenta" and "brightMagenta" in place of "purple" and "brightPurple". 

Also, its shell extension now supports the following accelerator keys in the context menu of Explorer:

  • T for Open in Terminal,
  • P for Open in Terminal Preview,
  • D for Open in Terminal (Dev)

More in the official announcement.


Windows Terminal is available for download from Microsoft Store:

You can also download it from the GitHub releases page.

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!

Author: Sergey Tkachenko

Sergey Tkachenko is a software developer who started Winaero back in 2011. On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram, Twitter, and YouTube.

Leave a Reply

Your email address will not be published.

Exit mobile version
Using Telegram? Subscribe to the blog channel!
Hello. Add your message here.