JavaScript is the scripting language for the web. On the other hand, Vim is the editor of choice for many programmers. Being feature-rich, Vim can auto-complete JavaScript syntaxes. To use the feature, you'll need to enable it first.
Enter the following while in Vim's command mode to enable the feature.
:set omnifunc=javascriptcomplete#CompleteJS
You can now auto-complete JavaScript syntaxes by pressing Ctrl + x followed by Ctrl + o while partially typing JavaScript codes.
The following is a sample screenshot.
You can use the arrow key to navigate through the list to choose your desired auto-complete suggestion.
Automatically enable auto-complete for JavaScript files
To automatically enable JavaScript to auto-complete every JavaScript file, add the following line to your ~/.vimrc;
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS

Author: Mohd Shakir Zakaria
Mohd Shakir Zakaria is a skilled cloud architect with a background in development, entrepreneurship, and open-source advocacy. As the founder of Simplified Guide, he helps others understand the complexities of computing, making tech concepts accessible to all.

Mohd Shakir Zakaria is a skilled cloud architect with a background in development, entrepreneurship, and open-source advocacy. As the founder of Simplified Guide, he helps others understand the complexities of computing, making tech concepts accessible to all.
Discuss the article:
Comment anonymously. Login not required.