Home

Awesome

nu_plugin_skim

This is a Nushell plugin that adds integrates the skim fuzzy finder.

The regular sk executable filters lines of text, but the sk command added by this plugin can filter Nushell's structured data.

Installing

Install the crate using:

> cargo install nu_plugin_skim

Then register the plugin using (this must be done inside Nushell):

> plugin add ~/.cargo/bin/nu_plugin_skim

Usage

Pipe the input of any Nushell command into sk:

> ps | sk --format {get name} --preview {}

This will open the skim TUI, allowing you to select an item from the stream:

                    │╭─────────┬─────────────╮            1/9
                    ││ pid     │ 4223        │
                    ││ ppid    │ 3944        │
> /usr/bin/nu       ││ name    │ /usr/bin/nu │
  nu                ││ status  │ Running     │
  nu                ││ cpu     │ 28.78       │
  nu                ││ mem     │ 37.4 MiB    │
  nu                ││ virtual │ 1.4 GiB     │
  nu                │╰─────────┴─────────────╯
  6/258         5/0 │
> 'nu               │

The item will be returned as the same structured Nushell type that was fed into sk:

> ps | sk --format {get name} --preview {}
╭─────────┬─────────────╮
│ pid     │ 4223        │
│ ppid    │ 3944        │
│ name    │ /usr/bin/nu │
│ status  │ Running     │
│ cpu     │ 28.57       │
│ mem     │ 37.8 MiB    │
│ virtual │ 1.4 GiB     │
╰─────────┴─────────────╯

Of course, the result of the command can be piped into another command:

> ps | sk --format {get name} --preview {} | kill $in.pid

Notable flags

nu_plugin_skim aims to repliacte skim's sytnax, but there are some differences to better integrate with Nushell: