I have found that I can get my cursor to blink by including the following instruction in my .bashrc file:
echo -ne "\x1b[1 q"
But I also want to change the color of the blinking cursor. I know that my terminal supports color because I can set the prompt colors and print text in color, but I just can't change the cursor color. Any suggestions?
I'm adding the following comment, that I'm aware of how to change the color of text that is displayed on the terminal, but that is not the same as changing the color of the the cursor. So my question is not addressed in that other question.
But I did find a workaround in my terminal emulator software, provided below.
Thanks for the feedback, especially the part about making the selection of the proper escape codes portable across terminal types.
Answer
I found afterwards that I can change the cursor color, not in bash, but in the terminal emulator program. In my case that program is MobaXTerm. I discovered the following sequence: Settings - Terminal - Cursor. At that point, selecting a cursor color causes the cursor in the bash shell to be displayed in the desired color. So now in the files that I edit using vim in the bash environment in my xterm window I see a blinking green block cursor, which is what I needed.
Please check the following short demonstration clip: Blinking Green Block Cursor in bash and vim
Attaining that was what my question was about, not about how to display colored text on the screen, which as was pointed out is already answered elsewhere. So my question is not a duplicate. Anyway, it turned out that my xterm emulation software Mobaxterm allowed me to set the cursor color whereas the escape sequence in my .bashrc file allowed me to get it to blink.
No comments:
Post a Comment