diff --git a/.openpublishing.redirection.json b/.openpublishing.redirection.json index 9d94aa46..cf4d8c2f 100644 --- a/.openpublishing.redirection.json +++ b/.openpublishing.redirection.json @@ -2,27 +2,27 @@ "redirections": [ { "source_path": "TerminalDocs/customize-settings/key-bindings.md", - "redirect_url": "https://docs.microsoft.com/windows/terminal/customize-settings/actions", + "redirect_url": "/windows/terminal/customize-settings/actions", "redirect_document_id": true }, { "source_path": "TerminalDocs/customize-settings/global-settings.md", - "redirect_url": "https://docs.microsoft.com/windows/terminal/customize-settings/startup", + "redirect_url": "/windows/terminal/customize-settings/startup", "redirect_document_id": true }, { "source_path": "TerminalDocs/customize-settings/profile-settings.md", - "redirect_url": "https://docs.microsoft.com/windows/terminal/customize-settings/profile-general", + "redirect_url": "/windows/terminal/customize-settings/profile-general", "redirect_document_id": true }, { "source_path": "TerminalDocs/get-started.md", - "redirect_url": "https://docs.microsoft.com/windows/terminal/install", + "redirect_url": "/windows/terminal/install", "redirect_document_id": true }, { "source_path": "TerminalDocs/tutorials/powerline-setup.md", - "redirect_url": "https://docs.microsoft.com/windows/terminal/tutorials/custom-prompt-setup", + "redirect_url": "/windows/terminal/tutorials/custom-prompt-setup", "redirect_document_id": true } ] diff --git a/TerminalDocs/command-line-arguments.md b/TerminalDocs/command-line-arguments.md index ac9d3234..b0909312 100644 --- a/TerminalDocs/command-line-arguments.md +++ b/TerminalDocs/command-line-arguments.md @@ -431,7 +431,7 @@ wt --tabColor #009999 ; new-tab --tabColor #f59218 #### [PowerShell](#tab/powershell) ```powershell -wt --tabColor #009999 ; new-tab --tabColor #f59218 +wt --tabColor '#009999' `; new-tab --tabColor '#f59218' ``` #### [Linux](#tab/linux) @@ -448,7 +448,7 @@ Execution aliases do not work in WSL distributions. If you want to use wt.exe fr When `--tabColor` is set for a tab, it is associated with the first pane of this tab. Hence in a tab with multiple panes, the color will be applied only if the first pane is in focus. To set the tab color for additional panes, you will need to add the `--tabColor` parameter to the `split-pane` subcommand as well. In the example below, a tab with two panes is created with tab colors specified for each pane: ```powershell -wt new-tab --tabColor #009999 ; split-pane --tabColor #f59218 +wt new-tab --tabColor '#009999' `; split-pane --tabColor '#f59218' ``` ### Color scheme diff --git a/TerminalDocs/customize-settings/interaction.md b/TerminalDocs/customize-settings/interaction.md index 65e96588..48f304d6 100644 --- a/TerminalDocs/customize-settings/interaction.md +++ b/TerminalDocs/customize-settings/interaction.md @@ -45,7 +45,7 @@ ___ ## Remove trailing white-space in rectangular selection -When this is set to `true` and you copy text in a rectangular (block) selection to the clipboard, trailing white-spaces are removed from each line. When it's set to `false`, the white-spaces are preserved, ensuring that all lines have the same length. To copy text in a rectangular (block) selection, hold down the Alt key, right-click, and drag your mouse over the text area you want to select. This can be useful for selecting text columns, etc. +When this is set to `true` and you copy text in a rectangular (block) selection to the clipboard, trailing white-spaces are removed from each line. When it's set to `false`, the white-spaces are preserved, ensuring that all lines have the same length. To copy text in a rectangular (block) selection, hold down the Alt key, click and drag your mouse over the text area you want to select. This can be useful for selecting text columns, etc. **Property name:** `trimBlockSelection` diff --git a/TerminalDocs/selection.md b/TerminalDocs/selection.md index 33b21249..3032f0c5 100644 --- a/TerminalDocs/selection.md +++ b/TerminalDocs/selection.md @@ -45,8 +45,8 @@ Regardless of being in mark mode, you can expand an existing selection using the | Key binding | Result | | ----------- | ------ | | Shift + Arrow keys | Expand by character in the specified direction | -| Ctrl + Left | Expand to the beginning of the previous or existing word | -| Ctrl + Right | Expand to the end of the next or existing word | +| Ctrl + Shift + Left | Expand to the beginning of the previous or existing word | +| Ctrl + Shift + Right | Expand to the end of the next or existing word | | Shift + Home | Expand to the beginning of the line | | Shift + End | Expand to the end of the line | | Shift + Pgup | Expand up by a page (viewport) | diff --git a/TerminalDocs/tips-and-tricks.md b/TerminalDocs/tips-and-tricks.md index 552826d1..d883e909 100644 --- a/TerminalDocs/tips-and-tricks.md +++ b/TerminalDocs/tips-and-tricks.md @@ -3,7 +3,7 @@ title: Windows Terminal tips and tricks description: In this page, you will find tips and tricks to help improve your Windows Terminal experience. author: cinnamon-msft ms.author: cinnamon -ms.date: 10/08/2021 +ms.date: 07/08/2022 ms.topic: how-to --- @@ -130,6 +130,24 @@ Navigating to the parent directory with a key binding may also be helpful. You can also use this functionality to run builds or test scripts. +## Focus mode + +"Focus mode" hides the title bar and tabs normally located at the top of Windows Terminal, letting you focus only on the terminal content. It is similar to ["Zen mode"](https://code.visualstudio.com/docs/getstarted/tips-and-tricks#_zen-mode) in Visual Studio Code. + +To enter focus mode, open the [command pallette](./command-palette.md) using `Ctrl` + `Shift` + `p`, enter "focus mode", and select "Toggle focus mode." To exit focus mode, repeat these same steps. + +To set focus mode to launch every time you start Windows Terminal, open the **Settings** (`Ctrl` + `,`) and select the **Startup** tab. Under **Launch mode**, select **Focus** (or **Maximized focus**, which is focus mode with your terminal window maximized). Select **Save** before exiting. The next time you launch the Windows Terminal, it will open up in focus mode. To stop Windows Terminal from launching in focus mode, follow these same steps, but select **Default** from the list of **Launch mode** options. + +To add a shortcut key (or keybinding) for entering focus mode, open the `settings.json` file (`Ctrl` + `Shift` + `,`). Inside your `settings.json` file, find the [`"actions":`](./customize-settings/actions.md) section and add the following command: + +```json +{ "command": "toggleFocusMode", "keys": "ctrl+f12" } +``` + +Replace "ctrl+f12" with the shortcut / keybinding of your choice, but be sure not to repeat any existing keybindings from the Actions list. You can also see a list of Actions with associated keybindings, and **+ Add new** bindings, in the **Actions** tab of the Windows Terminal **Settings** dashboard. Remember to **Save** after making any changes. You can now toggle focus mode using the "action" shortcut key that you created. (In the case of our example, `Shift` + `F12`). + +To learn more about this command, see [`toggleFocusMode`](/windows/terminal/customize-settings/actions#toggle-focus-mode). + ## Quake mode "Quake mode" is the name for the special mode the terminal enters when naming a window `_quake`. When a window is in quake mode: diff --git a/TerminalDocs/tutorials/new-tab-same-directory.md b/TerminalDocs/tutorials/new-tab-same-directory.md index f0c7555f..35d79ac2 100644 --- a/TerminalDocs/tutorials/new-tab-same-directory.md +++ b/TerminalDocs/tutorials/new-tab-same-directory.md @@ -3,12 +3,12 @@ title: Opening a tab/pane in the same directory description: In this tutorial, you learn how to configure your shell to allow Windows Terminal to open tabs in the same path. author: zadjii-msft ms.author: migrie -ms.date: 11/18/2021 +ms.date: 07/08/2022 ms.topic: tutorial #Customer intent: As a developer or IT admin, I want to open tabs in the same working directory as my current tab. --- -# Tutorial: Opening a tab/pane in the same directory in Windows Terminal +# Tutorial: Opening a tab or pane in the same directory in Windows Terminal Typically, the "new tab" and "split pane" actions will always open a new tab/pane in whatever the `startingDirectory` is for that profile. However, on other platforms, it's common for new tabs to automatically use the working directory of the current tab as the starting directory for a new tab. This allows the user to quickly multitask in a single directory. @@ -65,7 +65,7 @@ function prompt { #### PowerShell with posh-git -If you're using posh-git, then that will already modify your prompt. In that case, you'll want to only add the necessary output to the already modified prompt. The following example is a lightly modified version of this example from [the ConEmu docs](https://conemu.github.io/en/ShellWorkDir.html#PowerShellPoshGit): +If you're using [posh-git](https://github.com/dahlbyk/posh-git), then that will already modify your prompt. In that case, you'll want to only add the necessary output to the already modified prompt. The following example is a lightly modified version of this example from [the ConEmu docs](https://conemu.github.io/en/ShellWorkDir.html#PowerShellPoshGit): ```powershell function prompt @@ -84,11 +84,26 @@ function prompt } ``` +#### PowerShell with Starship + +If you're using [Starship](http://starship.rs/), then that will already modify your prompt. In that case, you'll want to only add the necessary output to the already modified prompt. + +```powershell +function Invoke-Starship-PreCommand { + $loc = $($executionContext.SessionState.Path.CurrentLocation); + $prompt = "$([char]27)]9;12$([char]7)" + if ($loc.Provider.Name -eq "FileSystem") + { + $prompt += "$([char]27)]9;9;`"$($loc.Path)`"$([char]7)" + } + $host.ui.Write($prompt) +} + ### WSL #### `bash` -Add the following line to the end of your `.bashrc` file: +Add the following line to the end of your `.bash_profile` config file: ```bash PROMPT_COMMAND=${PROMPT_COMMAND:+"$PROMPT_COMMAND; "}'printf "\e]9;9;%s\e\\" "$(wslpath -w "$PWD")"' @@ -109,8 +124,33 @@ precmd_functions+=(keep_current_path) The `precmd_functions` hook tells zsh what commands to run before displaying the prompt. The `printf` statement is what we're using to append the sequence for setting the working directory with the Terminal. The `$(wslpath -w "$PWD")` bit will invoke the `wslpath` executable to convert the current directory into its Windows-like path. Using `precmd_functions+=` make sure we append the `keep_current_path` function to any existing function already defined for this hook. +#### Fish + +If you're using [Fish shell](https://fishshell.com/), add the following lines to the end of your config file located at `~/.config/fish/config.fish`: + +```bash +function storePathForWindowsTerminal --on-variable PWD + if test -n "$WT_SESSION" + printf "\e]9;9;%s\e\\" (wslpath -w "$PWD") + end +end +``` + +This function will be called whenever the current path is changed to confirm the current session is opened by Windows Terminal (verifying $WT_SESSION) and sending Operating System Command (OSC 9;9;), with the Windows equivalent path (`wslpath -w`) of current path. + +#### MINGW + +For MINGW, Git Bash and Cygwin, you need to modify the `PROMT_COMMAND` for WSL: replace `wslpath` with `cygpath`. + +Add the following line to the end of your `.bashrc` file: + +```bash +PROMPT_COMMAND=${PROMPT_COMMAND:+"$PROMPT_COMMAND; "}'printf "\e]9;9;%s\e\\" "`cygpath -w $PWD`"' +``` + > [!NOTE] -> Don't see your favorite shell here? If you figure it out, feel free to open a PR to contribute a solution for your preferred shell! +> Don't see your favorite shell here? If you figure it out, feel free to [open a PR](https://github.com/MicrosoftDocs/terminal/edit/main/TerminalDocs/tutorials/new-tab-same-directory.md) +> to contribute a solution for your preferred shell! ## Using actions to duplicate the path