Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for python dots #84

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions after/plugin/snipMate.vim
Expand Up @@ -18,6 +18,10 @@ if !exists('g:snips_trigger_key_backwards')
let g:snips_trigger_key_backwards = '<s-' . substitute(g:snips_trigger_key, '[<>]', '', 'g')
endif

if !exists('g:snipMateAllowMatchingDot')
let g:snipMateAllowMatchingDot = 1
endif

exec 'ino <silent> ' . g:snips_trigger_key . ' <c-g>u<c-r>=snipMate#TriggerSnippet()<cr>'
exec 'snor <silent> ' . g:snips_trigger_key . ' <esc>i<right><c-r>=snipMate#TriggerSnippet()<cr>'
exec 'ino <silent> ' . g:snips_trigger_key_backwards . '> <c-r>=snipMate#BackwardsSnippet()<cr>'
Expand Down
18 changes: 12 additions & 6 deletions autoload/snipMate.vim
Expand Up @@ -719,9 +719,13 @@ endf
" used by both: completion and insert snippet
fun! snipMate#GetSnippetsForWordBelowCursor(word, suffix, break_on_first_match)
" Setup lookups: '1.2.3' becomes [1.2.3] + [3, 2.3]
let parts = split(a:word, '\W\zs')
if len(parts) > 2
let parts = parts[-2:] " max 2 additional items, this might become a setting
if g:snipMateAllowMatchingDot
let parts = split(a:word, '\W\zs')
if len(parts) > 2
let parts = parts[-2:] " max 2 additional items, this might become a setting
endif
else
let parts = [a:word]
endif
let lookups = [a:word.a:suffix]
let lookup = ''
Expand All @@ -732,9 +736,11 @@ fun! snipMate#GetSnippetsForWordBelowCursor(word, suffix, break_on_first_match)
endif
endfor

" allow matching '.'
if a:word =~ '\.$'
call add(lookups, '.'.a:suffix)
if g:snipMateAllowMatchingDot
" allow matching '.'
if a:word =~ '\.$'
call add(lookups, '.'.a:suffix)
endif
endif

call filter(lookups, 'v:val != ""')
Expand Down