Abstract starship and fish into separate modules

This should make things easier to reason about and more modular in
general.
This commit is contained in:
Donovan Glover 2023-05-16 12:33:18 -04:00
parent 8e05ad4cae
commit a17ba29926
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65
3 changed files with 153 additions and 143 deletions

View File

@ -1,7 +1,11 @@
{ config, pkgs, lib, stylix, ... }: { config, pkgs, lib, stylix, ... }:
{ {
imports = [ ./laptop.nix ]; imports = [
./laptop.nix
./modules/starship.nix
./modules/fish.nix
];
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
@ -103,79 +107,6 @@
mv = "mv -i"; mv = "mv -i";
rg = "rg --max-columns=2000"; rg = "rg --max-columns=2000";
}; };
programs.fish.shellAbbrs = {
g = "git";
ga = "git add";
gaa = "git add --all";
gap = "git add --patch";
gb = "git branch"; # List all branches
gc = "git commit -m";
gca = "git commit --amend";
gcl = "git clone";
gco = "git checkout";
gd = "git diff"; # Show all file changes not staged yet
gdi = "git difftool --no-symlinks --dir-diff";
gds = "git diff --staged"; # Show changes staged but not committed
gdsi = "git difftool --no-symlinks --dir-diff --staged";
gi = "git init";
gl = "git log --oneline --decorate --all --graph -n 10";
gm = "git merge";
gp = "git push"; # Push your commits to a remote server
gr = "git reset HEAD~"; # Undo the last commit but keep changed files
gra = "git remote add";
gre = "git remote --verbose"; # List all remotes
grh = "git reset HEAD";
grr =
"git reset --hard HEAD~"; # Remove the last commit and all changes with it
gs = "git status";
gst = "git stash";
gstp = "git stash pop";
gt = "git tag";
gts = "git tag -s";
d = "sudo docker";
dc = "sudo docker-compose";
dcu = "sudo docker-compose up";
dcd = "sudo docker-compose down";
dcp = "sudo docker-compose pull";
dcl = "sudo docker-compose logs";
y = "yarn";
ya = "yarn add";
yar = "yarn remove";
yi = "yarn init";
yin = "yarn install";
yu = "yarn upgrade-interactive";
v = "vagrant";
vu = "vagrant up";
vh = "vagrant halt";
vs = "vagrant ssh";
vp = "vagrant provision";
dl = "yt-dlp";
vol =
"wpctl set-volume '@DEFAULT_AUDIO_SINK@'"; # Change the volume, e.g. vol 10%+, vol 10%-, vol 100%
cf = "tput reset"; # Clear the terminal completely
nf = "tput reset; and neofetch --size 56%";
df = "df --human-readable --type=ext4 --total";
du = "du --human-readable --summarize";
jis =
"recode shift_jis..utf8"; # Easily convert shift_jis-encoded files to utf8
utf16 =
"recode utf16..utf8"; # Rarely, some files from Japan are utf16 instead
jp = "LANG=ja_JP.UTF-8 LC_ALL=ja_JP.UTF-8";
a = "ansible-playbook";
b = "swaybg -m fill -i"; # Change the background
c = "clear"; # Because 5 letters is too much
e = "exit";
k = "kitty @ set-colors -c -a ~/.cache/wal/kitty";
l = "ls -l";
r = "ranger";
w = "wal -o ~/.config/wal/done.sh";
T = "tree";
};
time.timeZone = "America/New_York"; time.timeZone = "America/New_York";
@ -186,75 +117,6 @@
services.xserver.enable = true; services.xserver.enable = true;
programs.thunar.enable = true; programs.thunar.enable = true;
programs.starship = {
enable = true;
settings = {
add_newline = false;
directory = {
style = "purple";
read_only = " ro";
};
git_branch = {
style = "yellow";
symbol = "";
};
character = {
success_symbol = "[>](red)[>](green)[>](blue)";
error_symbol = "[>](cyan)[>](purple)[>](yellow)";
vicmd_symbol = "[<](bold green)";
};
line_break = { disabled = true; };
nodejs = {
format = "with [$symbol($version )]($style)";
symbol = "node ";
version_format = "\${major}";
disabled = true;
};
git_commit.tag_symbol = " tag ";
git_status = {
ahead = ">";
behind = "<";
diverged = "<>";
renamed = "r";
deleted = "x";
};
aws.symbol = "aws ";
cobol.symbol = "cobol ";
conda.symbol = "conda ";
crystal.symbol = "cr ";
cmake.symbol = "cmake ";
dart.symbol = "dart ";
deno.symbol = "deno ";
dotnet.symbol = ".NET ";
docker_context.symbol = "docker ";
elixir.symbol = "exs ";
elm.symbol = "elm ";
golang.symbol = "go ";
hg_branch.symbol = "hg ";
java.symbol = "java ";
julia.symbol = "jl ";
kotlin.symbol = "kt ";
memory_usage.symbol = "memory ";
nim.symbol = "nim ";
nix_shell.symbol = "nix ";
ocaml.symbol = "ml ";
package.symbol = "pkg ";
perl.symbol = "pl ";
php.symbol = "php ";
purescript.symbol = "purs ";
python.symbol = "python ";
ruby.symbol = "ruby ";
rust.symbol = "rust ";
scala.symbol = "scala ";
swift.symbol = "swift ";
};
};
programs.neovim.enable = true; programs.neovim.enable = true;
programs.htop = { programs.htop = {
enable = true; enable = true;

77
modules/fish.nix Normal file
View File

@ -0,0 +1,77 @@
{
programs.fish = {
shellAbbrs = {
g = "git";
ga = "git add";
gaa = "git add --all";
gap = "git add --patch";
gb = "git branch"; # List all branches
gc = "git commit -m";
gca = "git commit --amend";
gcl = "git clone";
gco = "git checkout";
gd = "git diff"; # Show all file changes not staged yet
gdi = "git difftool --no-symlinks --dir-diff";
gds = "git diff --staged"; # Show changes staged but not committed
gdsi = "git difftool --no-symlinks --dir-diff --staged";
gi = "git init";
gl = "git log --oneline --decorate --all --graph -n 10";
gm = "git merge";
gp = "git push"; # Push your commits to a remote server
gr = "git reset HEAD~"; # Undo the last commit but keep changed files
gra = "git remote add";
gre = "git remote --verbose"; # List all remotes
grh = "git reset HEAD";
grr =
"git reset --hard HEAD~"; # Remove the last commit and all changes with it
gs = "git status";
gst = "git stash";
gstp = "git stash pop";
gt = "git tag";
gts = "git tag -s";
d = "sudo docker";
dc = "sudo docker-compose";
dcu = "sudo docker-compose up";
dcd = "sudo docker-compose down";
dcp = "sudo docker-compose pull";
dcl = "sudo docker-compose logs";
y = "yarn";
ya = "yarn add";
yar = "yarn remove";
yi = "yarn init";
yin = "yarn install";
yu = "yarn upgrade-interactive";
v = "vagrant";
vu = "vagrant up";
vh = "vagrant halt";
vs = "vagrant ssh";
vp = "vagrant provision";
dl = "yt-dlp";
vol =
"wpctl set-volume '@DEFAULT_AUDIO_SINK@'"; # Change the volume, e.g. vol 10%+, vol 10%-, vol 100%
cf = "tput reset"; # Clear the terminal completely
nf = "tput reset; and neofetch --size 56%";
df = "df --human-readable --type=ext4 --total";
du = "du --human-readable --summarize";
jis =
"recode shift_jis..utf8"; # Easily convert shift_jis-encoded files to utf8
utf16 =
"recode utf16..utf8"; # Rarely, some files from Japan are utf16 instead
jp = "LANG=ja_JP.UTF-8 LC_ALL=ja_JP.UTF-8";
a = "ansible-playbook";
b = "swaybg -m fill -i"; # Change the background
c = "clear"; # Because 5 letters is too much
e = "exit";
k = "kitty @ set-colors -c -a ~/.cache/wal/kitty";
l = "ls -l";
r = "ranger";
w = "wal -o ~/.config/wal/done.sh";
T = "tree";
};
};
}

71
modules/starship.nix Normal file
View File

@ -0,0 +1,71 @@
{
programs.starship = {
enable = true;
settings = {
add_newline = false;
directory = {
style = "purple";
read_only = " ro";
};
git_branch = {
style = "yellow";
symbol = "";
};
character = {
success_symbol = "[>](red)[>](green)[>](blue)";
error_symbol = "[>](cyan)[>](purple)[>](yellow)";
vicmd_symbol = "[<](bold green)";
};
line_break = { disabled = true; };
nodejs = {
format = "with [$symbol($version )]($style)";
symbol = "node ";
version_format = "\${major}";
disabled = true;
};
git_commit.tag_symbol = " tag ";
git_status = {
ahead = ">";
behind = "<";
diverged = "<>";
renamed = "r";
deleted = "x";
};
aws.symbol = "aws ";
cobol.symbol = "cobol ";
conda.symbol = "conda ";
crystal.symbol = "cr ";
cmake.symbol = "cmake ";
dart.symbol = "dart ";
deno.symbol = "deno ";
dotnet.symbol = ".NET ";
docker_context.symbol = "docker ";
elixir.symbol = "exs ";
elm.symbol = "elm ";
golang.symbol = "go ";
hg_branch.symbol = "hg ";
java.symbol = "java ";
julia.symbol = "jl ";
kotlin.symbol = "kt ";
memory_usage.symbol = "memory ";
nim.symbol = "nim ";
nix_shell.symbol = "nix ";
ocaml.symbol = "ml ";
package.symbol = "pkg ";
perl.symbol = "pl ";
php.symbol = "php ";
purescript.symbol = "purs ";
python.symbol = "python ";
ruby.symbol = "ruby ";
rust.symbol = "rust ";
scala.symbol = "scala ";
swift.symbol = "swift ";
};
};
}