2018-11-10 Manual Pages

I like people who write their own man pages with the most important information they keep forgetting about existing commands. Keep this info in text files and use a little script like mman to access those text files; keep using man for the original. I found this via tfurrows’s gopher site.

On Mastodon, I got some more suggestions:

@raucao suggested tldr. I installed the Perl variant via cpanm tldr.

alex@melanobombus:~$ tldr emacs

  The extensible, customizable, self-documenting, real-time display editor.

  ✓ Open emacs in console mode (without X window):

    🍣  emacs -nw

  ✓ Open a file in emacs:

    🍣  emacs {{filename}}

  ✓ Exit emacs:

    🍣  C-x C-c

Know about ed I can tell you that knowing how to quit is essential information. But surely there is more to it?

@coffe suggested cheat. I installed it via pip3 install cheat. And I set some options in my ~/bashrc:

export EDITOR=emacsclient
export CHEATCOLORS=true

You need to provide an editor because you can edit your cheat sheets. That’s the spirit!

The colourisation for the Emacs page is wrong. I guess it isn’t handled as Markdown? But at least there’s more information available. Perhaps it’s too much?

alex@melanobombus:~$ cheat emacs
# Running emacs

  GUI mode            $ emacs
  Terminal mode       $ emacs -nw

# Basic usage

  Indent              Select text then press TAB
  Cut                 CTRL-w
  Copy                ALT-w
  Paste ("yank")      CTRL-y
  Begin selection     CTRL-SPACE
  Search/Find         CTRL-s
  Replace             ALT-% (ALT-SHIFT-5)
  Save                CTRL-x CTRL-s
  Save as             CTRL-x CTRL-w
  Load/Open           CTRL-x CTRL-f
  Undo                CTRL-x u
  Highlight all text  CTRL-x h
  Directory listing   CTRL-x d
  Cancel a command    CTRL-g
  Font size bigger    CTRL-x CTRL-+
  Font size smaller   CTRL-x CTRL--

# Buffers

  Split screen vertically                         CTRL-x 2
  Split screen vertically with 5 row height       CTRL-u 5 CTRL-x 2
  Split screen horizontally                       CTRL-x 3
  Split screen horizontally with 24 column width  CTRL-u 24 CTRL-x 3
  Revert to single screen                         CTRL-x 1
  Hide the current screen                         CTRL-x 0
  Move to the next screen                         CTRL-x o
  Kill the current buffer                         CTRL-x k
  Select a buffer                                 CTRL-x b
  Run command in the scratch buffer               CTRL-x CTRL-e

# Navigation ( backward / forward )
  
  Character-wise                                  CTRL-b , CTRL-f
  Word-wise                                       ALT-b  , ALT-f
  Line-wise                                       CTRL-p , CTRL-n
  Sentence-wise                                   ALT-a  , ALT-e
  Paragraph-wise                                  ALT-{ , ALT-}
  Function-wise                                   CTRL-ALT-a , CTRL-ALT-e
  Line beginning / end                            CTRL-a , CTRL-e

# Other stuff

  Open a shell         ALT-x eshell
  Goto a line number   ALT-x goto-line
  Word wrap            ALT-x toggle-word-wrap
  Spell checking       ALT-x flyspell-mode
  Line numbers         ALT-x linum-mode
  Toggle line wrap     ALT-x visual-line-mode
  Compile some code    ALT-x compile
  List packages        ALT-x package-list-packages

# Line numbers

  To add line numbers and enable moving to a line with CTRL-l:

    (global-set-key "\C-l" 'goto-line)
    (add-hook 'find-file-hook (lambda () (linum-mode 1)))

I am reminded of my own recommendation regarding Emacs. I wrote this in 2006. Reference Sheet by Alex Schroeder (for Emacs).

Tags:

Comments

I’ve done something similar using BASH functions. I first saw these in a comment on hackernews, and have simply taken them wholesale.

mdless() {
      pandoc -s -f markdown -t man $1.md | groff -T utf8 -man | less
        }
umedit() { mkdir -p ~/docs/linux_stuff/knowledge; vim ~/docs/linux_stuff/knowledge/$1.md; }
um() { mdless ~/docs/linux_stuff/knowledge/"$1"; }
umls() { ls ~/docs/linux_stuff/knowledge; }

However, these leave a little to be desired in terms of completeness. I’ve been mostly satisfied with them so far though!

– reed 2018-11-12 20:37 UTC


Hah, to translate from Markdown to man is genius. :)

– Alex 2018-11-13 06:22 UTC


Please make sure you contribute only your own work, or work licensed under the GNU Free Documentation License. Note: in order to facilitate peer review and fight vandalism, we will store your IP number for a number of days. See Privacy Policy for more information. See Info for text formatting rules. You can edit the comment page if you need to fix typos. You can subscribe to new comments by email without leaving a comment.

To save this page you must answer this question:

Please say HELLO.