fix vim_legacy script

master
Totem4 Totem4 1 year ago
parent a5445d0fda
commit 1beba3e809

@ -9,26 +9,18 @@ endif
let g:autoloaded_Banana= 1
fun! banana#Enc() range
if line("'<") > 0
call s:ReplSel(s:Dec2Ban(s:GetSel()))
else
call s:EncLine()
endif
endfun!
fun! s:EncLine()
fun! banana#EncLine()
call setline('.', substitute(getline('.'), '\d\d*', '\=toupper(s:Doban(submatch(0)))','g'))
endfun!
fun! banana#Dec() range
if line("'<") > 0
call s:ReplSel(s:Ban2Dec(s:GetSel()))
else
call s:DecLine()
endif
endfun!
fun! s:DecLine()
fun! banana#DecLine()
call setline('.', substitute(getline('.'), '\C\u\u*', '\=s:Unban(tolower(submatch(0)))','g'))
endfun!
@ -103,7 +95,7 @@ fun! s:ReplSel(str)
let l:new_str = slice(l:lines[0],0,l:cstart - 1) . a:str . l:lines[-1][l:cend:]
let l:new_str_lst = split(l:new_str,'\n')
call setline(l:lstart ,l:new_str_lst)
delmarks < >
call setcursorcharpos(lstart, cstart)
endfun!
fun! s:Dec2Ban(text)

@ -17,10 +17,14 @@ if !hasmapto('<Plug>BananaDec')
map <unique> <Leader>d <Plug>BananaDec
endif
noremap <silent> <unique> <script> <Plug>BananaEnc
vnoremap <silent> <unique> <script> <Plug>BananaEnc
\ :call banana#Enc()<CR>
noremap <silent> <unique> <script> <Plug>BananaDec
vnoremap <silent> <unique> <script> <Plug>BananaDec
\ :call banana#Dec()<CR>
nnoremap <silent> <unique> <script> <Plug>BananaEnc
\ :call banana#EncLine()<CR>
nnoremap <silent> <unique> <script> <Plug>BananaDec
\ :call banana#DecLine()<CR>
let &cpo= s:keepcpo
unlet s:keepcpo

Loading…
Cancel
Save