Reverse and count
Someone typed things upside down and now a Vim ninja needs to reverse the lines and count how many there are.
Start file
Sixth line
Fifth line
Fourth line
Third line
Second line
First line
End file
1. First line
2. Second line
3. Third line
4. Fourth line
5. Fifth line
6. Sixth line
1,6c1,6
< Sixth line
< Fifth line
< Fourth line
< Third line
< Second line
< First line
---
> 1. First line
> 2. Second line
> 3. Third line
> 4. Fourth line
> 5. Fifth line
> 6. Sixth line
Solutions
The best way to learn is to practice. Below, you will find some of the solutions other golfers have entered. To unlock higher ranked solutions, submit your own entry which does as well or better than the solutions you can currently see - climb the ladder!
Check out these helpful resources to improve your Vim skills... Game on.
Unlock
175 remaining solutions by
signing in and submitting your own entry
#176
Zigmas Bitinas / @samgiz -
Score: 111 -
02/11/24 @ 20:46
:g/^/m 0<CR><Esc><Esc><Esc>qqq:for i in range(1,6)|execute i .'<BS> 's/!<BS>^/'. o<BS>i /<BS>,<BS>. \<BS>'. ' | endfore<CR>:<Up><BS><CR>i<Del>6<Up><Up><Up><Up><Up><BS><Del><Del><Esc>:qw<BS><BS>wq<CR>
0 comments
176 active golfers, 473 entries
Leaderboard (lowest score wins):
06/25/2015 at 07:17PM
01/20/2016 at 10:29PM
#3 - Peter Brynza / @v3_1
08/28/2016 at 08:07PM
11/28/2017 at 06:20PM
05/27/2018 at 01:48AM
08/14/2018 at 03:29PM
12/27/2019 at 12:55PM
01/22/2021 at 06:10AM
03/24/2022 at 09:02PM
05/23/2022 at 03:46PM
05/31/2022 at 02:29AM
07/01/2022 at 05:40PM
07/30/2022 at 03:31AM
09/23/2022 at 09:23AM
09/25/2022 at 02:35AM
01/03/2024 at 03:40AM
02/25/2024 at 06:28AM
06/02/2024 at 09:45AM
02/20/2021 at 04:12AM
03/13/2021 at 12:58PM
02/23/2023 at 02:06PM
08/13/2017 at 04:05PM
03/25/2019 at 03:33PM
09/30/2020 at 09:08PM
03/14/2021 at 04:37PM
11/07/2022 at 06:50PM
03/04/2023 at 04:52PM
03/06/2024 at 04:36AM
#29 - Aurélien Delahaye / @alkove
01/02/2011 at 09:29PM
01/03/2011 at 10:48PM