Skip to content

Instantly share code, notes, and snippets.

@thisfred
Created February 12, 2013 22:32
Show Gist options
  • Save thisfred/4774098 to your computer and use it in GitHub Desktop.
Save thisfred/4774098 to your computer and use it in GitHub Desktop.
function! SuperCleverTab()
if strpart(getline('.'), 0, col('.') - 1) =~ '^\s*$'
return "\<Tab>"
else
if &omnifunc != ''
return "\<C-X>\<C-O>"
elseif &dictionary != ''
return "\<C-K>"
else
return "\<C-N>"
endif
endif
endfunction
inoremap <Tab> <C-R>=SuperCleverTab()<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment