Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit39e41dc

Browse files
committed
Update undo history when nested expansion
1 parent30449e9 commit39e41dc

File tree

2 files changed

+42
-26
lines changed

2 files changed

+42
-26
lines changed

‎autoload/vsnip/session.vim‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,14 @@ endfunction
4747
" merge.
4848
"
4949
function!s:Session.merge(session)abort
50+
calls:TextEdit.apply(self.bufnr,self.snippet.sync())
51+
callself.store(self.changenr)
52+
5053
calla:session.expand()
5154
callself.snippet.merge(self.tabstop,a:session.snippet)
5255
callself.snippet.insert(deepcopy(a:session.snippet.position),a:session.snippet.children)
5356
calls:TextEdit.apply(self.bufnr,self.snippet.sync())
57+
callself.store(changenr())
5458
endfunction
5559

5660
"
@@ -188,7 +192,6 @@ function! s:Session.on_text_changed() abort
188192
" save state.
189193
ifself.changenr!=l:changenr
190194
callself.store(self.changenr)
191-
letself.changenr=l:changenr
192195
ifhas_key(self.changenrs,l:changenr)
193196
letself.tabstop=self.changenrs[l:changenr].tabstop
194197
letself.snippet=self.changenrs[l:changenr].snippet
@@ -249,5 +252,6 @@ function! s:Session.store(changenr) abort
249252
\'tabstop':self.tabstop,
250253
\'snippet':deepcopy(self.snippet)
251254
\}
255+
letself.changenr=a:changenr
252256
endfunction
253257

‎autoload/vsnip/snippet/node/transform.vim‎

Lines changed: 37 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,6 @@ endfunction
44

55
lets:Transform= {}
66

7-
function!s:upcase(word)
8-
let word=toupper(a:word)
9-
return word
10-
endfunction
11-
12-
function!s:downcase(word)
13-
let word=tolower(a:word)
14-
return word
15-
endfunction
16-
17-
function!s:capitalize(word)
18-
let word=s:upcase(strpart(a:word,0,1)) .strpart(a:word,1)
19-
return word
20-
endfunction
21-
22-
" https://github.com/tpope/vim-abolish/blob/3f0c8faa/plugin/abolish.vim#L111-L118
23-
function!s:camelcase(word)
24-
let word=substitute(a:word,'-','_','g')
25-
if word!~#'_'&& word=~#'\l'
26-
returnsubstitute(word,'^.','\l&','')
27-
else
28-
returnsubstitute(word,'\C\(_\)\=\(.\)','\=submatch(1)==""?tolower(submatch(2)) : toupper(submatch(2))','g')
29-
endif
30-
endfunction
31-
327
"
338
" new.
349
"
@@ -98,3 +73,40 @@ function! s:Transform.to_string() abort
9873
\join(self.options,''),
9974
\)
10075
endfunction
76+
77+
"
78+
" upcase
79+
"
80+
function!s:upcase(word)abort
81+
let word=toupper(a:word)
82+
return word
83+
endfunction
84+
85+
"
86+
" downcase
87+
"
88+
function!s:downcase(word)abort
89+
let word=tolower(a:word)
90+
return word
91+
endfunction
92+
93+
"
94+
" capitalize
95+
"
96+
function!s:capitalize(word)abort
97+
let word=s:upcase(strpart(a:word,0,1)) .strpart(a:word,1)
98+
return word
99+
endfunction
100+
101+
"
102+
" camelcase
103+
" @see https://github.com/tpope/vim-abolish/blob/3f0c8faa/plugin/abolish.vim#L111-L118
104+
"
105+
function!s:camelcase(word)abort
106+
let word=substitute(a:word,'-','_','g')
107+
if word!~#'_'&& word=~#'\l'
108+
returnsubstitute(word,'^.','\l&','')
109+
else
110+
returnsubstitute(word,'\C\(_\)\=\(.\)','\=submatch(1)==""?tolower(submatch(2)) : toupper(submatch(2))','g')
111+
endif
112+
endfunction

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp