1
Fork 0
mirror of https://github.com/RGBCube/ncc synced 2025-07-30 11:37:44 +00:00

Add copy to clipboard command to nushell

This commit is contained in:
RGBCube 2025-01-19 00:32:35 +03:00
parent 48e53c11e3
commit ffac2b64dc
Signed by: RGBCube
SSH key fingerprint: SHA256:CzqbPcfwt+GxFYNnFVCqoN5Itn4YFrshg1TrnACpA5M
4 changed files with 18 additions and 4 deletions

View file

@ -231,6 +231,16 @@ $env.config.menus = [
] ]
$env.config.keybindings = [ $env.config.keybindings = [
{
name: copy_commandline
modifier: alt
keycode: char_c
mode: [ vi_normal vi_insert ]
event: {
send: executehostcommand
cmd: 'commandline | nu-highlight | $"```ansi\n($in)\n```" | copy'
}
}
{ {
name: completion_menu name: completion_menu
modifier: none modifier: none

View file

@ -1,5 +1,5 @@
{ config, lib, pkgs, ... }: let { config, lib, pkgs, ... }: let
inherit (lib) enabled const filter first foldl' getExe last match mkIf nameValuePair optionalAttrs readFile removeAttrs splitString; inherit (lib) enabled filter first foldl' getExe last match mkIf nameValuePair optionalAttrs readFile removeAttrs splitString;
in { in {
users = optionalAttrs config.isLinux { defaultUserShell = pkgs.nushell; }; users = optionalAttrs config.isLinux { defaultUserShell = pkgs.nushell; };

View file

@ -7,12 +7,16 @@ $env.ENV_CONVERSIONS.PATH = {
} }
} }
def --env mc [path: path] { def copy []: string -> nothing {
print -n $"(ansi osc)52;c;($in | encode base64)(ansi st)"
}
def --env mc [path: path]: nothing -> nothing {
mkdir $path mkdir $path
cd $path cd $path
} }
def --env mcg [path: path] { def --env mcg [path: path]: nothing -> nothing {
mkdir $path mkdir $path
cd $path cd $path
git init git init

View file

@ -4,7 +4,7 @@
def main --wrapped [ def main --wrapped [
host: string = "" # The host to build. host: string = "" # The host to build.
...arguments # The arguments to pass to `nixos-rebuild switch`. ...arguments # The arguments to pass to `nixos-rebuild switch`.
] { ]: nothing -> nothing {
let host = if ($host | is-not-empty) { let host = if ($host | is-not-empty) {
$host $host
} else { } else {