You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
919 B
VimL
44 lines
919 B
VimL
if exists("g:loaded_Banana") || &cp
|
|
finish
|
|
endif
|
|
let g:loaded_Banana= 1 " your version number
|
|
let s:keepcpo = &cpo
|
|
set cpo&vim
|
|
|
|
if !hasmapto('<Plug>BananaEnc')
|
|
map <unique> <Leader>b <Plug>BananaEnc
|
|
endif
|
|
|
|
if !hasmapto('<Plug>BananaDec')
|
|
map <unique> <Leader>d <Plug>BananaDec
|
|
endif
|
|
|
|
noremap <silent> <unique> <script> <Plug>BananaEnc
|
|
\ :call <SID>Enc()<CR>
|
|
noremap <silent> <unique> <script> <Plug>BananaDec
|
|
\ :call <SID>Dec()<CR>
|
|
|
|
python3 import sys
|
|
python3 import vim
|
|
python3 sys.path.append(vim.eval('expand("<sfile>:h")'))
|
|
|
|
fun! s:Enc()
|
|
python3 << EOL
|
|
from banana import text2banana,get_selected_text,replace_selected_text
|
|
|
|
replace_selected_text(text2banana(get_selected_text()))
|
|
|
|
EOL
|
|
endfun!
|
|
|
|
fun! s:Dec()
|
|
python3 << EOL
|
|
from banana import text2dec,get_selected_text,replace_selected_text
|
|
|
|
replace_selected_text(text2dec(get_selected_text()))
|
|
|
|
EOL
|
|
endfun!
|
|
|
|
let &cpo= s:keepcpo
|
|
unlet s:keepcpo |