New implementation of migration code within the history_t class will
copy the contents of the old fish_history found in the config directory
to its new location in the data directory. The old file is left intact.
This is done only in the event that a fish_history is not already found in
the data directory ($XDG_DATA_HOME/fish or ~/.local/share/fish).
The fish_history file is now located in the "data"
directory ($XDG_DATA_HOME/fish or ~/.local/share/fish),
accessible using the function `path_get_data`.
(This commit also cleans trailing whitespace in the source file.)
Add new functions path_get_data and path_create_data which parallel existing
functions path_get_config and path_create_data. The new functions refer to
XDG_DATA_HOME, if it is defined, or ./local/share if not.
Modify history_filename to use the new function path_get_data.
As a consequence, fish_history will now be located in XDG_DATA_HOME,
not XDG_CONFIG_HOME.
Note that these changes mirror what is already used in
fish-shell/share/tools/create_manpage_completions.py, which stores the
completions in XDG_DATA_HOME
This change matches recommendations in the xdg basedir spec at
http://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
($XDG_DATA_HOME defines the base directory relative to which user specific data
files should be stored. If $XDG_DATA_HOME is either not set or empty, a default
equal to $HOME/.local/share should be used.)
It addresses suggestions from the following issues:
1. Don't put history in $XDG_CONFIG_HOME (closes#744)
https://github.com/fish-shell/fish-shell/issues/744
2. Fish is placing non-config files in $XDG_CONFIG_HOME #1257https://github.com/fish-shell/fish-shell/issues/1257
3. Move non-config data out of $XDG_CONFIG_HOME #1669https://github.com/fish-shell/fish-shell/issues/1669
This reduces code duplication and adds some previously unavailable
bindings that don't quite _violate_ the vi-principle (like
prevd-or-backward-word on alt-left) and matches other "impure" bindings
like \cf for forward-word (a quite emacs-ish binding) we already have.
Fixes#2412Fixes#2472Fixes#2255
For cygwin, you can't `cd C:`, so a prompt of "C:/Something" is
misleading.
For OSX, we dereference symlinks elsewhere
This also simplifies prompt_pwd quite a bit.
Instead of duplicating the script invocation across targets,
put it into a separate target and add dependencies. This also
requires moving its output into the SHARED_DERIVED_FILE_DIR
(which may be undocumented)?
Not for _everything_ because that causes too many options to be
generated (which is an issue for git as it is), but for modified, staged
and added files - which is where it is most useful.
Fixes#901 as far as I'm concerned.
git has options that can appear before commands, but not all of
them, and some of them need an argument. This means
`__fish_seen_subcommand_from` will give too many false-positives, while
`[ (count $cmd) -eq 2 ]` will give too many false-negatives.
Instead go through all arguments and check if they are in that list of
options that can be before a command and skip the argument for them, if
any.
Teach Xcode to run new script xcode_version_gen.sh before building
the fish_shell and fish_indent targets. The script generates file
fish-build-version.h for inclusion by fish_version.cpp.
Note that Xcode always runs the script because of the phony target
named force-fish-build-version.h, but fish-build-version.h is only
touched if the contents of FISH-BUILD-VERSION-FILE change.
Fixes#890
This is to the benefit of systems with ancient GNU sed, which does not
recognize "-E", but only "-r".
Fixes#2305 - even if it doesn't replace all `sed -E` invocations in the
codebase, the others are unlikely to occur on CentOS and other similarly
crusty systems.
`__fish_apm_using_command` was incorrectly taking lists of commands, new function added to support multiple a command having synonyms.
Simplify switch statement
Also remove superfluous function.
Allow for multiple completions after a command
Useful for removing packages, will complete for more than one.
Code improvements