diff --git a/modules/common/nushell/configuration.nu b/modules/common/nushell/configuration.nu index df77d85..eb19838 100644 --- a/modules/common/nushell/configuration.nu +++ b/modules/common/nushell/configuration.nu @@ -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 diff --git a/modules/common/nushell/default.nix b/modules/common/nushell/default.nix index 1f04435..1512291 100644 --- a/modules/common/nushell/default.nix +++ b/modules/common/nushell/default.nix @@ -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; }; diff --git a/modules/common/nushell/environment.nu b/modules/common/nushell/environment.nu index 31d5eef..be28004 100644 --- a/modules/common/nushell/environment.nu +++ b/modules/common/nushell/environment.nu @@ -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 diff --git a/rebuild.nu b/rebuild.nu index e6b94f7..2799699 100755 --- a/rebuild.nu +++ b/rebuild.nu @@ -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 {