How to scroll up in Emacs ansi-term
I've been Googling around and looking at Emacs built-in help but I have yet to determine how to scroll up (or down) in Emacs ansi-term.
I'm using Emacs 23.3.1开发者_开发技巧, OS X, in iTerm2. Thanks!
Edit: I've noticed most the advice people give me doesn't work in ansi-term but does work in eshell. I have since moved to eshell.
In general, if you don't need full screen terminal emulation, shell
or eshell
are better choices.
However, if you decide to stick with ansi-term
, press C-c C-j to go into line mode. Then you can move around normally with the usual cursor movement keys. Press C-c C-k to get back into char mode to interact with the terminal.
Alternatively, you can scroll backwards a screen at a time with C-c C-v and just enter text to scroll back to the terminal input point.
Take a look at the Emacs documentation on term-mode
(most of which applies equally to ansi-term
) for more information.
Shift-page up/down (in Emacs-speak, S-prior
/S-next
) will work using the default bindings.
(While the normal C-h m
/C-h b
don't work to see mode information and bindings in this mode, you can still use C-c M-x describe-mode
/describe-bindings
, or depending on your setup, use F1 or the help key instead of C-h
.)
install evil-mode at first, press C-z
to switch to vim key binding.
- You can use
C-f
,C-b
to scroll up and down - you can use
20%
to jump to to the top 20% of the buffer - you can use
/
,?
,#
,*
to search the text in the buffer. - all the grep/filter commands now usable (occur, swiper, helm-swoop, .... just name a few)
- you can narrow/widen the buffer
- you can yank text
Have you tried: Page up, up arrow, Ctrl-V,Alt-V
For ansi-term, I have this in my .emacs
:
(add-hook 'term-mode-hook
(function
(lambda ()
(define-key term-raw-map [?\C-c prior] 'scroll-down)
(define-key term-raw-map [?\C-c next] 'scroll-up))))
Then I can use C-c pgup
and C-c pgdn
to scroll.
I was having the same issue but with multi-term (zsh), and after reading the response from @muffinista (the C-v
did not work for me) but the Alt-v
worked to go 1 page, after that you can use the normal C-p
and C-n
to scroll up and down.
This worked for me, but it depends a lot on which term you are using and key bindings you might have.
Up and down are Ctrl-P and Ctrl-V. There's a whole long list here
精彩评论