Skip to content

Commit

Permalink
add setting to temporarily override ignorecase
Browse files Browse the repository at this point in the history
fixes #134
  • Loading branch information
ervandew committed Nov 17, 2014
1 parent fd4e0d0 commit c27cdf6
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
20 changes: 20 additions & 0 deletions doc/supertab.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Supertab *supertab*
Preselecting the first entry |supertab-longesthighlight|
Mapping <cr> to end completion |supertab-crmapping|
Auto close the preview window |supertab-closepreviewonpopupclose|
Keyword completion ignore/match case |supertab-completecase|
Completion Chaining |supertab-completionchaining|

==============================================================================
Expand Down Expand Up @@ -375,6 +376,25 @@ g:SuperTabClosePreviewOnPopupClose (default value: 0)
When enabled, supertab will attempt to close vim's completion preview window
when the completion popup closes (completion is finished or canceled).


Completion ignore/match case *supertab-completecase*
*g:SuperTabCompleteCase*

g:SuperTabCompleteCase (default value: 'inherit')

When issuing completions (keyword and potentially others), the value of your
|'ignorecase'| setting will determine what results are returned based on
whether or not you've chosen to ignore case or not. However, you may have
|'ignorecase'| set or unset for other reasons and don't want that value
considered when using insert completion. SuperTab allows you temporarily
override |'ignorecase'| by setting g:SuperTabCompleteCase to either 'ignore'
or 'match' depending on whether you want to always ignore or match case when
using insert completion.

Note: third party omni/user completion plugins may or may not honor
|'ignorecase'|. If they do not, then you can probably contact them to add that
support.

Completion Chaining *supertab-completionchaining*

SuperTab provides the ability to chain one of the completion functions
Expand Down
21 changes: 21 additions & 0 deletions plugin/supertab.vim
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ set cpo&vim
let g:SuperTabUndoBreak = 0
endif

if !exists("g:SuperTabCompleteCase")
let g:SuperTabCompleteCase = 'inherit'
endif

" }}}

" Script Variables {{{
Expand Down Expand Up @@ -469,6 +473,23 @@ function! SuperTab(command) " {{{
return "\<c-g>u" . complType
endif

if g:SuperTabCompleteCase == 'ignore' ||
\ g:SuperTabCompleteCase == 'match'
if exists('##CompleteDone')
let ignorecase = g:SuperTabCompleteCase == 'ignore' ? 1 : 0
if &ignorecase != ignorecase
let b:supertab_ignorecase_save = &ignorecase
let &ignorecase = ignorecase
augroup supertab_ignorecase
autocmd CompleteDone <buffer>
\ let &ignorecase = b:supertab_ignorecase_save |
\ unlet b:supertab_ignorecase_save |
\ autocmd! supertab_ignorecase
augroup END
endif
endif
endif

return complType
endif

Expand Down

0 comments on commit c27cdf6

Please sign in to comment.