3

After listening to Damien Conways More Instantly Better Vim I've switch colon and semicolon in my vimrc like so

" remap colon to semicolon in norman and visual mode, but not in insert mode
nnoremap ; :
nnoremap : ;
vnoremap ; :
vnoremap : ;

And it was really convenient for me. But recently I've learned from vim help (I've finally started reading it systematically) that not only I can search for next occurence of character in line with f, but also repeat this search with semicolon and with comma in backward direction.

This creates the conflict between this two. So initially I've disabled remapping colon to semicolon. But it's so annoying now, that I'm trying to find another solution.

Can I change the key at which vim found repeat search, not just remap it for all commands?

  • I think it will be more confusing than keeping the default settings. I switched back to the default ;, :, , mapping and I have other mappings for quick access to the command line. Otherwise you should be able to sort this with a function that keep track of your current "status" (searching/not searching). – nobe4 Apr 26 '16 at 8:13
  • What mappings do you use? – user1685095 Apr 26 '16 at 11:38
  • I do use <leader>w to save, <leader>q to quit, <leader>o to open the command line for search file (was previoulsy mapped to ctrlp). I don't use a lot of mapping, I tend to prefer using command. – nobe4 Apr 26 '16 at 12:25
  • You could make some crazy script where they undo the remap after a search until you do some sequence to "escape" your search mode. But that sounds more like a problem than just leaving the two keys where they are or just pressing shift when doing your search. – jecxjo Apr 26 '16 at 13:28
4

Can I change the key at which vim found repeat search […] ?

Why, you already did so:

nnoremap : ;
vnoremap : ;

Colon now does what semicolon used to do.

f/t/F/T work in Normal and Visual modes, where you also have direct access to Command mode (by pressing :). Thus, you can't map both "next match" and "got to Command mode" onto one key, as it will become impossible for Vim to figure out what you ask of it. You have to consider what you need more often and either keep your current bindings (and learn to use Shift-; to go to next match) or drop them (and go through the pain of pressing Shift each time you need to access Command mode.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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