Extending VisiData With Plugins¶
VisiData allows users to extend the program’s functionality through plugins. You can write your own, or use plugins other people have written. This chapter focuses on incorporating already-written plugins.
Using VisiData’s plugin installer¶
VisiData provides an interface for installing certain plugins. To open the interface, press Space to raise the longname-command prompt, type open-plugins
, and press Enter:
File Edit View Column Row Data Plot System Help Ctrl+H for help menu name ║ instal…| description | maintainer | latest> vfake ║ | replace column with fake values | Saul Pwanson @saul…| 2020-1… dedupe ║ | adds commands for selection and remova…| Jeremy Singer-Vine…| 2021-0… normcol ║ | normalizes column names in any given s…| Jeremy Singer-Vine…| 2020-1… fec ║ | loader for .fec files from the Federal…| Jeremy Singer-Vine…| 2019-0… sparkline ║ | add a sparkline column to visualise tr…| Lucas Messenger @l…| 2020-0… rownum ║ | add column of original row ordering | Saul Pwanson @saul…| 2019-1… vmailcap ║ | add mailcap-view(-selected) commands t…| Saul Pwanson @saul…| 2020-1… vmutagen ║ | add mp3 metadata columns to DirSheet | Saul Pwanson @saul…| 2019-0… vds3 ║ | add support for Amazon S3 paths | AJ Kerrigan @ajker…| 2021-0… genericSQL ║ | add loaders for SQL databases (Oracle,…| Andrew Swanson @as…| 2020-0… diff ║ | adds command to create diff sheets | Anja Kefala @anjak…| 2020-1… marks ║ | adds commands for marking selected row…| Saul Pwanson @saul…| 2020-1… conll ║ | CoNLL data loader | Paul McCann <polm@…| 2020-1… darkdraw ║ | textart and animation for the terminal…| devottys @devottys | 2021-0… f5log ║ | parse F5 BIG-IP ltm, gtm, asm, apm, au…| James Deucker <f5l…| 2022-0… parent_navigation ║ | navigate a parent sheet from its child | AJ Kerrigan @ajker…| 2022-0… vd_toml ║ | add a loader for TOML files | AJ Kerrigan @ajker…| 2022-0… 3› plugins_global| "open-plugins" Space 17 plugins •0
To install and activate any of these plugins, navigate to its row and press a. To deactivate a plugin, navigate to its row and press d.
How to install a plugin manually¶
You can also manually install plugins that are not available through the installer. Doing so involves two steps:
- First, make the plugin available to VisiData. Depending on the plugin, you’ll do this either by saving the plugin file to your
~/.visidata/
directory, or by runningpip install [plugin_package_name]
. - Then, use your
~/.visidatarc
configuration file to import the plugin. If you’ve saved your plugin as~/.visidata/myplugin.py
, all you need to do is add a line that saysimport myplugin
.
Example¶
To demonstrate, let’s install a “dedupe” plugin:
- Open this file in your browser and save it to
~/.visidata/dedupe.py
on your computer. - Open your
~/.visidatarc
file, addimport dedupe
on a new line, and save the file.
That’s it. Next time you start VisiData, you should have access to two new commands: select-duplicate-rows
and dedupe-rows
.
Let’s give the plugin a spin. Download dedupe-example.csv
and open it in VisiData:
vd dedupe-example.csv
You should see this:
File Edit View Column Row Data Plot System Help Ctrl+H for help menu animal | name ║ dog | Apollo ║ dog | Bambi ║ dog | Cutie ║ fish | Fido ║ fish | Fido ║ 1› dedupe-example| saul.pw/VisiData v2.8 | opening datasets/dedupe-example.c 5 rows •0
Press Space to initiate the longname-command prompt, and type dedupe-rows
:
File Edit View Column Row Data Plot System Help Ctrl+H for help menu animal | name ║ dog | Apollo ║ dog | Bambi ║ dog | Cutie ║ fish | Fido ║ fish | Fido ║ command name: dedupe-rows Space exec-longname 5 rows •0
Press Enter to execute the command. Now you should see a new copy of the sheet, but with the duplicate row removed:
File Edit View Column Row Data Plot System Help Ctrl+H for help menu animal | name ║ dog | Apollo ║ dog | Bambi ║ dog | Cutie ║ fish | Fido ║ 2› dedupe-example_deduped| No key cols specified. Using all columns. | Space 4 rows •0
Where to find plugins¶
Plugin support is a relatively new feature of VisiData, so there aren’t many public plugins yet available. Here is a (likely incomplete) list of resources:
Warning
As with any software you download, plugins may contain malicious code. If you’re unsure whether a plugin is safe to install, err on the side of caution.