From 1beba3e80947d5208bf526f99807538732d73d7f Mon Sep 17 00:00:00 2001 From: totem4 Date: Thu, 21 Sep 2023 21:17:28 +0200 Subject: [PATCH] fix vim_legacy script --- vim_legacy/autoload/banana.vim | 16 ++++------------ vim_legacy/plugin/banana.vim | 8 ++++++-- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/vim_legacy/autoload/banana.vim b/vim_legacy/autoload/banana.vim index b56bc3d..1156d52 100644 --- a/vim_legacy/autoload/banana.vim +++ b/vim_legacy/autoload/banana.vim @@ -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 + call s:ReplSel(s:Dec2Ban(s:GetSel())) 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) diff --git a/vim_legacy/plugin/banana.vim b/vim_legacy/plugin/banana.vim index ff2c959..fc5b420 100644 --- a/vim_legacy/plugin/banana.vim +++ b/vim_legacy/plugin/banana.vim @@ -17,10 +17,14 @@ if !hasmapto('BananaDec') map d BananaDec endif -noremap