For example, I have the following code
command! -range Test call TestFunc() function! TestFunc() abort " if run with range " get selected content " else " get current word under the cursor " endif endfunction
I want to differentiate whether users run
mode() function doesn't work here. Also
<line2> do not help because they always give me the same result(current line number) when I run it with range(select the current line) or not.
I wonder if there are any solutions for this?