dotfiles/.config/nushell/config.nu.cgt

76 lines
1.7 KiB
Text
Raw Normal View History

2024-05-09 14:55:59 +02:00
$env.config = {
show_banner: false
table: {
mode: reinforced
padding: { left: 0, right: 0 }
header_on_separator: true
}
completions: {
algorithm: "fuzzy"
}
cursor_shape: {
vi_insert: line
vi_normal: block
}
edit_mode: vi
shell_integration: true
use_kitty_protocol: true
highlight_resolved_externals: true
2024-05-09 22:42:13 +02:00
history: {
file_format: "sqlite"
isolation: true
}
keybindings: [
{
name: new_line_shift
modifier: shift
keycode: enter
mode: vi_insert
event: { edit: insertnewline }
},
]
}
# Aliases
def l [path: glob = "."] { ls $path | sort-by type }
def ll [path: glob = "."] { ls -la $path | sort-by type }
def la [path: glob = "."] { ls -a $path | sort-by type }
2024-05-09 15:38:08 +02:00
alias nv = nvim
2024-05-17 23:30:21 +02:00
alias nvide = & neovide "--no-fork"
2024-05-20 23:08:36 +02:00
# Misc functions
2024-05-21 23:14:18 +02:00
def --env mkdircd [p: string] {
mkdir $p
cd $p
}
2024-05-20 23:08:36 +02:00
def wldd [path: string] {
match (which $path) {
[{ path: $p }] => { ldd $p },
_ => { error make { msg: $"No external command ($path)" } },
}
}
2024-05-21 23:14:18 +02:00
def viewdoc [f: path] {
let inp = $f | path parse
match $inp.extension {
$e if $e in [ "doc", "docx", "odt", "ppt", "pptx", "odp" ] => {
let outp = { extension: "pdf", parent: "/tmp", stem: $inp.stem } | path join
libreoffice --convert-to pdf $f --outdir /tmp
try { zathura $outp }
rm $outp
},
"pdf" => { zathura $f },
"html" => { openbrowser $"file://($f | path expand)" }
$e if $e in [ "png", "webp", "jpg", "jpeg", "ff", "bmp" ] => { nsxiv $f },
_ => { mpv $f },
}
}