A snippet manager in a file.
-
Clone the repository (or copy the module files) into one of your
$env.NU_LIB_DIRS:git clone git@github.com:lassoColombo/snip.git ~/nu_libs/aiai -
Use the module (e.g., in
~/.config/nushell/config.nu):use snip
Snippets file live in the snip directory:
if ($env.SNIP_SNIPDIR? | is-not-empty) {
$env.SNIP_SNIPDIR
} else if ($env.XDG_CONFIG_HOME? | is-not-empty) {
[$env.XDG_CONFIG_HOME snip] | path join
} else {
[$env.HOME .config snip] | path join
}puts the content of the selected snippet in the commandline to be executed
opens the default editor in the snip directory
opens the selected snippet in the default editor
returns the content of the selected snippet
returns all the snippets in a nushell table