A nushell-native snippet manager.
-
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 and config 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
returns the config file
opens the config file in the default editor
Snip is natively integrated with some popular external tools that enhance its functionalities. Those integrations can be enabled by editing the config file
the nu plugin skim is used to provide a better fuzzyfinding experience by displaying the snippets in a preview.
It can be enabled in the config file as follows:
extensions:
fuzzyfind:
skim:
enabled: truebat is used to provide a syntax-highlighted preview of the snippets.
It can be enabled in the config file as follows:
extensions:
display:
bat:
enabled: true