diff --git a/flake.lock b/flake.lock index 74053123..3678b1b6 100644 --- a/flake.lock +++ b/flake.lock @@ -588,6 +588,22 @@ "type": "github" } }, + "nushell-scripts": { + "flake": false, + "locked": { + "lastModified": 1690554155, + "narHash": "sha256-gJAnMY1HtRhRyRKOi0ifbuDVaImMmQeo4yY3jxY6N6c=", + "owner": "nushell", + "repo": "nu_scripts", + "rev": "f4f765a9462a4d06a1e1a8eab0dc2ee4c7421fe5", + "type": "github" + }, + "original": { + "owner": "nushell", + "repo": "nu_scripts", + "type": "github" + } + }, "root": { "inputs": { "agenix": "agenix", @@ -609,6 +625,7 @@ "nixpkgs-darwin": "nixpkgs-darwin", "nixpkgs-unstable": "nixpkgs-unstable", "nixpkgs-wayland": "nixpkgs-wayland", + "nushell-scripts": "nushell-scripts", "wallpapers": "wallpapers" } }, diff --git a/flake.nix b/flake.nix index 3834b11e..1641ac21 100644 --- a/flake.nix +++ b/flake.nix @@ -207,6 +207,12 @@ flake = false; }; + # useful nushell scripts, such as auto_completion + nushell-scripts = { + url = "github:nushell/nu_scripts"; + flake = false; + }; + # my private secrets, it's a private repository, you need to replace it with your own. # use ssh protocol to authenticate via ssh-agent/ssh-key, and shallow clone to save time mysecrets = { diff --git a/home/base/desktop/neovim/default.nix b/home/base/desktop/neovim/default.nix index 64f55413..c44bf2f7 100644 --- a/home/base/desktop/neovim/default.nix +++ b/home/base/desktop/neovim/default.nix @@ -17,6 +17,16 @@ # Toggle visual mode: `v` # Toggle visual block mode: ` + v` (select a block(vertically) of text) # +# Add at the end of Multiple line: `:normal A` +# Note that `:normal` execute `A` on each line. +# `A` means append text at the end of the line. +# You need to select the lines via visual mode first. +# +# Add at the end of the visual block: `:A` +# You need to select the block via visual block mode first. +# And then this command will append text at the end of the block on each line. +# If the position exceeds the end of the line, neovim will automatically add spaces +# # Commands & shortcuts in AstroNvim # Learn Neovim's Basics: `:Tutor` # Opening file explorer: ` + e` diff --git a/home/base/desktop/shell.nix b/home/base/desktop/shell.nix index 3f0eb9a7..c463d40c 100644 --- a/home/base/desktop/shell.nix +++ b/home/base/desktop/shell.nix @@ -1,4 +1,4 @@ -{...}: { +{ nushell-scripts, ...}: { programs.bash = { # load the alias file for work bashrcExtra = '' @@ -19,6 +19,13 @@ # https://github.com/nushell/nushell/issues/8214 extraConfig = '' source /etc/agenix/alias-for-work.nushell + use ${nushell-scripts}/custom-completions/git/git-completions.nu * + use ${nushell-scripts}/custom-completions/glow/glow-completions.nu * + use ${nushell-scripts}/custom-completions/make/make-completions.nu * + use ${nushell-scripts}/custom-completions/nix/nix-completions.nu * + use ${nushell-scripts}/custom-completions/man/man-completions.nu * + use ${nushell-scripts}/custom-completions/cargo/cargo-completions.nu * + use ${nushell-scripts}/custom-completions/zellij/zellij-completions.nu * ''; }; } diff --git a/home/linux/base/shell.nix b/home/linux/base/shell.nix index 29181ffe..ae426787 100644 --- a/home/linux/base/shell.nix +++ b/home/linux/base/shell.nix @@ -1,4 +1,4 @@ -{config, ...}: let +{config, nushell-scripts, ...}: let d = config.xdg.dataHome; c = config.xdg.configHome; cache = config.xdg.cacheHome;