add os config
This commit is contained in:
parent
d8d692d313
commit
33bf5ec883
30 changed files with 271 additions and 5 deletions
135
fish.nix
135
fish.nix
|
|
@ -1,135 +0,0 @@
|
|||
{ lib, pkgs, variant, ... }:
|
||||
{
|
||||
programs.fish = {
|
||||
enable = true;
|
||||
loginShellInit = ''
|
||||
set -gx fish_greeting
|
||||
'' +
|
||||
(if variant == "allegro" then ''
|
||||
source ${pkgs.nix}/etc/profile.d/nix.fish
|
||||
if test $(tty) = /dev/tty2
|
||||
nixGLIntel Hyprland
|
||||
end
|
||||
'' else "");
|
||||
|
||||
interactiveShellInit = ''
|
||||
set -gx fish_greeting
|
||||
set -x DIRENV_LOG_FORMAT ""
|
||||
bind \ef forward-word
|
||||
bind \eF accept-autosuggestion
|
||||
'';
|
||||
|
||||
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
|
||||
'';
|
||||
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 TODO fix this if condition
|
||||
# if which direnv >/dev/null
|
||||
set -l direnv_status (direnv status | grep -q "Found RC path" && echo " direnv")
|
||||
# end
|
||||
|
||||
if set -q SSH_CLIENT
|
||||
set login_str (prompt_login)
|
||||
else
|
||||
set login_str ""
|
||||
end
|
||||
|
||||
# echo -n -s (prompt_login)' ' (set_color $color_cwd) (prompt_pwd) $normal (fish_vcs_prompt) \
|
||||
echo -n -s $login_str " " (set_color $color_cwd) (prompt_pwd) $normal (fish_vcs_prompt) \
|
||||
(set_color -i yellow) $direnv_status $normal " "$prompt_status " "$suffix " "
|
||||
'';
|
||||
# run $argv when a file tracked by git is updated.
|
||||
gitentr.body = ''
|
||||
${pkgs.git}/bin/git ls-tree -r HEAD --name-only | ${pkgs.entr}/bin/entr $argv
|
||||
'';
|
||||
ffsum.body = ''
|
||||
${pkgs.ffmpeg}/bin/ffmpeg -hide_banner -v error $argv[..-2] -i $argv[-1] -map 0:v -f md5 -
|
||||
'';
|
||||
};
|
||||
|
||||
shellAliases = {
|
||||
ls = "ls -hN --color=auto --group-directories-first";
|
||||
grep = "grep --color=auto";
|
||||
diff = "diff --color=auto";
|
||||
bt = "bluetuith";
|
||||
hm = "home-manager";
|
||||
hms = "nh home switch ~/home-manager";
|
||||
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";
|
||||
del = "trash -rf";
|
||||
rsyncp = "rsync --info=progress2 --no-inc-recursive";
|
||||
ffmpeg = "ffmpeg -hide_banner";
|
||||
ffprobe = "ffprobe -hide_banner";
|
||||
co = "git checkout";
|
||||
stash = "git stash";
|
||||
popstash = "git stash pop";
|
||||
pull = "git pull";
|
||||
m = "meson";
|
||||
n = "ninja";
|
||||
gdb_asan = "gdb -tui -ex='break __asan::ReportGenericError'";
|
||||
gdb_ubsan = "gdb -tui -ex='break __ubsan::ScopedReport::~ScopedReport'";
|
||||
};
|
||||
|
||||
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