fish: move things to conf.d

This commit is contained in:
Charles Gould 2020-07-18 22:37:59 -04:00
parent da2588ac6c
commit 22738a7492
4 changed files with 40 additions and 37 deletions

13
fish/conf.d/fisher.fish Normal file
View File

@ -0,0 +1,13 @@
# https://github.com/jorgebucaran/fisher
set -g fisher_path ~/.config/fish/fisher
set fish_function_path $fish_function_path[1] $fisher_path/functions $fish_function_path[2..-1]
set fish_complete_path $fish_complete_path[1] $fisher_path/completions $fish_complete_path[2..-1]
if not functions -q fisher
echo "Installing fish-shell package manager: $fisher_path/functions/fisher.fish"
curl -fsSL -o $fisher_path/functions/fisher.fish --create-dirs https://git.io/fisher
echo "Installing fish-shell packages..."
fish -c fisher
end
for file in $fisher_path/conf.d/*.fish
builtin source $file 2> /dev/null
end

8
fish/conf.d/fzf.fish Normal file
View File

@ -0,0 +1,8 @@
# https://github.com/junegunn/fzf
set -gx FZF_DEFAULT_OPTS "--no-height --layout=reverse --multi"
set -gx FZF_DEFAULT_COMMAND "fd --type=file"
set -gx FZF_CTRL_T_COMMAND "fd --type=file --follow"
set -gx FZF_CTRL_T_OPTS "--ansi --preview 'bat --color=always {}'"
set -gx FZF_CTRL_R_OPTS "--preview 'echo {}' --preview-window down:3:hidden:wrap --bind '?:toggle-preview'"
set -gx FZF_ALT_C_COMMAND "fd --type=directory --follow"
set -gx FZF_ALT_C_OPTS "--preview 'tree -CL 1 {}'"

19
fish/conf.d/nix.fish Normal file
View File

@ -0,0 +1,19 @@
# https://github.com/NixOS/nix
#
# If nix profile exists:
# - source the profile in bash
# - export the NIX_* variables in fish
# - add nix profile to PATH
#
if test -f ~/.nix-profile/etc/profile.d/nix.sh
for line in (bash -c 'source $0; for name in "${!NIX_@}"; do printf "%s=%s\n" "$name" "${!name}"; done' ~/.nix-profile/etc/profile.d/nix.sh)
set -gx (string split -m 1 = $line)
end
if functions -q fish_add_path
fish_add_path -gP ~/.nix-profile/bin
else
if not contains -- ~/.nix-profile/bin $PATH
set PATH ~/.nix-profile/bin $PATH 2>/dev/null
end
end
end

View File

@ -7,43 +7,6 @@ if test -x /usr/libexec/java_home
set -gx JAVA_HOME (/usr/libexec/java_home -v 1.8)
end
# FZF (https://github.com/junegunn/fzf)
set -gx FZF_DEFAULT_OPTS "--no-height --layout=reverse --multi"
set -gx FZF_DEFAULT_COMMAND "fd --type=file"
set -gx FZF_CTRL_T_COMMAND "fd --type=file --follow"
set -gx FZF_CTRL_T_OPTS "--ansi --preview 'bat --color=always {}'"
set -gx FZF_CTRL_R_OPTS "--preview 'echo {}' --preview-window down:3:hidden:wrap --bind '?:toggle-preview'"
set -gx FZF_ALT_C_COMMAND "fd --type=directory --follow"
set -gx FZF_ALT_C_OPTS "--preview 'tree -CL 1 {}'"
# Nix package manager
if test -f ~/.nix-profile/etc/profile.d/nix.sh
for line in (bash -c 'source $0; for name in "${!NIX_@}"; do printf "%s=%s\n" "$name" "${!name}"; done' ~/.nix-profile/etc/profile.d/nix.sh)
set -gx (string split -m 1 = $line)
end
if functions -q fish_add_path
fish_add_path -gP ~/.nix-profile/bin
else
if not contains -- ~/.nix-profile/bin $PATH
set PATH ~/.nix-profile/bin $PATH 2>/dev/null
end
end
end
# Fish package manager
set -g fisher_path ~/.config/fish/fisher
set fish_function_path $fish_function_path[1] $fisher_path/functions $fish_function_path[2..-1]
set fish_complete_path $fish_complete_path[1] $fisher_path/completions $fish_complete_path[2..-1]
if not functions -q fisher
echo "Installing fish-shell package manager: $fisher_path/functions/fisher.fish"
curl -fsSL -o $fisher_path/functions/fisher.fish --create-dirs https://git.io/fisher
echo "Installing fish-shell packages..."
fish -c fisher
end
for file in $fisher_path/conf.d/*.fish
builtin source $file 2> /dev/null
end
if status --is-interactive
# Disable the default shell greeting
set fish_greeting