mirror of
https://github.com/elwrcl/copnix.git
synced 2026-10-31 14:28:02 +03:00
50 lines
1.1 KiB
Nix
50 lines
1.1 KiB
Nix
{ ... }:
|
|
{
|
|
flake.homeModules.home-nushell-editor =
|
|
{ ... }:
|
|
{
|
|
programs.nushell = {
|
|
environmentVariables = {
|
|
EDITOR = "hx";
|
|
VISUAL = "hx";
|
|
};
|
|
|
|
shellAliases = {
|
|
e = "hx";
|
|
cop = "codium ~/copland";
|
|
};
|
|
#/nu/#
|
|
extraConfig = ''
|
|
def hxf [] {
|
|
let picked = (
|
|
do {
|
|
fd --type f --hidden --exclude .git
|
|
| fzf --preview 'bat --color=always --style=numbers {}'
|
|
} | complete
|
|
)
|
|
|
|
if $picked.exit_code != 0 { return }
|
|
|
|
let file = ($picked.stdout | str trim)
|
|
if ($file | is-not-empty) { hx $file }
|
|
}
|
|
|
|
def hxd [rev: string = "@"] {
|
|
let files = (
|
|
jj diff --revision $rev --name-only
|
|
| lines
|
|
| where { |line| ($line | str trim) != "" }
|
|
)
|
|
|
|
if ($files | is-empty) {
|
|
print $"(ansi yellow)($rev) no changes (ansi reset)"
|
|
return
|
|
}
|
|
|
|
hx ...$files
|
|
}
|
|
'';
|
|
};
|
|
};
|
|
}
|