rewrite nu shit

This commit is contained in:
Schrottkatze 2025-01-01 05:16:08 +01:00
parent f64f61b9b6
commit 2ce0df9880
No known key found for this signature in database
6 changed files with 101 additions and 96 deletions

View file

@ -13,14 +13,14 @@
pkgs.pueue pkgs.pueue
]; ];
home.file."shell-startup" = { home.file."shell-startup" = {
source = ../../other/scripts/desktop/shell-startup.nu; source = ./nu/shell-startup.nu;
target = ".config/nushell/shell-startup.nu"; target = ".config/nushell/shell-startup.nu";
}; };
programs.nushell = { programs.nushell = {
enable = true; enable = true;
package = config.users.defaultUserShell; package = config.users.defaultUserShell;
configFile.source = ../../other/config.nu; configFile.source = ./nu/config.nu;
envFile.source = ../../other/env.nu; envFile.source = ./nu/env.nu;
extraConfig = '' extraConfig = ''
plugin add ${pkgs.nushellPlugins.query}/bin/nu_plugin_query; plugin add ${pkgs.nushellPlugins.query}/bin/nu_plugin_query;
plugin add ${pkgs.nushellPlugins.polars}/bin/nu_plugin_polars; plugin add ${pkgs.nushellPlugins.polars}/bin/nu_plugin_polars;
@ -30,7 +30,9 @@
plugin use polars; plugin use polars;
plugin use formats; plugin use formats;
nu ${../../other/scripts/desktop/shell-startup.nu}; source ${./nu/custom_commands.nu};
source ${./nu/aliases.nu};
nu ${./nu/shell-startup.nu};
''; '';
extraEnv = '' extraEnv = ''
''; '';

View file

@ -0,0 +1,28 @@
alias gnix = cd ~/nix-configs;
alias grepo = cd ~/Documents/repos;
alias wh = wormhole-rs;
alias gg = gitui;
alias ga = git add;
alias gc = git commit;
alias gca = git commit --all;
alias gp = git push;
alias gl = git pull;
alias gs = git status;
alias clip = xclip -selection c;
alias cr = cargo run;
alias cl = cargo clippy;
alias cb = cargo build;
alias cch = cargo check;
alias togglecaps = xdotool key Caps_Lock;
alias TOGGLECAPS = togglecaps;
alias bash = echo $"(ansi red)no, fuck that shit!";
alias sh = echo $"(ansi red)no, fuck that shit!";
alias zsh = echo $"(ansi red)no, fuck that shit!";
alias fish = echo $"(ansi red)no, fuck that shit!";
alias px = pulsemixer;

View file

@ -101,95 +101,3 @@ $env.config = {
pre_execution: [{ $env.CMD_COUNT = $env.CMD_COUNT + 1; }] # run before the repl input is run pre_execution: [{ $env.CMD_COUNT = $env.CMD_COUNT + 1; }] # run before the repl input is run
} }
} }
# start_zellij
def nsp [
...programs: string
] {
nix shell ...($programs | each {|it| $"nixpkgs#($it)" })
}
def nr [
program: string
] {
nix run $"nixpkgs#($program)"
}
def lcr [
file_extension: string
] {
ls **/*
| where name ends-with $".($file_extension)"
| par-each {|file|
open $file.name
| lines --skip-empty
| length }
| math sum
}
def glog [
amount: int
] {
git log --pretty=%h»¦«%s»¦«%aN»¦«%aE»¦«%aD -n $amount
| lines
| split column "»¦«" commit subject name email date
}
def typed [
name: string
] {
touch $"($name).typ"
typst compile $"($name).typ"
mprocs --names Editor,Viewer,Notify $"hx '($name).typ'" $"while true; do mupdf-x11 '($name).pdf' && break; done" $"while inotifywait -e modify '($name).pdf' ; do pkill -HUP mupdf; done"
}
def nev [ unit = day ] {
( ( open Docs/dates.csv
| update datetime {|it| $it.datetime | into datetime }
| first
).datetime - (date now)
)
| into duration
| format duration $unit
}
# TODO: intermediate stations
def bx [from: string to: string] {
let map = open ~/Docs/ril100map.json;
let start = $map | get ($from | str upcase) | first;
let dest = $map | get ($to | str upcase) | first;
let url = $"https://bahn.expert/routing/($start)/($dest)/0/";
print $url;
^bash -c $"nohup chromium '($url)' &";
}
alias gnix = cd ~/nix-configs;
alias grepo = cd ~/Documents/repos;
alias wh = wormhole-rs;
alias gg = gitui;
alias ga = git add;
alias gc = git commit;
alias gca = git commit --all;
alias gp = git push;
alias gl = git pull;
alias gs = git status;
alias clip = xclip -selection c;
alias cr = cargo run;
alias cl = cargo clippy;
alias cb = cargo build;
alias cch = cargo check;
alias togglecaps = xdotool key Caps_Lock;
alias TOGGLECAPS = togglecaps;
alias bash = echo $"(ansi red)no, fuck that shit!";
alias sh = echo $"(ansi red)no, fuck that shit!";
alias zsh = echo $"(ansi red)no, fuck that shit!";
alias fish = echo $"(ansi red)no, fuck that shit!";
alias px = pulsemixer;

View file

@ -0,0 +1,67 @@
# open nix shell with a bunch of programs
def nsp [
...programs: string
] {
nix shell ...($programs | each {|it| $"nixpkgs#($it)" })
}
# do a nix run of a nix package
def nr [
program: string
] {
nix run $"nixpkgs#($program)"
}
# do a recursive line count of a file extension
def lcr [
file_extension: string
] {
ls **/*
| where name ends-with $".($file_extension)"
| par-each {|file|
open $file.name
| lines --skip-empty
| length }
| math sum
}
# get parsed git log
def glog [
amount: int
] {
git log --pretty=%h»¦«%s»¦«%aN»¦«%aE»¦«%aD -n $amount
| lines
| split column "»¦«" commit subject name email date
}
# open typst IDE ish setup
def typed [
name: string
] {
touch $"($name).typ"
typst compile $"($name).typ"
mprocs --names Editor,Viewer,Notify $"hx '($name).typ'" $"while true; do mupdf-x11 '($name).pdf' && break; done" $"while inotifywait -e modify '($name).pdf' ; do pkill -HUP mupdf; done"
}
# figure out when the next event is
def nev [ unit = day ] {
( ( open Docs/dates.csv
| update datetime {|it| $it.datetime | into datetime }
| first
).datetime - (date now)
)
| into duration
| format duration $unit
}
# open chromium with bahn.expert opened and ready
# TODO: intermediate stations
def bx [from: string to: string] {
let map = open ~/Docs/ril100map.json;
let start = $map | get ($from | str upcase) | first;
let dest = $map | get ($to | str upcase) | first;
let url = $"https://bahn.expert/routing/($start)/($dest)/0/";
print $url;
^bash -c $"nohup chromium '($url)' &";
}