What the E492 Error Means
The E492: Not an editor command (or simply unknown command) error in Vim means the editor could not recognize the command you entered. It can appear when you try to execute a command manually (e.g., :somecommand) or when you press a key combination that is interpreted as an unknown command.
The full error message looks like this:
E492: Not an editor command: <unknown_command_name>
Where <unknown_command_name> is what you entered. For example: E492: Not an editor command: dd (if you accidentally entered the command in Insert mode).
The error is non-critical—Vim will continue to run, but it will not perform the desired action.
Common Causes
- Incorrect Vim mode. You are trying to execute a command (which starts with
:,*,/, or control keys) in Insert or Visual mode instead of Normal mode. - Typo in the command. An incorrectly entered command, e.g.,
:wqitinstead of:wq, or using a non-existent command. - English vs. Russian keyboard layout. Attempting to enter a command using Cyrillic characters (e.g.,
:сохранитьinstead of:w), or vice versa. - Plugin conflict or error. An installed plugin (e.g., for autocompletion or buffer management) may be intercepting input and generating invalid commands.
- Corrupted or incorrect configuration file (
~/.vimrcor~/.config/nvim/init.vim). It may contain syntax errors or incompatible settings. - Outdated Vim version. The command you are trying to use was introduced in a newer version of Vim/Neovim, while you have an older one installed.
Solutions
Solution 1: Check and Change Mode (Most Common Case)
Most often, the error occurs when a user in Insert mode presses a key combination that is a command in Normal mode (e.g., dd to delete a line).
- Press the
Esckey to guarantee you are in Normal mode. The-- INSERT --indicator should disappear from the bottom-left corner. - Enter the command again, making sure you start with
:for command-line commands (e.g.,:wto save) or use the correct control keys (e.g.,ddto delete a line). - If the command is supposed to run from Insert mode (e.g., autocompletion), check if the relevant plugin is configured correctly.
Solution 2: Check Keyboard Layout
Ensure you are entering commands in the English keyboard layout. Vim does not understand Cyrillic characters in commands.
- Look at the layout indicator in your OS's status bar (e.g.,
RU/EN). - If you see Russian letters where English commands should be (e.g., you pressed
ддandддappeared at the bottom), switch to the English layout (usuallyAlt+ShiftorWin+Space). - Enter the command again using English letters.
Solution 3: Disable Plugins for Diagnosis
The problem may lie with one of your installed plugins (e.g., for buffer management, autocompletion, or themes).
For Vim:
# Rename the plugins directory (usually ~/.vim/plugged)
mv ~/.vim/plugged ~/.vim/plugged.bak
For Neovim:
# Rename the plugins directory (usually ~/.config/nvim/plugged)
mv ~/.config/nvim/plugged ~/.config/nvim/plugged.bak
- Start Vim again and try to execute the problematic command.
- If the error disappears, the issue is definitely with one of the plugins. Restore the directory (
mv ~/.vim/plugged.bak ~/.vim/plugged) and disable plugins one by one (by renaming their folders insideplugged) to find the culprit.
Solution 4: Start Vim Without a Configuration File
This method checks whether your personal settings file ~/.vimrc or init.vim is causing the error.
- Start Vim with the
-u NONEflag:
Or for Neovim:vim -u NONEnvim -u NONE - In this "clean" Vim, try to execute the command that was causing the error.
- If the error does not appear, the problem is in your configuration file. Open it (
:e ~/.vimrc) and check for syntax errors, especially in lines that define custom commands (command! ...) or mappings (nnoremap ...).
Solution 5: Check and Update Vim
Ensure you have a sufficiently new version of Vim/Neovim that supports the command you are trying to use.
- Check your version:
orvim --versionnvim --version - Compare it with the command's documentation. For example, the
:terminalcommand was introduced in Vim 8.0 and Neovim 0.3.0. - If your version is old, update Vim using your distribution's package manager (e.g.,
sudo apt update && sudo apt install vimfor Ubuntu/Debian).
Prevention
- Always check your mode. Before entering a command (especially one starting with
:), pressEsc. - Enter commands in the English layout. Make it a habit to check the language indicator before starting work in the terminal.
- Be cautious with plugins. Install plugins only from trusted sources (e.g., via a plugin manager like
vim-plugorpacker.nvim). Update them regularly and remove unused ones. - Back up your configuration. Before making significant changes to
~/.vimrc, save a copy. This allows you to quickly revert if problems arise. - Learn basic commands. Knowing the fundamentals of Normal mode (
h,j,k,l,i,a,dd,yy,p,:q,:w) minimizes accidental presses of non-existent combinations.
💡 Tip: If you are new to Vim, configure the current mode to be displayed in the status line (add
set showmodeto your~/.vimrc). This will help you always understand which mode you are in.