Commit Graph

14233 Commits

Author SHA1 Message Date
Fabian Homborg
2416aa5337 Let --no-config imply private mode
This stops it from saving history.
2021-05-01 18:59:25 +02:00
Fabian Homborg
0420901cb2 default prompt: Set fish_color_status if unset
Otherwise this'll error with --no-config
2021-05-01 18:59:25 +02:00
Fabian Homborg
5ddb1adac1 Only use DATADIR in $fish_function_path if no-config is used
This only uses the functions fish ships with, but still doesn't allow
any *customization*, which is the point of no-config.

This makes it a lot more usable, given that the actual normal prompt
and things are there.

This still doesn't set any colors, because we don't run
__fish_config_interactive because we don't read config.fish (any
config.fish), because that would run the snippets.
2021-05-01 18:59:25 +02:00
Fabian Homborg
848f7a0787 Don't do uvars if no-config is in effect 2021-05-01 18:59:25 +02:00
Fabian Homborg
980365735a If no uvars are available, fall back to global when setting
Otherwise `set -U foo bar` if uvars aren't available would simply not
set *anything*.
2021-05-01 18:59:25 +02:00
Fabian Homborg
52f56e2119 WIP Add no-config mode
This loads *no* config, *at all*. Not even share/config.fish, so
$fish_function_path is entirely unset.
2021-05-01 18:59:25 +02:00
Fabian Homborg
b3926aca63 Ye olde changelogge 2021-05-01 18:54:33 +02:00
Fabian Homborg
2b74affaf0 Add prompt selector
It's a bit weird to *have* to fire up a browser to get fish_config to
choose a prompt.

So this adds a `prompt` subcommand to `fish_config`:

- `fish_config prompt list` shows all the available prompt names
- `fish_config prompt show` demos the available sample prompts
- `fish_config prompt choose` sources a prompt
- `fish_config prompt save` makes the choice permanent

A bare `fish_config` or `fish_config browse` opens the web UI.

Part of #3625.

TODO: This shows the right prompt on a new line. Showing it in-line is awkward
to do because we'd have to move it to the right.
2021-05-01 18:50:05 +02:00
Fabian Homborg
e548dca686 Webconfig: Fix initial tab
For some reason the url is now

http://localhost:$PORT/$RANDOM/#!/$TAB

while this created

http://localhost:$PORT/$RANDOM/#$TAB

which redirected to

http://localhost:$PORT/$RANDOM/#!/colors#$TAB

i.e. the "colors" tab with a useless unmatched anchor.
2021-05-01 18:47:49 +02:00
Johannes Altmanninger
daa3ae4be1 fish_config: use background color for some themes search matches
See https://github.com/fish-shell/fish-shell/issues/2442#issuecomment-829636721
2021-04-30 22:13:23 +02:00
Fabian Homborg
2e9dab71a3 __fish_apropos: Don't overwrite $dir 2021-04-30 20:09:56 +02:00
Fabian Homborg
c25efeed7a __fish_apropos: Fix broken variable name 2021-04-30 20:07:20 +02:00
Fabian Homborg
f485169391 __fish_apropos: Fix on macOS
Because MacOS' apropos is bad and doesn't support the `--` option
separator, this apparently spews errors.

Because the argument _can't_ start with a `-` (because we add a `^`),
we can just remove it.

Fixes #7965.
2021-04-30 19:16:57 +02:00
Fabian Homborg
2cea5b8eb1 Add a "prompt_login" helper function
This prints a description of the "host". Currently that's

`(chroot:debianchroot) $USER@$hostname`

with the chroot part when needed.

This also switches the default and terlar prompts to use it, the other
prompts have slightly different coloring or logic here.
2021-04-30 17:07:54 +02:00
Fabian Homborg
f768389cf7 fish_tests: Actually set locale
Otherwise this fails if the $PWD has non-ASCII characters.

Fixes #7962.
2021-04-29 08:00:05 +02:00
tomKPZ
7735d13d79 Fix prompt reflow in kitty terminal 2021-04-28 08:14:08 +02:00
Fabian Homborg
8cd5f6cfde funcsave: Don't save details
The "# defined in /path/to/file" comment here is, almost by
definition, wrong.
2021-04-27 16:33:41 +02:00
Johannes Altmanninger
9d7f6db792 fish_indent: preserve escaped newlines around variable assignments
In many cases we currently discard escaped newlines, since they
are often unnecessary (when used around &|;). Escaped newlines
are useful for structuring argument lists. Allow them for variable
assignments since they are similar.

Closes #7955
2021-04-27 00:13:48 +02:00
Johannes Altmanninger
15e265f209 Don't read user configuration in tmux-complete test
As discussed in 7a556ec6f2 (commitcomment-49671741)
2021-04-25 13:32:14 +02:00
Fabian Homborg
6aade380c1 Sample prompts: Handle print_pipestatus if TERM=dumb
This is the simple solution of just quoting it. The real solution
would probably handle `set_color` with no color better - #5443.

Fixes #7904.
2021-04-25 09:49:18 +02:00
Fabian Homborg
58885fbd0b docs: Handle undefined LINK_SUFFIX
When building the docs with an old sphinx (like e.g. on Debian), this
would break links in the search results.

