Reputation: 692
I was thinking of mapping ,u
to uncomment a block of code in visual mode, but first I wanted to make sure that ,u
wasn't already doing something else important.
I selected three lines visually and typed ,u
and I got the message at the bottom of the screen (where : commands are entered): "3 lines changed".
The lines didn't change, but maybe they would have under some circumstances. Obviously, vim is claiming to have executed some command, but what?
I typed :map
and ,u
was not listed as having been remapped. So I typed, :help ,u
and it told me "No help for ,u
" (read: No help for you!).
There's no ,u
or <leader>u
in my .vimrc. I haven't redefined comma as my leader.
If it were the unix command line, I'd type which ,u
, but I don't know any equivalent in vim.
How do I figure out what, if anything, a given command is doing in any particular running instance of vim?
Upvotes: 1
Views: 100
Reputation: 196476
In visual mode, the comma does nothing but u
lowercases the selected text.
This means that you can safely use ,u
for a visual mode mapping: you will still be able to use u
but ,
followed immediately by u
will do what you want.
The :map
command only lists mappings. Since built-in operators are not mappings you won't be able to see them there.
When a "shortcut" doesn't appear in :map
, try vim's awesome documentation:
:help v_u " shows help for u in visual mode (note the v_)
If you get nothing, either from :map
or from :help
, using the those keys for your mapping may not be completely trouble-free. A bit of trial and error may be necessary.
Suggested reading:
Learn Vimscript the Hard Way: Chapter 3, 4 and 5.
Upvotes: 3