0

I am trying to change the key used for going backwards in search results while using Vim.

Currently, the key used is the semicolon (,), but this conflicts with another function in my config.

I would like to change the key to a period (.) instead.

How can I make this change?

4
  • 1. "Semicolon" or "colon"? 2. What do you call "backward search" exactly? 3. Do you really want to lose :help .?
    – romainl
    Commented Jan 28, 2023 at 8:46
  • 1
    , is a comma.
    – D. Ben Knoble
    Commented Jan 28, 2023 at 15:21
  • @romainl when i enter search, and enter pattern, and it highlights matching patterns. I can move to next occurence with ; and previous occurence with , Commented Jan 28, 2023 at 18:48
  • Well, that's not at all what :help , and :help ; are supposed to do. Next match is supposed to b :help n and previous match is supposed to be :help N. So it looks like you have some custom mappings somewhere. Find them, remove them, and you will solve your problem.
    – romainl
    Commented Jan 28, 2023 at 19:15

1 Answer 1

2

Welcome vi.SE @igor-lerinc
It's like you are looking for remapping. Something like:

nnoremap . ,

Use the command alone to list all mapping and plugins that provide them:

:nmap

For more usage, read :help :map and :help :nore

Update based on comments.
First open your ~/.vimrc and search for previous mapping

/\mmap\s+,\s+N

Replace that line with this new one

nnoremap . N

Save and exit. Now within your Vim sessions you'll be able to repeat your search backward with dot.

2
  • when i enter search, and enter pattern, and it highlights matching patterns. I can move to next occurence with ; and previous occurence with , so i want, to remap colon (,) to dot (.) i this case Commented Jan 28, 2023 at 18:49
  • Oh… you mean search with /pattern or ?pattern do you? Normal mapping is n and N ...you where looking for nnoremap . N :)
    – gildux
    Commented Jan 28, 2023 at 21:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.