Provide alternative scratching surfaces such as scratching posts. Use deterrents such as unpleasant scents or textures. Keep unsupervised time around your keyboard to a minimum.