From f865598d74bc9a7c250614c85275219c838e8ff0 Mon Sep 17 00:00:00 2001 From: Dave Kerr Date: Tue, 22 Jun 2021 19:45:35 +0800 Subject: [PATCH] feat: `set -ixon` in shell config so we can use Ctrl+S search --- samples/dotfiles/shell.sh | 4 ++++ .../managing-your-dotfiles/_index.md | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/samples/dotfiles/shell.sh b/samples/dotfiles/shell.sh index 60b72c15..2907bec5 100644 --- a/samples/dotfiles/shell.sh +++ b/samples/dotfiles/shell.sh @@ -37,6 +37,10 @@ VISUAL=vi # done # unset editor preferred_editors +# Allow us to use Ctrl+S to perform forward search, by disabling the start and +# stop output control signals, which are not needed on modern systems. +stty -ixon + # Set a shell option but don't fail if it doesn't exist! safe_set() { shopt -s "$1" >/dev/null 2>&1 || true; } diff --git a/website/content/docs/part-5-building-your-toolkit/managing-your-dotfiles/_index.md b/website/content/docs/part-5-building-your-toolkit/managing-your-dotfiles/_index.md index 064ffa5a..297d6ca0 100644 --- a/website/content/docs/part-5-building-your-toolkit/managing-your-dotfiles/_index.md +++ b/website/content/docs/part-5-building-your-toolkit/managing-your-dotfiles/_index.md @@ -228,6 +228,16 @@ In this method we specify an array of editors, go through each one, check to see You'll notice that in the _~/effective-shell/dotfiles/shell.sh_ folder I `unset` every shell variable after I use it. This is just to clean up after myself and try to leave the environment as pristine as possible after sourcing the file. +Another useful option to set is `stty -ixon`: + +```sh +# Allow us to use Ctrl+S to perform forward search, by disabling the start and +# stop output control signals, which are not needed on modern systems. +stty -ixon +``` + +This command tells the terminal driver that we don't need to control transmission with the Ctrl+Q and Ctrl+S commands, meaning we can instead use Ctrl+S to perform a forward search. + Now let's set some sensible settings for working with folders: ```sh