Read Manpages With Less, Bat, Vim or Neovim

Поделиться
HTML-код
  • Опубликовано: 14 янв 2025

Комментарии • 88

  • @trampolinhusetuser7098
    @trampolinhusetuser7098 3 года назад +40

    Last time I was that early DT was still explaining the difference between bald and shaved

  • @matt92hun
    @matt92hun 3 года назад +30

    Just a few tips for people who may not know:
    - You can clear your screen with Ctrl + L.
    - Less has most of the same commands that you would use for a man page as vi(m), same navigation, searching with / and ?, etc.
    - You can reload your shell with just ". ~/.bashrc" (or whatever your shell's configuration file is called).
    P.S: I never looked into the performance of less vs. some text editor, my gut feeling is that less would be faster because most people don't really configure it much, but that might be an interesting topic to explore.

    • @matt92hun
      @matt92hun 3 года назад +1

      @Learn Linux Yeah, mine is assuming to be in the home directory, I'll edit my comment above to avoid confusion.

    • @greatsaid5271
      @greatsaid5271 3 года назад +1

      also you can add syntax highlighting to less by changing it in .bashrc

    • @tgda904
      @tgda904 3 года назад +1

      My command history has been about 90% 'clear' up until now. Thanks for the shortcut - can't believe I never knew that.

    • @matt92hun
      @matt92hun 3 года назад

      @@CrazyMineCuber I don't see what you would need from a man page that less can't do anyway.

    • @urugulu1656
      @urugulu1656 3 года назад

      @@tgda904 you know that you can configure the history to not have duplicates? just dont ask me how i dont know of top. but its possible.

  • @kanashimi6209
    @kanashimi6209 3 года назад +3

    I really like your videos Derek, both the technical ones and the more dialogue oriented kind of videos. Keep up the good work!

  • @navakelvin
    @navakelvin 2 года назад

    The "vim" option works for me. Thank you sir!

  • @heikokraemer2735
    @heikokraemer2735 3 года назад +2

    Very cool, have set vim as my manpager now as I'm viminizing everything at the moment. Thanks man!!

    • @raynei
      @raynei 3 года назад +2

      The vim keybinds are just too good not to use

  • @lawrencedoliveiro9104
    @lawrencedoliveiro9104 3 года назад +11

    If you want a nice GUI-style viewer, KDE Konqueror recognizes “man://” and “info://” URLs. Those particular URLs give you browseable lists of what’s available.

  • @OGBhyve
    @OGBhyve 3 года назад +1

    I was just trying to use vim for something like this at work last week. Thanks DT!

  • @marioschroers7318
    @marioschroers7318 3 года назад +1

    I would love nvim as my man pager. Bat doesn't look too bad either 🙂
    Guess I will just steal these aliases with your permission. I never actually knew this was possible.
    I have invented some new aliases recently. You contribute to the growth of my list of aliases with this video. Keep up the good work!

  • @GodIsTheReason
    @GodIsTheReason 3 года назад +3

    I love bat! It's amazing for inspecting code.

  • @emeukal7683
    @emeukal7683 3 года назад +3

    Good video with good information! Personally I like less more.

    • @andrewgrasman8951
      @andrewgrasman8951 3 года назад +1

      You should check out most, pretty much just adds highlighting

    • @KaiserTheAdversary
      @KaiserTheAdversary 3 года назад +1

      @@andrewgrasman8951 You can do highlighting in less as well.

  • @dungeon4971
    @dungeon4971 3 года назад +1

    Exactly what I need thanks dt.

  • @nekoill
    @nekoill 3 года назад +4

    I don't use Vim/Nvim as a pager because I have a fairly hefty config for those, and while they still load up in a second I just feel weird running an app that has all the syntax highlighting, code snippets and all that jazz baked in, while less is still as barebones as it was when I installed (GNU/)Linux, so it feels way less organic, I guess. But I can see the use for this advice tbh.

  • @richardtwyning
    @richardtwyning 3 года назад

    Finally got this working! Had trouble locating I'd found and installed the correct version of bat (actually batcat) in Ubuntu 20.04 ;-)

  • @AtomToast
    @AtomToast 3 года назад +4

    Actually all of the shortcuts you showed, like /, gg, G, etc, are also there by default in less (and bat, which uses less). Honestly the main feature that would make me want to use neovim for my man pager (idk if vim does this too) is the gO command. It gives you a location list with all the different headings and also the option to directly jump to them. This is something that is not really possible in less. You would have to rely on the search and your memory

    • @thallium54
      @thallium54 3 года назад +1

      But I can't type :q to quit in less which is really annoying😂

    • @AtomToast
      @AtomToast 3 года назад

      But you can? Even ZZ works

    • @matt92hun
      @matt92hun 3 года назад

      @@thallium54 You can, you don't even need to type a colon.

    • @thallium54
      @thallium54 3 года назад

      @@matt92hun lol maybe my memory went wrong😂 I only know q is quit

    • @Soulskinner
      @Soulskinner 3 года назад +2

      @@thallium54 Loool. It's funny, but it works. XD ("q" is just faster)
      Now, I've checked, you can do "jk" to scroll in man too. And you can Ctrl+N, Ctrl+P (Emacs style) to scroll and Ctrl/Alt+V - PageUp, PageDown.
      So less looks like some combination of Vim and Emacs. XD

  • @othernicksweretaken
    @othernicksweretaken 3 года назад +5

    Unfortunately, under Linux manpages are of varying quality.
    I prefer reading manpages over the newer and often more thorough infopages, which I regret that the whole story often isn't told in the manpages anymore these days, and I am fine with less as my default manpage pager.
    I think to remember that the BSD or later FreeBSD had the most comprehensive manpages (almost similar to the Arch Wiki, but long before there were any Wikis, let alone Arch).
    I cannot tell if this still holds since it's been two decades I last fiddled with FreeBSD and I am sure I have forgotten all from BSD including their ancient BSD boot system compared to SysV init or even systemd.
    In the video when DT was editing his .bashrc I could see the definition of lots of environment variables therein.
    Though there is no major issue with putting them into .bashrc I think to recall from man bash that the "correct" place for environment variable definitions would be the user's .bash_profile wheras alias and function definitions would go into .bashrc.
    As I am writing this in bed on my smartphone I cannot check man bash right now in case I'm wrong.

    • @armynyus9123
      @armynyus9123 3 года назад +1

      You typed this on a smartphone? I want your autocompleter...

    • @othernicksweretaken
      @othernicksweretaken 3 года назад

      @@armynyus9123 ha, ha, autocompletion was the first setting I switched off when I was given this mobile for mainly work related purposes from my employer (n.b. I don't even posess a private mobile),
      because the autocompletion virtually drove me insane.

  • @ultradude5410
    @ultradude5410 3 года назад

    export PAGER=“nvim +’set ft=man’ +’set number relativenumber’ +’set scrolloff=999’ +’norm 32j’”
    Best pager IMHO

  • @CrustyAbsconder
    @CrustyAbsconder 3 года назад

    Hey Distrohuggers,
    The developmental version of Fedora 34 now has all Beta packages of Gnome 40.
    Meaning you can download an unofficial copy of Fedora 34 and it will update to Gnome 40 Beta.
    However, at this early stage, getting a clean install is unlikely.
    The good news, is that by the time Fedora 35 ships around Thanksgiving, Gnome 40 will be in tip-top shape, with lots of improvements to xwayland, wayland, mesa, wine, kernel 5.12, rust packages, sound and Bluetooth improvements via pipewire.
    I will finally be able to claim Fedora is better than Windows XP.

  • @hosseines276
    @hosseines276 3 года назад

    awesome!

  • @ashishpanigrahi8391
    @ashishpanigrahi8391 3 года назад

    Wow, learnt something new today. Can this be done for `info` as well?

  • @govindgnana8364
    @govindgnana8364 3 года назад +9

    For neovim as a manpager, this might be simpler:
    ```
    export MANPAGER='nvim +Man!'
    ```

    • @paulosantana9607
      @paulosantana9607 3 года назад +2

      thank you!

    • @AlbertoEgurrola
      @AlbertoEgurrola 3 года назад +1

      Yeap, works pretty good. Thanks.

    • @freezejr2000
      @freezejr2000 Год назад +4

      the method in the video wasn't working for me but this one works perfectly tysm!

  • @braelinmichelus
    @braelinmichelus 3 года назад

    How did you do the thing in your terminal with the randomized ASCII art?

  • @mikemarcum9407
    @mikemarcum9407 3 года назад +1

    OFF TOPIC: I don't mean to jump in here with off topic subject but I just discovered 'QTerminal'.... I've been using terminator for a while because of the multiple windows you can have but qterminal does it too... I just looked to compare sizes and wow, what a difference. In fact QTerminal is small than all thee main stream variants I looked at... Come on DT, check into it... OK?

  • @peacemekka
    @peacemekka 3 года назад +3

    why use *less* when you can just use *more* ;)
    Also protip you can customize the default less using the LESS_TERMCAP.. environment variables and can slap full colors onto it.
    More details probably are in manpage of less.
    I've pimped less and it looks pretty neat.

    • @bullpup1337
      @bullpup1337 Год назад

      you know, in this case , less really is more… good.

  • @N3XusfLuX
    @N3XusfLuX 3 года назад +1

    I like most better then more or less

  • @Klatsch_Batsch
    @Klatsch_Batsch 3 года назад

    How you find vifm ?

  • @badwolf8112
    @badwolf8112 3 года назад

    YEAH! DON'T SETTLE FOR LESS!

  • @HeraldOD
    @HeraldOD 3 года назад

    Just curious, why use vim as a pager when less/bat also allows search, g and G, hjkl etc?

    • @billeterk
      @billeterk 3 года назад

      To follow “See also: “ links and quickly switch between pages in vim buffers

    • @HeraldOD
      @HeraldOD 3 года назад

      @@billeterk Really good point, hadn't thought of the See Also links!

  • @mellowgeekstudio
    @mellowgeekstudio 2 года назад

    I don't get why nmap is being used to launch man pages on vim. (?!)

  • @kkenzuro
    @kkenzuro 3 года назад +3

    less actually has syntax highlighting ability, they are set by LESS_TERMCAP variables and I find it better for minimalism

  • @almosthelpless9374
    @almosthelpless9374 3 года назад +5

    I've always heard less is more but ok

  • @LevKozlodoev
    @LevKozlodoev 3 года назад +1

    Each of the vim commands you used are available in less (gg, G, /)

  • @1MinuteFlipDoc
    @1MinuteFlipDoc 3 года назад

    i find reading man pages posted on linux related websites a lot more user friendly and easier on the eyes. no special commands needed. LOL

  • @C6438911
    @C6438911 3 года назад

    Also, don't settle for 'more' or 'most' (pun intented).

  • @jaewonchungcs
    @jaewonchungcs 3 года назад +1

    You can do this for neovim:
    export MANPAGER='nvim +Man!'
    export MANWIDTH=999
    See :help :Man for more info.

  • @MaxPrehl
    @MaxPrehl 3 года назад

    what about macho!?

  • @JosueRodriguez08
    @JosueRodriguez08 3 года назад

    You can have syntax highlights on man very easily

  • @chigozie123
    @chigozie123 3 года назад

    For bash and zsh users, reload your shell with exec $SHELL.

    • @DistroTube
      @DistroTube  3 года назад +1

      That doesn't reload your shell. That executes your user's default shell...which may or may not be the one that you are currently in.

    • @bullpup1337
      @bullpup1337 Год назад

      @@DistroTubewell . also does not “reload” it just reads in your config

  • @notimportant7682
    @notimportant7682 3 года назад

    All I want is a man pager that is dynamically resizable

    • @notimportant7682
      @notimportant7682 3 года назад +1

      I get that its possible to export a fullscreen value for MANWIDTH but it mangles the header if the pager is not fullscreen, maybe the answer is to just remove it, but imo if neovim could reload the manpage if I change the terminal size it would be preferable.

  • @clouddaemon4828
    @clouddaemon4828 3 года назад

    Imo as long as it has vi keybindings is good for me. Highlighting would be nice, yes, but KISS
    Not saying this video is bad, tho, don't misunderstand me

  • @aryakiran256
    @aryakiran256 3 года назад +2

    00:02 why are u saying linux it is gnu + linux

  • @maybeanonymous6846
    @maybeanonymous6846 3 года назад

    Imma use that and call man "batman"

  • @IndianaRoy
    @IndianaRoy 3 года назад

    I like to use batman

  • @emvdl
    @emvdl 3 года назад

    emacs?

  • @arkansawdave7428
    @arkansawdave7428 3 года назад

    Silly me. I thought Less was More...

  • @thundreturtle
    @thundreturtle 3 года назад

    Wth is a Cacune :D

  • @Johnvardas
    @Johnvardas 3 года назад

    You forgot emacs

  • @davidjackson7675
    @davidjackson7675 3 года назад +1

    But less is more....

  • @webbonyoutube
    @webbonyoutube 3 года назад +2

    First

  • @WillemO
    @WillemO 3 года назад

    Turn a man page into a pdf with a function using ghostscript.
    pdfify() # convert man pages to pdf and open the pdf file
    {
    man -t $1 | ps2pdf - $1.pdf && setsid xdg-open $1.pdf &> /dev/null
    }

  • @UnspankableGoose
    @UnspankableGoose 3 года назад +1

    imagine using man pages, i use -h or --help 😎

  • @gunnerjoe53
    @gunnerjoe53 Год назад

    In bashrc or bash_alias can I just alias man=/usr/bin/batman
    Seems to work ok.
    Joe