Honza/vim-snippets is just a collection of snippet files — it doesn’t do anything by itself. You need a snippet engine (a plugin) to read and expand those snippets. Here’s how to set it up step by step.
The repo supports several engines. Choose one:
| Engine | Language | Best For | Install |
|---|---|---|---|
| UltiSnips | Python | Vim with Python, most features | SirVer/ultisnips |
| LuaSnip | Lua | Neovim, modern, fast | L3MON4D3/LuaSnip |
| snipMate | VimL | Vim without Python | garbas/vim-snipmate |
| nvim-snippy | Lua | Neovim, lightweight | dcampos/nvim-snippy |
Quick recommendation:
You need both the engine plugin AND the honza/vim-snippets repo (which provides the actual HTML snippets).
.vimrc or init.vim):For LuaSnip (Neovim):
Plug 'L3MON4D3/LuaSnip'
Plug 'honza/vim-snippets'
For UltiSnips (Vim with Python):
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
For snipMate (Vim without Python):
Plug 'garbas/vim-snipmate'
Plug 'honza/vim-snippets'
Then run :PlugInstall.
By default, you type the snippet name and hit a trigger key to expand it.
.vimrc):" Trigger key for expanding snippets
let g:UltiSnipsExpandTrigger = "<tab>"
" Jump to next placeholder with tab
let g:UltiSnipsJumpForwardTrigger = "<tab>"
let g:UltiSnipsJumpBackwardTrigger = "<s-tab>"
init.vim / init.lua):" Requires a bit more setup, here's the Vimscript version:
lua << EOF
require("luasnip").setup()
require("luasnip.loaders.from_snipmate").lazy_load() -- loads snippets/ folder
require("luasnip.loaders.from_vscode").lazy_load() -- optional: VS Code snippets
EOF
" Keymaps to expand and jump
imap <silent><expr> <Tab> luasnip#expand_or_jumpable() ? '<Plug>luasnip-expand-or-jump' : '<Tab>'
smap <silent><expr> <Tab> luasnip#jumpable(1) ? '<Plug>luasnip-jump-next' : '<Tab>'
snipMate works out of the box with <tab> once installed. No extra config needed.
Open any .html file and type:
| Type | Then hit <tab> |
Expands to |
|---|---|---|
p |
<tab> |
<p>|</p> (cursor inside) |
br |
<tab> |
<br> |
div |
<tab> |
<div>|</div> |
a |
<tab> |
<a href="|">|</a> |
img |
<tab> |
<img src="|" alt="|" /> |
html |
<tab> |
Full HTML5 boilerplate |
The | shows where your cursor lands. Hit <tab> again to jump to the next placeholder.
@p and @b Style Instead?If you prefer your own @ prefix instead of typing p + tab, you have two options:
Option A: Custom snippets — Create your own snippet file that overrides or adds to the defaults.
Option B: Vim abbreviations (no plugins needed):
:iab @p <p></p><Esc>3hi
:iab @b <br>
:iab @div <div></div><Esc>4hi
:iab @a <a href=""></a><Esc>4hi
This is native Vim, zero plugins, works everywhere.
honza/vim-snippets<tab>)p<Tab>If you tell me which editor you’re using (Vim or Neovim) and your plugin manager, I can give you the exact config to copy-paste.