First Commit
This commit is contained in:
commit
cae9d57360
22 changed files with 1957 additions and 0 deletions
108
fish.nix
Normal file
108
fish.nix
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
enable = true;
|
||||
loginShellInit = ''
|
||||
set -gx fish_greeting
|
||||
if test $(tty) = /dev/tty1
|
||||
Hyprland
|
||||
end
|
||||
'';
|
||||
|
||||
interactiveShellInit = ''
|
||||
# bind ctrl+s to fg
|
||||
bind \cz 'fg 2>/dev/null; commandline -f repaint'
|
||||
set -x DIRENV_LOG_FORMAT ""
|
||||
'';
|
||||
|
||||
functions = {
|
||||
# use "e" to open the text editor. if e job is paused, return to it
|
||||
e.body = ''
|
||||
jobs -c | grep $EDITOR \
|
||||
|| $EDITOR $argv \
|
||||
&& fg 2>/dev/null; commandline -f repaint
|
||||
'';
|
||||
lfcd.body = ''
|
||||
set tmp (mktemp)
|
||||
# `command` is needed in case `lfcd` is aliased to `lf`
|
||||
command lf -last-dir-path=$tmp $argv
|
||||
if test -f "$tmp"
|
||||
set dir (cat $tmp)
|
||||
rm -f $tmp
|
||||
if test -d "$dir"
|
||||
if test "$dir" != (pwd)
|
||||
cd $dir
|
||||
end
|
||||
end
|
||||
end
|
||||
'';
|
||||
upgrade-nix.body = ''
|
||||
sudo nix-channel --update
|
||||
sudo nixos-rebuild switch &| ${pkgs.nix-output-monitor}/bin/nom
|
||||
nix-env -u '.*'
|
||||
home-manager switch &| ${pkgs.nix-output-monitor}/bin/nom
|
||||
'';
|
||||
fish_prompt.body = ''
|
||||
set -l last_pipestatus $pipestatus
|
||||
set -lx __fish_last_status $status # Export for __fish_print_pipestatus.
|
||||
set -l normal (set_color normal)
|
||||
set -q fish_color_status
|
||||
or set -g fish_color_status red
|
||||
|
||||
# Color the prompt differently when we're root
|
||||
set -l color_cwd $fish_color_cwd
|
||||
set -l suffix '>'
|
||||
if functions -q fish_is_root_user; and fish_is_root_user
|
||||
if set -q fish_color_cwd_root
|
||||
set color_cwd $fish_color_cwd_root
|
||||
end
|
||||
set suffix '#'
|
||||
end
|
||||
|
||||
# Write pipestatus
|
||||
# If the status was carried over (if no command is issued or if `set` leaves the status untouched), don't bold it.
|
||||
set -l bold_flag --bold
|
||||
set -q __fish_prompt_status_generation; or set -g __fish_prompt_status_generation $status_generation
|
||||
if test $__fish_prompt_status_generation = $status_generation
|
||||
set bold_flag
|
||||
end
|
||||
set __fish_prompt_status_generation $status_generation
|
||||
set -l status_color (set_color $fish_color_status)
|
||||
set -l statusb_color (set_color $bold_flag $fish_color_status)
|
||||
set -l prompt_status (__fish_print_pipestatus "[" "]" "|" "$status_color" "$statusb_color" $last_pipestatus)
|
||||
|
||||
# direnv status
|
||||
set -l direnv_status (direnv status | grep -q "Found RC path" && echo " direnv")
|
||||
|
||||
# echo -n -s (prompt_login)' ' (set_color $color_cwd) (prompt_pwd) $normal (fish_vcs_prompt) \
|
||||
echo -n -s (set_color $color_cwd) (prompt_pwd) $normal (fish_vcs_prompt) \
|
||||
(set_color -i yellow) $direnv_status $normal " "$prompt_status " "$suffix " "
|
||||
'';
|
||||
};
|
||||
|
||||
shellAliases = {
|
||||
ls = "ls -hN --color=auto --group-directories-first";
|
||||
grep = "grep --color=auto";
|
||||
diff = "diff --color=auto";
|
||||
bt = "bluetuith";
|
||||
hm = "home-manager";
|
||||
hms = "home-manager switch &| nom";
|
||||
dev = "nix develop -c fish";
|
||||
gparted = "nix-shell -p pkgs.gparted --run 'sudo -E gparted'";
|
||||
ns = "nix shell";
|
||||
nsp = "nix shell nixpkgs#";
|
||||
f = "lfcd";
|
||||
sxiv = "nsxiv";
|
||||
};
|
||||
|
||||
plugins = [
|
||||
{
|
||||
name = "fish-lf-icons";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "joshmedeski";
|
||||
repo = "fish-lf-icons";
|
||||
rev = "d1c47b2088e0ffd95766b61d2455514274865b4f";
|
||||
sha256 = "sha256-6po/PYvq4t0K8Jq5/t5hXPLn80iyl3Ymx2Whme/20kc=";
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue