DEV Community

Cover image for How To Avoid Getting Stuck in Vim as a New git User
Sam E. Lawrence
Sam E. Lawrence

Posted on

How To Avoid Getting Stuck in Vim as a New git User

I started a new job recently. When I set up a new work machine, I immediately install zsh and pull down a few repos to get digging into code. It's all fun and games until you run git branch and BLAM, you're stuck in Vim-land now, hope you brought a towel. I've seen more than a few new developers get stuck here, and I've had to embarrassingly ask for help myself, so if you're finding yourself stuck in this situation, know that you're not alone and you'll be ok. Just type :wq and you should return to the terminal. However, if you want to prevent this happening again, read on.

WARNING: This change is global and will affect all your git repositories. See the link below for details if you want to control this setting per repo.

git config --global core.pager cat
Enter fullscreen mode Exit fullscreen mode

This command modifies the global git configuration to use the tool cat as the terminal pager for all your future git commands. By default, on a new Mac with zsh installed, Vi is used... or Vim... I still don't really understand the difference, but it's one of them and you can't get out without :wq.

Remember that after changing any configurations, you will need to re-launch your terminal to see changes take effect.

Source: StackOverflow

Top comments (0)