Vim on Arch: /etc/vimrc can remap keys but not turn off syntax highlighting

Abstract: Disable persistent syntax highlighting on Arch Linux by placing syntax off in ~/.vimrc after file type detection.

Created: 2026-10-24 by

Editing /etc/vimrc on Arch Linux remaps keys successfully because it executes before user-specific configurations, but syntax highlighting often persists due to the default runtime path or conflicting settings in ~/.vimrc. To disable highlighting globally, you must ensure syntax off is placed correctly and check for overriding plugins or file-type detection that re-enables it.

Understanding the Execution Order of Vimrc Files

When you modify /etc/vimrc, you are editing the system-wide configuration file that applies to all users on the Arch Linux installation. Vim loads this file early in its initialization process, which is why your key remappings take effect immediately. However, the behavior of syntax highlighting is more complex because it interacts with the file type detection system. Vim determines the file type based on the extension or content of the file you open. Once a file type is detected, Vim automatically runs scripts located in the after/ftplugin directories within the runtime path. These scripts often contain commands like syntax enable or specific highlight groups that can override previous settings. If you place syntax off in /etc/vimrc, it might be executed before the file type is even known, leading to the highlighting being turned back on later by these auto-detected plugins. This design ensures that users get appropriate syntax coloring for code files out of the box. However, for users who prefer a plain text environment or have performance concerns, this automatic behavior can be frustrating. The key is to understand that /etc/vimrc is not the last word; user-specific files and runtime plugins can overwrite its directives.

Distinguishing Between User and System Configurations

It is crucial to distinguish between /etc/vimrc and ~/.vimrc. The former affects every user, while the latter affects only your personal session. If you are trying to disable syntax highlighting for all users, /etc/vimrc is the correct place. However, if you find that changes here are ignored, it is likely because a plugin or a user-level config is re-enabling it. Always check if other users on the system have customized their own ~/.vimrc files, as these are sourced after /etc/vimrc and will take precedence for those specific users.

Why Syntax Highlighting Persists Despite Configuration

The most common reason syntax highlighting remains active when you expect it to be off is the interaction with Vim's built-in file type detection. When you open a file, Vim checks its name against patterns defined in the runtime directory. If it matches a known type, such as .py for Python or .c for C, it triggers the corresponding ftplugin scripts. These scripts often call syntax on explicitly. Even if you set syntax off in /etc/vimrc, the subsequent execution of the ftplugin script will turn it back on. This is intentional behavior designed to provide a helpful coding experience. Additionally, some distributions, including Arch, may include additional packages or plugins that alter the default runtime path, introducing more opportunities for overrides. If you are using a minimal Arch installation, you might not have many extra plugins, but the base Vim package itself includes robust file type support. Therefore, simply turning off syntax in the main config file is rarely enough to suppress it for all file types permanently.

Solutions to Disable Syntax Highlighting Globally

To effectively disable syntax highlighting across the board, you need to intervene at the right stage of the initialization process. Here are the most reliable methods to achieve this on Arch Linux.

Method 1: Using After Directories

The most robust way to override default behaviors is to use the after/ directory structure. Vim sources files in after/ directories after the main configuration files. You can create a file in /usr/share/vim/after/syntax/ or manipulate the runtime path to ensure your settings run last. However, a simpler approach for global disabling is to prevent the file type detection from triggering syntax highlighting altogether. You can add the following line to /etc/vimrc:
filetype off
This command disables the entire file type detection mechanism, which includes syntax highlighting, indentations, and plugins associated with file types. While this solves the highlighting issue, it also removes helpful features like automatic indentation for Python files. Use this only if you do not rely on these features.

Method 2: Explicitly Disabling After Detection

If you want to keep other file type features but just stop syntax highlighting, you can intercept the process. Add this to /etc/vimrc:
autocmd FileType * syntax off
This autocommand triggers every time a file type is detected, immediately turning off syntax highlighting regardless of what the ftplugin script tried to do. This is generally safer than filetype off because it preserves indentation and other non-highlighting features.

Method 3: Checking for Conflicting Plugins

Sometimes, the issue is not Vim itself but a plugin installed via a package manager or manually. On Arch, you might have installed vim-runtime or similar packages that include extra scripts. Check your ~/.vimrc and any plugin managers (like Vundle or Pathogen) to see if they are explicitly enabling syntax. If you find a line like syntax on in your user config, comment it out or remove it. Remember that /etc/vimrc runs first, so user configs will always win if they contain conflicting commands. For more advanced configuration techniques, you might want to explore broader Vim customization strategies. You can read more about this in our guide on Mastering Vim: A Comprehensive Guide.

Verifying Your Configuration

After making changes to /etc/vimrc, you should verify that they are applied correctly. Restart Vim and open a file with syntax highlighting, such as a .js or .py file. If the colors are still present, run the command :scriptnames in Vim. This lists all scripts that were sourced during startup. Look for lines that mention syntax or ftplugin and check the order. If a script is sourcing after your /etc/vimrc entry, it confirms that an override is occurring. You can also test the effectiveness of your autocommand by checking the value of the g:syntax_on variable. If it is unset or false, highlighting should be disabled. If you are still experiencing issues, consider checking if your Arch Linux system has updated Vim recently, as version changes can sometimes alter default behaviors or runtime paths. For those interested in optimizing their editor further, understanding how to merge lines or manipulate text efficiently is also valuable. You can learn about Merging lines with a specific pattern in VIM to enhance your workflow alongside these configuration tweaks.

Frequently Asked Questions

Does editing /etc/vimrc affect all users on Arch Linux?

Yes, changes to /etc/vimrc apply to every user on the system because it is the system-wide configuration file. However, individual user settings in ~/.vimrc can override these global settings for specific accounts.

Why does my syntax highlighting turn back on after I disable it?

This usually happens because Vim's file type detection system runs scripts after your initial configuration. These scripts, located in after/ftplugin directories, often explicitly enable syntax highlighting for recognized file types, overriding your earlier syntax off command.

Can I disable syntax highlighting without losing indentation features?

Yes, using an autocommand like autocmd FileType * syntax off allows you to keep file type detection for indentation and other features while specifically suppressing syntax coloring. This is preferable to using filetype off, which disables all file type related functionality.

How can I check which scripts are overriding my Vim settings?

Run the command :scriptnames inside Vim. This lists every script loaded during startup in the order they were sourced. By examining this list, you can identify if a plugin or runtime script is loading after your /etc/vimrc entries and causing the override.

Is it safe to modify /etc/vimrc on Arch Linux?

It is safe, but you should be cautious. Since this file affects all users, errors can impact everyone on the system. It is recommended to back up the original file before making changes and to test your configuration thoroughly. Additionally, package updates to Vim might overwrite this file, so be prepared to reapply your changes after system updates.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More