Coding⏱️ 3 min read📅 2026-06-11

How to Fix: How can i customize the highlighted error in vim by file .vimrc?

Customize highlighted errors in vim with .vimrc to underline instead of background red.

Quick Answer: Add the following code to your ~/.vimrc file: set errorformat=%F%m%: %l%|%c% on

Troubleshooting Guide: Customizing Highlighted Errors in Vim with .vimrc

This guide will walk you through customizing the highlighted error in vim by editing your ~/.vimrc file. The goal is to change the default background red color to underline instead.

⚠️ Common Causes

  • The issue arises because the ALE plugin uses a default background color for errors, which cannot be changed using the built-in syntax highlighting options.
  • However, you can customize this by editing your ~/.vimrc file and adding the following code:

🛠️ Step-by-Step Verified Fixes

Editing .vimrc to Change Error Highlighting

  1. Step 1: Add the following lines to your ~/.vimrc file: `highlight Error guibg=Underline` and `let g:ale_linters_error_style = 'underline'` This will change the default background color for errors to underline.
  2. Step 2: Save your changes and restart vim or run `:source %` to apply the changes.
  3. Step 3: After making these changes, you should see highlighted errors with an underline instead of a red background.

Alternative Fix Method

  1. Step 1: If the above method does not work for some reason, you can try setting the `g:ale_linters_error_style` option to 'underline' directly in your vimrc file.
  2. Step 2: Add the following line to your ~/.vimrc file: `let g:ale_linters_error_style = 'underline'`
  3. Step 3: Save your changes and restart vim or run `:source %` to apply the changes.

💡 Conclusion

By following these steps, you should be able to customize the highlighted error in vim by editing your ~/.vimrc file. Remember to save your changes and restart vim after making any modifications.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions