terminal - How to show long git output in separate buffer with less? -



terminal - How to show long git output in separate buffer with less? -

when open less, it's in separate buffer (maybe there's term that?): scroll bar of terminal disappears , can scroll mouse wheel. 1 time less closed, bash session restored.

if have long output git, automatically piped less in case, uses same buffer session. scroll bars of terminal stay, scrolling mouse wheel scrolls session , scrolling , forth (with keyboard) leaves that's ever shown in terminal. lastly thing can shown continuously hitting j , k. first line repeated multiple times when scrolling terminal buffer.

other tools utilize less work, e.g., long output psql shown less in separate buffer. how can create git same?

git-config(1) says:

core.pager

the command git utilize paginate output. can overridden git_pager environment variable. note git sets less environment variable frsx if unset when runs pager.

the critical part x of less variable. consulting less' man page:

-x or --no-init

disables sending termcap initialization , deinitialization strings terminal. desirable if deinitialization string unnecessary, clearing screen.

so need disable that. luckily, git-config(1) shows solution:

if want selectively override git’s default setting less, can set core.pager e.g. less -+s. passed shell git, translate final command less=frsx less -+s.

great, easier setting less variable ourselves if otherwise happy defaults. solution becomes:

git config --global core.pager 'less -+x -+f'

this re-enables termcap initialization involves creating new buffer. unfortunately f has disabled. causes less exit if output fits on screen. because output in buffer, command returns without printing anything.

git terminal

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -