Sometimes, ggVG does not work to select text. It will move the cursor to the top, but not select the text. This happens seemingly randomly. I have figured out if I type ggVVG it will work as expected. I can also retype ggVG many times and it will work eventually after 4-10 tries.
1 Answer
Make sure to not accidentally typing gggVG
, so after gg
(to go to the top), another g
, which in turn changes your V
command to a gV
command (see :help gV
), which basically is a no-op in your case and this would explain why your V
command randomly does not appear to work.
BTW: depending on your use case for the ggVG
command, it might be easier to use an ex-command. I assume you want to copy the whole buffer text, which I think :%y
find much easier (for yank all lines).
gggV
? so accidentally usinggV
instead ofV
?:verbose map V