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 104 remaining solutions by signing in and submitting your own entry
#105 Shreyas Kulkarni / ghatotkatch - Score: 13 - 09/15/15 @ 19:43
:%s/'$/e'/<CR>ZZ

0 comments

#106 Tamas Gal / tamasgal - Score: 13 - 09/26/15 @ 08:11
qq2$ie<Esc>q5@qZZ

0 comments

#107 Sam Cristall / sbcristall - Score: 13 - 09/28/15 @ 17:23
:%s/c'/ce'<CR>ZZ

0 comments

#108 Slavisa Djukic / ssdjuka - Score: 13 - 09/30/15 @ 21:52
qaj$ie<Esc>q5@aZZ

0 comments

#109 ggdGiBork:3^[:wq / CopperBadger - Score: 13 - 10/06/15 @ 00:57
qaj$ie<Esc>q5@aZZ

0 comments

#110 Ronnie McCall / RonnieMcC - Score: 13 - 10/07/15 @ 01:23
:%s/c'/ce'<CR>ZZ

0 comments

#111 Pin / ponfelipon - Score: 13 - 10/08/15 @ 17:18
qqj$ie<Esc>q5@qZZ

0 comments

#112 Anshu Avinash / anshu_avinash - Score: 13 - 10/17/15 @ 22:17
qaj$ie<Esc>q5@aZZ

0 comments

#113 roboguy / roboguy - Score: 13 - 10/19/15 @ 04:33
:%s/c'/ce'<CR>ZZ

0 comments

#114 Shobhit Gupta / shobhitg - Score: 13 - 10/26/15 @ 21:18
qaj$ie<Esc>q5@aZZ

0 comments

#115 mnx / mnxx - Score: 13 - 11/15/15 @ 17:52
qqj$ie<Esc>q5@qZZ

0 comments

#116 Andre Danielsson / DanielssonAndre - Score: 13 - 02/08/16 @ 20:13
qqj$ie<Esc>q5@qZZ

0 comments

#117 Kyouma / kyoumaJohn - Score: 13 - 10/14/16 @ 19:33
:%s/c'/ce'<CR>ZZ

0 comments

#118 Alexander Gryson / agryson - Score: 13 - 05/01/17 @ 16:12
qqj$ie<Esc>q5@qZZ

0 comments

#119 Remus Dalrymple / bornintheflames - Score: 13 - 05/09/17 @ 06:56
qqj$ie<Esc>q5@qZZ

0 comments

#120 alex / alexAngle8 - Score: 14 - 08/21/15 @ 19:53
:%s/c'/ce'/<CR>ZZ

0 comments

#121 Taylor Andrews / xtaylorandrewsx - Score: 14 - 09/02/15 @ 01:29
jqq$ie<Esc>jq5@qZZ

0 comments

#122 David Stimpert / DavidStimpert - Score: 14 - 09/23/15 @ 01:18
qqj$ie<Esc>0q5@qZZ

0 comments

#123 Marcus Buffett / MarcusBuffett - Score: 14 - 10/05/15 @ 04:49
jqq$ie<Esc>jq5@qZZ

0 comments

#124 NuM / NuM314 - Score: 14 - 10/24/15 @ 06:51
:%s_/c_&e_g|x<CR>

0 comments

#125 Cristian Lupașcu / clupasq - Score: 14 - 02/22/16 @ 15:05
$jh*:%s//ce<CR>ZZ

0 comments

#126 darfontz sucks / buttsToTheSky - Score: 15 - 08/25/15 @ 17:34
qaj$ie<Esc>q5@a:wq<CR>

0 comments

#127 Jay Hack / _jayhack_ - Score: 15 - 12/11/15 @ 20:50
:%s/'$/e'/g<CR><Esc>ZZ

0 comments

#128 Illuminati Tsaur / IlluminatiTsaur - Score: 18 - 08/26/15 @ 12:05
:%sc'<Left><Left>/<Right><Right>/ce'<CR>:x<CR>

0 comments

#129 Filype Pereira / FilypePereira - Score: 19 - 09/26/15 @ 09:38
jA<Left>e<Esc><Down>.<Down><Right>.<Down>.<Down>.<Down>.<Esc>ZZ

0 comments

#130 Theodore DeRego / tedsta0 - Score: 21 - 12/08/15 @ 03:20
j$ie<Esc>vyjqgPj$q4@g:wq<CR>

0 comments

Created by: Flurrywinde

130 active golfers, 239 entries

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

08/21/2015 at 06:36PM

12
#2 - Tim Chase / gumnos

08/21/2015 at 06:36PM

12
#3 - Anoop Kumar / anooplive

08/21/2015 at 06:41PM

12
#4 - John Braxler / braxler

08/21/2015 at 08:43PM

12
#5 - Louis Burke / LambdaABeta

08/21/2015 at 09:02PM

12
#6 - Kai Yuan / kentyuan

08/21/2015 at 09:34PM

12
#7 - Petro Тrouq / zulolosi

08/22/2015 at 01:26AM

12
#8 - jyloup / jyloup

08/22/2015 at 10:25AM

12
#9 - Martin Galpin / MartinRGalpin

08/22/2015 at 03:16PM

12
#10 - joinvimgolf / joinvimgolf

08/22/2015 at 05:44PM

12
#11 - Mutter Mumble / muttermumble

08/22/2015 at 06:21PM

12
#12 - randomizer user / alsdkfhjlkadfha

08/22/2015 at 08:08PM

12
#13 - Blake Tereau / BlakeTereau

08/22/2015 at 10:01PM

12
#14 - Dennis Burke / ikirudennis

08/22/2015 at 10:47PM

12
#15 - ZC-死理性派 / zecyzhang

08/23/2015 at 01:34PM

12
#16 - Paulo Romeira / pauloromeira

08/24/2015 at 02:23AM

12
#17 - raghu erapaneedi / raghue9

08/24/2015 at 10:22AM

12
#18 - I / ForgetIt17

08/24/2015 at 11:17AM

12
#19 - Bart / oneofmanybarts

08/24/2015 at 11:33AM

12
#20 - Dennis Li / _DennisLi

08/25/2015 at 06:54AM

12
#21 - Elizabeth / sprinkles418

08/25/2015 at 04:16PM

12
#22 - Jason Schulz / uxcn_

08/26/2015 at 05:18AM

12
#23 - Dan Moldovan / Lenea92

08/26/2015 at 01:35PM

12
#24 - Po-Ying Chen / PoYingChen

08/26/2015 at 03:10PM

12
#25 - Ryan / eatsleephack_

08/27/2015 at 01:40AM

12
#26 - Martin Delille / martinodelilo

08/28/2015 at 10:31AM

12
#27 - Rudolfs Sohn / rudolf_son

08/28/2015 at 01:22PM

12
#28 - S.Lebedev / drasgo

08/28/2015 at 10:14PM

12
#29 - T A / SirAviles

08/29/2015 at 03:21PM

12
#30 - Sime Buljac / sim_bul

08/31/2015 at 03:21PM

12
#31 - Kirill Cherkashin / kirjs

08/31/2015 at 08:39PM

12
#32 - Aleksandr Block / AleksandrBlock

09/01/2015 at 07:02AM

12
#33 - Jinzhou Zhang / jinzhouz

09/02/2015 at 09:57AM

12
#34 - oscar / zonza_mas

09/02/2015 at 01:01PM

12
#35 - Mart T / xtimmu

09/02/2015 at 07:26PM

12
#36 - Restroom Sounds / RestroomSounds

09/06/2015 at 01:54AM

12
#37 - Yaroslav Kanarev / yarosurabu

09/07/2015 at 03:36PM

12
#38 - 0e4ef622 / 0e4ef622

09/13/2015 at 03:42PM

12
#39 - luffy / raxcoi

09/13/2015 at 06:49PM

12
#40 - Marcin Sza / coot_

09/15/2015 at 07:57AM

12
#41 - Kevin Merlin / mp3merlin

09/17/2015 at 03:39PM

12
#42 - Victor Kasatkin / vikasatkin

09/20/2015 at 11:24PM

12
#43 - Thomas Draper / QuanTom561

09/26/2015 at 02:31AM

12
#44 - Hello World / CrisTsanNtua

09/27/2015 at 12:15PM

12
#45 - Mike Adams / davis_cromwell

09/27/2015 at 09:27PM

12
#46 - Self Doc Code / self_doc_code

09/28/2015 at 07:12AM

12
#47 - Walker Boh / walker_boh

09/30/2015 at 01:55PM

12
#48 - Jon Krause / jkrause314

10/02/2015 at 06:02AM

12
#49 - Julian Andrews / NoLemurs

10/03/2015 at 08:37PM

12
#50 - ojung / oskrjung

10/05/2015 at 01:11AM

12
#51 - Ben Crowder / bencrowder

10/07/2015 at 02:05PM

12
#52 - Smylers / Smylers2

10/08/2015 at 06:37PM

12
#53 - Mark Brody / _markbrody

10/15/2015 at 03:10PM

12
#54 - 朱国栋 / GuodongZhu

10/15/2015 at 03:20PM

