My personal configuration files and scripts.
1#!/usr/bin/env bash
2
3# Simple wrapper script around man that opens man pages in either Neovim or Vim.
4
5if [[ $# == 0 ]]; then
6 echo "What manual page do you want?"
7 echo "For example, try 'vman man'."
8 exit 0
9elif ! man -w "$@" > /dev/null; then
10 # Exit early if the manual page does not exist in order to avoid visual noise from
11 # opening Neovim.
12 exit 1
13fi
14
15if [[ -x $(command -v nvim) ]]; then
16 nvim -c "SuperMan $*"
17elif [[ -x $(command -v vim) ]]; then
18 vim -c "SuperMan $*"
19else
20 echo "Neither NeoVim nor Vim are installed!"
21 exit 2
22fi