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
177 remaining solutions by
signing in and submitting your own entry
#178
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
178 active golfers, 480 entries
Leaderboard (lowest score wins):
01/03/2011 at 10:48PM
#32 - Danny O'Sullivan / @db0s
01/05/2011 at 11:01AM
01/08/2011 at 11:04PM
06/11/2011 at 12:27AM
06/19/2011 at 05:21PM
07/19/2011 at 02:42PM
10/09/2011 at 07:58PM
12/22/2011 at 04:18AM
01/17/2012 at 06:40PM
03/03/2012 at 06:25PM
03/31/2012 at 06:11PM
04/22/2012 at 03:07AM
09/25/2012 at 12:04AM
07/25/2013 at 03:21AM
06/01/2015 at 09:03PM
07/08/2020 at 11:44PM
10/20/2022 at 12:57AM
01/01/2011 at 01:18AM
05/09/2024 at 09:37AM
12/31/2010 at 05:06PM
12/31/2010 at 05:22PM
12/31/2010 at 05:32PM
12/31/2010 at 07:28PM
#55 - Henri Bourcereau / @mmai
12/31/2010 at 09:07PM
12/31/2010 at 09:16PM
#57 - Ricardo Mendes / @locks
12/31/2010 at 10:19PM
01/01/2011 at 07:57AM
01/02/2011 at 01:01AM
01/02/2011 at 01:31AM