Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remapping semicolon to colon in vim breaks ':ls'

Tags:

vim

vi

After watching Damian Conway's excellent Instantly Better Vim, I decided to switch Vim's colon and semicolon:

nnoremap ; :
nnoremap : ;

This all works wonderfully, except for one small thing. When I type ;ls, I get the buffer listing (as expected), with the standard message to "Press ENTER or type command to continue." Often what I want to do is type something like :bd 2 4 9 to delete some buffers.

However, with the new mapping, typing a semicolon doesn't work (it exits to a new blank command line), but neither does typing a colon (it acts as any other keypress, as far as I can tell)! Is there any way to get around this? I do tend to use the default semicolon functionality fairly frequently, so I'd like to keep that mapping if possible. The problem fixes itself if I remove the nnoremap : ; so that the default colon still works.

like image 410
Michael M. Avatar asked Oct 22 '13 13:10

Michael M.


1 Answers

I'd say that's an unfortunate consequence of the implementation of the hit-enter prompt. The logic whether to clear the output does not seem to take the mapping into account. You should raise this on the vim_dev mailing list; maybe someone implements a patch, as this swap idiom is rather common.

like image 56
Ingo Karkat Avatar answered Oct 23 '22 16:10

Ingo Karkat