Help us understand the problem. What is going on with this article?

ターミナルに何も残さないように、manをMacVimで読む

More than 5 years have passed since last update.

manをVimで読むと快適

$ man find | col -b -x | vim +"set ft=man nolist nomod noma" -

MacVimで標準入力を読むと、変なのが残る

$ man find | col -b -x | mvim +"set ft=man nolist nomod noma" -
$ Vim: Reading from stdin...
# ctrl+cで終了させないと消えない
# MacVimを完全に終了しても消えない

$ man find | col -b -x | mvim -f +"set ft=man nolist nomod noma" -
# noforkだとMacVim終了で消える

MacVimを起動してから、EXコマンドでmanの出力を読み込む

$ mvim +"r ! man find | col -b -x" +"normal ggdd" +"set ft=man nolist nomod noma"
# 何も残らない!

シェルスクリプト化

manv.sh
#!/bin/bash
if man "$1" >&/dev/null;then
  mvim +"r ! man $1 | col -b -x" +"normal ggdd" +"set ft=man nolist nomod noma"
else
  echo "ERROR: No man to argument." 1>&2
  exit 1
fi
$ manv find
# MacVimが起動してfindのmanを読み込む

$ manv zzz
ERROR: No man to argument.

関連

catfist
物書き志望です。
https://wbtmiu.herokuapp.com/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away