1

I am in xterm on Pangolin, inside a tmux session, in copy mode. I am trying to copy the text of a man page but what I yank into the clipboard by using the simple vi bindings of spacebar/enter is text full full of whitespace which I can't just paste into vim.

  • How can I view a man page as "plain text", perhaps even outside of the man program?

  • Alternatively, how can I use the tmux copy mode to properly copy the text as it appears on the screen so that CTRL+] pasting it elsewhere will be faithful to the formatting I intended to reproduce?

EDIT: I should mention that the command capture-pane, followed by save-buffer, works to save an entire buffer to a file. I am looking for something less of an overkill: simple copy mode, select and yank, paste somewhere else; for example: inside vim.

7
  • Are you aware that you can pipe the output of man directly? Is there a reason you need to go through tmux?
    – jw013
    Oct 5, 2012 at 3:56
  • No, I am not aware of that. Please teach me how to get a simple txt file from a man page... that would be an answer I would immediately accept. Oct 5, 2012 at 3:58
  • 1
    Try man man > saved. It usually works for me.
    – jw013
    Oct 5, 2012 at 6:41
  • Yes, it does. I can accept the answer. Ideally I would be able to format it too (e.g. specify a width in columns, not just the terminal $COLUMNS value it seems to pick up automatically...) Oct 5, 2012 at 6:53
  • 2
    I can paste text I copy from man pages using tmux copy mode to vim just fine. Is it possible you're not setting :set paste in vim before the paste?
    – none
    Oct 5, 2012 at 19:36

2 Answers 2

3

so as I told in my comment, there's a paste option in vim which disables insert mode keybindings as well as other options such as automatic indentation so that you can paste some text in insert mode without deformation. you can turn it on using:

:set paste

after you paste you probably want to turn it off again using:

:set nopaste

there's still the issue that you can't scroll your man page in tmux copy mode therefore you can only copy a screen full of text at a time but still it may become convenient for some cases.

0

Piping output of man through col helps a lot and it's probably better than using copy mode, I am still going to wait a bit for an answer using tmux though. Here's how I make do in the meantine:

COLUMNS=9999 man tmux | col -bx > /tmp/tmp

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .