From e753504d3db03eec9b3d9d95cb292fd8b5d8196c Mon Sep 17 00:00:00 2001 From: totem4 Date: Sat, 3 Oct 2020 11:54:48 +0200 Subject: [PATCH] convert entire line without selection --- plugin/banana.vim | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/plugin/banana.vim b/plugin/banana.vim index 6c6f17f..7df2329 100644 --- a/plugin/banana.vim +++ b/plugin/banana.vim @@ -24,21 +24,24 @@ python3 sys.path.append(vim.eval('expand(":h")')) fun! s:Enc() python3 << EOL -from banana import text2banana,get_selected_text,replace_selected_text +from banana import text2banana,get_selected_text,replace_selected_text,enc_line try: replace_selected_text(text2banana(get_selected_text())) -except: - print("banana: select the text you want to convert") +except TypeError: + enc_line() EOL endfun! fun! s:Dec() python3 << EOL -from banana import text2dec,get_selected_text,replace_selected_text +from banana import text2dec,get_selected_text,replace_selected_text,dec_line -replace_selected_text(text2dec(get_selected_text())) +try: + replace_selected_text(text2dec(get_selected_text())) +except TypeError: + dec_line() EOL endfun!