12
#55 - Domingue Justin / _jdomingue

10/15/2015 at 04:34PM

12
#56 - Stani Banani / Stani_Banani

10/16/2015 at 07:03PM

12
#57 - merphant / merphant

10/23/2015 at 12:57AM

12
#58 - Bogumił Kamiński / BogumilKaminski

10/25/2015 at 04:14PM

12
#59 - Peter / sunirbmag

10/25/2015 at 10:00PM

12
#60 - Justin Sermeno / catchvar

11/01/2015 at 07:03PM

12
#61 - Stefan Knudsen / knud32

11/09/2015 at 03:13AM

12
#62 - coryknapp / 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 / w_labranche

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

13
#87 - Lifepillar / lifepillar

08/21/2015 at 07:37PM

13
#88 - Christophe Sicard / tophsic

08/21/2015 at 07:58PM

13
#89 - James / Dronak

08/21/2015 at 08:59PM

13
#90 - Leeren / Leeren

08/21/2015 at 10:31PM

13
#91 - JS / jjohsan

08/22/2015 at 09:31AM

13
#92 - Matthieu Crapet / mcr05

08/22/2015 at 03:58PM

13
#93 - Thanh ND / thanhnd84

08/23/2015 at 09:10AM

13
#94 - gyermolenko / gyermolenko_

08/24/2015 at 06:26PM

13
#95 - daniel olsson / glajan

08/27/2015 at 05:10PM

13
#96 - Osleg aka Akira ^_^ / 4k1r4

08/28/2015 at 03:16AM

13
#97 - Léo S / LeoSauvaget

08/28/2015 at 12:34PM

13
#98 - Mikołaj Morzy / MikolajMorzy

09/01/2015 at 09:09PM

13
#99 - A / Tower_1980

09/03/2015 at 12:41PM

13
#100 - Nicholas Marrone / nickmarrone

09/05/2015 at 10:42PM

13
#101 - Mika .B / Michael_Ben_Ali

09/10/2015 at 02:26PM

13
#102 - Joey / joeyism101

09/12/2015 at 02:54PM

13
#103 - dd / dd22147119

09/14/2015 at 03:04PM

13
#104 - Alex Bartol / alexbartol

09/15/2015 at 05:58PM

13
#105 - Shreyas Kulkarni / ghatotkatch

09/15/2015 at 07:43PM

13
#106 - Tamas Gal / tamasgal

09/26/2015 at 08:11AM

13
#107 - Sam Cristall / sbcristall

09/28/2015 at 05:23PM

13
#108 - Slavisa Djukic / ssdjuka

09/30/2015 at 09:52PM

13
#109 - ggdGiBork:3^[:wq / CopperBadger

10/06/2015 at 12:57AM

13
#110 - Ronnie McCall / RonnieMcC

10/07/2015 at 01:23AM

13
#111 - Pin / ponfelipon

10/08/2015 at 05:18PM

13
#112 - Anshu Avinash / anshu_avinash

10/17/2015 at 10:17PM

13
#113 - roboguy / roboguy

10/19/2015 at 04:33AM

13
#114 - Shobhit Gupta / shobhitg

10/26/2015 at 09:18PM

13
#115 - mnx / mnxx

11/15/2015 at 05:52PM

13
#116 - Andre Danielsson / DanielssonAndre

02/08/2016 at 08:13PM

13
#117 - Kyouma / kyoumaJohn

10/14/2016 at 07:33PM

13
#118 - Alexander Gryson / agryson

05/01/2017 at 04:12PM

13
#119 - Remus Dalrymple / bornintheflames

05/09/2017 at 06:56AM

14
#120 - alex / alexAngle8

08/21/2015 at 07:53PM

14
#121 - Taylor Andrews / xtaylorandrewsx

09/02/2015 at 01:29AM

14
#122 - David Stimpert / DavidStimpert

09/23/2015 at 01:18AM

14
#123 - Marcus Buffett / MarcusBuffett

10/05/2015 at 04:49AM

14
#124 - NuM / NuM314

10/24/2015 at 06:51AM

14
#125 - Cristian Lupașcu / clupasq

02/22/2016 at 03:05PM

15
#126 - darfontz sucks / buttsToTheSky

08/25/2015 at 05:34PM

15
#127 - Jay Hack / _jayhack_

12/11/2015 at 08:50PM

18
#128 - Illuminati Tsaur / IlluminatiTsaur

08/26/2015 at 12:05PM

19
#129 - Filype Pereira / FilypePereira

09/26/2015 at 09:38AM

21
#130 - Theodore DeRego / tedsta0

12/08/2015 at 03:20AM