LoginSignup
2
2

More than 5 years have passed since last update.

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

Last updated at Posted at 2015-02-14

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.

関連

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2