1
Fork 0
mirror of https://github.com/RGBCube/ncc synced 2025-07-29 11:07: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 8a118cc51a
commit 152d5d259e
4 changed files with 18 additions and 4 deletions

View file

@ -231,6 +231,16 @@ $env.config.menus = [
]
$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
modifier: none

View file

@ -1,5 +1,5 @@
{ 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 {
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
cd $path
}
def --env mcg [path: path] {
def --env mcg [path: path]: nothing -> nothing {
mkdir $path
cd $path
git init

View file

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