Extending VisiData With Plugins

As of version 1.5, VisiData now supports plugins, which let you easily incorporate features that other people have written, and to write your own. This chapter focuses on incorporating already-written plugins.

How to install a plugin

Installing a plugin involves two main 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 running pip 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 says import myplugin.

Example

To demonstrate, let’s install the “vddedupe” plugin:

  • Open this file in your browser and save it to ~/.visidata/vddedupe.py on your computer.
  • Open your ~/.visidatarc file, add import vddedupe 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:

 animal   | name                                                                                   
 dog      | Apollo   ‖                                                                              
 dog      | Bambi    ‖                                                                              
 dog      | Cutie    ‖                                                                              
 fish     | Fido     ‖                                                                              
 fish     | Fido     ‖                                                                              
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
dedupe-example| saul.pw/VisiData v1.5.2 | opening dedupe-example as csv | Ctrl+H o          5 rows… 

Press Space to initiate the longname-command prompt, and type dedupe-rows:

 animal   | name                                                                                   
 dog      | Apollo   ‖                                                                              
 dog      | Bambi    ‖                                                                              
 dog      | Cutie    ‖                                                                              
 fish     | Fido     ‖                                                                              
 fish     | Fido     ‖                                                                              
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
command name: dedupe-rows                                                                   5 rows… 

Press Enter to execute the command. Now you should see a new copy of the sheet, but with the duplicate row removed:

 animal   | name                                                                                   
 dog      | Apollo   ‖                                                                              
 dog      | Bambi    ‖                                                                              
 dog      | Cutie    ‖                                                                              
 fish     | Fido     ‖                                                                              
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
                                                                                                    
dedupe-example_deduped| No key cols specified. Using all columns. | "dedupe-rows"           4 rows  

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.