Hacker News new | ask | show | jobs
by zhann_dc 2862 days ago
I went for:

    function mdless() {
      pandoc -s -f markdown -t man $1 | groff -T utf8 -man | less
    }
    umedit() { mkdir -p ~/.notes; vim ~/.notes/$1; }
    um() { mdless ~/.notes/"$1"; }
    umls() { ls ~/.notes }
This way I can write the notes in markdown and view them as such in `less`.
3 comments

Great, thank you! I rewrote them for fish shell syntax and added the '-c' flag for `less` so it starts writing from the top of the window instead that from the bottom, I'm more confortable with it (still I don't know why it doesn't fit the terminal width like man does, but it wraps text every 80 characters - I guess it's not a problem anyway).

function mdless pandoc -s -f markdown -t man $argv[1] | groff -T utf8 -man | less -c end function umedit mkdir -p ~/.notes; nvim ~/.notes/$argv[1]; end function um mdless ~/.notes/"$argv[1]" end function umls ls ~/.notes/ end

(reminder, to make them permanent just: `funcsave mdless umedit um umls`)

umedit with templating:

    function umedit() {
        mkdir -p ~/.notes
        if [ ! -f ~/.notes/$1.md ]; then
            echo "% $(echo $1 | tr '[:lower:]' '[:upper:]')(shell) Um Pages | Um Page" >> ~/.notes/$1.md
            echo "\n# NAME\n$1 - $(whatis $1 2> /dev/null | cut -d '-' -f 2 | awk '{$1=$1};1')\n\n# COMMANDS" >> ~/.notes/$1.md
        fi
        vim ~/.notes/$1.md
    }
But how to share these man pages and how to search for man pages written by others?

I can share my man pages with git/github, but nobody will notice them, nobody will fix my spelling errors or contribute additional information.

Is there something like wiki, but for man pages?

> Is there something like wiki, but for man pages?

yes. it's the source repo for whatever app you want improved man pages on. Everyone can submit changes to it. All the good ones get merged in. It's effectively a wiki curated by the most knowledgeable people on the subject.

um solves a different problem though. It's not trying to make a _common_ man page. It's trying to make a man page that works _for you_. What _you_ need to be highlighted is likely different from what _I_ need to be highlighted.

Personally I don't _want_ a generic wiki man page for stuff. I like the man pages written by the creators of the code (because i know they're correct), combined with my notes highlighting what's important to me.