Real Vim ninjas count every keystroke - do you?

Pick a challenge, fire up Vim, and show us what you got.

Changelog, Rules & FAQ, updates: @vimgolf, RSS.

Your VimGolf key: please sign in

$ gem install vimgolf
$ vimgolf setup
$ vimgolf put 5301e83c0cb38c0002000008

Carriage return

I have some raw data from terminal output which uses carriege return for formatting. Carriage return sets the pointer to the first character on the line, and subsequent characters will overwrite what was there before. The challange is to simulate the terminal behaviour in vim. I'm kind of unsure if I should have skipped lines 9 and 15, since there might be some interesting solutions which are not that generic. Happy Golfing!

Start file
+--------------------------+
|                          |
| A nice header in a frame
+--------------------------+


Emacs rules!
Vim  


A short line
Some longer text replacing it

+----------------+
|                |
| Another header
+----------------+

Several carriege returns on a line
O few  
A

B few more simple ones
A
two reduce the amount
to 
off specializing the solution
of 
dust for this file
j
End file
+--------------------------+
| A nice header in a frame |
+--------------------------+


Vim   rules!


Some longer text replacing it

+----------------+
| Another header |
+----------------+

A few   carriege returns on a line

A few more simple ones
to  reduce the amount
of  specializing the solution
just for this file

View Diff

2c2
< |                          |
| A nice header in a frame
---
> | A nice header in a frame |
6c6
< Emacs rules!
Vim  
---
> Vim   rules!
9c9
< A short line
Some longer text replacing it
---
> Some longer text replacing it
12c12
< |                |
| Another header
---
> | Another header |
15c15
< Several carriege returns on a line
O few  
A
---
> A few   carriege returns on a line
17,20c17,20
< B few more simple ones
A
< two reduce the amount
to 
< off specializing the solution
of 
< dust for this file
j
---
> A few more simple ones
> to  reduce the amount
> of  specializing the solution
> just for this file

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 14 remaining solutions by signing in and submitting your own entry
#15 Lucius L. Hilley III / unkmar - Score: 29 - 02/27/14 @ 10:15
15Gqz?\r<CR>rRD0@"<Esc>q7@znD@z0rAZZ

0 comments

#16 Pedro Santos / pedrosans - Score: 35 - 02/17/14 @ 21:10
/O<CR>rAqq$F<CR>xD0R<C-R>"<Esc>q:g/\r/norm! @q<CR>ZZ

0 comments

#17 codegourmet / codegourmet - Score: 38 - 02/17/14 @ 12:24
15GceA few  <Esc>fODxggqq/<C-V><CR><CR>xD^R<C-R>"<Esc>q7@qZZ

codegourmet: Sorry for cheating in line 15 ;)

1 comment

#18 RobertT / techrt2050 - Score: 45 - 04/01/14 @ 23:52
/<C-V><CR><CR>qqrRD0@"<Esc>nq3@qnn4@qrRn.FRdtR0@"<Esc>;lD0@"<Esc>ZZ

0 comments

Created by: Anka213

18 active golfers, 40 entries

Leaderboard (lowest score wins):
22
#1 - Urtica dioica / udioica

02/17/2014 at 08:09PM

22
#2 - John Braxler / braxler

02/17/2014 at 08:18PM

22
#3 - Petro Тrouq / zulolosi

02/18/2014 at 01:49AM

22
#4 - Mina Naguib / minaguib

02/18/2014 at 02:37AM

22
#5 - grey wolfs / grey_wolfs

02/19/2014 at 07:07AM

22
#6 - Bart Nagel / bjnagel

02/20/2014 at 09:00AM

22
#7 - Quota / Quotad

02/20/2014 at 02:07PM

22
#8 - Marcin Cabaj / marcincabaj

02/20/2014 at 08:17PM

22
#9 - oliver mueller / marcontwit

02/21/2014 at 06:59PM

22
#10 - Jack Jacquemmoz / MozJack

02/27/2014 at 05:20PM

22
#11 - Markus Kasper / KasperBox

05/22/2014 at 01:40PM

22
#12 - Carlos A Henríquez Q / lagunex

02/24/2016 at 12:41AM

25
#13 - YAMADA Yukimi / edp02

02/23/2014 at 10:29AM

26
#14 - Jared Meyering / Jmeyering

02/17/2014 at 07:17PM

29
#15 - Lucius L. Hilley III / unkmar

02/27/2014 at 10:15AM

35
#16 - Pedro Santos / pedrosans

02/17/2014 at 09:10PM

38
#17 - codegourmet / codegourmet

02/17/2014 at 12:24PM

45
#18 - RobertT / techrt2050

04/01/2014 at 11:52PM