Commit graph

1936 commits

Author SHA1 Message Date
Mahmoud Al-Qudsi
8eb7a08035 Document backward-char-passive 2024-03-29 14:23:53 -05:00
Mahmoud Al-Qudsi
674c481d87 Add documentation for forward-char-passive 2024-03-28 00:18:24 -05:00
Johannes Altmanninger
c3cd68dda5 Process shell commands from bindings like regular char events
A long standing issue is that bindings cannot mix special input functions
and shell commands. For example,

    bind x end-of-line "commandline -i x"

silently does nothing. Instead we have to do lift everything to shell commands

    bind x "commandline -f end-of-line; commandline -i x"

for no good reason.

Additionally, there is a weird ordering difference between special input
functions and shell commands. Special input functions are pushed into the
the queue whereas shell commands are executed immediately.

This weird ordering means that the above "bind x" still doesn't work as
expected, because "commandline -i" is processed before "end-of-line".

Finally, this is all implemented via weird hack to allow recursive use of
a mutable reference to the reader state.

Fix all of this by processing shell commands the same as both special input
functions and regular chars. Hopefully this doesn't break anything.

Fixes #8186
Fixes #10360
Closes #9398
2024-03-23 10:06:11 +01:00
Johannes Altmanninger
299fcde808 Better link for POSIX test 2024-03-23 09:51:09 +01:00
Fabian Boehm
c759a98b37 docs: Clarify that disowned jobs won't fire on-process/job-exit
Fixes #10381
2024-03-19 16:39:37 +01:00
Fabian Boehm
6869b14fb5 docs: Add fish_should_add_to_history to commands list 2024-03-09 12:09:00 +01:00
Fabian Boehm
f7cc1743c6
Allow deciding if a command should be saved to history (#10302)
Call fish_should_add_to_history to see if a command should be saved

If it returns 0, it will be saved, if it returns anything else, it
will be ephemeral.

It gets the right-trimmed text as the argument.

If it doesn't exist, we do the historical behavior of checking for a
leading space.

That means you can now turn that off by defining a
`fish_should_add_to_history` that just doesn't check it.

documentation based on #9298
2024-03-09 12:04:16 +01:00
TAKAHASHI Shuuji
3c7b2af442 docs: Correct default value of read function in read.rst 2024-03-04 17:49:47 +01:00
Henrik Hørlück Berg
59fa7479ee
Add documentation and release notes for #10282 2024-02-11 12:43:13 +01:00
Johannes Altmanninger
47aa79813d Open command script in external editor on Alt+o
Fish functions are great for configuring fish but they don't integrate
seamlessly with the rest of the system. For tasks that can run outside fish,
writing scripts is the natural approach.

To edit my scripts I frequently run

    $EDITOR (which my-script)

Would be great to reduce the amount typing for this common case (the names
of editor and scripts are usually short, so that's a lot of typing spent on
the boring part).

Our Alt+o binding opens the file at the cursor in a pager.  When the cursor
is in command position, it doesn't do anything (unless the command is actually
a valid file path). Let's make it open the resolved file path in an editor.

In future, we should teach this binding to delegate to "funced" upon seeing
a function instead of a script. I didn't do it yet because funced prints
messages, so it will mess with the commandline rendering if used from
a binding.  (The fact that funced encourages overwriting functions that
ship with fish is worrysome. Also I'm not sure why funced doesn't open the
function's source file directly (if not sourced from stdin). Persisting the
function should probably be the default.)

Alternative approach: I think other shells expand "=my-script" to
"/path/to/my-script".  That is certainly an option -- if we do that we'd want
to teach fish to complete command names after "=".  Since I don't remember
scenarios where I care about the full path of a script beyond opening it in
my editor, I didn't look further into this.

Closes #10266
2024-02-07 00:07:47 +01:00
Fabian Boehm
8d71eef1da
Add feature flag to turn off %self (#10262)
This is the last remnant of the old percent expansion.

It has the downsides of it, in that it is annoying to combine with
anything:

```fish
echo %self/foo
```

prints "%self/foo", not fish's pid.

We have introduced $fish_pid in 3.0, which is much easier to use -
just like a variable, because it is one.

If you need backwards-compatibility for < 3.0, you can use the
following shim:

```fish
set -q fish_pid
or set -g fish_pid %self
```

So we introduce a feature-flag called "remove-percent-self" to turn it
off.

"%self" will simply not be special, e.g. `echo %self` will print
"%self".
2024-02-06 22:13:16 +01:00
Fabian Boehm
94d3307469 docs/argparse: Add some more examples, something on -x
Fixes #10284
2024-02-03 21:41:50 +01:00
Fabian Boehm
f8da013f33 docs/prompt: A few small fixes
`set_color` does *just* the formatting, the string to color needs to
be added separately
2024-02-03 11:12:11 +01:00
Demian Ferreiro
bbbef75978 Fix rounding error on math docs 2024-01-30 20:12:56 +01:00
David Adam
7d33f6706f Import FindRust from Corrosion 2024-01-30 18:18:55 +08:00
Johannes Altmanninger
33a9659cd1 Fix stale name of --tokens-expand option
Missed in 368017905 (builtin commandline: -x for expanded tokens, supplanting
-o, 2024-01-06).
2024-01-27 20:09:33 +01:00
Johannes Altmanninger
368017905e builtin commandline: -x for expanded tokens, supplanting -o
Issue #10194 reports Cobra completions do

    set -l args (commandline -opc)
    eval $args[1] __complete $args[2..] (commandline -ct | string escape)

The intent behind "eval" is to expand variables and tildes in "$args".
Fair enough. Several of our own completions do the same, see the next commit.

The problem with "commandline -o" + "eval" is that the former already
removes quotes that are  relevant for "eval". This becomes a problem if $args
contains quoted () or {}, for example this command will wrongly execute a
command substituion:

    git --work-tree='(launch-missiles)' <TAB>

It is possible to escape the string the tokens before running eval, but
then there will be no expansion of variables etc.  The problem is that
"commandline -o" only unescapes tokens so they end up in a weird state
somewhere in-between what the user typed and the expanded version.

Remove the need for "eval" by introducing "commandline -x" which expands
things like variables and braces. This enables custom completion scripts to
be aware of shell variables without eval, see the added test for completions
to "make -C $var/some/dir ".

This means that essentially all third party scripts should migrate from
"commandline -o" to "commandline -x". For example

    set -l tokens
    if commandline -x >/dev/null 2>&1
        set tokens (commandline -xpc)
    else
        set tokens (commandline -opc)
    end

Since this is mainly used for completions, the expansion skips command
substitutions.  They are passed through as-is (instead of cancelling or
expanding to nothing) to make custom completion scripts work reasonably well
in the common case. Of course there are cases where we would want to expand
command substitutions here, so I'm not sure.
2024-01-27 09:28:06 +01:00
Fabian Boehm
b8b062eb84 docs: Update qmark-noglob status
Note: The version number needs to be adjusted
2024-01-25 18:47:41 +01:00
Fabian Boehm
f7b57065db docs/command: Simplify
This prefers `-s` to `-v` - we have a *lot* more uses of `command -s`, it's the easier
mnemonic *and* the more compatible-with-fish option.

Also we don't really need the separate section that explains what
these options do *again*.
2024-01-22 21:44:59 +01:00
Fabian Boehm
bf2fa6ef46 docs: Explain globs more in fish-for-bash-users 2024-01-14 11:06:51 +01:00
Fabian Boehm
f4ba2866fc docs: Add overview table of "operators"
Fixes #10201
2024-01-14 11:06:37 +01:00
Fabian Boehm
af366862f4 docs: Call it "reserved words"
"Reserved keywords" is a mouthful and some of these arguably aren't
"keywords".
2024-01-14 10:40:51 +01:00
Fabian Boehm
f8cb8284b2 docs: Add argparse examples on how to use the flags 2024-01-14 10:20:11 +01:00
David Adam
f65ed782e8 Drop unused CMake module CheckIncludeFiles
This was only needed for certain configure checks, now elided, and for
CMake < 3.11.
2024-01-13 22:55:13 +08:00
Manlio Perillo
a953b7984d doc_src: add print media support to the Sphinx theme
Update the pydoctheme.css file to add support for print media.

The code was adapted from the existing support for screens that are less than
700px wide, with the following changes:

  - Remove the documents and sections index
  - Remove the quick search
  - Remove dead CSS code

Additionally, add section numbers and ensure that code blocks are never split
across multiple pages.
2024-01-12 17:52:43 +01:00
Fabian Boehm
96caee837c docs: Add else and end to keywords list 2024-01-09 16:27:33 +01:00
Johannes Altmanninger
3c12864436 docs: fix double space in example fish_greeting
Closes #10176
2024-01-06 15:26:20 +01:00
David Adam
094f10874b bump copyright year to 2024 2024-01-06 22:24:55 +08:00
Fabian Boehm
4286b049ca docs: Fix two formatting errors
sphinx *really* needs an empty line after a `::` code block starter
2024-01-05 16:49:49 +01:00
Fabian Boehm
ff8563cfdb docs/set: Fix typo
Fixes #10185
2024-01-02 21:54:07 +01:00
David Adam
6c599d8f22 docs/license: tidy up formatting 2023-12-31 21:49:38 +08:00
David Adam
413ba192a0 drop unused code:
fish_tests.cpp:
* comma_join

env.cpp:
* env_get_inherited
* env_get_runtime_path
* check_runtime_path (from tmux)
2023-12-31 21:14:40 +08:00
David Adam
ea34f71e1c docs/license: note Nord theme license 2023-12-31 12:44:29 +08:00
David Adam
ea256323ab docs: standardise name for vi mode
Vi mode, vi-mode and various permutations are used.

Standardise on "vi mode".
2023-12-17 17:40:45 +08:00
Alex Chan
ccc8308d41 Add a missing space after a comma 2023-11-26 22:44:54 +08:00
David Adam
f2f41c6eec drop unused functions and configure checks
Remove the following C++ functions/methods, which have no callers:

common.cpp:
- read_loop
- narrow_string_safe
- escape_string_for_double_quotes
- read_unquoted_escape
- format_size
- format_size_safe
- valid_func_name
- get_executable_path

env.cpp:
- env_stack_t::set_empty
- env_stack_t::set_argv

fallback.cpp:
- fish_mkstemp_cloexec
- flock

proc_util.cpp:
- parse_util_slice_length
- parse_util_argument_is_help

path.cpp:
- path_get_path
- path_as_implicit_cd
- path_apply_working_directory
- path_emit_config_directory_messages
- path_get_data_remoteness
- path_get_config_remoteness
- path_is_valid
- paths_are_same_file

wcstringutil.cpp:
- split_string_tok

wutil.cpp:
- wgetcwd
- wunlink
- wrealpath
- wrename
- file_id_for_path
- fish_wcstoull

Also drop unused configure checks/defines:
- HAVE_FLOCK
2023-11-26 22:35:51 +08:00
Fabian Boehm
21b5f6f163 docs: Fix markdown links 2023-11-22 18:42:34 +01:00
ridiculousfish
c1e4a447fd Remove C++ UTF-8 bits
These are no longer used.
2023-11-18 19:21:25 -08:00
Johannes Stölp
1cba28c120 [doc]: fix --path description of set cmd 2023-11-18 19:00:56 -08:00
a-kenji
17eadcff03 Fix small typos 2023-11-18 18:27:25 -08:00
Fabian Boehm
723bfb9aaf docs/complete: List --description with the options 2023-11-14 16:32:43 +01:00
Fabian Boehm
f81c9cba50 docs: Make the vendor dirs a nested list 2023-11-07 17:55:36 +01:00
Fabian Boehm
ddd9d183e2 Document $__fish_vendor_confdirs and __fish_build_paths
Fixes #10078
2023-11-07 17:48:54 +01:00
Fabian Boehm
8fea3cb56d docs: Fix link 2023-11-07 17:48:54 +01:00
Fabian Boehm
496fc03b98 docs: More on key timeout, key chord limitations 2023-10-24 18:25:49 +02:00
Fabian Boehm
dd12f55dc2 docs/read: Specify default scope
Fixes #10061
2023-10-19 21:12:54 +02:00
Florian Meißner
b16a869907 Fix typo in read doc 2023-10-18 19:09:11 +02:00
Oliver Schrenk
631f2c073c fix typo in set -U option 2023-10-18 19:08:09 +02:00
Fabian Boehm
913eddbdcf docs: Underline *all* body links, not just internal ones 2023-10-18 18:35:02 +02:00
Fabian Boehm
c6e905a1b9 docs/read: Mention the more common mode first
Printing to stdout is a thing it can do, yes, but writing to variables
is the more typical way to use it.
2023-10-12 22:35:43 +02:00
ridiculousfish
98018753e5 Replace references to angular with alpine
Updates our license references.
2023-10-08 12:25:43 -07:00
Fabian Boehm
c4ca1a68d3
Add a clear-screen bind function to clear the screen (#10044)
This can be bound like `bind \cl clear-screen`, and is, by default

In contrast to the current way it doesn't need the external `clear`
command that was always awkward.

Also it will clear the screen and first draw the old prompt to remove
flicker.
Then it will immediately trigger a repaint, so the prompt will be overwritten.
2023-10-08 11:41:30 +02:00
Fabian Boehm
ebb8368464 docs/read: Some reorganization
This just had *all the options* in one gigantic list, and some very
stuffy wording - "prompt-str" sounded like it was discouraged for some reason?
2023-09-13 17:18:19 +02:00
Fabian Boehm
ad54f07328 docs/set: Correct some errors 2023-09-13 17:08:52 +02:00
Fabian Boehm
778f4e6732 docs: Improve quoting variables section
This now specifically explains quoting with `set`, and the contrast to bash.
2023-09-11 17:31:00 +02:00
Fabian Boehm
0e81d25b36 docs/commandline: Add more on the -oc/-ct thing
This was the remaining immediately actionable part of #7375.

It's not definitely the last word, but a change here would require a
bigger plan.

Fixes #7375
2023-09-08 18:27:34 +02:00
Fabian Boehm
f9b51cf8a6 docs: Add key timeout 2023-08-30 23:13:09 +02:00
Fabian Boehm
55c425a0dd fish_key_reader: Humanize key descriptions
This used to print all codepoints outside of the ASCII range (i.e.
above 0x80) in \uXXXX or \UYYYYYYYY notation.

That's quite awkward, considering that this is about keys that are
being pressed, and many keyboards have actual symbols for these on
them - I have an "ö" key, so I would like to use `bind ö` and not
`bind \u00F6`. So we go by iswgraph.

On a slightly different note, `\e` was written as `\c[ (or \e)`. I do
not believe anyone really uses `\c[` (the `[` would need to
be escaped!), and it's confusing and unnecessary to even mention that.
2023-08-26 10:43:42 +02:00
Fabian Boehm
d803ebbff9 docs: Some teensy bits on if/while
The ``test`` thing was just duplicated, and ``while`` linked to the
if-*command* page, where the syntax section is probably nicer
2023-08-26 09:32:05 +02:00
Fabian Boehm
b48fa1f1a0
Css refresh (#9982)
This cleans up the CSS, reduces the number of different colors and special settings we use.

It increases contrast so we now pass WCAG AAA (according to chromium), and switches to css variables for colors to make dark mode simpler to implement.
2023-08-25 17:13:35 +02:00
Fabian Boehm
e555f1b235 math: Fix docs on --scale
Fixes #9983
2023-08-25 16:17:59 +02:00
Fabian Boehm
b3ff982ad7 docs: Remove some jquery leftovers 2023-08-24 21:55:57 +02:00
Fabian Boehm
e3b1d327f1 docs: Remove reference to nonexistent style.css 2023-08-24 21:55:57 +02:00
Fabian Boehm
0aa21440d1 docs/path: Remove incorrect status comments
During development, for a while `path change-extension` would return 0
when it found an extension to change.

This was later changed to returning 0 if there are any path arguments.

Neither of which is *super* useful, I admit, but we've picked one and
the docs shouldn't contradict it.
2023-08-24 18:06:03 +02:00
Fabian Boehm
8abd0319fb docs: Some slight rewordings 2023-08-23 23:08:56 +02:00
Kevin Cali
716001789b docs: correct insert mode key 2023-08-21 17:50:45 +02:00
Fabian Boehm
79aeb1656c docs/type: Correct "--no-functions"
This was accidentally changed in 3.2.0, when type was made a builtin.

Since it's been 4 releases and nobody has noticed, rather than
breaking things again let's leave it as it is, especially because the
option is named "--no-functions", not "--no-functions-or-builtins".
2023-08-21 17:44:21 +02:00
Fabian Boehm
53598d6a21 docs: More on if-conditions 2023-08-21 17:43:43 +02:00
Fabian Boehm
3711d0e06c docs: Clarify a sentence in the test docs 2023-08-20 22:10:30 +02:00
Fabian Boehm
2f86b31bd3 docs: More on scopes
Let's start with an example to motivate the rest
2023-08-19 12:26:27 +02:00
Fabian Boehm
c07136e8d3 docs: Mention fish_cursor_replace
Fixes #9956
2023-08-15 19:11:03 +02:00
Pavel savchenko
c56f9e1981 Docs: correct small grammatical error in read.rst 2023-07-26 09:20:49 +02:00
Adam J. Stewart
72de1dc201 Docs: fix code block 2023-07-10 18:31:46 +02:00
Adam J. Stewart
e31c0ebb05 Fix grammar in completion docs 2023-07-09 14:11:01 +08:00
Fabian Boehm
1a52f79c24 docs/test: More on THE PROBLEM 2023-07-06 18:39:42 +02:00
Johannes Altmanninger
052823c120 history pager: delete selected history entry with Shift-Delete
After accidentally running a command that includes a pasted password, I want
to delete command from history. Today we need to recall or type (part of)
that command and type "history delete".  Let's maybe add a shortcut to do
this from the history pager.

The current shortcut is Shift+Delete. I don't think that's very discoverable,
maybe we should use Delete instead (but only if the cursor is at the end of
the commandline, otherwise delete a char).

Closes #9454
2023-07-04 18:42:11 +02:00
Fabian Boehm
92551e1818 docs/abbr: Explain saving abbrs 2023-07-04 18:30:28 +02:00
Fabian Boehm
9bcb4dcf70 docs: Remove some needless margins for nested lists
This double-indented a nested list *and* added some gaps at the
bottom.

Other lists are unaffected
2023-06-28 16:32:55 +02:00
Fabian Boehm
22f2926185 docs/prompt: Fix nested list formatting
Sphinx needs three spaces here at least
2023-06-28 16:13:00 +02:00
David Adam
a75de42f4b docs: use consistent spelling of color
i miss u
2023-06-21 21:13:03 +08:00
David Adam
229f19a6e9 docs: slight update to writing your own prompt doc 2023-06-21 21:12:12 +08:00
Fabian Boehm
c385027eca
docs: Add "Writing your own prompt" doc (#9841)
* docs: Add "Writing your own prompt" doc

* Remove a space from the "output"

* some teensy adjustments

* Address feedback

* envvar one more PWD

* More html warning
2023-06-20 19:43:09 +02:00
Fabian Boehm
f980125fb9 docs: More on profiling 2023-06-16 16:22:58 +02:00
Fabian Boehm
bc190ee818 docs: Turn off highlighting correctly in fish_config 2023-06-16 16:17:58 +02:00
Fabian Boehm
65769bf8c8 history: Allow deleting ranges
This allows giving a range like "5..7".

It works in combination with more (including overlapping) ranges or
single indices.

Fixes #9736
2023-06-10 15:35:40 +02:00
Fabian Boehm
ffd43c950a docs/fish_config: Document theme files 2023-06-09 16:59:02 +02:00
Fabian Boehm
3cd527a62e docs: Improve bg docs
Show an actual session here, to explain what you would actually do
with it.
2023-06-05 18:26:13 +02:00
Jo
272d123431 Fix a typo in language.rst 2023-06-02 13:13:49 +02:00
Fabian Boehm
946ecf235c Restyle fishscript and python 2023-06-01 18:20:19 +02:00
Fabian Boehm
4ed74ed6c1 Improve CONTRIBUTING and add it to the docs 2023-06-01 18:09:02 +02:00
Fabian Boehm
bec8e8df05 docs/faq: Remove external tools
This was always extremely weasel-wordy and I have no idea which one
here is a good choice.

OMF is basically inactive at this point, so we might be doing people a
disservice by linking to it.
2023-05-25 17:46:25 +02:00
Fabian Boehm
2fa2b802c9 docs/interactive: Some small adjustments
Wording improvements and move private mode down, to the history section.
2023-05-25 17:46:25 +02:00
David Adam
4e13b1b5d5 Licensing: note MIT licensing status of Dracula theme 2023-05-25 21:30:30 +08:00
David Adam
2fbee01e17 Licensing: update the OpenBSD license details
The strlcpy/wcslcpy function is long gone.
2023-05-25 21:06:48 +08:00
David Adam
7c059b1112 Licensing: drop the LGPL reference and text
The wcstok function is long gone.
2023-05-25 20:50:36 +08:00
Fabian Boehm
8282ddcff2 faq: Update
Remove two that really aren't frequently asked and simplify the
history substitution thing, plus abbrs.
2023-05-23 16:57:53 +02:00
Fabian Boehm
80324c9d7f docs: Fix link 2023-05-23 16:48:28 +02:00
Fabian Boehm
b1c06bbd2c Put back extra licenses
This was erroneously removed in commit 03a6fb4a69.
2023-05-23 16:47:32 +02:00
Fabian Boehm
b435fc4539 docs: Add something on variables-as-commands
Specifically point towards the necessary splitting (as always,
separate ahead of time) and the keyword thing.

Fixes #9797
2023-05-21 10:13:54 +02:00
Fabian Boehm
8a9f57112c Fix typo
See https://github.com/fish-shell/fish-site/pull/112
2023-05-18 17:52:51 +02:00