6

Both more and less seem to be heavily influenced by the vi commands. Are there any pagers that are more emacs like out of the box?

apgwoz
  • 163
  • 5

3 Answers3

4

less supports actually a subset of both vi and emacs commands. You should be able to add the ones you are missing using the lesskey command.

jlliagre
  • 13,899
  • 4
  • 31
  • 48
1

Not exactly a pager, but GNU Info uses the same bindings as Emacs.

Though I wonder why you would need a pager if you use Emacs…

Emacs can browse man pages with woman, you can « tail » a file with auto-revert-tail-mode.

Daimrod
  • 583
  • 2
  • 7
  • You use pagers for a lot more than man and info pages... – apgwoz Oct 11 '12 at 18:15
  • My shell run in emacs and if I need to do complex operations on the output, I can simply put it in a buffer and write some elisp, run some shell command (`M-|`) or use some keyboard macros (`C-x k (`). Thus I only use a pager when I'm don't have (my) emacs. – Daimrod Oct 11 '12 at 21:25
  • Which shell are you using? I guess I could force myself to do more things within emacs. I already do do a lot of things. I'm just so used to using an xterm I guess... – apgwoz Oct 12 '12 at 02:11
  • I use multi-term to run multiple terminals inside emacs. https://github.com/daimrod/Emacs-config/blob/master/config-multi-term.el And then, you can switch between `term-char-mode` and `term-line-mode` with respectively `C-c C-k` and `C-c C-j`. `term-char-mode` has the `standard` term bindings, and with `term-line-mode` you can navigate in the buffer like in any other buffers. – Daimrod Oct 12 '12 at 06:14
  • I've used multi-term in the past, but stopped for some reason--not sure why, but perhaps it's time to try again. My config is here: https://github.com/apgwoz/emacs-config – apgwoz Oct 12 '12 at 11:54
0

I use this bash function to view files (from memory):

ev() {
  emacs "$1" -nw --eval '(setq buffer-read-only t)'
}

It opens the file $1 in a read only buffer.
I don't know the best way to set a bash function as a pager, I suppose you could put it in a shellscript instead and use that as pager instead.

(Not on a computer with bash to test on)

Nifle
  • 34,203
  • 26
  • 108
  • 137
  • Yeah, it'd be trivial to convert this to a shell script. I'd probably use emacsclient though to avoid the hefty startup time. – apgwoz Oct 11 '12 at 18:11
  • or add `-Q` - that also reduces the startup time quite a bit by not loading any customizations or distro-provided packages. – user45469 Oct 19 '16 at 18:49