Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Vim: Set Color of ColorColumn

📅 2011-Jul-29 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ colors, guidelines, vim ⬩ 📚 Archive

One or more guidelines can be added in Vim using the colorcolumn setting. Vim picks the color for this colorcolumn based on whether it is in GUI or non-GUI mode and on the background setting. If you are not happy with the color of the colorcolumn, it can be changed easily by setting the color of the ColorColumn highlighting group.

For non-GUI Vim running in the Windows command prompt, the color is set using the ctermbg argument to the ColorColumn highlighting group. For example, to set the colorcolumn to a light grey color try:

highlight ColorColumn ctermbg=7

The 16 color values that can be used with ctermbg argument can be seen by typing :help ctermbg

For GVim, the color is set using the guibg argument to the ColorColumn highlighting group. For example, to set the colorcolumn to a black color try:

highlight ColorColumn guibg=Black

To see the list of colors that can be used for the guibg argument, type :help guibg in GVim. A detailed chart of Vim color names can be seen here.

Tried with: Vim 7.3


© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 @codeyarns@hachyderm.io📧