toys

Tools and things that make my life easier - y'all might like them too

View the Project on GitHub pfuntner/toys

br

Purpose

br stands for browse. This is a script that you kind of have to use to appreciate. It reads from stdin, stashes the data verbatim in a temporary file, launches vi on the file, and then removes the file when you’re done. So it’s a little bit like more/less but I think it’s much more flexible and you have a full editor to play with. I think this was inspired by my time on Windoze when I had a script to launch notepad.exe on data coming from stdin. That was nice but had some issues and I like this better.

Alternatively, if you run it without redirecting stdin and give it one or more filenames, it launches vi in read-only mode. I used to have an alias for years that would only do read-only editing but I finally combined them together and the script has proven very useful. I often appreciate an extra safeguard to help keep me from changing a file by accident.

Syntax

Syntax: br [-g] [-n] [ [ OPTS ] FILENAME ... ]

Options and arguments

| Option | Description | Default | | —— | ———– | ——- | | -g --gvim | Use {gvim} instead of vi/vim | Available only on Windoze | | -n --notepad | Use Windoze {notepad} of vi/vim | Available only on Windoze | | -g --gedit | Use {gedit} instead of vi | Available only on Unix |

Example

The script is too interactive to give a good example with just text. You can learn a lot by just trying it out. I’ve also created a desktop video to help.

Example from Linux shell

Click the image below to watch a video demonstrating the tool from Linux:

Linux example

Example from Windoze command prompt

Click the image below to watch a video demonstrating the tool from Windoze:

Windoze example

Notes