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 55d7692d134b34420f05ac0b

Add to end of each line... kinda

Visual-block mode can be used to add something to the end of each line, even if they are of differing lengths. However, what if it's not quite at the end?

Start file
function! FixLatexChars() 
	execute '%s/\\/\\textbackslash{}/c'
	execute '%s/#/\\#/c'
	execute '%s/\$/\\$/c'
	execute '%s/%/\\%/c'
	execute '%s/&/\\&/c'
	execute '%s/_/\\_/c'
endfunction
End file
function! FixLatexChars() 
	execute '%s/\\/\\textbackslash{}/ce'
	execute '%s/#/\\#/ce'
	execute '%s/\$/\\$/ce'
	execute '%s/%/\\%/ce'
	execute '%s/&/\\&/ce'
	execute '%s/_/\\_/ce'
endfunction

View Diff

2,7c2,7
< 	execute '%s/\\/\\textbackslash{}/c'
< 	execute '%s/#/\\#/c'
< 	execute '%s/\$/\\$/c'
< 	execute '%s/%/\\%/c'
< 	execute '%s/&/\\&/c'
< 	execute '%s/_/\\_/c'
---
> 	execute '%s/\\/\\textbackslash{}/ce'
> 	execute '%s/#/\\#/ce'
> 	execute '%s/\$/\\$/ce'
> 	execute '%s/%/\\%/ce'
> 	execute '%s/&/\\&/ce'
> 	execute '%s/_/\\_/ce'

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 141 remaining solutions by signing in and submitting your own entry
#142 Theodore DeRego / @tedsta0 - Score: 21 - 12/08/15 @ 03:20
j$ie<Esc>vyjqgPj$q4@g:wq<CR>

0 comments


Created by: @Flurrywinde

142 active golfers, 264 entries

Leaderboard (lowest score wins):
12
#61 - Stefan Knudsen / @knud32

11/09/2015 at 03:13AM

12
#62 - Cory Knapp / @coryknapp

11/13/2015 at 06:30PM

12
#63 - territorialmale / @territorialmale

11/19/2015 at 04:38AM

12
#64 - Sean Stout / @s183s657

12/09/2015 at 08:23PM

12
#65 - Wilmer Bandres / @WilmerBandres

12/13/2015 at 01:50PM

12
#66 - Strabs / @artistavenue

01/11/2016 at 03:59PM

12
#67 - jackliusr / @jackliusr

01/13/2016 at 10:05AM

12
#68 - Sergey Fedorov / @Shade30

01/18/2016 at 07:50AM

12
#69 - Ian Trophy / @prfrgg

02/01/2016 at 11:40AM

12
#70 - Aleksey Zhidkov / @AlexeyZhidkov

02/11/2016 at 05:28AM

12
#71 - ben kavanagh / @bkava

02/24/2016 at 03:24AM

12
#72 - glepha / @glepha_vim

03/10/2016 at 05:21AM

12
#73 - Dimitar Dimitrov / @kurkale6ka

03/15/2016 at 03:08PM

12
#74 - Carlos A Henríquez Q / @lagunex

03/15/2016 at 10:24PM

12
#75 - hans peter / @mullovc

03/21/2016 at 10:35PM

12
#76 - Janko Jerinic / @JankoJerinic

03/28/2016 at 06:13AM

12
#77 - Chenut Ludovic / @7Brwa7

04/12/2016 at 07:49AM

12
#78 - Pedro Santos / @pedrosans

07/12/2016 at 08:06PM

12
#79 - Jeremiah Goyette / @JeremiahGoyette

08/03/2016 at 06:31AM

12
#80 - Will / @obiwan__k3n00bi

08/22/2016 at 05:11AM

12
#81 - jj johnson / @jcassj1

08/23/2016 at 08:05AM

12
#82 - TweetDreams / @TweetMusicians

10/16/2016 at 10:22PM

12
#83 - Michał Dytko / @DytkoM

12/28/2016 at 09:23AM

12
#84 - Saurav Mitra / @SauravMitra11

12/31/2016 at 11:10AM

12
#85 - Daniel / @Daniel00288663

03/30/2017 at 03:49PM

12
#86 - Bill Ruddock / @biinari

05/03/2017 at 10:43PM

12
#87 - tPenguinLTG / @tpenguinltg

07/03/2017 at 01:47AM

12
#88 - Turkey Man / @lvturkeyman

11/24/2017 at 06:58PM

12
#89 - BarbaJol / @drpproteus

01/09/2018 at 05:18PM

12
#90 - DHM / @DHM29978992

04/30/2018 at 05:15PM