Skip to content

Commit

Permalink
don't map <cr> if user has an iabbrev w/ a <cr> in it
Browse files Browse the repository at this point in the history
  • Loading branch information
ervandew committed Jun 20, 2013
1 parent 94b62de commit 6f9b1f1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions doc/supertab.txt
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,10 @@ Compatibility with other plugins:
- delimitMate: not compatible (disabled if the delimitMate <cr> mapping is
detected.)

Note: if you have an insert expression mapping with a <cr> in it or an insert
abbreviation containing a <cr>, then supertab will not create a <cr> mapping
which could potentially cause problems with those.


Auto close the preview window *supertab-closepreviewonpopupclose*
*g:SuperTabClosePreviewOnPopupClose*
Expand Down
7 changes: 7 additions & 0 deletions plugin/supertab.vim
Original file line number Diff line number Diff line change
Expand Up @@ -802,9 +802,16 @@ endfunction " }}}
let expr_map = maparg('<cr>', 'i') =~? '\<cr>'
endif

redir => iabbrevs
silent iabbrev
redir END
let iabbrev_map = iabbrevs =~? '\<cr>'

if expr_map
" Not compatible w/ expr mappings. This is most likely a user mapping,
" typically with the same functionality anyways.
elseif iabbrev_map
" Not compatible w/ insert abbreviations containing <cr>
elseif maparg('<CR>', 'i') =~ '<Plug>delimitMateCR'
" Not compatible w/ delimitMate since it doesn't play well with others
" and will always return a <cr> which we don't want when selecting a
Expand Down

0 comments on commit 6f9b1f1

Please sign in to comment.