Skip to content
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 .linuxify.fish for Fish shell? #40

Open
krissrex opened this issue Mar 9, 2024 · 3 comments
Open

Add .linuxify.fish for Fish shell? #40

krissrex opened this issue Mar 9, 2024 · 3 comments

Comments

@krissrex
Copy link

krissrex commented Mar 9, 2024

I tried porting the .linuxify to a script you run once with source .linuxify.fish.

set -l BREW_HOME (brew --prefix)

# Keep default manpath
echo 'set -gx MANPATH $MANPATH (cat /private/etc/manpaths | tr \'\n\' \':\')' >> "$__fish_config_dir/conf.d/linuxify.fish"

# most programs
fish_add_path --prepend "$BREW_HOME/bin"
echo 'set -gx MANPATH "'$BREW_HOME'/share/man" $MANPATH' >> "$__fish_config_dir/conf.d/linuxify.fish"
echo 'set -gx INFOPATH "'$BREW_HOME'/share/info" $INFOPATH' >> "$__fish_config_dir/conf.d/linuxify.fish"

# coreutils
fish_add_path --prepend "$BREW_HOME/opt/coreutils/libexec/gnubin"
echo 'set -gx MANPATH "'$BREW_HOME'/opt/coreutils/libexec/gnuman" $MANPATH' >> "$__fish_config_dir/conf.d/linuxify.fish"

# make
fish_add_path --prepend "$BREW_HOME/opt/make/libexec/gnubin"
echo 'set -gx MANPATH "'$BREW_HOME'/opt/make/libexec/gnuman" $MANPATH' >> "$__fish_config_dir/conf.d/linuxify.fish"

# m4
fish_add_path --prepend "$BREW_HOME/opt/m4/bin"

# file-formula
fish_add_path --prepend "$BREW_HOME/opt/file-formula/bin"

# unzip
fish_add_path --prepend "$BREW_HOME/opt/unzip/bin"

# python
fish_add_path --prepend "$BREW_HOME/opt/python/libexec/bin"

# flex
fish_add_path --prepend "$BREW_HOME/opt/flex/bin"
echo 'set -gx LDFLAGS "-L'$BREW_HOME'/opt/flex/lib"' >> "$__fish_config_dir/conf.d/linuxify.fish"
echo 'set -gx CPPFLAGS "-I'$BREW_HOME'/opt/flex/include"' >> "$__fish_config_dir/conf.d/linuxify.fish"

# bison
fish_add_path --prepend "$BREW_HOME/opt/bison/bin"
echo 'set -gx LDFLAGS "-L'$BREW_HOME'/opt/bison/lib"' >> "$__fish_config_dir/conf.d/linuxify.fish"

# libressl
fish_add_path --prepend "$BREW_HOME/opt/libressl/bin"
echo 'set -gx LDFLAGS "-L'$BREW_HOME'/opt/libressl/lib"' >> "$__fish_config_dir/conf.d/linuxify.fish"
echo 'set -gx CPPFLAGS "-I'$BREW_HOME'/opt/libressl/include"' >> "$__fish_config_dir/conf.d/linuxify.fish"
echo 'set -gx PKG_CONFIG_PATH "'$BREW_HOME'/opt/libressl/lib/pkgconfig"' >> "$__fish_config_dir/conf.d/linuxify.fish"

# ed
fish_add_path --prepend "$BREW_HOME/opt/ed/libexec/gnubin"

# findutils
fish_add_path --prepend "$BREW_HOME/opt/findutils/libexec/gnubin"
set -gx MANPATH "/opt/homebrew/opt/findutils/libexec/gnuman" $MANPATH

# gnu-indent
fish_add_path --prepend "$BREW_HOME/opt/gnu-indent/libexec/gnubin"

# gnu-sed
fish_add_path --prepend "$BREW_HOME/opt/gnu-sed/libexec/gnubin"

# gnu-tar
fish_add_path --prepend "$BREW_HOME/opt/gnu-tar/libexec/gnubin"

# gnu-which
fish_add_path --prepend "$BREW_HOME/opt/gnu-which/libexec/gnubin"

# grep
fish_add_path --prepend "$BREW_HOME/opt/grep/libexec/gnubin"

set -e BREW_HOME
  • Also, the CPPFLAGS and LDFLAGS are set several times, overwriting the previous. Is this wrong?
  • Another thing, man xargs doesn't work when MANPATH is set. I think /usr/share/man is missing. When manpath is set, the default folders are no longer checked. The file /private/etc/manpaths contains the paths to use. I added those
@krissrex
Copy link
Author

krissrex commented Mar 9, 2024

to uninstall, rm $__fish_config_dir/conf.d/linuxify.fish will remove the set statements.

However, the fish_add_path must be removed some other way. These are added to the $fish_user_paths array env, which is a "universal variable" and persisted to ~/.config/fish/fish_variables.

Alternatively, I could use --path and echo all these to the conf.d/.linxify.fish as well.

@krissrex
Copy link
Author

krissrex commented Mar 11, 2024

Just realised the set -l BREW_HOME (brew --prefix) will not get baked into echo 'set -gx MANPATH "$BREW_HOME/share/man" ..., so the script will just set /share/man when it runs. Got to fix that.

Edit: fixed

@krissrex
Copy link
Author

krissrex commented Mar 11, 2024

I also believe /opt/homebrew/opt/findutils/libexec/man is missing. Without it, you get the default manpage for xargs (unless you do man gxargs).

Edit: fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant