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!