Software⏱️ 4 min read📅 2026-06-19

How to Fix: nvim error on :so in Ubuntu WSL2

Fix nvim error on :so in Ubuntu WSL2 by checking init.lua file and ensuring correct remapping.

Quick Answer: Check the init.lua file for any syntax errors or missing configuration, and ensure that the :Ex command is properly remapped.

The error 'E471: Argument required' in nvim on :so command is typically encountered when the user tries to save changes made in insert mode without specifying a file or directory. This issue affects users who have followed tutorials or guides that include the ':so' command, but fail to provide necessary context or configuration for nvim to recognize the intended behavior.

This error can be frustrating as it prevents the user from successfully saving their work and may lead to confusion about what went wrong. However, with a thorough understanding of the issue and the appropriate steps to resolve it, users can overcome this obstacle and continue working efficiently.

🛑 Root Causes of the Error

  • The primary reason for this error is that the ':so' command requires an argument specifying the file or directory where changes should be saved. Without this argument, nvim interprets the command as invalid and displays the 'E471: Argument required' message.
  • An alternative cause could be a misconfigured nvim configuration file or a missing plugin that affects the behavior of the ':so' command.

✅ Best Solutions to Fix It

Configuring the nvim configuration file to include the ':so' command with an argument

  1. Step 1: First, open the nvim configuration file in your preferred editor. The default location for this file is ~/.config/nvim/init.lua. If it does not exist, create a new file and add the following code: `let g:so_autosave = 1` This line enables autosaving of changes made in insert mode.
  2. Step 2: Next, restart nvim to apply the changes to the configuration file. You can do this by running the command ':source ~/.config/nvim/init.lua' in the nvim command line or simply restarting the nvim process.
  3. Step 3: After making these changes, try using the ':so' command again and provide a valid argument specifying the file or directory where you want to save your changes.

Configuring the nvim remap to map :Ex to pv

  1. Step 1: To configure the nvim remap, open the nvim configuration file and add the following code: `nnoremap pv :so %` This line maps the 'pv' key sequence to run the ':so' command with the current buffer as an argument.
  2. Step 2: Save the changes to the configuration file and restart nvim to apply the remap. You can do this by running the command ':source ~/.config/nvim/init.lua' in the nvim command line or simply restarting the nvim process.

🎯 Final Words

By following these steps, you should be able to resolve the 'E471: Argument required' error when using the ':so' command in nvim. Remember to always specify a valid argument when using this command to ensure that your changes are saved correctly.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions