Search code examples
vimperator

How can I avoid pressing enter in Vimperator keymapping?


I've created a key mapping to clear search highlights by pressing ..

map . :nohlsearch

However, pressing . only enters the nohlsearch command, requiring me to press Enter to execute the command. Is there a way to have the keybinding both enter and execute the command?


Solution

  • Add <CR> to the end, like this:

    map . :nohlsearch<CR>
    

    The <CR> is a "carriage return", which is the same as what pressing Enter does.