I want to assign different commands depending on context.
I’m trying to do something like this:
if line is empty:
map x key to y command
else
map x key to z command
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.
It is normally achieved by
<expr>mapping:nnoremap <expr> ((empty(getline('.')))?('y'):('z'))As you are going to use NerdCommenter, you are forced not to use “nore”:
Replace
''with the desired code as I do not understand what you mean by “appending a comment”.