I’m writing a plugin for commenting the code in special way and it should act a bit different when called in visual or normal modes.
Is there a function or some way to determine the mode in which the user is (was) when the function was called?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There’s
http://vimdoc.sourceforge.net/htmldoc/eval.html#mode%28%29
but that might not work since you’re probably going to start command mode in the rhs of the mapping.
A more robust way would be to set up slightly different mappings like
and use the argument value to know what mode the user was in.