Skip to content

Instantly share code, notes, and snippets.

@mhartington
Created October 15, 2021 19:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhartington/4df69ab6138927b218a928b3628a8662 to your computer and use it in GitHub Desktop.
Save mhartington/4df69ab6138927b218a928b3628a8662 to your computer and use it in GitHub Desktop.
function! s:expand_html_tab()
" try to determine if we're within quotes or tags.
" if so, assume we're in an emmet fill area.
let line = getline('.')
if col('.') < len(line)
let line = matchstr(line, '[">][^<"]*\%'.col('.').'c[^>"]*[<"]')
if len(line) >= 2
return "\<C-n>"
endif
endif
" expand anything emmet thinks is expandable.
if emmet#isExpandable()
return emmet#expandAbbrIntelligent("\<tab>")
endif
" return a regular tab character
return "\<tab>"
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment