Skip to content
This repository was archived by the owner on Jun 10, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion doc/snipMate.txt
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,19 @@ in the current buffer to show a list via |popupmenu-completion|.
==============================================================================
SETTINGS *snipMate-settings* *g:snips_author*

The g:snips_author string (similar to $TM_FULLNAME in TextMate) should be set
The `g:snips_author string (similar to $TM_FULLNAME in TextMate) should be set
to your name; it can then be used in snippets to automatically add it. E.g.: >

let g:snips_author = 'Hubert Farnsworth'
snippet name
`g:snips_author`
<
*g:snipmate_default_choice*

The `g:snipmate_default_choice` variable is provided to select in advance an
option when snipmate output several alternatives, by default it selects none >

let g:snipmate_default_choice = 1
<
*snipMate-expandtab* *snipMate-indenting*
If you would like your snippets to be expanded using spaces instead of tabs,
Expand Down
10 changes: 7 additions & 3 deletions plugin/snipMate.vim
Original file line number Diff line number Diff line change
Expand Up @@ -223,14 +223,18 @@ fun s:GetSnippet(word, scope)
endf

fun s:ChooseSnippet(scope, trigger)
let snippet = []
if !exists('g:snipmate_default_choice') | let snippet = [] | else | let snippet = "" | endif
let i = 1
for snip in s:multi_snips[a:scope][a:trigger]
let snippet += [i.'. '.snip[0]]
if !exists('g:snipmate_default_choice') | let snippet += [i.'. '.snip[0]] | else | let snippet .= i.'. '.snip[0] . "\n" | endif
let i += 1
endfor
if i == 2 | return s:multi_snips[a:scope][a:trigger][0][1] | endif
let num = inputlist(snippet) - 1
if !exists('g:snipmate_default_choice') | let num = inputlist(snippet) - 1
else
let snippet .= 'Type number and <Enter> or press <Esc> to cancel: '
let num = str2nr(input(snippet, g:snipmate_default_choice)) - 1
endif
return num == -1 ? '' : s:multi_snips[a:scope][a:trigger][num][1]
endf

Expand Down