nix-configs/other/config.nu
2025-01-01 04:51:29 +01:00

195 lines
5.4 KiB
Text

let colors = {
separator: white
leading_trailing_space_bg: { attr: n } # no fg, no bg, attr none effectively turns this off
header: green_bold
empty: blue
bool: light_cyan
int: white
filesize: cyan
duration: white
date: purple
range: white
float: white
string: white
nothing: white
binary: white
cellpath: white
row_index: green_bold
record: white
list: white
block: white
hints: dark_gray
search_result: {bg: red fg: white}
shape_and: purple_bold
shape_binary: purple_bold
shape_block: blue_bold
shape_bool: light_cyan
shape_closure: green_bold
shape_custom: green
shape_datetime: cyan_bold
shape_directory: cyan
shape_external: cyan
shape_externalarg: green_bold
shape_external_resolved: light_cyan_bold
shape_filepath: cyan
shape_flag: blue_bold
shape_float: purple_bold
shape_garbage: { fg: white bg: red attr: b}
shape_globpattern: cyan_bold
shape_int: purple_bold
shape_internalcall: cyan_bold
shape_list: cyan_bold
shape_literal: blue
shape_match_pattern: green
shape_matching_brackets: { attr: u }
shape_nothing: light_cyan
shape_operator: yellow
shape_or: purple_bold
shape_pipe: purple_bold
shape_range: yellow_bold
shape_record: cyan_bold
shape_redirection: purple_bold
shape_signature: green_bold
shape_string: green
shape_string_interpolation: cyan_bold
shape_table: blue_bold
shape_variable: purple
shape_vardecl: purple
}
$env.config = {
show_banner: false # true or false to enable or disable the welcome banner at startup
ls: {
use_ls_colors: true # use the LS_COLORS environment variable to colorize output
}
rm: {
always_trash: true
}
table: {
mode: reinforced # basic, compact, compact_double, light, thin, with_love, rounded, reinforced, heavy, none, other
header_on_separator: true # show header text on separator/border line
}
history: {
max_size: 1_000_000_000 # Session has to be reloaded for this to take effect
isolation: false
}
completions: {
algorithm: "fuzzy" # prefix or fuzzy
sort: "smart"
}
cursor_shape: {
emacs: line # block, underscore, line, blink_block, blink_underscore, blink_line (line is the default)
vi_insert: line # block, underscore, line , blink_block, blink_underscore, blink_line (block is the default)
vi_normal: block # block, underscore, line, blink_block, blink_underscore, blink_line (underscore is the default)
}
color_config: $colors # if you want a more interesting theme, you can replace the empty record with `$dark_theme`, `$light_theme` or another custom record
footer_mode: 25 # always, never, number_of_rows, auto
float_precision: 2 # the precision for displaying floats in tables
buffer_editor: "" # command that will be used to edit the current line buffer with ctrl+o, if unset fallback to $env.EDITOR and $env.VISUAL
use_ansi_coloring: true
bracketed_paste: true # enable bracketed paste, currently useless on windows
edit_mode: vi # emacs, vi
use_kitty_protocol: true
hooks: {
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;