add conditional and delmarks

master
Totem4 Totem4 4 years ago
parent d94a5ac06d
commit 6fe44cbb93

@ -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)

Loading…
Cancel
Save