began tidying fish.nix
This commit is contained in:
parent
5579ce1ea2
commit
86d380c6d6
2 changed files with 446 additions and 175 deletions
|
|
@ -1,18 +1,33 @@
|
|||
pkgs: {
|
||||
enable = true;
|
||||
loginShellInit = ''
|
||||
set -x EDITOR lvim
|
||||
set -x LIBVIRT_DEFAULT_URI "qemu:///system"
|
||||
fish_add_path "~/.local/bin"
|
||||
fish_add_path ~/.local/bin/scripts
|
||||
fish_add_path /var/lib/flatpak/exports/bin
|
||||
fish_add_path ~/.cargo/bin
|
||||
fish_add_path ~/.local/share/npm-global/bin
|
||||
'';
|
||||
{ self, inputs, outputs, lib, config, pkgs, ... }:
|
||||
|
||||
shellAbbrs = {
|
||||
b = "bat";
|
||||
"1" = "prevd";
|
||||
{
|
||||
|
||||
programs = {
|
||||
|
||||
fish = {
|
||||
|
||||
enable = true;
|
||||
|
||||
loginShellInit = ''
|
||||
'';
|
||||
|
||||
interactiveShellInit = ''
|
||||
'';
|
||||
|
||||
plugins = [ {
|
||||
name = "done";
|
||||
src = pkgs.fishPlugins.done.src;
|
||||
} {
|
||||
name = "puffer";
|
||||
src = pkgs.fishPlugins.puffer.src;
|
||||
} {
|
||||
name = "autopair";
|
||||
src = pkgs.fishPlugins.autopair.src;
|
||||
} ];
|
||||
|
||||
shellAbbrs = {
|
||||
b = "bat";
|
||||
"1" = "prevd";
|
||||
"2" = "prevd 2";
|
||||
"3" = "prevd 3";
|
||||
"4" = "prevd 4";
|
||||
|
|
@ -23,7 +38,7 @@ pkgs: {
|
|||
sshfix = "kitty +kitten ssh";
|
||||
tree = "eza -TR --git-ignore";
|
||||
up = "topgrade";
|
||||
gay = "curl fetch.sashanoraa.gay";
|
||||
sasha = "curl fetch.sashanoraa.gay";
|
||||
sc = "sudo systemctl";
|
||||
scs = "systemctl status";
|
||||
scst = "sudo systemctl start";
|
||||
|
|
@ -31,10 +46,10 @@ pkgs: {
|
|||
scr = "sudo systemctl restart";
|
||||
jr = "journalctl";
|
||||
jre = "journalctl -e -u";
|
||||
jrf = "journalctl -f -u";
|
||||
jrf = "journalctl -f -u";
|
||||
|
||||
nxp = "nix-shell --command fish -p";
|
||||
nxs = "nix search nixpkgs";
|
||||
nxp = "nix-shell --command fish -p";
|
||||
nxs = "nix search nixpkgs";
|
||||
# nxr = {
|
||||
# expansion = "nix run nixpkgs#%";
|
||||
# setCursor = true;
|
||||
|
|
@ -52,7 +67,7 @@ pkgs: {
|
|||
gco = "git checkout";
|
||||
gc = "git commit";
|
||||
gca = "git commit --amend";
|
||||
gcl = "git clone";
|
||||
gcl = "git clone";
|
||||
gd = "git diff";
|
||||
gf = "git fetch";
|
||||
gl = "git log";
|
||||
|
|
@ -67,97 +82,24 @@ pkgs: {
|
|||
grbi = "git rebase -i";
|
||||
gs = "git status -sb";
|
||||
gsu = "git submodule";
|
||||
gro = "git restore";
|
||||
gsw = "git switch";
|
||||
};
|
||||
gro = "git restore";
|
||||
gsw = "git switch";
|
||||
};
|
||||
|
||||
shellAliases = {
|
||||
cl = "printf '\\033[2J\\033[3J\\033[1;1H'";
|
||||
git-master-to-main = "git branch -m master main && git push origin :master main:main";
|
||||
l = "eza";
|
||||
la = "eza -a";
|
||||
ll = "eza -l";
|
||||
lla = "eza -al";
|
||||
shn = "git remote add origin git@git.sr.ht:~zethra/$(basename $(pwd))";
|
||||
scratch = "lvim /tmp/scratch";
|
||||
tmp = "lvim /dev/null";
|
||||
ssh = "kitty +kitten ssh";
|
||||
};
|
||||
shellAliases = {
|
||||
git-master-to-main = "git branch -m master main && git push origin :master main:main";
|
||||
};
|
||||
|
||||
interactiveShellInit = ''
|
||||
fish_vi_key_bindings
|
||||
set fish_cursor_default block
|
||||
set fish_cursor_insert line
|
||||
set fish_cursor_replace_one underscore
|
||||
set fish_cursor_replace underscore
|
||||
set fish_cursor_external line
|
||||
set fish_cursor_visual block
|
||||
functions = {
|
||||
|
||||
|
||||
set -x EXA_COLORS 'di=35;01:da=35'
|
||||
|
||||
# Syntax Highlighting Colors
|
||||
set -Ux fish_color_normal c0caf5
|
||||
set -Ux fish_color_command 7dcfff
|
||||
set -Ux fish_color_keyword bb9af7
|
||||
set -Ux fish_color_quote e0af68
|
||||
set -Ux fish_color_redirection c0caf5
|
||||
set -Ux fish_color_end ff9e64
|
||||
set -Ux fish_color_error f7768e
|
||||
set -Ux fish_color_param 9d7cd8
|
||||
set -Ux fish_color_comment 565f89
|
||||
set -Ux fish_color_selection --background=33467c
|
||||
set -Ux fish_color_search_match --background=33467c
|
||||
set -Ux fish_color_operator 9ece6a
|
||||
set -Ux fish_color_escape bb9af7
|
||||
set -Ux fish_color_autosuggestion 565f89
|
||||
|
||||
# Completion Pager Colors
|
||||
set -Ux fish_pager_color_progress 565f89
|
||||
set -Ux fish_pager_color_prefix 7dcfff
|
||||
set -Ux fish_pager_color_completion c0caf5
|
||||
set -Ux fish_pager_color_description 565f89
|
||||
set -Ux fish_pager_color_selected_background --background=33467c
|
||||
|
||||
source ~/.config/fish/functions/__fre_cd.fish
|
||||
|
||||
abbr -a nxr --set-cursor "nix run nixpkgs#%"
|
||||
abbr -a nxsh --set-cursor "nix shell nixpkgs#%"
|
||||
|
||||
complete -x -c mkproj -d "Template name" -a "(ls ~/Projects/nixcfg/programs/cookiecutter)"
|
||||
'';
|
||||
|
||||
functions = {
|
||||
fre-clean = ''
|
||||
for p in (fre --sorted)
|
||||
if ! [ -d $p ]
|
||||
echo $p
|
||||
fre -D $p
|
||||
end
|
||||
end
|
||||
'';
|
||||
fish_greeting = ''
|
||||
if type -q kitty-img
|
||||
printf '💖 hiya sashanoraa '
|
||||
kitty-img ~/.config/fish/pfp.png 2>/dev/null
|
||||
echo ' 'welcome to (gethost) "~" 🏳️⚧️
|
||||
else
|
||||
echo 💖 hiya sashanoraa welcome to (gethost) "~" 🏳️⚧️
|
||||
end
|
||||
'';
|
||||
gbd = {
|
||||
wraps = "git branch -d";
|
||||
body = "git branch -d $argv[1] && git push --delete origin $argv[1]";
|
||||
};
|
||||
gbD = {
|
||||
wraps = "git branch -D";
|
||||
body = "git branch -D $argv[1] && git push --delete origin $argv[1]";
|
||||
};
|
||||
mkproj = {
|
||||
body = ''
|
||||
cookiecutter "$HOME/Projects/nixcfg/programs/cookiecutter/$argv[1]"
|
||||
'';
|
||||
};
|
||||
fish_greeting = ''
|
||||
if type -q kitty-img
|
||||
printf '💖 hiya serenity '
|
||||
echo ' 'welcome to (gethost) "~" 🏳️⚧️
|
||||
else
|
||||
echo 💖 hiya serenity welcome to (gethost) "~" 🏳️⚧️
|
||||
end
|
||||
'';
|
||||
|
||||
gethost = ''
|
||||
if test -f /run/.containerenv
|
||||
|
|
@ -179,49 +121,6 @@ pkgs: {
|
|||
end
|
||||
'';
|
||||
|
||||
mkshell = ''
|
||||
echo "{ pkgs ? import <nixpkgs> {} }:
|
||||
|
||||
pkgs.mkShell {
|
||||
packages = with pkgs; [ $argv ];
|
||||
}" > shell.nix
|
||||
echo "use nix" > .envrc && direnv allow .
|
||||
printf ".envrc\n.direnv" >> .gitignore
|
||||
'';
|
||||
|
||||
copy = ''
|
||||
if command -v wl-copy &> /dev/null
|
||||
if test -f "$argv[1]"
|
||||
wl-copy < "$argv[1]"
|
||||
else
|
||||
wl-copy $argv
|
||||
end
|
||||
else
|
||||
xclip -sel clip "$argv"
|
||||
end
|
||||
'';
|
||||
|
||||
paste = ''
|
||||
if command -v wl-paste &> /dev/null
|
||||
wl-paste
|
||||
else
|
||||
xclip -sel clip -o "$argv"
|
||||
end
|
||||
'';
|
||||
|
||||
current_branch = ''
|
||||
set ref (git symbolic-ref HEAD 2> /dev/null); or \
|
||||
set ref (git rev-parse --short HEAD 2> /dev/null); or return
|
||||
echo $ref | sed s-refs/heads/--
|
||||
'';
|
||||
|
||||
__fre_cd = {
|
||||
onVariable = "PWD";
|
||||
body = ''
|
||||
status --is-command-substitution; and return
|
||||
fre --add (pwd)
|
||||
'';
|
||||
};
|
||||
|
||||
mommy = ''
|
||||
set -g prev_status $status
|
||||
|
|
@ -351,32 +250,22 @@ pkgs: {
|
|||
return 0
|
||||
end
|
||||
|
||||
function failure
|
||||
set -l response (pick_response "negative")
|
||||
sub_terms "$response" >&2
|
||||
return $prev_status
|
||||
end
|
||||
function failure
|
||||
set -l response (pick_response "negative")
|
||||
sub_terms "$response" >&2
|
||||
return $prev_status
|
||||
end
|
||||
|
||||
if test $prev_status -eq 0
|
||||
success
|
||||
else
|
||||
failure
|
||||
end
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
if test $prev_status -eq 0
|
||||
success
|
||||
else
|
||||
failure
|
||||
end
|
||||
'';
|
||||
};
|
||||
|
||||
plugins = [
|
||||
# {
|
||||
# name = "done";
|
||||
# src = pkgs.fishPlugins.done.src;
|
||||
# }
|
||||
# {
|
||||
# name = "puffer";
|
||||
# src = pkgs.fishPlugins.puffer.src;
|
||||
# }
|
||||
# {
|
||||
# name = "autopair";
|
||||
# src = pkgs.fishPlugins.autopair.src;
|
||||
# }
|
||||
];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue