Skip to content

Instantly share code, notes, and snippets.

@joequery
Created August 21, 2012 19:31
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 joequery/3418565 to your computer and use it in GitHub Desktop.
Save joequery/3418565 to your computer and use it in GitHub Desktop.
Tab or complete
"Use TAB to complete when typing words, else inserts TABs as usual.
function! Tab_Or_Complete()
if col('.')>1 && strpart( getline('.'), col('.')-2, 3 ) =~ '^\w'
return "\<C-N>"
else
return "\<Tab>"
endif
endfunction
inoremap <Tab> <C-R>=Tab_Or_Complete()<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment