combine previous separate functions for normal and visual mode into 1 single function