From 774ab6d2b88df4056ca7042da840678ca5b3ad15 Mon Sep 17 00:00:00 2001 From: haya14busa Date: Fri, 28 Nov 2014 02:00:53 +0900 Subject: [PATCH] Show error with empty selected string --- autoload/asterisk.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/autoload/asterisk.vim b/autoload/asterisk.vim index f486888..9df1d38 100644 --- a/autoload/asterisk.vim +++ b/autoload/asterisk.vim @@ -51,7 +51,11 @@ function! asterisk#do(mode, config) abort let pattern = (s:is_visual(a:mode) ? \ s:convert_2_word_pattern(s:get_selected_text(), config) : s:cword_pattern(config)) if s:is_empty_cword(pattern) " 'E348: No string under cursor' - return '*' + if s:is_visual(a:mode) + return "\:echohl ErrorMsg | echom 'asterisk.vim: No selected string' | echohl None\" + else + return '*' + endif endif let should_plus_one_count = s:should_plus_one_count(pattern, config, a:mode) let maybe_count = (should_plus_one_count ? string(v:count1 + 1) : '')