I'm trying to run git commands in eshell. When I run:
git log -p
it will look like this:
Notice that ^[[k before the cursor. Arrow key down does not work, it will gives error says 'Not found'. You can see that at minibuffer. The only way to scroll down is to use RETURN key, and it looks quite messy:
My $TERM is set to eterm, and I tried ansi too. They are the same. Anyone has experienced this before?
Thanks
Edit:
I have a way to work this around. I created this function:
(defun eshell/git (&rest args)
(apply 'eshell-exec-visual (cons "git" args)))
So every time when I run git command, it will launch the output in a *git* buffer.
If you have other ways, please let me know as well.
You must have colors turned on in git and that specific pseudo-terminal doesn't work in color. Try using m-x ansi-term
. It supports colors and is generally more terminal-like.
Or you can try this hook:
(add-hook 'eshell-preoutput-filter-functions
'ansi-color-filter-apply)
Referenced from here.
You can scroll only with RETURN because pager is used. You can either disable it permanently by changing git's core.pager config option, or you can disable it temporary by setting GIT_PAGER environment variable to empty string. Another possible source of problem - ^[ secuences, that are used to switch colors. You can disable them with --no-color option for git log command
Have you tried using Magit? It integrates git into your normal Emacs workflow. I can't tell you much about it because I've only just started using Emacs, and I'm still trying to learn the basics. Magit seems really nice though. Install magit, open a file in your repo, and run M-x magit-log-long
, that will create a buffer with the output of git log
with an ascii history graph. I'm fairly sure that you can also checkout old commits from that buffer, but you should read the manual to be sure.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With