nix-configs/other/config.nu

196 lines
5.4 KiB
Text
Raw Normal View History

2025-01-01 04:47:30 +01:00
let colors = {
2023-09-09 01:10:22 +02:00
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
2024-06-12 13:26:34 +02:00
shape_external_resolved: light_cyan_bold
2023-09-09 01:10:22 +02:00
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: {
2025-01-01 04:47:30 +01:00
always_trash: true
2023-09-09 01:10:22 +02:00
}
table: {
mode: reinforced # basic, compact, compact_double, light, thin, with_love, rounded, reinforced, heavy, none, other
2025-01-01 04:47:30 +01:00
header_on_separator: true # show header text on separator/border line
2023-09-09 01:10:22 +02:00
}
history: {
2025-01-01 04:47:30 +01:00
max_size: 1_000_000_000 # Session has to be reloaded for this to take effect
isolation: false
2023-09-09 01:10:22 +02:00
}
completions: {
algorithm: "fuzzy" # prefix or fuzzy
2025-01-01 04:47:30 +01:00
sort: "smart"
2023-09-09 01:10:22 +02:00
}
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)
}
2025-01-01 04:47:30 +01:00
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
2024-11-29 15:48:15 +01:00
footer_mode: 25 # always, never, number_of_rows, auto
2023-09-09 01:10:22 +02:00
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
2025-01-01 04:47:30 +01:00
use_kitty_protocol: true
2023-09-09 01:10:22 +02:00
hooks: {
2024-08-02 21:29:25 +02:00
pre_execution: [{ $env.CMD_COUNT = $env.CMD_COUNT + 1; }] # run before the repl input is run
2023-09-09 01:10:22 +02:00
}
}
# start_zellij
2023-09-09 01:10:22 +02:00
2023-11-13 14:07:25 +01:00
def nsp [
...programs: string
2023-11-13 14:07:25 +01:00
] {
nix shell ...($programs | each {|it| $"nixpkgs#($it)" })
2023-11-13 14:07:25 +01:00
}
def nr [
program: string
] {
nix run $"nixpkgs#($program)"
}
2023-11-13 14:07:25 +01:00
def lcr [
file_extension: string
] {
2024-04-03 17:56:13 +02:00
ls **/*
| where name ends-with $".($file_extension)"
2024-04-20 16:09:09 +02:00
| par-each {|file|
2023-11-20 17:29:43 +01:00
open $file.name
| lines --skip-empty
| length }
| math sum
}
def glog [
amount: int
] {
git log --pretty=%h»¦«%s»¦«%aN»¦«%aE»¦«%aD -n $amount
| lines
2024-02-29 19:48:57 +01:00
| split column "»¦«" commit subject name email date
2023-11-13 14:07:25 +01:00
}
def typed [
name: string
] {
touch $"($name).typ"
typst compile $"($name).typ"
2024-03-08 07:58:44 +01:00
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)' &";
}
2023-09-09 01:10:22 +02:00
alias gnix = cd ~/nix-configs;
alias grepo = cd ~/Documents/repos;
alias wh = wormhole-rs;
2023-11-23 18:55:52 +01:00
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;
2024-01-30 19:56:27 +01:00
alias clip = xclip -selection c;
2024-02-27 18:19:11 +01:00
alias cr = cargo run;
alias cl = cargo clippy;
alias cb = cargo build;
alias cch = cargo check;
2024-03-05 13:10:25 +01:00
alias togglecaps = xdotool key Caps_Lock;
alias TOGGLECAPS = togglecaps;
alias bash = echo $"(ansi red)no, fuck that shit!";
2024-04-18 18:47:22 +02:00
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;