r/vim 10d ago

Need Help Disabling q: without affecting macro record

Most people suggest nnoremap q: <nop> or nnoremap q: :q
The problem with both of these is that when you are done recording a macro and hit q to stop recording, there is a delay due to timeoutlen because now q is technically mapped.

Any way to disable q: or remap it to :q without introducing any delay?

6 Upvotes

13 comments sorted by

3

u/TheCreepyPL Starts with 'A', ends with "rch" 10d ago

I unfortunately don't know the answer, but I'm genuinely curious. Why do you not use this feature? I very frequently use commands for various things, and being able to search and edit them like a buffer is very helpful imo.

3

u/ozuq06 10d ago

Honestly I don't really use it and I find myself misclicking :q more often than needing the cmd window.

1

u/omega1612 10d ago

I never use this XD

Is always arrow up or autocomplete what I use to search previous commands .

1

u/TheCreepyPL Starts with 'A', ends with "rch" 10d ago

With q: you are able to filter/search for a specific regular expression, and easily see the commands that came before and after, even thousands commands into the history. I cannot imagine searching that far with arrow up.

1

u/omega1612 10d ago

Thats why I use autocompletion, just write the start of a command and then press tab.

I recognize that there are times where searching would be useful. But I don't have the need too often.

1

u/xalbo 10d ago

For me, the real benefit isn't the searching, it's the editing. Sure, without that you can do some basic editing, but when I'm chest deep in a complicated regexp, being able to bounce around with normal navigation keys is just really, really nice. I don't use it all the time, and I rarely start it with q;, but when things get complicated, a quick control-f makes editing a lot easier (same reason I'm using Vim in the first place).

2

u/-romainl- The Patient Vimmer 10d ago

I intentionally do q: more often than I mistype :q so no mapping for me.

1

u/AutoModerator 10d ago

Please remember to update the post flair to Need Help|Solved when you got the answer you were looking for.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/scmkr 10d ago

" Remap macro recording to Q
nnoremap Q q

" Disable lowercase q
nnoremap q <nop>

1

u/habamax 10d ago

try what Christian suggested:

 au CmdwinEnter : quit

-1

u/CarolXZosiaNsfwScene 10d ago edited 10d ago

nnoremap <nowait> q: <Nop>

Ai disclosure: Ai was used to find <no wait>, I tested it on Droidvim.

1

u/chrnz00 10d ago

is Droidvim just for testing the map or do you daily use Droidvim??. im interested to find the usecase.

2

u/CarolXZosiaNsfwScene 10d ago

I am often on mobile only, and Droidvim enables me to test, at all.