To follow-up on what Seth said, interestingly enough I found out that ggvG does not visually select quite the entire file. So to make this command really general : If the last line is not empty - you can never know it always is - you would have to do ggvG$ ($ meaning shift 4) for that. And if you want to be sure to delete or e.g replace the whole content in a file with the word blubber - which is something like foo baar I guess - you would have to do ggvG$cblubber if I do not mistaken.
6 comments:
Combined with visual blocks this is a really useful tip (vgg & vG)
I usualy use 1G to go to the first line but gg is one key less (the shift key for uppercase G).
I will use your trick.
Thanks
To follow-up on what Nico said, I use ggvG to visually select the entire file.
And if you're a gamer, gg should be easy enough to remember.
you can open a file on the command line and automatically put the cursor on the last line by typing:
vim + file
If you want vim to start at a specific line you can do the following instead:
vim +LINENUMBER file
To follow-up on what Seth said, interestingly enough I found out that ggvG does not visually select quite the entire file. So to make this command really general : If the last line is not empty - you can never know it always is - you would have to do ggvG$ ($ meaning shift 4) for that.
And if you want to be sure to delete or e.g replace the whole content in a file with the word blubber - which is something like foo baar I guess - you would have to do
ggvG$cblubber
if I do not mistaken.
Post a Comment