I appreciate when my kitten comes looking for attention. Except when she walks on the keyboard. Then it's trouble.
How do I 32eeeeeerrrrrrr discourage her from walking on the keyboard, while encouraging her to come sit by me?
What I usually do it kinda waggle my fingers in front of the cats nose, and it they keep coming they run into the waggly fingers. Most cats don't like it, and will back off. As soon as they back off, some pets are in order. That is also a good time to relocate kitty to a more acceptable location like your lap or a handy cat sized box. I keep a small pet bed within reach, and my cats get attention when they settle down on it.
My cat does the same thing. This is how I solved my problem. I cleared my desk so there's ample space. Then I placed one of my cat's favorite scratchers/loungers on the desk. So now when my cat wants my attention/to be near me, she would jump on the desk and settle down in her "assigned seat". This keeps her off of my computer while I work.
Caveat: it doesn't work 100% of the time. If she really wants something, then she will stand on my keyboards. But this only happens if I neglected to do certain things (like late to feeding her).
Another possible solution, which I've read in many places, but hasn't worked with me, is to walk away and ignore your cat as soon as it stands on your keyboard. The idea is to discourage this behavior (i.e. you stand on keyboard = I ignore you). But when I did this my cat just decided that she will settle down into a cat loaf and out-wait me. Having said that, my cat is very patient, so if you have a less patient cat, this might work.
This is what has worked for me (with several cats): I keep the space immediately to both sides of the keyboard clear, so there's enough room for a cat to sit or lie down. If the cat starts to walk across the keyboard (so, moving from one side of the desk to the other), I pick it up and put it on the other side. If it turns around and heads for the keyboard again, I pick it up and put it back on the first side. Do this enough and the cat gets the message that walking on the keyboard isn't ok -- although it also gets the message that the human is available for transport. For me that's a small price to pay to defend the keyboard.
To reduce the need for this, I have a basket on the corner of the desk (like in this answer) that is suitable for feline lounging. As I type this, my cat is lounging in that basket, within reach for petting.
All that said, I do lock my keyboard when I step away from the computer.