Vim can auto-complete syntax for popular programming languages, including HTML. It is, however, not enabled by default in most installations.
Entering the following while in Vim's command mode will enable auto-completion for HTML language.
:set omnifunc=htmlcomplete#CompleteTags
To start using the feature, press Ctrl + x followed by Ctrl + o keys while writing HTML syntaxes.
The following screenshot is an example in auto-completing <!
You can use the arrow key to navigate through the list to choose your desired auto-complete suggestion.
Automatically enable auto-complete for HTML files
To enable auto-complete every time an HTML file is opened, add the following line to your ~/.vimrc;
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
Author: Mohd
Shakir Zakaria
Mohd Shakir Zakaria is an experienced cloud architect with a strong development and open-source advocacy background. He boasts multiple certifications in AWS, Red Hat, VMware, ITIL, and Linux, underscoring his expertise in cloud architecture and system administration.
Mohd Shakir Zakaria is an experienced cloud architect with a strong development and open-source advocacy background. He boasts multiple certifications in AWS, Red Hat, VMware, ITIL, and Linux, underscoring his expertise in cloud architecture and system administration.
Discuss the article:
Comment anonymously. Login not required.