init.fish
, in that file add source $HOME/private_aliases.fish
. Then you can create that file and the next time fish is invoked or the configuration reloaded, it will be invoked.
Using release channel "stable".
Cloning master from https://github.com/oh-my-fish/oh-my-fish.git...
Writing bootstrap to /home/programmatore//.config/fish/conf.d/omf.fish...
Setting up Oh My Fish configuration...
Updating https://github.com/oh-my-fish/packages-main master... Done!
Installing package default
fatal: repository 'default' does not exist
Could not install default.
Install aborted: Error installing plugins
Oh My Fish installation failed.
If you think that it's a bug, please open an
issue with the complete installation log here:
http://github.com/oh-my-fish/oh-my-fish/issues
default
theme can't be installed?
set -lx
) variables interact with functions. We think this is much better (in particular it enables begin; set -lx something something; somecommandorfunction; end
to also work correctly with functions), but it can break some functions - those that expect to set
a global var without defining it explicitly as global. Could y'all test fish-shell/fish-shell#4149 and see if it works with your functions?
@komarnitskyi: In general terms, anything built-in is essentially free. That includes expansions, including $var
variable expansions, but also builtins like test
or echo
or string
.
So if you want to improve your script's performance, you should check where it calls external commands first. In your theme, that includes this piece:
echo (command git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||')
which calls sed
, which is an external thing, instead of string
(in fish <= 2.7, string
is slower than sed
et al for large strings, so there's a trade-off there. It's gone in the upcoming 3.0 though).
Also this part:
function _get_node_version
echo (command node -v)
end
# [...]
if [ (_get_node_version) ]
set -l node_version (string replace -r "\Av(\d*\.\d*.(0|[1-9]{1,}))\Z" '$1' (node -v))
set node_info " $zephyr_NODE_SYMBOL$set_green $node_version$set_normal"
end
Which calls node -v
twice. You can use something like
if set -l nv (node -v)
to get node's output and status (since set
does not change $status - it passes it through).
Also, this is very unlikely to change in a fish session, so you can cache the results:
if set -q node_version; or set -l nv (node -v)
set -g node_version (string replace -r "\Av(\d*\.\d*.(0|[1-9]{1,}))\Z" '$1' -- $nv)
set node_info " $zephyr_NODE_SYMBOL$set_green $node_version$set_normal"
end
Also, if you want to profile your theme, fish has a built-in profiler! I always use it like
# Write profile information to /tmp/some-file.prof of a run of fish_prompt
fish --profile /tmp/some-file.prof -c 'fish_prompt'
# Output it sorted by the second column - the "sum"
sort -nk 2 /tmp/some-file.prof
Hope that helps!
Also this:
if test (string match '*behind*' $push_or_pull)
should be
if string match -q '*behind*' -- $push_or_pull
bobthefish
has the option, but the same option doesn't do anything for default
.
~/.local/share/omf/pkg/omf/functions/bundle/omf.bundle.add.fish (line 11): Expected a string, but instead found a '&'
if not grep $record $bundle > /dev/null ^&1
^
from sourcing file ~/.local/share/omf/pkg/omf/functions/bundle/omf.bundle.add.fish
called on line 1 of file ~/.local/share/omf/pkg/omf/functions/packages/omf.packages.install.fish
in command substitution
called on line 55 of file ~/.local/share/omf/pkg/omf/functions/packages/omf.packages.install.fish
in function 'omf.packages.install' with arguments 'z'
called on line 13 of file ~/.local/share/omf/pkg/omf/functions/cli/omf.cli.install.fish
in function 'omf.cli.install' with arguments 'z'
called on line 2 of file -
in function '__omf_last_command' with arguments 'z'
called on line 50 of file ~/.local/share/omf/pkg/omf/functions/omf.fish
in function 'omf' with arguments 'install z'
source: Error while reading file '/Users/raguay/.local/share/omf/pkg/omf/functions/bundle/omf.bundle.add.fish'
fish: Unknown command: omf.bundle.add
~/.local/share/omf/pkg/omf/functions/packages/omf.packages.install.fish (line 55):
omf.bundle.add package $name_or_url
^
in function 'omf.packages.install' with arguments 'z'
called on line 13 of file ~/.local/share/omf/pkg/omf/functions/cli/omf.cli.install.fish
in function 'omf.cli.install' with arguments 'z'
called on line 2 of file -
in function '__omf_last_command' with arguments 'z'
called on line 50 of file ~/.local/share/omf/pkg/omf/functions/omf.fish
in function 'omf' with arguments 'install z'
bash: line 2: _z: command not found
cd: The directory 'bash: line 1: /Users/raguay/.local/share/omf/pkg/z/functions/../z/z.sh: No such file or directory' does not exist
~/.local/share/omf/pkg/z/functions/z.fish (line 16):
builtin cd $Z_PWD
^
in function 'z' with arguments '--add /Users/raguay/.local/share/omf/pkg/z'
called on line 5 of file ~/.local/share/omf/pkg/z/init.fish
in function 'z.pwd' with arguments 'VARIABLE SET PWD'
called on line 1 of file /usr/local/Cellar/fish/3.1.0/share/fish/functions/cd.fish
in event handler: handler for variable 'PWD'
called on line 36 of file /usr/local/Cellar/fish/3.1.0/share/fish/functions/cd.fish
Submodule 'z' (https://github.com/rupa/z) registered for path 'z'
Cloning into '/Users/raguay/.local/share/omf/pkg/z/z'...
Submodule path 'z': checked out '3eb64444d713b9fc6c9ad1a8fc8814639c584faa'
✔ z successfully installed.
This is the result of installing the z plugin.