6

I have been trying to find a way for the OS X Terminal to accept the mouse input to scroll in the man pages.

I have installed SIMBL and MouseTerm but this does not enable scrolling in the man pages. Any sugestions?

1

The amount of the man page that you can see at one time is determined by the buffer size. Here is how to change it.

After much trial and error, I have enabled scrolling in vim, but not for man pages.

Append to your ~/.vimrc

set mouse=a
set ttymouse=xterm2

The following blog shows how to enable scrolling in vim using iTerm2. It unfortunately does not work on man pages.


As a work around, I would suggest:

*NIXmanual - A widget you enable on your Mac that cointains the man pages

linuxmanpages.com - A website will all linux man pages

Use the standard vim keys 'hjkl' or Shift Page Up andShift Page Down


Additional Resources

Arch linux forum discussion 1
Arch linux forum discussion 2

1
  • In addition to the standard vim navigation, you can use d to scroll down half a page and u to scroll up half a page in man pages (and in less). You can also open man pages in vim with vim <(man foo); you could put that into a function in your .bashrc, something like: myman() { vim <(man "$1"); }, and then use it like myman foo. I'm aware that OSX uses bash version 3.x, so I don't know if process substitution works there, but if it does then that could be a workaround for getting the mouse in manpages.
    – evilsoup
    Aug 17 '13 at 9:02
0

I know I'm late to the party 🎉 (as usual) but I came across this question today, and only saw one answer that had some external links in it.

So the solution I came up with was to use one of my favorite text editors nvim to handle opening of man pages within a terminal session.

Now, you could go about by setting the $PAGER environment variable or the $MANPAGER variable to vim for shell session and I suppose that would work.

But however I decided to write a custom function for my shell, which happens to be fish-shell, however I'm sure both BASH and ZSH both support functions as well.

The reason I chose to go the function route was that I didn't really want to always use nvim as my PAGER for my own obvious reasons. However, if I could just run a command such as vman to open a man page within nvim that'd be awesome, thus leaving the $PAGER, $MANPAGER environment variables intact along with the man command as well.

So I created a function that looks like the below, added some comments so I'd have understanding of what all the flags are doing, so that way I wouldn't have to 🥁 ...open the man page 😉

function vman --description 'use vim / nvim to read man pages'

  # col `-b` flag = don't output any backspaces
  # col `-p` flag = force uknown control sequences
  # ===
  # iconv `-c` flag = characters that can't be converter are
  # ...silently discarded
  # ===
  # nvim `-c` flag = run argument / command after executing nvim
  # nvim `-R` flag = open "file" in read-only mode
  # ===
  man $argv | col -bp | iconv -c | nvim -c 'set ft=man nomod nolist' -;
end

Obviously your going to need mouse support enabled in vim / nvim which can be done by adding the below line to the respected editors configuration file.

set mouse=a

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy