1
0
mirror of https://github.com/gryf/snipmate.vim.git synced 2025-12-22 14:08:01 +01:00

changed all "en"s to "endifs" to hopefully make the script a bit more readable...

This commit is contained in:
Michael Sanders
2009-02-26 18:28:33 -05:00
parent 2e5caabf53
commit 74c848ecc4

View File

@@ -1,6 +1,6 @@
" File: snipMate.vim " File: snipMate.vim
" Author: Michael Sanders " Author: Michael Sanders
" Version: 0.7 " Version: 0.71
" Description: snipMate.vim implements some of TextMate's snippets features in " Description: snipMate.vim implements some of TextMate's snippets features in
" Vim. A snippet is a piece of often-typed text that you can " Vim. A snippet is a piece of often-typed text that you can
" insert into your document using a trigger word followed by a "<tab>". " insert into your document using a trigger word followed by a "<tab>".
@@ -8,7 +8,7 @@
" For more help see snipMate.txt; you can do this by using: " For more help see snipMate.txt; you can do this by using:
" :helptags ~/.vim/doc " :helptags ~/.vim/doc
" :h snipMate.txt " :h snipMate.txt
" Last Modified: February 25, 2009. " Last Modified: February 26, 2009.
if exists('loaded_snips') || &cp || version < 700 if exists('loaded_snips') || &cp || version < 700
finish finish
@@ -150,9 +150,9 @@ fun s:GetSnippet()
elseif exists('s:multi_snips["_"]["'.word.'"]') elseif exists('s:multi_snips["_"]["'.word.'"]')
let s:snippet = s:ChooseSnippet('_', word) let s:snippet = s:ChooseSnippet('_', word)
else else
if match(origWord, '\W') == -1 | break | en if match(origWord, '\W') == -1 | break | endif
let origWord = substitute(origWord, '.\{-}\W', '', '') let origWord = substitute(origWord, '.\{-}\W', '', '')
en endif
endw endw
return origWord return origWord
endf endf
@@ -439,7 +439,7 @@ fun s:UpdateTabStops(changeLine, changeCol)
endfor endfor
endif endif
endfor endfor
en endif
endf endf
fun s:SelectWord() fun s:SelectWord()
@@ -451,10 +451,12 @@ fun s:SelectWord()
let s:update = 1 let s:update = 1
let s:endSnip = -1 let s:endSnip = -1
let s:startSnip = s:snipPos[s:curPos][1]-1 let s:startSnip = s:snipPos[s:curPos][1]-1
en endif
if !s:origWordLen | return '' | en if !s:origWordLen | return '' | endif
let l = col('.') != 1 ? 'l' : '' let l = col('.') != 1 ? 'l' : ''
if &sel == 'exclusive' | return "\<esc>".l.'v'.s:origWordLen."l\<c-g>" | en if &sel == 'exclusive'
return "\<esc>".l.'v'.s:origWordLen."l\<c-g>"
endif
return s:origWordLen == 1 ? "\<esc>".l.'gh' return s:origWordLen == 1 ? "\<esc>".l.'gh'
\ : "\<esc>".l.'v'.(s:origWordLen-1)."l\<c-g>" \ : "\<esc>".l.'v'.(s:origWordLen-1)."l\<c-g>"
endf endf
@@ -538,27 +540,27 @@ fun s:UpdateSnip()
if pos[0] == curLine && pos[1] <= start if pos[0] == curLine && pos[1] <= start
let s:startSnip -= changeLen let s:startSnip -= changeLen
let s:endSnip -= changeLen let s:endSnip -= changeLen
en endif
for nPos in s:snipPos[s:curPos][3][(i):] for nPos in s:snipPos[s:curPos][3][(i):]
if nPos[0] == pos[0] if nPos[0] == pos[0]
if nPos[1] > pos[1] || (nPos == [curLine, pos[1]] && if nPos[1] > pos[1] || (nPos == [curLine, pos[1]] &&
\ nPos[1] > start) \ nPos[1] > start)
let nPos[1] -= changeLen let nPos[1] -= changeLen
en endif
elseif nPos[0] > pos[0] | break | en elseif nPos[0] > pos[0] | break | endif
endfor endfor
let i += 1 let i += 1
en endif
call setline(pos[0], substitute(getline(pos[0]), '\%'.pos[1].'c'. call setline(pos[0], substitute(getline(pos[0]), '\%'.pos[1].'c'.
\ s:oldWord, newWord, '')) \ s:oldWord, newWord, ''))
endfor endfor
if oldStartSnip != s:startSnip if oldStartSnip != s:startSnip
call cursor('.', startCol + s:startSnip - oldStartSnip) call cursor('.', startCol + s:startSnip - oldStartSnip)
en endif
let s:oldWord = newWord let s:oldWord = newWord
let s:snipPos[s:curPos][2] = newWordLen let s:snipPos[s:curPos][2] = newWordLen
en endif
endf endf
" vim:noet:sw=4:ts=4:ft=vim " vim:noet:sw=4:ts=4:ft=vim