Skip to content

Instantly share code, notes, and snippets.

@rupa
Created February 27, 2012 20:17
Show Gist options
  • Save rupa/1926746 to your computer and use it in GitHub Desktop.
Save rupa/1926746 to your computer and use it in GitHub Desktop.
function! SuperTab()
if (strpart(getline('.'),col('.')-2,1)=~'^\W\?$')
return "\<Tab>"
else
return "\<C-n>"
endif
endfunction
function! SuperShiftTab()
if (strpart(getline('.'),col('.')-2,1)=~'^\W\?$')
return "\<S-Tab>"
else
return "\<C-p>"
endif
endfunction
imap <Tab> <C-R>=SuperTab()<CR>
imap <S-Tab> <C-R>=SuperShiftTab()<CR>
@rupa
Copy link
Author

rupa commented Feb 27, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment