|
|
|
@ -63,7 +63,7 @@ def isbanana(banana, dictstart = None, shiftend = None, dictionary = None):
|
|
|
|
|
return(True)
|
|
|
|
|
|
|
|
|
|
def callback(x):
|
|
|
|
|
return " %s " % dec2banana(int(x[0], base=10)).upper()
|
|
|
|
|
return "%s" % dec2banana(int(x[0], base=10)).upper()
|
|
|
|
|
|
|
|
|
|
def text2banana(text):
|
|
|
|
|
text = re.sub(r"[0-9][0-9]*",callback,text)
|
|
|
|
@ -85,12 +85,14 @@ def get_selected_text():
|
|
|
|
|
(lnum1, col1) = buf.mark('<')
|
|
|
|
|
(lnum2, col2) = buf.mark('>')
|
|
|
|
|
lines = vim.eval('getline({}, {})'.format(lnum1, lnum2))
|
|
|
|
|
if len(lines) > 1:
|
|
|
|
|
lines[0] = lines[0][col1:]
|
|
|
|
|
lines[-1] = lines[-1][:col2]
|
|
|
|
|
else:
|
|
|
|
|
lines[0] = lines[0][col1:col2+1]
|
|
|
|
|
|
|
|
|
|
return "\n".join(lines)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def replace_selected_text(new_str):
|
|
|
|
|
buf = vim.current.buffer
|
|
|
|
|
(lnum1, col1) = buf.mark('<')
|
|
|
|
@ -100,8 +102,12 @@ def replace_selected_text(new_str):
|
|
|
|
|
new_str_list = new_str.split('\n')
|
|
|
|
|
del buf[lnum1-1:lnum2]
|
|
|
|
|
buf.append(new_str_list, lnum1-1)
|
|
|
|
|
vim.command("delmarks < >")
|
|
|
|
|
|
|
|
|
|
return new_str
|
|
|
|
|
|
|
|
|
|
def enc_line():
|
|
|
|
|
vim.current.line = re.sub(r"[0-9][0-9]*",callback,vim.current.line)
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
print("Ciao sono la libreria banana")
|
|
|
|
|
def dec_line():
|
|
|
|
|
vim.current.line = re.sub(r"[A-Z][A-Z]*",callback_dec,vim.current.line)
|
|
|
|
|