Skip to content

hardenedapple/vsh

Repository files navigation

Vsh -- Record and replay terminal sessions inside vim and saved to disk

Vim plugin for experimental shell sessions -- save a session for later/others and search/modify output with the power of vim.

It is different to the :terminal command for two main reasons:

  1. You run commands anywhere in the file.
  2. The buffer corresponds to a standard file on disk.

It can also be thought of as an interactive version of script(1) -- interactive because you can go back and modify what's stored while you work -- that facilitates re-running the same session during reading.

Benefits are mainly around exploratory terminal sessions, where you want to

  1. Keep a clean record of what you did, for record keeping.
  • This often means removing output from unimportant --help commands.
  1. Easily repeat those actions you performed -- whether restarting a python REPL or GDB session, re-running a manual inspection you have not yet formalised into an automatic testcase, or re-running a shell session given to you (by yourself a year ago or by your collegue) that demonstrates a behaviour or reproduces a bug.
  2. Search through and modify output of commands with Vim shortcuts.
  3. Write notes/annotations alongside commands for others to understand what's going on.
  4. Prepare and replay a live demo (see my presentation on GDB walkers).

Some demos are provided in the links below.

Requires vim with patch 8.0.0764 or nvim version 0.2.

Installation

Install with favourite package manager or Vim's built-in package support. For emacs can find this package on MELPA.

After installation, I'd suggest opening up vsh/demo/setup-env.sh to read (and possibly run) the (small number of) configuration steps there in turn. The biggest point is to ensure TERM=dumb is not overridden in your bashrc (manual adjustment to a different shell should be relatively simple).

Motivation video

Vsh motivation

Basic introduction

Vsh basics

Editing output

Editing output

Sending text

Sending text

Editing Files

Editing Files

"Remote editing" -- sort of

"Remote editing" -- sort of

Relative gf anywhere

Relative gf anywhere

Getting started

There are various demo.vsh files in vsh/demo/demo*.vsh. If you've just installed and are looking for how to use the plugin that's a great place to start. (demo.vsh includes demo_part2.vsh at the end of the demonstration, and that includes demo_part3.vsh, so they naturally get executed in turn).

About

Store and replay shell sessions -- also output search/modification/undo/redo.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •