How do I change my terminal’s cursor from a block to a blinking vertical bar?

Viewed 2629

Currently I'm using Intellij and ZSH as terminal. I already have disabled the caret block for Intellij and want to do the same for ZSH terminal. Is there any way to do it?

1 Answers

Setting the cursor shape is not specific to Zsh but depends on whether your terminal supports it. The are two ways to change the cursor shape in the terminal:

  • Many terminals allow you to choose in their settings what kind of cursor you want. Check your terminal's preferences and change it there.
  • If your terminal doesn't have any config for this, you can try adding echo '\e[5 q' to your .zshrc file (when using Zsh) or .bashrc file (when using Bash) to tell your terminal to draw a blinking bar as the cursor. However, in this case, too, it depends on whether your terminal supports that escape code. If it doesn't, nothing will change.

Also, for clarity:

  • Zsh and Bash are shells.
  • You interact with the shell through a terminal.
  • IntelliJ IDEA has an integrated terminal through which you interact with Zsh.
  • Any other app you use to interact with your shell is a terminal, too.
Related