From 7c27c1e7d0be2c7de8ad02fe190757bf4580959d Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sun, 30 Nov 2025 06:24:39 +0100 Subject: [PATCH] editorconfig / doc_src: trim trailing whitespace Commit 0893134543c (Added .editorconfig file (#3332) (#3313), 2016-08-25) trimmed trailing whitespace for Markdown file (which do have significant trailing whitespace) but ReStructuredText does not, and none of our Markdown files cares about this, so let's clean up whitespace always. --- .editorconfig | 1 - CHANGELOG.rst | 2 +- doc_internal/rust-devel.md | 2 +- doc_src/cmds/abbr.rst | 2 +- doc_src/cmds/alias.rst | 4 ++-- doc_src/cmds/begin.rst | 4 ++-- doc_src/cmds/cd.rst | 2 +- doc_src/cmds/count.rst | 2 +- doc_src/cmds/emit.rst | 2 +- doc_src/cmds/end.rst | 2 +- doc_src/cmds/export.rst | 2 +- doc_src/cmds/fish.rst | 2 +- doc_src/cmds/fish_should_add_to_history.rst | 2 +- doc_src/cmds/for.rst | 2 +- doc_src/cmds/function.rst | 6 +++--- doc_src/cmds/functions.rst | 4 ++-- doc_src/cmds/path.rst | 8 ++++---- doc_src/cmds/printf.rst | 2 +- doc_src/cmds/random.rst | 4 ++-- doc_src/cmds/string-length.rst | 2 +- doc_src/cmds/string-shorten.rst | 2 +- doc_src/cmds/time.rst | 2 +- doc_src/commands.rst | 2 +- doc_src/fish_for_bash_users.rst | 6 +++--- doc_src/index.rst | 4 ++-- doc_src/interactive.rst | 4 ++-- doc_src/language.rst | 2 +- doc_src/prompt.rst | 6 +++--- doc_src/tutorial.rst | 12 ++++++------ 29 files changed, 48 insertions(+), 49 deletions(-) diff --git a/.editorconfig b/.editorconfig index a753582e0..74eaa86b6 100644 --- a/.editorconfig +++ b/.editorconfig @@ -14,7 +14,6 @@ indent_style = tab [*.{md,rst}] max_line_length = unset -trim_trailing_whitespace = false [*.sh] indent_size = 4 diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 20a0b6a12..80e8dcc25 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -133,7 +133,7 @@ This release fixes the following regressions identified in 4.1.0: This will not affect fish's child processes unless ``LC_MESSAGES`` was already exported. - Some :doc:`fish_config ` subcommands for showing prompts and themes had been broken in standalone Linux builds (those using the ``embed-data`` cargo feature), which has been fixed (:issue:`11832`). -- On Windows Terminal, we observed an issue where fish would fail to read the terminal's response to our new startup queries, causing noticeable lags and a misleading error message. A workaround has been added (:issue:`11841`). +- On Windows Terminal, we observed an issue where fish would fail to read the terminal's response to our new startup queries, causing noticeable lags and a misleading error message. A workaround has been added (:issue:`11841`). - A WezTerm `issue breaking shifted key input `__ has resurfaced on some versions of WezTerm; our workaround has been extended to cover all versions for now (:issue:`11204`). - Fixed a crash in :doc:`the web-based configuration tool ` when using the new underline styles (:issue:`11840`). diff --git a/doc_internal/rust-devel.md b/doc_internal/rust-devel.md index 4f82a203e..68b9495fc 100644 --- a/doc_internal/rust-devel.md +++ b/doc_internal/rust-devel.md @@ -116,7 +116,7 @@ fn get_shell_name() -> &'static wstr { #### The wchar prelude We have a prelude to make working with these string types a whole lot more ergonomic. In particular `WExt` supplies the null-terminated-compatible `.char_at(usize)`, -and a whole lot more methods that makes porting C++ code easier. It is also preferred to use char-based-methods like `.char_count()` and `.slice_{from,to}()` +and a whole lot more methods that makes porting C++ code easier. It is also preferred to use char-based-methods like `.char_count()` and `.slice_{from,to}()` of the `WExt` trait over directly calling `.len()` and `[usize..]/[..usize]`, as that makes the code compatible with a potential future change to UTF8-strings. ```rust diff --git a/doc_src/cmds/abbr.rst b/doc_src/cmds/abbr.rst index 6d5339665..22e6feba0 100644 --- a/doc_src/cmds/abbr.rst +++ b/doc_src/cmds/abbr.rst @@ -46,7 +46,7 @@ Combining these features, it is possible to create custom syntaxes, where a regu > abbr >> ~/.config/fish/config.fish > abbr --erase (abbr --list) - + Alternatively you can keep them in a separate :ref:`configuration file ` by doing something like the following:: > abbr > ~/.config/fish/conf.d/myabbrs.fish diff --git a/doc_src/cmds/alias.rst b/doc_src/cmds/alias.rst index 8110692b3..c18e3556a 100644 --- a/doc_src/cmds/alias.rst +++ b/doc_src/cmds/alias.rst @@ -46,12 +46,12 @@ The following code will create ``rmi``, which runs ``rm`` with additional argume :: alias rmi="rm -i" - + # This is equivalent to entering the following function: function rmi --wraps rm --description 'alias rmi=rm -i' rm -i $argv end - + ``alias`` sometimes requires escaping, as you can see here:: # This needs to have the spaces escaped or "Chrome.app..." diff --git a/doc_src/cmds/begin.rst b/doc_src/cmds/begin.rst index a916e848b..315a5d215 100644 --- a/doc_src/cmds/begin.rst +++ b/doc_src/cmds/begin.rst @@ -33,10 +33,10 @@ The following code sets a number of variables inside of a block scope. Since the begin set -l PIRATE Yarrr - + ... end - + echo $PIRATE # This will not output anything, since the PIRATE variable # went out of scope at the end of the block diff --git a/doc_src/cmds/cd.rst b/doc_src/cmds/cd.rst index afc64e74a..52ae89561 100644 --- a/doc_src/cmds/cd.rst +++ b/doc_src/cmds/cd.rst @@ -41,7 +41,7 @@ Examples cd # changes the working directory to your home directory. - + cd /usr/src/fish-shell # changes the working directory to /usr/src/fish-shell diff --git a/doc_src/cmds/count.rst b/doc_src/cmds/count.rst index 4269bda32..5bdb76ce3 100644 --- a/doc_src/cmds/count.rst +++ b/doc_src/cmds/count.rst @@ -30,7 +30,7 @@ Example count $PATH # Returns the number of directories in the users PATH variable. - + count *.txt # Returns the number of files in the current working directory # ending with the suffix '.txt'. diff --git a/doc_src/cmds/emit.rst b/doc_src/cmds/emit.rst index 64cf74cc6..a28aa88d1 100644 --- a/doc_src/cmds/emit.rst +++ b/doc_src/cmds/emit.rst @@ -27,7 +27,7 @@ The following code first defines an event handler for the generic event named 't function event_test --on-event test_event echo event test: $argv end - + emit test_event something diff --git a/doc_src/cmds/end.rst b/doc_src/cmds/end.rst index 2b54412eb..2803d5438 100644 --- a/doc_src/cmds/end.rst +++ b/doc_src/cmds/end.rst @@ -7,7 +7,7 @@ Synopsis .. synopsis:: begin - [COMMANDS ...] + [COMMANDS ...] end .. synopsis:: diff --git a/doc_src/cmds/export.rst b/doc_src/cmds/export.rst index ed3e0e773..67a07ffdd 100644 --- a/doc_src/cmds/export.rst +++ b/doc_src/cmds/export.rst @@ -13,7 +13,7 @@ Synopsis Description ----------- -``export`` is a function included for compatibility with POSIX shells. In general, the :doc:`set ` +``export`` is a function included for compatibility with POSIX shells. In general, the :doc:`set ` builtin should be used instead. When called without arguments, ``export`` prints a list of currently-exported variables, like ``set diff --git a/doc_src/cmds/fish.rst b/doc_src/cmds/fish.rst index e5f9a48d9..76462bd36 100644 --- a/doc_src/cmds/fish.rst +++ b/doc_src/cmds/fish.rst @@ -51,7 +51,7 @@ The following options are available: when :command:`fish` exits, output timing information on all executed commands to the specified file. This excludes time spent starting up and reading the configuration. -**--profile-startup=PROFILE_FILE** +**--profile-startup=PROFILE_FILE** Will write timing for ``fish`` startup to specified file. **-P** or **--private** diff --git a/doc_src/cmds/fish_should_add_to_history.rst b/doc_src/cmds/fish_should_add_to_history.rst index b3bbf846d..93827d850 100644 --- a/doc_src/cmds/fish_should_add_to_history.rst +++ b/doc_src/cmds/fish_should_add_to_history.rst @@ -50,6 +50,6 @@ This refuses to store any immediate "vault", "mysql" or "ls" calls. Commands sta and string match -qr "^/home/me/my-secret-project/" -- (pwd -P) return 1 end - + return 0 end diff --git a/doc_src/cmds/for.rst b/doc_src/cmds/for.rst index 92ff56735..03ca5aefe 100644 --- a/doc_src/cmds/for.rst +++ b/doc_src/cmds/for.rst @@ -23,7 +23,7 @@ Example :: for i in foo bar baz; echo $i; end - + # would output: foo bar diff --git a/doc_src/cmds/function.rst b/doc_src/cmds/function.rst index daad2cef4..e9cff07d8 100644 --- a/doc_src/cmds/function.rst +++ b/doc_src/cmds/function.rst @@ -85,7 +85,7 @@ will run the ``ls`` command, using the ``-l`` option, while passing on any addit # prints: [DEBUG] foo: bar # OR - + function debug2 -a var echo [DEBUG] $var: $$var >&2 end @@ -106,7 +106,7 @@ will create a ``debug`` command to print chosen variables to `stderr`. if test $status = 0 switch $argv[(count $argv)] case '-*' - + case '*' cd $argv[(count $argv)] return @@ -124,7 +124,7 @@ This will run the ``mkdir`` command, and if it is successful, change the current function notify set -l job (jobs -l -g) or begin; echo "There are no jobs" >&2; return 1; end - + function _notify_job_$job --on-job-exit $job --inherit-variable job echo -n \a # beep functions -e _notify_job_$job diff --git a/doc_src/cmds/functions.rst b/doc_src/cmds/functions.rst index addbfd250..6fd490e1e 100644 --- a/doc_src/cmds/functions.rst +++ b/doc_src/cmds/functions.rst @@ -82,10 +82,10 @@ Examples functions -n # Displays a list of currently-defined functions - + functions -c foo bar # Copies the 'foo' function to a new function called 'bar' - + functions -e bar # Erases the function ``bar`` diff --git a/doc_src/cmds/path.rst b/doc_src/cmds/path.rst index 6652c1762..2416a0701 100644 --- a/doc_src/cmds/path.rst +++ b/doc_src/cmds/path.rst @@ -209,7 +209,7 @@ Examples # This is the same as above: "-f" is "--type=file", "-d" is "--type=dir", # "-x" is short for "--perm=exec" and "-w" short for "--perm=write"! /home/me - + >_ path filter -fx $PATH/* # Prints all possible commands - the first entry of each name is what fish would execute! @@ -306,7 +306,7 @@ Examples >_ path normalize /bin//bash # The "//" is squashed, but /bin isn't resolved even if your system links it to /usr/bin. /bin/bash - + >_ path normalize ./my/subdirs/../sub2 my/sub2 @@ -337,7 +337,7 @@ Examples # The "//" is squashed, and /bin is resolved if your system links it to /usr/bin. # sh here is bash (this is common on linux systems) /usr/bin/bash - + >_ path resolve /bin/foo///bar/../baz # Assuming /bin exists and is a symlink to /usr/bin, but /bin/foo doesn't. # This resolves the /bin/ and normalizes the nonexistent rest: @@ -381,7 +381,7 @@ Examples >_ path change-extension '' ~/.config. /home/alfa/.config - + "sort" subcommand ----------------------------- diff --git a/doc_src/cmds/printf.rst b/doc_src/cmds/printf.rst index 7dd31ec96..57f292669 100644 --- a/doc_src/cmds/printf.rst +++ b/doc_src/cmds/printf.rst @@ -22,7 +22,7 @@ The *FORMAT* argument is re-used as many times as necessary to convert all of th Unlike :doc:`echo `, ``printf`` does not append a new line unless it is specified as part of the string. -It doesn't support any options, so there is no need for a ``--`` separator, which makes it easier to use for arbitrary input than ``echo``. [#]_ +It doesn't support any options, so there is no need for a ``--`` separator, which makes it easier to use for arbitrary input than ``echo``. [#]_ Format Specifiers ----------------- diff --git a/doc_src/cmds/random.rst b/doc_src/cmds/random.rst index b4780b19c..5cf42592f 100644 --- a/doc_src/cmds/random.rst +++ b/doc_src/cmds/random.rst @@ -44,7 +44,7 @@ Example The following code will count down from a random even number between 10 and 20 to 1: :: - + for i in (seq (random 10 2 20) -1 1) echo $i end @@ -62,5 +62,5 @@ Or, to only get even numbers from 2 to 20:: random 2 2 20 Or odd numbers from 1 to 3:: - + random 1 2 3 # or 1 2 4 diff --git a/doc_src/cmds/string-length.rst b/doc_src/cmds/string-length.rst index 12056a5fe..1d5c6f066 100644 --- a/doc_src/cmds/string-length.rst +++ b/doc_src/cmds/string-length.rst @@ -46,7 +46,7 @@ Examples # depending on $fish_emoji_width, this is either 4 or 8 # in new terminals it should be 8 - + >_ string length --visible abcdef\r123 # this displays as "123def", so the width is 6 6 diff --git a/doc_src/cmds/string-shorten.rst b/doc_src/cmds/string-shorten.rst index 800b9a55a..2ad724c0c 100644 --- a/doc_src/cmds/string-shorten.rst +++ b/doc_src/cmds/string-shorten.rst @@ -89,7 +89,7 @@ See Also .. BEGIN SEEALSO - :doc:`string pad ` does the inverse of this command, adding padding to a specific width instead. - + - The :doc:`printf ` command can do simple padding, for example ``printf %10s\n`` works like ``string pad -w10``. - :doc:`string length ` with the ``--visible`` option can be used to show what fish thinks the width is. diff --git a/doc_src/cmds/time.rst b/doc_src/cmds/time.rst index 546c995c0..e3a81bc00 100644 --- a/doc_src/cmds/time.rst +++ b/doc_src/cmds/time.rst @@ -55,7 +55,7 @@ Example :: >_ time sleep 1s - + ________________________________________________________ Executed in 1,01 secs fish external usr time 2,32 millis 0,00 micros 2,32 millis diff --git a/doc_src/commands.rst b/doc_src/commands.rst index f5251b600..653fd02df 100644 --- a/doc_src/commands.rst +++ b/doc_src/commands.rst @@ -95,5 +95,5 @@ And here is the full list: .. toctree:: :glob: :maxdepth: 1 - + cmds/* diff --git a/doc_src/fish_for_bash_users.rst b/doc_src/fish_for_bash_users.rst index 67abcf1ba..661cbafc7 100644 --- a/doc_src/fish_for_bash_users.rst +++ b/doc_src/fish_for_bash_users.rst @@ -263,7 +263,7 @@ and could be written in other shells as xterm rxvt-unicode EOF - + So heredocs really are minor syntactical sugar that introduces a lot of special rules, which is why fish doesn't have them. Pipes are a core concept, and are simpler and compose nicer. .. [#] For example, the "EOF" is just a convention, the terminator can be an arbitrary string, something like "THISISTHEEND" also works. And using ``<<-`` trims leading *tab* characters (but not other whitespace), so you can indent the lines, but only with tabs. Substitutions (variables, commands) are done on the heredoc by default, but not if the terminator is quoted: ``cat << "EOF"``. @@ -341,7 +341,7 @@ Fish's blocking constructs look a little different. They all start with a word, done # becomes - + for i in 1 2 3 echo $i end @@ -361,7 +361,7 @@ Fish's blocking constructs look a little different. They all start with a word, } # becomes - + begin echo Hello end diff --git a/doc_src/index.rst b/doc_src/index.rst index 23f95b047..1e16d43d0 100644 --- a/doc_src/index.rst +++ b/doc_src/index.rst @@ -110,7 +110,7 @@ This will call ``env``, which then goes through :envvar:`PATH` to find a program The shebang line is only used when scripts are executed without specifying the interpreter. For functions inside fish or when executing a script with ``fish /path/to/script``, a shebang is not required (but it doesn't hurt!). When executing files without an interpreter, fish, like other shells, tries your system shell, typically ``/bin/sh``. This is needed because some scripts are shipped without a shebang line. - + Configuration ============= @@ -158,7 +158,7 @@ Other help pages ================ .. toctree:: :maxdepth: 1 - + self faq interactive diff --git a/doc_src/interactive.rst b/doc_src/interactive.rst index 1e9add660..e61fdd5c8 100644 --- a/doc_src/interactive.rst +++ b/doc_src/interactive.rst @@ -446,7 +446,7 @@ The ``fish_vi_cursor`` function will be used to change the cursor's shape depend # Set the replace mode cursors to an underscore set fish_cursor_replace_one underscore set fish_cursor_replace underscore - # Set the external cursor to a line. The external cursor appears when a command is started. + # Set the external cursor to a line. The external cursor appears when a command is started. # The cursor shape takes the value of fish_cursor_default when fish_cursor_external is not specified. set fish_cursor_external line # The following variable can be used to configure cursor shape in @@ -592,7 +592,7 @@ To find out the name of a key, you can use :doc:`fish_key_reader fish_key_reader # Press Alt + right-arrow Press a key: bind alt-right 'do something' - + Note that the historical way the terminal encodes keys and sends them to the application (fish, in this case) makes a lot of combinations indistinguishable or unbindable. In the usual encoding, :kbd:`ctrl-i` *is the same* as the tab key, and shift cannot be detected when ctrl is also pressed. There are more powerful encoding schemes, and fish tries to tell the terminal to turn them on, but there are still many terminals that do not support them. When ``fish_key_reader`` prints the same sequence for two different keys, then that is because your terminal sends the same sequence for them, and there isn't anything fish can do about it. It is our hope that these schemes will become more widespread, making input more flexible. diff --git a/doc_src/language.rst b/doc_src/language.rst index 09ff62f9d..95ddf8fcb 100644 --- a/doc_src/language.rst +++ b/doc_src/language.rst @@ -1178,7 +1178,7 @@ All variables in fish have a scope. For example they can be global or local to a echo $name, I am $place and my instrument is $instrument # Will print: - # Patrick, I am at the Krusty Krab and my instrument is + # Patrick, I am at the Krusty Krab and my instrument is There are four kinds of variable scopes in fish: universal, global, function and local variables. diff --git a/doc_src/prompt.rst b/doc_src/prompt.rst index dd3ffb66f..f84791802 100644 --- a/doc_src/prompt.rst +++ b/doc_src/prompt.rst @@ -113,9 +113,9 @@ It's useful to display this in your prompt, but showing it when it's 0 seems kin First of all, since every command (except for :doc:`set `) changes the status, you need to store it for later use as the first thing in your prompt. Use a :ref:`local variable ` so it will be confined to your prompt function:: set -l last_status $status - + And after that, you can set a string if it is not zero:: - + # Prompt status only if it's not 0 set -l stat if test $last_status -ne 0 @@ -125,7 +125,7 @@ And after that, you can set a string if it is not zero:: And to print it, we add it to our ``string join``:: string join '' -- (set_color green) (prompt_pwd) (set_color normal) $stat '>' - + If ``$last_status`` was 0, ``$stat`` is empty, and so it will simply disappear. So our entire prompt is now:: diff --git a/doc_src/tutorial.rst b/doc_src/tutorial.rst index dad147058..43a48ecaf 100644 --- a/doc_src/tutorial.rst +++ b/doc_src/tutorial.rst @@ -323,7 +323,7 @@ This also means that, if the list is empty, there will be no argument:: > set empty # no argument > echo $empty/this_is_gone # prints an empty line - + If you quote the list, it will be used as one string and so you'll get one argument even if it is empty. For more, see :ref:`Lists `. @@ -431,7 +431,7 @@ Like other shells, fish allows multiple commands either on separate lines or the To write them on the same line, use the semicolon (";"). That means the following two examples are equivalent:: echo fish; echo chips - + # or echo fish echo chips @@ -504,9 +504,9 @@ To compare strings or numbers or check file properties (whether a file exists or if test "$fish" = "flounder" echo FLOUNDER end - + # or - + if test "$number" -gt 5 echo $number is greater than five else @@ -698,9 +698,9 @@ It is possible to directly create functions and variables in ``config.fish`` fil :: > cat ~/.config/fish/config.fish - + set -x PATH $PATH /sbin/ - + function ll ls -lh $argv end