Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Moar is a pager. It's designed to just do the right thing without any configuration.

License

NotificationsYou must be signed in to change notification settings

walles/moar

Repository files navigation

Linux CIWindows CI

Moar is a pager. It reads and displays UTF-8 encoded text from files orpipelines.

moar is designed to just do the right thing without any configuration:

Moar displaying its own source code

The intention is that Moar should be trivial to get into if you have previouslybeen usingLess. If you come from Lessand find Moar confusing or hard to migrate to,please reportit!

Doing the right thing includes:

  • Syntax highlight source code by default usingChroma
  • Search is incremental / find-as-you-type just like inChrome orEmacs
  • Search becomes case sensitive if you add any UPPER CASE charactersto your search terms, just like in Emacs
  • Regexpsearch if your search string is a valid regexp
  • Supports displaying ANSI color coded texts (like the output fromgit diff|riff for example)
  • Supports UTF-8 input and output
  • Transparent decompression when viewingcompressed textfiles(.gz,.bz2,.xz,.zst,.zstd) orstreams
  • The position in the file is always shown
  • Supportsword wrapping (on actual word boundaries) if requested using--wrap or by pressingw
  • Follows output as long as you are on the last line,just liketail -f
  • Rendersterminalhyperlinksproperly
  • Mouse Scrolling works out of the box (butlook here for tradeoffs)

For compatibility reasons,moaruses the formats declared in these environment variables if present:

For configurability reasons,moar reads extra command line options from theMOAR environment variable.

Moar is used as the default pager by:

  • px /ptop,ps andtop for human beings
  • riff, a diff filter highlighting which line parts have changed

Installing

Both macOS and Linux users can use Homebrew to install. See below for distrospecific instructions.

brew install moar

Then whenever you want to upgrade to the latest release:

brew upgrade
sudo port install moar

More infohere.

UsingGentoo

emerge --ask --verbose sys-apps/moar

More infohere.

yay -S moar

More infohere.

Debian / Ubuntu

Nobody has stepped up to maintainmoar for Debian.

If you want tomaintain themoar packaging forDebian, that would be very welcome!

Otherwise use Homebrew (see above) or read on for manual install instructions.

Manual Install

Usinggo

This will installmoar into$GOPATH/bin:

go install github.com/walles/moar@latest

NOTE: If you got here because there is no binary for your platform,please consider packagingmoar.

Downloading binaries

  1. Downloadmoar for your platform fromhttps://github.com/walles/moar/releases/latest
  2. chmod a+x moar-*-*-*
  3. sudo mv moar-*-*-* /usr/local/bin/moar

And now you can just invokemoar from the prompt!

Trymoar --help to see options.

Configuring

Domoar --help for an up to date list of options.

Environment variableMOAR can be used to set default options.

For example:

export MOAR='--statusbar=bold --no-linenumbers'

Settingmoar as your default pager

Set it as your default pager by adding...

export PAGER=/usr/local/bin/moar

... to your.bashrc.

Issues

Issues are trackedhere, oryou can send questions tojohan.walles@gmail.com.

Packaging

If you packagemoar, do includethe man page in your package.

Embedding

Here's one way to embedmoar in your app:

package mainimport ("bytes""fmt""github.com/walles/moar/m")funcmain() {buf:=new(bytes.Buffer)forrange [99]struct{}{} {fmt.Fprintln(buf,"Moar")}err:=m.NewPager(m.NewReaderFromStream("Moar",buf)).Page()iferr!=nil {// Handle paging problemspanic(err)}}

m.Reader can also be initialized usingNewReaderFromText() orNewReaderFromFilename().

Developing

You need thego tools.

Run tests:

./test.sh

Launch the manual test suite:

./manual-test.sh

To run tests in 32 bit mode, either doGOARCH=386 ./test.sh if you're onLinux, ordocker build . -f Dockerfile-test-386 (tested on macOS).

Run microbenchmarks:

gotest -benchmem -run='^$' -bench=.. ./...

ProfilingBenchmarkPlainTextSearch(). Try replacing-alloc_objects with-alloc_space or change the-focus function:

gotest -memprofilerate 1 -memprofile profile.out -benchmem -run='^$' -bench'^BenchmarkPlainTextSearch$' github.com/walles/moar/m&& go tool pprof -alloc_objects -focus findFirstHit -relative_percentages -web profile.out

Build + run:

./moar.sh ...

Install (into/usr/local/bin) from source:

./install.sh

Making a new Release

Make sure thatscreenshot.png matches moar's current UI.If it doesn't, scale a window to 81x16 characters and make a new one.

Executerelease.sh and follow instructions.

TODO

  • Enable exiting using ^c (without restoring the screen).

  • Start at a certain line if run asmoar file.txt:42

  • Handle search hits to the right of the right screen edge. Searching forwardsshould move first right, then to the left edge and down. Searching backwardsshould move first left, then up and to the right edge (if needed for showingsearch hits).

  • Support viewing multiple files by pushing them in reverse order on the viewstack.

  • Retain the search string when pressing / to search a second time.

Done

  • Add> markers at the end of lines being cut because they are too long

  • Doing moar on an arbitrary binary (like/bin/ls) should put allline-continuation markers at the rightmost column. This really means ourtruncation code must work even with things like tabs and various controlcharacters.

  • Make sure search hits are highlighted even when we have to scroll rightto see them

  • Change out-of-file visualization to writing--- after the end of the fileand leaving the rest of the screen blank.

  • Exit search on pressing up / down / pageup / pagedown keys andscroll. I attempted to do that spontaneously, so it's probably agood idea.

  • Remedy all FIXMEs in this README file

  • Release thego version as the newmoar, replacing the previous Rubyimplementation

  • Add licensing information (same as for the Ruby branch)

  • Make suregit grep output gets highlighted properly.

  • Handle all kinds of line endings.

  • Make sure version information is printed if there are warnings.

  • Add spinners while file is still loading

  • Maketail -f /dev/null exit properly, fix#7.

  • Showing unicode search hits should highlight the correct chars

  • Word wrap text rather than character wrap it.

  • Arrow keys up / down while in line wrapping mode should scroll by screen line,not by input file line.

  • Define 'g' to prompt for a line number to go to.


[8]ページ先頭

©2009-2025 Movatter.jp