Search code examples
oh-my-zsh

behavior of git branch in powerlevel10k


I am using oh-my-zsh and powerlevel10k on Mac and I observed a weird behavior when using git branch. Instead of like other commands, like git status which will list the result in current terminal. enter image description here

However, git branch is like into an editor mode and I have to press q to exit the mode to get back to terminal. enter image description here

Anyone knows how to fix it, i.e., let the git branch command to show results in current terminal instead of entering into an editor mode?


Solution

  • git is using the pager (usually less command) for its output.

    you can configure it via core.pager for all the git commands or use per command config pager.<cmd>; there is also GIT_PAGER env variable

    the easiest way to skip the paging for one time is to use --no-pager option for command; and to disable the paging completely git documentation suggests:

    To disable pagination for all commands, set core.pager or GIT_PAGER to cat.

    git config --global core.pager cat

    you may experiment with setting the pager to less -F -X; this will make less command to page the content only if it does not fit the screen -F, and not to clean the terminal buffer -X

    git config --global core.pager 'less -F -X'

    or simply disable the pager for the branch command

    git config --global pager.branch false