This happens because we've nabbed the searchtools.js from a sphinx to
add our special handling of short builtins like "and", "end", "cd" (as
part of #7757).

I don't believe this will change *a lot* in practice, so it's probably
still okay, but this hack is still worthwhile.

See #7946
2021-04-25 09:42:02 +02:00
Fabian Homborg
981a07d4c7 cmake: Error out with "-static"
I'm not entirely sure this *has* to be given via
CMAKE_EXE_LINKER_FLAGS, but this would have stopped at least one
person from trying.

Static linking 1. does not work at the moment, 2. is not *useful*. You
don't get a single-file fish you can just copy somewhere because
you're missing our functions. On glibc systems you also can't
statically link glibc. Given all that, it does not appear to be worth
putting in any effort to make it work (if it's possible at all).

See #7947.
2021-04-25 09:38:04 +02:00
Fabian Homborg
3cccb77b52 Make test error when number is invalid nicer
This would print the default "Argument is invalid" error string, which
is *true* but not super obvious, because `test` doesn't always perform
numeric conversion, and that's the bit that failed here.
2021-04-24 11:18:58 +02:00
ridiculousfish
fc0dd49842 Attempt to fix the bind test on MacOS
Wait for the command line to "catch up" to what is sent.
Use expect_str rather than hard-coded delays.
Fixes #7942
2021-04-22 13:15:40 -07:00
Fabian Homborg
2095d744cf README: Remove "try in browser" leftovers
This was missed in 5a53ead240.
2021-04-22 18:25:28 +02:00
Fabian Homborg
4e41a2bc9f CHANGELOG Remove reverted git change
56af5d0702 reverted the bit that showed
staged state if dirty state wasn't active.
2021-04-22 16:25:00 +02:00
Fabian Homborg
281817f2c5 CHANGELOG prompt stuff 2021-04-22 16:24:38 +02:00
ridiculousfish
42d674819f Make the kill ring thread-safe
Now that the kill ring may be accessed on a background thread, ensure it
is thread safe.
2021-04-21 17:37:44 -07:00
Karolina Gontarek
9d66ddc840 Rename variable to fish_killring 2021-04-21 16:39:29 -07:00
Karolina Gontarek
da97daa800 Add variable to Special variables section 2021-04-21 16:39:29 -07:00
Karolina Gontarek
539837f317 Add variable to documentation 2021-04-21 16:39:29 -07:00
Karolina Gontarek
f1ece78b67 Add CHANGELOG entry 2021-04-21 16:39:29 -07:00
Karolina Gontarek
ed64cf5e34 Implementation of variable with killring entries 2021-04-21 16:39:29 -07:00
ridiculousfish
0a559ac457 Reformat source files with clang-format 2021-04-21 13:31:58 -07:00
Fabian Homborg
f21e015f1b webconfig: Make blue, green, red a bit brighter
These were hard to read in the browser, but not in the terminal.

The palette in color.cpp lists #000080 for blue, which is *even darker*. I'm not sure if that's actually a thing - I was under the impression that table was taken from xterm.

Either way, listing it in this color doesn't do anyone any favors. It's just a rough approximation anyway.
2021-04-21 17:26:52 +02:00
Fabian Homborg
152b0ef018 Webconfig: Sort the prompt list
Otherwise this has filesystem order, which on my system is quite
chaotic.

An alternative would be to randomize the order so people see different
prompts each time.
2021-04-21 17:13:03 +02:00
Fabian Homborg
f2364103b4 Sample prompts: Add a simplified version of my own prompt
Some features:

- A nice `►` prompt char with a fallback for non-utf8 systems
- The $PWD is colored depending on its sha, so different directories
  are colored differently, but each directory stays the same
- User@Host is only shown if not on the local machine (ssh or
  virtualization)
- A right prompt with a nice git display, date, duration of the last
  command (if it took over 100ms), and virtualenv
2021-04-21 17:01:05 +02:00
Fabian Homborg
4355636386 webconfig: Handle right prompt
This gets fish to print the right prompt of any sample if it has any,
and then shows it separately.

If there is a right prompt, it will also save it. If not, it will *not* overwrite an existing right prompt.
2021-04-21 17:01:05 +02:00
Johannes Altmanninger
2fff12104d Correct test environment setup
XDG_RUNTIME_DIR was misspelled.
XDG_DATA_DIRS could affect tests. Remove it since it's used read-only.
2021-04-21 00:47:03 +02:00
ridiculousfish
f4bcfd9085 Correct behavior of string match variable import with multiple arguments
This refactors the behavior of string match with capture groups to
correctly handle multiple arguments. Now the variable capture applies to
the first match, as documented. Fixes #7938.
2021-04-20 15:15:52 -07:00
ridiculousfish
abd59c50b0 Add a test for invalid regex variable names
Also apply some mild refactoring.
2021-04-20 15:15:52 -07:00
ridiculousfish
8e95bba25e Clean up and reduce some allocations in env.cpp 2021-04-20 15:15:52 -07:00
Fabian Homborg
9c413b039d Also fix tokenizer_state in bracketed paste path
Also removes our remaining use of
`__fish_commandline_is_singlequoted`.

See #7782.
2021-04-20 15:29:28 +02:00
Fabian Homborg
dc57ba01a2 __fish_pwd: Just always define the cygwin version
This called `uname` just to check if we *should* shorten "cygdrive"
directories.

That's more annoying than just doing it by default - on my system `pwd
| string replace` takes about 100 *micro*seconds, and this is done
once per prompt. Anyway, using $PWD further speeds it up to ~30
microseconds (compared to 10-20 for just `pwd`). This is hard to
measure because it's heavily impacted by system hitter.

The alternative is to ask cygwin to ship this feature as a patch.
2021-04-19 18:58:00 +02:00
Fabian Homborg
c95a223f5e Better errors when calling a command in a command substitution fails 2021-04-19 16:47:17 +02:00
Fabian Homborg
04f1254c94 Disable tmux tests for now
These are just broken at the moment
2021-04-19 16:46:50 +02:00
ridiculousfish
e8a6d31aea Correct behavior of string match and unmatched capture groups
string match is documented as setting an unset variable if a capture group
is unmatched in an otherwise matched regex, and if the `--all` flag is not
provided. However prior to this fix, it instead set a variable containing
the empty string as a single value. Correct the implementation to match
the documentation.

Note that if the `--all` flag is provided we continue to set empty
strings, which is documented.
2021-04-18 21:04:25 -07:00
ridiculousfish
1aa8200b96 Minor cleanup of builtin_string regex
Mark some classes as final and remove some unnecessary variables.
Add a test in preparation for the next fix.
2021-04-18 20:39:14 -07:00
ridiculousfish
092168485b Remove wcstring_tok
wcstring_tok was a funky function which was confusing and used only in
one place. Replace it with split_string_tok, which is somewhat simpler.
2021-04-18 14:46:05 -07:00
ridiculousfish
2fb0a703de Simplify rgb_color_t::try_parse_named
This came out of an investigation into making strings immutable.
This code did "lazy" lowercasing but we can simplify it by just
providing our own case-insensitive compare routine, which is good
enough for colors.
2021-04-18 12:11:38 -07:00