-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add --no-config option
#7921
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add --no-config option
#7921
Conversation
This loads *no* config, *at all*. Not even share/config.fish, so $fish_function_path is entirely unset.
Otherwise `set -U foo bar` if uvars aren't available would simply not set *anything*.
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.
Otherwise this'll error with --no-config
This stops it from saving history.
This was defined in config.fish. Just define it here again, it's trivial.
|
Alright, I'm merging this now to get more testing, and because the biggest thing (key bindings aren't set) is probably best solved by adding the $fish_key_bindings variable handling to C++, and that's a good PR on its own. Imagine this as a preview - I think we're on the right track, but the specifics may need hashing out. |
|
will creating scripts by "#!/bin/fish --no-config", be the preferred way now if you want to create predictable scripts for say setup/install or similar. |
|
@robfordww Basically not. The issue is that you can't guarantee fish's path (and it most likely will not be /bin/fish, but either /usr/bin/fish or /usr/local/bin/fish), so you would have to use and on linux at least the shebang can only have one argument - If you can guarantee fish's path, then sure, go ahead. If not you'd either need a pre-processing step or a wrapper sh-script to execute |
|
@faho Thanks. I was not aware of the "one-argument" thing in #! |
|
So if you can guarantee your script will only ever be run on GNU systems, have at it. It's just not a solution for us and needlessly narrows the platforms your script can run on. Also it's an ugly hack. |
|
Just for the record, FreeBSD added the |
|
While waiting for a prettier recipe, the |
The fallback bindings are super awkward to use. This was called out specifically in fish-shell#7921, I'm going for the targeted fix for now.
* Turn on default bindings for --no-config mode The fallback bindings are super awkward to use. This was called out specifically in #7921, I'm going for the targeted fix for now. * Only change keybindings when interactive That's also when we'd source them normally.
Description
This adds a
--no-configoption to fish, to let it start up without reading the config.In particular it will:
set -U var valis "redirected" to global). They aren't read at all.My hope is that this is basically "independent" of the system entirely. I'm not sure I caught all the places we write something or read something, so anyone else checking is appreciated.
One big issue with this is that it's very uncomfortable interactively because we don't set the colors or set up the handler for $fish_key_bindings. Both of those things happen in
__fish_config_interactive, which isn't started.The bindings can be improved later - {up,down}-or-search shouldn't be functions and then we can just add them to the hardcoded defaults. The colors are tricky because they're usually defined as uvars and we want to allow unsetting a color.
There are a few things we could be doing differently - for instance it would also be possible to do without $fish_function_path entirely, by leaving it unset. This is awkward because fish isn't fully operational without the functions. It's gotten better since e.g.
typeandevalare no longer functions, butpsubstill is.Fixes #1256
Rerun of #5417, #5416
Helps with #5394.
TODOs: